All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lithic.api.models.Transaction.kt Maven / Gradle / Ivy

Go to download

The Lithic Developer API is designed to provide a predictable programmatic interface for accessing your Lithic account through an API and transaction webhooks. Note that your API key is a secret and should be treated as such. Don't share it with anyone, including us. We will never ask you for it.

The newest version!
// File generated from our OpenAPI spec by Stainless.

package com.lithic.api.models

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.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.lithic.api.core.Enum
import com.lithic.api.core.ExcludeMissing
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toImmutable
import com.lithic.api.errors.LithicInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects

@JsonDeserialize(builder = Transaction.Builder::class)
@NoAutoDetect
class Transaction
private constructor(
    private val acquirerFee: JsonField,
    private val acquirerReferenceNumber: JsonField,
    private val accountToken: JsonField,
    private val amount: JsonField,
    private val amounts: JsonField,
    private val authorizationAmount: JsonField,
    private val authorizationCode: JsonField,
    private val avs: JsonField,
    private val cardToken: JsonField,
    private val cardholderAuthentication: JsonField,
    private val created: JsonField,
    private val events: JsonField>,
    private val merchant: JsonField,
    private val merchantAmount: JsonField,
    private val merchantAuthorizationAmount: JsonField,
    private val merchantCurrency: JsonField,
    private val network: JsonField,
    private val networkRiskScore: JsonField,
    private val result: JsonField,
    private val pos: JsonField,
    private val settledAmount: JsonField,
    private val status: JsonField,
    private val token: JsonField,
    private val tokenInfo: JsonField,
    private val updated: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    /**
     * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the
     * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative value
     * to indicate credited fees.
     */
    fun acquirerFee(): Long? = acquirerFee.getNullable("acquirer_fee")

    /**
     * Unique identifier assigned to a transaction by the acquirer that can be used in dispute and
     * chargeback filing.
     */
    fun acquirerReferenceNumber(): String? =
        acquirerReferenceNumber.getNullable("acquirer_reference_number")

    /** The token for the account associated with this transaction. */
    fun accountToken(): String = accountToken.getRequired("account_token")

    /**
     * When the transaction is pending, this represents the authorization amount of the transaction
     * in the anticipated settlement currency. Once the transaction has settled, this field
     * represents the settled amount in the settlement currency.
     */
    fun amount(): Long = amount.getRequired("amount")

    fun amounts(): TransactionAmounts = amounts.getRequired("amounts")

    /** The authorization amount of the transaction in the anticipated settlement currency. */
    fun authorizationAmount(): Long? = authorizationAmount.getNullable("authorization_amount")

    /**
     * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with
     * networks.
     */
    fun authorizationCode(): String? = authorizationCode.getNullable("authorization_code")

    fun avs(): Avs? = avs.getNullable("avs")

    /** Token for the card used in this transaction. */
    fun cardToken(): String = cardToken.getRequired("card_token")

    fun cardholderAuthentication(): CardholderAuthentication? =
        cardholderAuthentication.getNullable("cardholder_authentication")

    /** Date and time when the transaction first occurred. UTC time zone. */
    fun created(): OffsetDateTime = created.getRequired("created")

    fun events(): List? = events.getNullable("events")

    fun merchant(): Merchant = merchant.getRequired("merchant")

    /** Analogous to the 'amount', but in the merchant currency. */
    fun merchantAmount(): Long? = merchantAmount.getNullable("merchant_amount")

    /** Analogous to the 'authorization_amount', but in the merchant currency. */
    fun merchantAuthorizationAmount(): Long? =
        merchantAuthorizationAmount.getNullable("merchant_authorization_amount")

    /** 3-digit alphabetic ISO 4217 code for the local currency of the transaction. */
    fun merchantCurrency(): String = merchantCurrency.getRequired("merchant_currency")

    /**
     * Card network of the authorization. Can be `INTERLINK`, `MAESTRO`, `MASTERCARD`, `VISA`, or
     * `UNKNOWN`. Value is `UNKNOWN` when Lithic cannot determine the network code from the upstream
     * provider.
     */
    fun network(): Network? = network.getNullable("network")

    /**
     * Network-provided score assessing risk level associated with a given authorization. Scores are
     * on a range of 0-999, with 0 representing the lowest risk and 999 representing the highest
     * risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will normalize
     * the score by multiplying the raw score by 10x.
     */
    fun networkRiskScore(): Long? = networkRiskScore.getNullable("network_risk_score")

    fun result(): DeclineResult = result.getRequired("result")

    fun pos(): Pos = pos.getRequired("pos")

    /** The settled amount of the transaction in the settlement currency. */
    fun settledAmount(): Long = settledAmount.getRequired("settled_amount")

    /** Status of the transaction. */
    fun status(): Status = status.getRequired("status")

    /** Globally unique identifier. */
    fun token(): String = token.getRequired("token")

    fun tokenInfo(): TokenInfo? = tokenInfo.getNullable("token_info")

    /** Date and time when the transaction last updated. UTC time zone. */
    fun updated(): OffsetDateTime = updated.getRequired("updated")

    /**
     * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the
     * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative value
     * to indicate credited fees.
     */
    @JsonProperty("acquirer_fee") @ExcludeMissing fun _acquirerFee() = acquirerFee

    /**
     * Unique identifier assigned to a transaction by the acquirer that can be used in dispute and
     * chargeback filing.
     */
    @JsonProperty("acquirer_reference_number")
    @ExcludeMissing
    fun _acquirerReferenceNumber() = acquirerReferenceNumber

    /** The token for the account associated with this transaction. */
    @JsonProperty("account_token") @ExcludeMissing fun _accountToken() = accountToken

    /**
     * When the transaction is pending, this represents the authorization amount of the transaction
     * in the anticipated settlement currency. Once the transaction has settled, this field
     * represents the settled amount in the settlement currency.
     */
    @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

    @JsonProperty("amounts") @ExcludeMissing fun _amounts() = amounts

    /** The authorization amount of the transaction in the anticipated settlement currency. */
    @JsonProperty("authorization_amount")
    @ExcludeMissing
    fun _authorizationAmount() = authorizationAmount

    /**
     * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with
     * networks.
     */
    @JsonProperty("authorization_code") @ExcludeMissing fun _authorizationCode() = authorizationCode

    @JsonProperty("avs") @ExcludeMissing fun _avs() = avs

    /** Token for the card used in this transaction. */
    @JsonProperty("card_token") @ExcludeMissing fun _cardToken() = cardToken

    @JsonProperty("cardholder_authentication")
    @ExcludeMissing
    fun _cardholderAuthentication() = cardholderAuthentication

    /** Date and time when the transaction first occurred. UTC time zone. */
    @JsonProperty("created") @ExcludeMissing fun _created() = created

    @JsonProperty("events") @ExcludeMissing fun _events() = events

    @JsonProperty("merchant") @ExcludeMissing fun _merchant() = merchant

    /** Analogous to the 'amount', but in the merchant currency. */
    @JsonProperty("merchant_amount") @ExcludeMissing fun _merchantAmount() = merchantAmount

    /** Analogous to the 'authorization_amount', but in the merchant currency. */
    @JsonProperty("merchant_authorization_amount")
    @ExcludeMissing
    fun _merchantAuthorizationAmount() = merchantAuthorizationAmount

    /** 3-digit alphabetic ISO 4217 code for the local currency of the transaction. */
    @JsonProperty("merchant_currency") @ExcludeMissing fun _merchantCurrency() = merchantCurrency

    /**
     * Card network of the authorization. Can be `INTERLINK`, `MAESTRO`, `MASTERCARD`, `VISA`, or
     * `UNKNOWN`. Value is `UNKNOWN` when Lithic cannot determine the network code from the upstream
     * provider.
     */
    @JsonProperty("network") @ExcludeMissing fun _network() = network

    /**
     * Network-provided score assessing risk level associated with a given authorization. Scores are
     * on a range of 0-999, with 0 representing the lowest risk and 999 representing the highest
     * risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will normalize
     * the score by multiplying the raw score by 10x.
     */
    @JsonProperty("network_risk_score") @ExcludeMissing fun _networkRiskScore() = networkRiskScore

    @JsonProperty("result") @ExcludeMissing fun _result() = result

    @JsonProperty("pos") @ExcludeMissing fun _pos() = pos

    /** The settled amount of the transaction in the settlement currency. */
    @JsonProperty("settled_amount") @ExcludeMissing fun _settledAmount() = settledAmount

    /** Status of the transaction. */
    @JsonProperty("status") @ExcludeMissing fun _status() = status

    /** Globally unique identifier. */
    @JsonProperty("token") @ExcludeMissing fun _token() = token

    @JsonProperty("token_info") @ExcludeMissing fun _tokenInfo() = tokenInfo

    /** Date and time when the transaction last updated. UTC time zone. */
    @JsonProperty("updated") @ExcludeMissing fun _updated() = updated

    @JsonAnyGetter
    @ExcludeMissing
    fun _additionalProperties(): Map = additionalProperties

    fun validate(): Transaction = apply {
        if (!validated) {
            acquirerFee()
            acquirerReferenceNumber()
            accountToken()
            amount()
            amounts().validate()
            authorizationAmount()
            authorizationCode()
            avs()?.validate()
            cardToken()
            cardholderAuthentication()?.validate()
            created()
            events()?.forEach { it.validate() }
            merchant().validate()
            merchantAmount()
            merchantAuthorizationAmount()
            merchantCurrency()
            network()
            networkRiskScore()
            result()
            pos().validate()
            settledAmount()
            status()
            token()
            tokenInfo()?.validate()
            updated()
            validated = true
        }
    }

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

    companion object {

        fun builder() = Builder()
    }

    class Builder {

        private var acquirerFee: JsonField = JsonMissing.of()
        private var acquirerReferenceNumber: JsonField = JsonMissing.of()
        private var accountToken: JsonField = JsonMissing.of()
        private var amount: JsonField = JsonMissing.of()
        private var amounts: JsonField = JsonMissing.of()
        private var authorizationAmount: JsonField = JsonMissing.of()
        private var authorizationCode: JsonField = JsonMissing.of()
        private var avs: JsonField = JsonMissing.of()
        private var cardToken: JsonField = JsonMissing.of()
        private var cardholderAuthentication: JsonField = JsonMissing.of()
        private var created: JsonField = JsonMissing.of()
        private var events: JsonField> = JsonMissing.of()
        private var merchant: JsonField = JsonMissing.of()
        private var merchantAmount: JsonField = JsonMissing.of()
        private var merchantAuthorizationAmount: JsonField = JsonMissing.of()
        private var merchantCurrency: JsonField = JsonMissing.of()
        private var network: JsonField = JsonMissing.of()
        private var networkRiskScore: JsonField = JsonMissing.of()
        private var result: JsonField = JsonMissing.of()
        private var pos: JsonField = JsonMissing.of()
        private var settledAmount: JsonField = JsonMissing.of()
        private var status: JsonField = JsonMissing.of()
        private var token: JsonField = JsonMissing.of()
        private var tokenInfo: JsonField = JsonMissing.of()
        private var updated: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        internal fun from(transaction: Transaction) = apply {
            this.acquirerFee = transaction.acquirerFee
            this.acquirerReferenceNumber = transaction.acquirerReferenceNumber
            this.accountToken = transaction.accountToken
            this.amount = transaction.amount
            this.amounts = transaction.amounts
            this.authorizationAmount = transaction.authorizationAmount
            this.authorizationCode = transaction.authorizationCode
            this.avs = transaction.avs
            this.cardToken = transaction.cardToken
            this.cardholderAuthentication = transaction.cardholderAuthentication
            this.created = transaction.created
            this.events = transaction.events
            this.merchant = transaction.merchant
            this.merchantAmount = transaction.merchantAmount
            this.merchantAuthorizationAmount = transaction.merchantAuthorizationAmount
            this.merchantCurrency = transaction.merchantCurrency
            this.network = transaction.network
            this.networkRiskScore = transaction.networkRiskScore
            this.result = transaction.result
            this.pos = transaction.pos
            this.settledAmount = transaction.settledAmount
            this.status = transaction.status
            this.token = transaction.token
            this.tokenInfo = transaction.tokenInfo
            this.updated = transaction.updated
            additionalProperties(transaction.additionalProperties)
        }

        /**
         * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the
         * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative
         * value to indicate credited fees.
         */
        fun acquirerFee(acquirerFee: Long) = acquirerFee(JsonField.of(acquirerFee))

        /**
         * Fee assessed by the merchant and paid for by the cardholder in the smallest unit of the
         * currency. Will be zero if no fee is assessed. Rebates may be transmitted as a negative
         * value to indicate credited fees.
         */
        @JsonProperty("acquirer_fee")
        @ExcludeMissing
        fun acquirerFee(acquirerFee: JsonField) = apply { this.acquirerFee = acquirerFee }

        /**
         * Unique identifier assigned to a transaction by the acquirer that can be used in dispute
         * and chargeback filing.
         */
        fun acquirerReferenceNumber(acquirerReferenceNumber: String) =
            acquirerReferenceNumber(JsonField.of(acquirerReferenceNumber))

        /**
         * Unique identifier assigned to a transaction by the acquirer that can be used in dispute
         * and chargeback filing.
         */
        @JsonProperty("acquirer_reference_number")
        @ExcludeMissing
        fun acquirerReferenceNumber(acquirerReferenceNumber: JsonField) = apply {
            this.acquirerReferenceNumber = acquirerReferenceNumber
        }

        /** The token for the account associated with this transaction. */
        fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken))

        /** The token for the account associated with this transaction. */
        @JsonProperty("account_token")
        @ExcludeMissing
        fun accountToken(accountToken: JsonField) = apply {
            this.accountToken = accountToken
        }

        /**
         * When the transaction is pending, this represents the authorization amount of the
         * transaction in the anticipated settlement currency. Once the transaction has settled,
         * this field represents the settled amount in the settlement currency.
         */
        fun amount(amount: Long) = amount(JsonField.of(amount))

        /**
         * When the transaction is pending, this represents the authorization amount of the
         * transaction in the anticipated settlement currency. Once the transaction has settled,
         * this field represents the settled amount in the settlement currency.
         */
        @JsonProperty("amount")
        @ExcludeMissing
        fun amount(amount: JsonField) = apply { this.amount = amount }

        fun amounts(amounts: TransactionAmounts) = amounts(JsonField.of(amounts))

        @JsonProperty("amounts")
        @ExcludeMissing
        fun amounts(amounts: JsonField) = apply { this.amounts = amounts }

        /** The authorization amount of the transaction in the anticipated settlement currency. */
        fun authorizationAmount(authorizationAmount: Long) =
            authorizationAmount(JsonField.of(authorizationAmount))

        /** The authorization amount of the transaction in the anticipated settlement currency. */
        @JsonProperty("authorization_amount")
        @ExcludeMissing
        fun authorizationAmount(authorizationAmount: JsonField) = apply {
            this.authorizationAmount = authorizationAmount
        }

        /**
         * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with
         * networks.
         */
        fun authorizationCode(authorizationCode: String) =
            authorizationCode(JsonField.of(authorizationCode))

        /**
         * A fixed-width 6-digit numeric identifier that can be used to identify a transaction with
         * networks.
         */
        @JsonProperty("authorization_code")
        @ExcludeMissing
        fun authorizationCode(authorizationCode: JsonField) = apply {
            this.authorizationCode = authorizationCode
        }

        fun avs(avs: Avs) = avs(JsonField.of(avs))

        @JsonProperty("avs") @ExcludeMissing fun avs(avs: JsonField) = apply { this.avs = avs }

        /** Token for the card used in this transaction. */
        fun cardToken(cardToken: String) = cardToken(JsonField.of(cardToken))

        /** Token for the card used in this transaction. */
        @JsonProperty("card_token")
        @ExcludeMissing
        fun cardToken(cardToken: JsonField) = apply { this.cardToken = cardToken }

        fun cardholderAuthentication(cardholderAuthentication: CardholderAuthentication) =
            cardholderAuthentication(JsonField.of(cardholderAuthentication))

        @JsonProperty("cardholder_authentication")
        @ExcludeMissing
        fun cardholderAuthentication(
            cardholderAuthentication: JsonField
        ) = apply { this.cardholderAuthentication = cardholderAuthentication }

        /** Date and time when the transaction first occurred. UTC time zone. */
        fun created(created: OffsetDateTime) = created(JsonField.of(created))

        /** Date and time when the transaction first occurred. UTC time zone. */
        @JsonProperty("created")
        @ExcludeMissing
        fun created(created: JsonField) = apply { this.created = created }

        fun events(events: List) = events(JsonField.of(events))

        @JsonProperty("events")
        @ExcludeMissing
        fun events(events: JsonField>) = apply { this.events = events }

        fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant))

        @JsonProperty("merchant")
        @ExcludeMissing
        fun merchant(merchant: JsonField) = apply { this.merchant = merchant }

        /** Analogous to the 'amount', but in the merchant currency. */
        fun merchantAmount(merchantAmount: Long) = merchantAmount(JsonField.of(merchantAmount))

        /** Analogous to the 'amount', but in the merchant currency. */
        @JsonProperty("merchant_amount")
        @ExcludeMissing
        fun merchantAmount(merchantAmount: JsonField) = apply {
            this.merchantAmount = merchantAmount
        }

        /** Analogous to the 'authorization_amount', but in the merchant currency. */
        fun merchantAuthorizationAmount(merchantAuthorizationAmount: Long) =
            merchantAuthorizationAmount(JsonField.of(merchantAuthorizationAmount))

        /** Analogous to the 'authorization_amount', but in the merchant currency. */
        @JsonProperty("merchant_authorization_amount")
        @ExcludeMissing
        fun merchantAuthorizationAmount(merchantAuthorizationAmount: JsonField) = apply {
            this.merchantAuthorizationAmount = merchantAuthorizationAmount
        }

        /** 3-digit alphabetic ISO 4217 code for the local currency of the transaction. */
        fun merchantCurrency(merchantCurrency: String) =
            merchantCurrency(JsonField.of(merchantCurrency))

        /** 3-digit alphabetic ISO 4217 code for the local currency of the transaction. */
        @JsonProperty("merchant_currency")
        @ExcludeMissing
        fun merchantCurrency(merchantCurrency: JsonField) = apply {
            this.merchantCurrency = merchantCurrency
        }

        /**
         * Card network of the authorization. Can be `INTERLINK`, `MAESTRO`, `MASTERCARD`, `VISA`,
         * or `UNKNOWN`. Value is `UNKNOWN` when Lithic cannot determine the network code from the
         * upstream provider.
         */
        fun network(network: Network) = network(JsonField.of(network))

        /**
         * Card network of the authorization. Can be `INTERLINK`, `MAESTRO`, `MASTERCARD`, `VISA`,
         * or `UNKNOWN`. Value is `UNKNOWN` when Lithic cannot determine the network code from the
         * upstream provider.
         */
        @JsonProperty("network")
        @ExcludeMissing
        fun network(network: JsonField) = apply { this.network = network }

        /**
         * Network-provided score assessing risk level associated with a given authorization. Scores
         * are on a range of 0-999, with 0 representing the lowest risk and 999 representing the
         * highest risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will
         * normalize the score by multiplying the raw score by 10x.
         */
        fun networkRiskScore(networkRiskScore: Long) =
            networkRiskScore(JsonField.of(networkRiskScore))

        /**
         * Network-provided score assessing risk level associated with a given authorization. Scores
         * are on a range of 0-999, with 0 representing the lowest risk and 999 representing the
         * highest risk. For Visa transactions, where the raw score has a range of 0-99, Lithic will
         * normalize the score by multiplying the raw score by 10x.
         */
        @JsonProperty("network_risk_score")
        @ExcludeMissing
        fun networkRiskScore(networkRiskScore: JsonField) = apply {
            this.networkRiskScore = networkRiskScore
        }

        fun result(result: DeclineResult) = result(JsonField.of(result))

        @JsonProperty("result")
        @ExcludeMissing
        fun result(result: JsonField) = apply { this.result = result }

        fun pos(pos: Pos) = pos(JsonField.of(pos))

        @JsonProperty("pos") @ExcludeMissing fun pos(pos: JsonField) = apply { this.pos = pos }

        /** The settled amount of the transaction in the settlement currency. */
        fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))

        /** The settled amount of the transaction in the settlement currency. */
        @JsonProperty("settled_amount")
        @ExcludeMissing
        fun settledAmount(settledAmount: JsonField) = apply {
            this.settledAmount = settledAmount
        }

        /** Status of the transaction. */
        fun status(status: Status) = status(JsonField.of(status))

        /** Status of the transaction. */
        @JsonProperty("status")
        @ExcludeMissing
        fun status(status: JsonField) = apply { this.status = status }

        /** Globally unique identifier. */
        fun token(token: String) = token(JsonField.of(token))

        /** Globally unique identifier. */
        @JsonProperty("token")
        @ExcludeMissing
        fun token(token: JsonField) = apply { this.token = token }

        fun tokenInfo(tokenInfo: TokenInfo) = tokenInfo(JsonField.of(tokenInfo))

        @JsonProperty("token_info")
        @ExcludeMissing
        fun tokenInfo(tokenInfo: JsonField) = apply { this.tokenInfo = tokenInfo }

        /** Date and time when the transaction last updated. UTC time zone. */
        fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))

        /** Date and time when the transaction last updated. UTC time zone. */
        @JsonProperty("updated")
        @ExcludeMissing
        fun updated(updated: JsonField) = apply { this.updated = updated }

        fun additionalProperties(additionalProperties: Map) = apply {
            this.additionalProperties.clear()
            this.additionalProperties.putAll(additionalProperties)
        }

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

        fun putAllAdditionalProperties(additionalProperties: Map) = apply {
            this.additionalProperties.putAll(additionalProperties)
        }

        fun build(): Transaction =
            Transaction(
                acquirerFee,
                acquirerReferenceNumber,
                accountToken,
                amount,
                amounts,
                authorizationAmount,
                authorizationCode,
                avs,
                cardToken,
                cardholderAuthentication,
                created,
                events.map { it.toImmutable() },
                merchant,
                merchantAmount,
                merchantAuthorizationAmount,
                merchantCurrency,
                network,
                networkRiskScore,
                result,
                pos,
                settledAmount,
                status,
                token,
                tokenInfo,
                updated,
                additionalProperties.toImmutable(),
            )
    }

    @JsonDeserialize(builder = TransactionAmounts.Builder::class)
    @NoAutoDetect
    class TransactionAmounts
    private constructor(
        private val cardholder: JsonField,
        private val hold: JsonField,
        private val merchant: JsonField,
        private val settlement: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        fun cardholder(): Cardholder = cardholder.getRequired("cardholder")

        fun hold(): Hold = hold.getRequired("hold")

        fun merchant(): Merchant = merchant.getRequired("merchant")

        fun settlement(): Settlement = settlement.getRequired("settlement")

        @JsonProperty("cardholder") @ExcludeMissing fun _cardholder() = cardholder

        @JsonProperty("hold") @ExcludeMissing fun _hold() = hold

        @JsonProperty("merchant") @ExcludeMissing fun _merchant() = merchant

        @JsonProperty("settlement") @ExcludeMissing fun _settlement() = settlement

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): TransactionAmounts = apply {
            if (!validated) {
                cardholder().validate()
                hold().validate()
                merchant().validate()
                settlement().validate()
                validated = true
            }
        }

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var cardholder: JsonField = JsonMissing.of()
            private var hold: JsonField = JsonMissing.of()
            private var merchant: JsonField = JsonMissing.of()
            private var settlement: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(transactionAmounts: TransactionAmounts) = apply {
                this.cardholder = transactionAmounts.cardholder
                this.hold = transactionAmounts.hold
                this.merchant = transactionAmounts.merchant
                this.settlement = transactionAmounts.settlement
                additionalProperties(transactionAmounts.additionalProperties)
            }

            fun cardholder(cardholder: Cardholder) = cardholder(JsonField.of(cardholder))

            @JsonProperty("cardholder")
            @ExcludeMissing
            fun cardholder(cardholder: JsonField) = apply {
                this.cardholder = cardholder
            }

            fun hold(hold: Hold) = hold(JsonField.of(hold))

            @JsonProperty("hold")
            @ExcludeMissing
            fun hold(hold: JsonField) = apply { this.hold = hold }

            fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant))

            @JsonProperty("merchant")
            @ExcludeMissing
            fun merchant(merchant: JsonField) = apply { this.merchant = merchant }

            fun settlement(settlement: Settlement) = settlement(JsonField.of(settlement))

            @JsonProperty("settlement")
            @ExcludeMissing
            fun settlement(settlement: JsonField) = apply {
                this.settlement = settlement
            }

            fun additionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.clear()
                this.additionalProperties.putAll(additionalProperties)
            }

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

            fun putAllAdditionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun build(): TransactionAmounts =
                TransactionAmounts(
                    cardholder,
                    hold,
                    merchant,
                    settlement,
                    additionalProperties.toImmutable(),
                )
        }

        @JsonDeserialize(builder = Cardholder.Builder::class)
        @NoAutoDetect
        class Cardholder
        private constructor(
            private val amount: JsonField,
            private val conversionRate: JsonField,
            private val currency: JsonField,
            private val additionalProperties: Map,
        ) {

            private var validated: Boolean = false

            /** The aggregate settled amount in the cardholder billing currency. */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * The conversion rate used to convert the merchant amount to the cardholder billing
             * amount.
             */
            fun conversionRate(): String = conversionRate.getRequired("conversion_rate")

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            fun currency(): Currency = currency.getRequired("currency")

            /** The aggregate settled amount in the cardholder billing currency. */
            @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

            /**
             * The conversion rate used to convert the merchant amount to the cardholder billing
             * amount.
             */
            @JsonProperty("conversion_rate") @ExcludeMissing fun _conversionRate() = conversionRate

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map = additionalProperties

            fun validate(): Cardholder = apply {
                if (!validated) {
                    amount()
                    conversionRate()
                    currency()
                    validated = true
                }
            }

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

            companion object {

                fun builder() = Builder()
            }

            class Builder {

                private var amount: JsonField = JsonMissing.of()
                private var conversionRate: JsonField = JsonMissing.of()
                private var currency: JsonField = JsonMissing.of()
                private var additionalProperties: MutableMap = mutableMapOf()

                internal fun from(cardholder: Cardholder) = apply {
                    this.amount = cardholder.amount
                    this.conversionRate = cardholder.conversionRate
                    this.currency = cardholder.currency
                    additionalProperties(cardholder.additionalProperties)
                }

                /** The aggregate settled amount in the cardholder billing currency. */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /** The aggregate settled amount in the cardholder billing currency. */
                @JsonProperty("amount")
                @ExcludeMissing
                fun amount(amount: JsonField) = apply { this.amount = amount }

                /**
                 * The conversion rate used to convert the merchant amount to the cardholder billing
                 * amount.
                 */
                fun conversionRate(conversionRate: String) =
                    conversionRate(JsonField.of(conversionRate))

                /**
                 * The conversion rate used to convert the merchant amount to the cardholder billing
                 * amount.
                 */
                @JsonProperty("conversion_rate")
                @ExcludeMissing
                fun conversionRate(conversionRate: JsonField) = apply {
                    this.conversionRate = conversionRate
                }

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun currency(currency: JsonField) = apply { this.currency = currency }

                fun additionalProperties(additionalProperties: Map) = apply {
                    this.additionalProperties.clear()
                    this.additionalProperties.putAll(additionalProperties)
                }

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

                fun putAllAdditionalProperties(additionalProperties: Map) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun build(): Cardholder =
                    Cardholder(
                        amount,
                        conversionRate,
                        currency,
                        additionalProperties.toImmutable(),
                    )
            }

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

                return /* spotless:off */ other is Cardholder && this.amount == other.amount && this.conversionRate == other.conversionRate && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */
            }

            private var hashCode: Int = 0

            override fun hashCode(): Int {
                if (hashCode == 0) {
                    hashCode = /* spotless:off */ Objects.hash(amount, conversionRate, currency, additionalProperties) /* spotless:on */
                }
                return hashCode
            }

            override fun toString() =
                "Cardholder{amount=$amount, conversionRate=$conversionRate, currency=$currency, additionalProperties=$additionalProperties}"
        }

        @JsonDeserialize(builder = Hold.Builder::class)
        @NoAutoDetect
        class Hold
        private constructor(
            private val amount: JsonField,
            private val currency: JsonField,
            private val additionalProperties: Map,
        ) {

            private var validated: Boolean = false

            /**
             * The aggregate authorization amount of the transaction in the anticipated settlement
             * currency.
             */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            fun currency(): Currency = currency.getRequired("currency")

            /**
             * The aggregate authorization amount of the transaction in the anticipated settlement
             * currency.
             */
            @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map = additionalProperties

            fun validate(): Hold = apply {
                if (!validated) {
                    amount()
                    currency()
                    validated = true
                }
            }

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

            companion object {

                fun builder() = Builder()
            }

            class Builder {

                private var amount: JsonField = JsonMissing.of()
                private var currency: JsonField = JsonMissing.of()
                private var additionalProperties: MutableMap = mutableMapOf()

                internal fun from(hold: Hold) = apply {
                    this.amount = hold.amount
                    this.currency = hold.currency
                    additionalProperties(hold.additionalProperties)
                }

                /**
                 * The aggregate authorization amount of the transaction in the anticipated
                 * settlement currency.
                 */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /**
                 * The aggregate authorization amount of the transaction in the anticipated
                 * settlement currency.
                 */
                @JsonProperty("amount")
                @ExcludeMissing
                fun amount(amount: JsonField) = apply { this.amount = amount }

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun currency(currency: JsonField) = apply { this.currency = currency }

                fun additionalProperties(additionalProperties: Map) = apply {
                    this.additionalProperties.clear()
                    this.additionalProperties.putAll(additionalProperties)
                }

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

                fun putAllAdditionalProperties(additionalProperties: Map) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun build(): Hold =
                    Hold(
                        amount,
                        currency,
                        additionalProperties.toImmutable(),
                    )
            }

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

                return /* spotless:off */ other is Hold && this.amount == other.amount && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */
            }

            private var hashCode: Int = 0

            override fun hashCode(): Int {
                if (hashCode == 0) {
                    hashCode = /* spotless:off */ Objects.hash(amount, currency, additionalProperties) /* spotless:on */
                }
                return hashCode
            }

            override fun toString() =
                "Hold{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
        }

        @JsonDeserialize(builder = Merchant.Builder::class)
        @NoAutoDetect
        class Merchant
        private constructor(
            private val amount: JsonField,
            private val currency: JsonField,
            private val additionalProperties: Map,
        ) {

            private var validated: Boolean = false

            /** The aggregate settled amount in the merchant currency. */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            fun currency(): Currency = currency.getRequired("currency")

            /** The aggregate settled amount in the merchant currency. */
            @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map = additionalProperties

            fun validate(): Merchant = apply {
                if (!validated) {
                    amount()
                    currency()
                    validated = true
                }
            }

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

            companion object {

                fun builder() = Builder()
            }

            class Builder {

                private var amount: JsonField = JsonMissing.of()
                private var currency: JsonField = JsonMissing.of()
                private var additionalProperties: MutableMap = mutableMapOf()

                internal fun from(merchant: Merchant) = apply {
                    this.amount = merchant.amount
                    this.currency = merchant.currency
                    additionalProperties(merchant.additionalProperties)
                }

                /** The aggregate settled amount in the merchant currency. */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /** The aggregate settled amount in the merchant currency. */
                @JsonProperty("amount")
                @ExcludeMissing
                fun amount(amount: JsonField) = apply { this.amount = amount }

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun currency(currency: JsonField) = apply { this.currency = currency }

                fun additionalProperties(additionalProperties: Map) = apply {
                    this.additionalProperties.clear()
                    this.additionalProperties.putAll(additionalProperties)
                }

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

                fun putAllAdditionalProperties(additionalProperties: Map) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun build(): Merchant =
                    Merchant(
                        amount,
                        currency,
                        additionalProperties.toImmutable(),
                    )
            }

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

                return /* spotless:off */ other is Merchant && this.amount == other.amount && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */
            }

            private var hashCode: Int = 0

            override fun hashCode(): Int {
                if (hashCode == 0) {
                    hashCode = /* spotless:off */ Objects.hash(amount, currency, additionalProperties) /* spotless:on */
                }
                return hashCode
            }

            override fun toString() =
                "Merchant{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
        }

        @JsonDeserialize(builder = Settlement.Builder::class)
        @NoAutoDetect
        class Settlement
        private constructor(
            private val amount: JsonField,
            private val currency: JsonField,
            private val additionalProperties: Map,
        ) {

            private var validated: Boolean = false

            /** The aggregate settled amount in the settlement currency. */
            fun amount(): Long = amount.getRequired("amount")

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            fun currency(): Currency = currency.getRequired("currency")

            /** The aggregate settled amount in the settlement currency. */
            @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

            /**
             * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
             * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
             * `USD`.
             */
            @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map = additionalProperties

            fun validate(): Settlement = apply {
                if (!validated) {
                    amount()
                    currency()
                    validated = true
                }
            }

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

            companion object {

                fun builder() = Builder()
            }

            class Builder {

                private var amount: JsonField = JsonMissing.of()
                private var currency: JsonField = JsonMissing.of()
                private var additionalProperties: MutableMap = mutableMapOf()

                internal fun from(settlement: Settlement) = apply {
                    this.amount = settlement.amount
                    this.currency = settlement.currency
                    additionalProperties(settlement.additionalProperties)
                }

                /** The aggregate settled amount in the settlement currency. */
                fun amount(amount: Long) = amount(JsonField.of(amount))

                /** The aggregate settled amount in the settlement currency. */
                @JsonProperty("amount")
                @ExcludeMissing
                fun amount(amount: JsonField) = apply { this.amount = amount }

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                fun currency(currency: Currency) = currency(JsonField.of(currency))

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                @JsonProperty("currency")
                @ExcludeMissing
                fun currency(currency: JsonField) = apply { this.currency = currency }

                fun additionalProperties(additionalProperties: Map) = apply {
                    this.additionalProperties.clear()
                    this.additionalProperties.putAll(additionalProperties)
                }

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

                fun putAllAdditionalProperties(additionalProperties: Map) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun build(): Settlement =
                    Settlement(
                        amount,
                        currency,
                        additionalProperties.toImmutable(),
                    )
            }

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

                return /* spotless:off */ other is Settlement && this.amount == other.amount && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */
            }

            private var hashCode: Int = 0

            override fun hashCode(): Int {
                if (hashCode == 0) {
                    hashCode = /* spotless:off */ Objects.hash(amount, currency, additionalProperties) /* spotless:on */
                }
                return hashCode
            }

            override fun toString() =
                "Settlement{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
        }

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

            return /* spotless:off */ other is TransactionAmounts && this.cardholder == other.cardholder && this.hold == other.hold && this.merchant == other.merchant && this.settlement == other.settlement && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(cardholder, hold, merchant, settlement, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "TransactionAmounts{cardholder=$cardholder, hold=$hold, merchant=$merchant, settlement=$settlement, additionalProperties=$additionalProperties}"
    }

    @JsonDeserialize(builder = Avs.Builder::class)
    @NoAutoDetect
    class Avs
    private constructor(
        private val address: JsonField,
        private val zipcode: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        /** Cardholder address */
        fun address(): String = address.getRequired("address")

        /** Cardholder ZIP code */
        fun zipcode(): String = zipcode.getRequired("zipcode")

        /** Cardholder address */
        @JsonProperty("address") @ExcludeMissing fun _address() = address

        /** Cardholder ZIP code */
        @JsonProperty("zipcode") @ExcludeMissing fun _zipcode() = zipcode

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): Avs = apply {
            if (!validated) {
                address()
                zipcode()
                validated = true
            }
        }

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var address: JsonField = JsonMissing.of()
            private var zipcode: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(avs: Avs) = apply {
                this.address = avs.address
                this.zipcode = avs.zipcode
                additionalProperties(avs.additionalProperties)
            }

            /** Cardholder address */
            fun address(address: String) = address(JsonField.of(address))

            /** Cardholder address */
            @JsonProperty("address")
            @ExcludeMissing
            fun address(address: JsonField) = apply { this.address = address }

            /** Cardholder ZIP code */
            fun zipcode(zipcode: String) = zipcode(JsonField.of(zipcode))

            /** Cardholder ZIP code */
            @JsonProperty("zipcode")
            @ExcludeMissing
            fun zipcode(zipcode: JsonField) = apply { this.zipcode = zipcode }

            fun additionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.clear()
                this.additionalProperties.putAll(additionalProperties)
            }

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

            fun putAllAdditionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun build(): Avs =
                Avs(
                    address,
                    zipcode,
                    additionalProperties.toImmutable(),
                )
        }

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

            return /* spotless:off */ other is Avs && this.address == other.address && this.zipcode == other.zipcode && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(address, zipcode, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "Avs{address=$address, zipcode=$zipcode, additionalProperties=$additionalProperties}"
    }

    @JsonDeserialize(builder = CardholderAuthentication.Builder::class)
    @NoAutoDetect
    class CardholderAuthentication
    private constructor(
        private val _3dsVersion: JsonField,
        private val acquirerExemption: JsonField,
        private val authenticationResult: JsonField,
        private val decisionMadeBy: JsonField,
        private val liabilityShift: JsonField,
        private val threeDSAuthenticationToken: JsonField,
        private val verificationAttempted: JsonField,
        private val verificationResult: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        /** The 3DS version used for the authentication */
        fun _3dsVersion(): String? = _3dsVersion.getNullable("3ds_version")

        /** Whether an acquirer exemption applied to the transaction. */
        fun acquirerExemption(): AcquirerExemption =
            acquirerExemption.getRequired("acquirer_exemption")

        /** Indicates what the outcome of the 3DS authentication process is. */
        fun authenticationResult(): AuthenticationResult =
            authenticationResult.getRequired("authentication_result")

        /** Indicates which party made the 3DS authentication decision. */
        fun decisionMadeBy(): DecisionMadeBy = decisionMadeBy.getRequired("decision_made_by")

        /**
         * Indicates whether chargeback liability shift applies to the transaction. Possible enum
         * values:
         *
         *     * `3DS_AUTHENTICATED`: The transaction was fully authenticated through a 3-D Secure flow, chargeback liability shift applies.
         *     * `ACQUIRER_EXEMPTION`: The acquirer utilised an exemption to bypass Strong Customer Authentication (`transStatus = N`, or `transStatus = I`). Liability remains with the acquirer and in this case the `acquirer_exemption` field is expected to be not `NONE`.
         *     * `NONE`: Chargeback liability shift has not shifted to the issuer, i.e. the merchant is liable.
         * - `TOKEN_AUTHENTICATED`: The transaction was a tokenized payment with validated
         *   cryptography, possibly recurring. Chargeback liability shift to the issuer applies.
         */
        fun liabilityShift(): LiabilityShift = liabilityShift.getRequired("liability_shift")

        /**
         * Unique identifier you can use to match a given 3DS authentication (available via the
         * three_ds_authentication.created event webhook) and the transaction. Note that in cases
         * where liability shift does not occur, this token is matched to the transaction on a
         * best-effort basis.
         */
        fun threeDSAuthenticationToken(): String? =
            threeDSAuthenticationToken.getNullable("three_ds_authentication_token")

        /**
         * Indicates whether a 3DS challenge flow was used, and if so, what the verification method
         * was. (deprecated, use `authentication_result`)
         */
        fun verificationAttempted(): VerificationAttempted =
            verificationAttempted.getRequired("verification_attempted")

        /**
         * Indicates whether a transaction is considered 3DS authenticated. (deprecated, use
         * `authentication_result`)
         */
        fun verificationResult(): VerificationResult =
            verificationResult.getRequired("verification_result")

        /** The 3DS version used for the authentication */
        @JsonProperty("3ds_version") @ExcludeMissing fun __3dsVersion() = _3dsVersion

        /** Whether an acquirer exemption applied to the transaction. */
        @JsonProperty("acquirer_exemption")
        @ExcludeMissing
        fun _acquirerExemption() = acquirerExemption

        /** Indicates what the outcome of the 3DS authentication process is. */
        @JsonProperty("authentication_result")
        @ExcludeMissing
        fun _authenticationResult() = authenticationResult

        /** Indicates which party made the 3DS authentication decision. */
        @JsonProperty("decision_made_by") @ExcludeMissing fun _decisionMadeBy() = decisionMadeBy

        /**
         * Indicates whether chargeback liability shift applies to the transaction. Possible enum
         * values:
         *
         *     * `3DS_AUTHENTICATED`: The transaction was fully authenticated through a 3-D Secure flow, chargeback liability shift applies.
         *     * `ACQUIRER_EXEMPTION`: The acquirer utilised an exemption to bypass Strong Customer Authentication (`transStatus = N`, or `transStatus = I`). Liability remains with the acquirer and in this case the `acquirer_exemption` field is expected to be not `NONE`.
         *     * `NONE`: Chargeback liability shift has not shifted to the issuer, i.e. the merchant is liable.
         * - `TOKEN_AUTHENTICATED`: The transaction was a tokenized payment with validated
         *   cryptography, possibly recurring. Chargeback liability shift to the issuer applies.
         */
        @JsonProperty("liability_shift") @ExcludeMissing fun _liabilityShift() = liabilityShift

        /**
         * Unique identifier you can use to match a given 3DS authentication (available via the
         * three_ds_authentication.created event webhook) and the transaction. Note that in cases
         * where liability shift does not occur, this token is matched to the transaction on a
         * best-effort basis.
         */
        @JsonProperty("three_ds_authentication_token")
        @ExcludeMissing
        fun _threeDSAuthenticationToken() = threeDSAuthenticationToken

        /**
         * Indicates whether a 3DS challenge flow was used, and if so, what the verification method
         * was. (deprecated, use `authentication_result`)
         */
        @JsonProperty("verification_attempted")
        @ExcludeMissing
        fun _verificationAttempted() = verificationAttempted

        /**
         * Indicates whether a transaction is considered 3DS authenticated. (deprecated, use
         * `authentication_result`)
         */
        @JsonProperty("verification_result")
        @ExcludeMissing
        fun _verificationResult() = verificationResult

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): CardholderAuthentication = apply {
            if (!validated) {
                _3dsVersion()
                acquirerExemption()
                authenticationResult()
                decisionMadeBy()
                liabilityShift()
                threeDSAuthenticationToken()
                verificationAttempted()
                verificationResult()
                validated = true
            }
        }

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var _3dsVersion: JsonField = JsonMissing.of()
            private var acquirerExemption: JsonField = JsonMissing.of()
            private var authenticationResult: JsonField = JsonMissing.of()
            private var decisionMadeBy: JsonField = JsonMissing.of()
            private var liabilityShift: JsonField = JsonMissing.of()
            private var threeDSAuthenticationToken: JsonField = JsonMissing.of()
            private var verificationAttempted: JsonField = JsonMissing.of()
            private var verificationResult: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(cardholderAuthentication: CardholderAuthentication) = apply {
                this._3dsVersion = cardholderAuthentication._3dsVersion
                this.acquirerExemption = cardholderAuthentication.acquirerExemption
                this.authenticationResult = cardholderAuthentication.authenticationResult
                this.decisionMadeBy = cardholderAuthentication.decisionMadeBy
                this.liabilityShift = cardholderAuthentication.liabilityShift
                this.threeDSAuthenticationToken =
                    cardholderAuthentication.threeDSAuthenticationToken
                this.verificationAttempted = cardholderAuthentication.verificationAttempted
                this.verificationResult = cardholderAuthentication.verificationResult
                additionalProperties(cardholderAuthentication.additionalProperties)
            }

            /** The 3DS version used for the authentication */
            fun _3dsVersion(_3dsVersion: String) = _3dsVersion(JsonField.of(_3dsVersion))

            /** The 3DS version used for the authentication */
            @JsonProperty("3ds_version")
            @ExcludeMissing
            fun _3dsVersion(_3dsVersion: JsonField) = apply {
                this._3dsVersion = _3dsVersion
            }

            /** Whether an acquirer exemption applied to the transaction. */
            fun acquirerExemption(acquirerExemption: AcquirerExemption) =
                acquirerExemption(JsonField.of(acquirerExemption))

            /** Whether an acquirer exemption applied to the transaction. */
            @JsonProperty("acquirer_exemption")
            @ExcludeMissing
            fun acquirerExemption(acquirerExemption: JsonField) = apply {
                this.acquirerExemption = acquirerExemption
            }

            /** Indicates what the outcome of the 3DS authentication process is. */
            fun authenticationResult(authenticationResult: AuthenticationResult) =
                authenticationResult(JsonField.of(authenticationResult))

            /** Indicates what the outcome of the 3DS authentication process is. */
            @JsonProperty("authentication_result")
            @ExcludeMissing
            fun authenticationResult(authenticationResult: JsonField) =
                apply {
                    this.authenticationResult = authenticationResult
                }

            /** Indicates which party made the 3DS authentication decision. */
            fun decisionMadeBy(decisionMadeBy: DecisionMadeBy) =
                decisionMadeBy(JsonField.of(decisionMadeBy))

            /** Indicates which party made the 3DS authentication decision. */
            @JsonProperty("decision_made_by")
            @ExcludeMissing
            fun decisionMadeBy(decisionMadeBy: JsonField) = apply {
                this.decisionMadeBy = decisionMadeBy
            }

            /**
             * Indicates whether chargeback liability shift applies to the transaction. Possible
             * enum values:
             *
             *     * `3DS_AUTHENTICATED`: The transaction was fully authenticated through a 3-D Secure flow, chargeback liability shift applies.
             *     * `ACQUIRER_EXEMPTION`: The acquirer utilised an exemption to bypass Strong Customer Authentication (`transStatus = N`, or `transStatus = I`). Liability remains with the acquirer and in this case the `acquirer_exemption` field is expected to be not `NONE`.
             *     * `NONE`: Chargeback liability shift has not shifted to the issuer, i.e. the merchant is liable.
             * - `TOKEN_AUTHENTICATED`: The transaction was a tokenized payment with validated
             *   cryptography, possibly recurring. Chargeback liability shift to the issuer applies.
             */
            fun liabilityShift(liabilityShift: LiabilityShift) =
                liabilityShift(JsonField.of(liabilityShift))

            /**
             * Indicates whether chargeback liability shift applies to the transaction. Possible
             * enum values:
             *
             *     * `3DS_AUTHENTICATED`: The transaction was fully authenticated through a 3-D Secure flow, chargeback liability shift applies.
             *     * `ACQUIRER_EXEMPTION`: The acquirer utilised an exemption to bypass Strong Customer Authentication (`transStatus = N`, or `transStatus = I`). Liability remains with the acquirer and in this case the `acquirer_exemption` field is expected to be not `NONE`.
             *     * `NONE`: Chargeback liability shift has not shifted to the issuer, i.e. the merchant is liable.
             * - `TOKEN_AUTHENTICATED`: The transaction was a tokenized payment with validated
             *   cryptography, possibly recurring. Chargeback liability shift to the issuer applies.
             */
            @JsonProperty("liability_shift")
            @ExcludeMissing
            fun liabilityShift(liabilityShift: JsonField) = apply {
                this.liabilityShift = liabilityShift
            }

            /**
             * Unique identifier you can use to match a given 3DS authentication (available via the
             * three_ds_authentication.created event webhook) and the transaction. Note that in
             * cases where liability shift does not occur, this token is matched to the transaction
             * on a best-effort basis.
             */
            fun threeDSAuthenticationToken(threeDSAuthenticationToken: String) =
                threeDSAuthenticationToken(JsonField.of(threeDSAuthenticationToken))

            /**
             * Unique identifier you can use to match a given 3DS authentication (available via the
             * three_ds_authentication.created event webhook) and the transaction. Note that in
             * cases where liability shift does not occur, this token is matched to the transaction
             * on a best-effort basis.
             */
            @JsonProperty("three_ds_authentication_token")
            @ExcludeMissing
            fun threeDSAuthenticationToken(threeDSAuthenticationToken: JsonField) = apply {
                this.threeDSAuthenticationToken = threeDSAuthenticationToken
            }

            /**
             * Indicates whether a 3DS challenge flow was used, and if so, what the verification
             * method was. (deprecated, use `authentication_result`)
             */
            fun verificationAttempted(verificationAttempted: VerificationAttempted) =
                verificationAttempted(JsonField.of(verificationAttempted))

            /**
             * Indicates whether a 3DS challenge flow was used, and if so, what the verification
             * method was. (deprecated, use `authentication_result`)
             */
            @JsonProperty("verification_attempted")
            @ExcludeMissing
            fun verificationAttempted(verificationAttempted: JsonField) =
                apply {
                    this.verificationAttempted = verificationAttempted
                }

            /**
             * Indicates whether a transaction is considered 3DS authenticated. (deprecated, use
             * `authentication_result`)
             */
            fun verificationResult(verificationResult: VerificationResult) =
                verificationResult(JsonField.of(verificationResult))

            /**
             * Indicates whether a transaction is considered 3DS authenticated. (deprecated, use
             * `authentication_result`)
             */
            @JsonProperty("verification_result")
            @ExcludeMissing
            fun verificationResult(verificationResult: JsonField) = apply {
                this.verificationResult = verificationResult
            }

            fun additionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.clear()
                this.additionalProperties.putAll(additionalProperties)
            }

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

            fun putAllAdditionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun build(): CardholderAuthentication =
                CardholderAuthentication(
                    _3dsVersion,
                    acquirerExemption,
                    authenticationResult,
                    decisionMadeBy,
                    liabilityShift,
                    threeDSAuthenticationToken,
                    verificationAttempted,
                    verificationResult,
                    additionalProperties.toImmutable(),
                )
        }

        class AcquirerExemption
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is AcquirerExemption && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val AUTHENTICATION_OUTAGE_EXCEPTION =
                    AcquirerExemption(JsonField.of("AUTHENTICATION_OUTAGE_EXCEPTION"))

                val LOW_VALUE = AcquirerExemption(JsonField.of("LOW_VALUE"))

                val MERCHANT_INITIATED_TRANSACTION =
                    AcquirerExemption(JsonField.of("MERCHANT_INITIATED_TRANSACTION"))

                val NONE = AcquirerExemption(JsonField.of("NONE"))

                val RECURRING_PAYMENT = AcquirerExemption(JsonField.of("RECURRING_PAYMENT"))

                val SECURE_CORPORATE_PAYMENT =
                    AcquirerExemption(JsonField.of("SECURE_CORPORATE_PAYMENT"))

                val STRONG_CUSTOMER_AUTHENTICATION_DELEGATION =
                    AcquirerExemption(JsonField.of("STRONG_CUSTOMER_AUTHENTICATION_DELEGATION"))

                val TRANSACTION_RISK_ANALYSIS =
                    AcquirerExemption(JsonField.of("TRANSACTION_RISK_ANALYSIS"))

                fun of(value: String) = AcquirerExemption(JsonField.of(value))
            }

            enum class Known {
                AUTHENTICATION_OUTAGE_EXCEPTION,
                LOW_VALUE,
                MERCHANT_INITIATED_TRANSACTION,
                NONE,
                RECURRING_PAYMENT,
                SECURE_CORPORATE_PAYMENT,
                STRONG_CUSTOMER_AUTHENTICATION_DELEGATION,
                TRANSACTION_RISK_ANALYSIS,
            }

            enum class Value {
                AUTHENTICATION_OUTAGE_EXCEPTION,
                LOW_VALUE,
                MERCHANT_INITIATED_TRANSACTION,
                NONE,
                RECURRING_PAYMENT,
                SECURE_CORPORATE_PAYMENT,
                STRONG_CUSTOMER_AUTHENTICATION_DELEGATION,
                TRANSACTION_RISK_ANALYSIS,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    AUTHENTICATION_OUTAGE_EXCEPTION -> Value.AUTHENTICATION_OUTAGE_EXCEPTION
                    LOW_VALUE -> Value.LOW_VALUE
                    MERCHANT_INITIATED_TRANSACTION -> Value.MERCHANT_INITIATED_TRANSACTION
                    NONE -> Value.NONE
                    RECURRING_PAYMENT -> Value.RECURRING_PAYMENT
                    SECURE_CORPORATE_PAYMENT -> Value.SECURE_CORPORATE_PAYMENT
                    STRONG_CUSTOMER_AUTHENTICATION_DELEGATION ->
                        Value.STRONG_CUSTOMER_AUTHENTICATION_DELEGATION
                    TRANSACTION_RISK_ANALYSIS -> Value.TRANSACTION_RISK_ANALYSIS
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    AUTHENTICATION_OUTAGE_EXCEPTION -> Known.AUTHENTICATION_OUTAGE_EXCEPTION
                    LOW_VALUE -> Known.LOW_VALUE
                    MERCHANT_INITIATED_TRANSACTION -> Known.MERCHANT_INITIATED_TRANSACTION
                    NONE -> Known.NONE
                    RECURRING_PAYMENT -> Known.RECURRING_PAYMENT
                    SECURE_CORPORATE_PAYMENT -> Known.SECURE_CORPORATE_PAYMENT
                    STRONG_CUSTOMER_AUTHENTICATION_DELEGATION ->
                        Known.STRONG_CUSTOMER_AUTHENTICATION_DELEGATION
                    TRANSACTION_RISK_ANALYSIS -> Known.TRANSACTION_RISK_ANALYSIS
                    else -> throw LithicInvalidDataException("Unknown AcquirerExemption: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class AuthenticationResult
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is AuthenticationResult && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val ATTEMPTS = AuthenticationResult(JsonField.of("ATTEMPTS"))

                val DECLINE = AuthenticationResult(JsonField.of("DECLINE"))

                val NONE = AuthenticationResult(JsonField.of("NONE"))

                val SUCCESS = AuthenticationResult(JsonField.of("SUCCESS"))

                fun of(value: String) = AuthenticationResult(JsonField.of(value))
            }

            enum class Known {
                ATTEMPTS,
                DECLINE,
                NONE,
                SUCCESS,
            }

            enum class Value {
                ATTEMPTS,
                DECLINE,
                NONE,
                SUCCESS,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    ATTEMPTS -> Value.ATTEMPTS
                    DECLINE -> Value.DECLINE
                    NONE -> Value.NONE
                    SUCCESS -> Value.SUCCESS
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    ATTEMPTS -> Known.ATTEMPTS
                    DECLINE -> Known.DECLINE
                    NONE -> Known.NONE
                    SUCCESS -> Known.SUCCESS
                    else -> throw LithicInvalidDataException("Unknown AuthenticationResult: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class DecisionMadeBy
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is DecisionMadeBy && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val CUSTOMER_ENDPOINT = DecisionMadeBy(JsonField.of("CUSTOMER_ENDPOINT"))

                val LITHIC_DEFAULT = DecisionMadeBy(JsonField.of("LITHIC_DEFAULT"))

                val LITHIC_RULES = DecisionMadeBy(JsonField.of("LITHIC_RULES"))

                val NETWORK = DecisionMadeBy(JsonField.of("NETWORK"))

                val UNKNOWN = DecisionMadeBy(JsonField.of("UNKNOWN"))

                fun of(value: String) = DecisionMadeBy(JsonField.of(value))
            }

            enum class Known {
                CUSTOMER_ENDPOINT,
                LITHIC_DEFAULT,
                LITHIC_RULES,
                NETWORK,
                UNKNOWN,
            }

            enum class Value {
                CUSTOMER_ENDPOINT,
                LITHIC_DEFAULT,
                LITHIC_RULES,
                NETWORK,
                UNKNOWN,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    CUSTOMER_ENDPOINT -> Value.CUSTOMER_ENDPOINT
                    LITHIC_DEFAULT -> Value.LITHIC_DEFAULT
                    LITHIC_RULES -> Value.LITHIC_RULES
                    NETWORK -> Value.NETWORK
                    UNKNOWN -> Value.UNKNOWN
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    CUSTOMER_ENDPOINT -> Known.CUSTOMER_ENDPOINT
                    LITHIC_DEFAULT -> Known.LITHIC_DEFAULT
                    LITHIC_RULES -> Known.LITHIC_RULES
                    NETWORK -> Known.NETWORK
                    UNKNOWN -> Known.UNKNOWN
                    else -> throw LithicInvalidDataException("Unknown DecisionMadeBy: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class LiabilityShift
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is LiabilityShift && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val _3DS_AUTHENTICATED = LiabilityShift(JsonField.of("3DS_AUTHENTICATED"))

                val ACQUIRER_EXEMPTION = LiabilityShift(JsonField.of("ACQUIRER_EXEMPTION"))

                val NONE = LiabilityShift(JsonField.of("NONE"))

                val TOKEN_AUTHENTICATED = LiabilityShift(JsonField.of("TOKEN_AUTHENTICATED"))

                fun of(value: String) = LiabilityShift(JsonField.of(value))
            }

            enum class Known {
                _3DS_AUTHENTICATED,
                ACQUIRER_EXEMPTION,
                NONE,
                TOKEN_AUTHENTICATED,
            }

            enum class Value {
                _3DS_AUTHENTICATED,
                ACQUIRER_EXEMPTION,
                NONE,
                TOKEN_AUTHENTICATED,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    _3DS_AUTHENTICATED -> Value._3DS_AUTHENTICATED
                    ACQUIRER_EXEMPTION -> Value.ACQUIRER_EXEMPTION
                    NONE -> Value.NONE
                    TOKEN_AUTHENTICATED -> Value.TOKEN_AUTHENTICATED
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    _3DS_AUTHENTICATED -> Known._3DS_AUTHENTICATED
                    ACQUIRER_EXEMPTION -> Known.ACQUIRER_EXEMPTION
                    NONE -> Known.NONE
                    TOKEN_AUTHENTICATED -> Known.TOKEN_AUTHENTICATED
                    else -> throw LithicInvalidDataException("Unknown LiabilityShift: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class VerificationAttempted
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is VerificationAttempted && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val NONE = VerificationAttempted(JsonField.of("NONE"))

                val OTHER = VerificationAttempted(JsonField.of("OTHER"))

                fun of(value: String) = VerificationAttempted(JsonField.of(value))
            }

            enum class Known {
                NONE,
                OTHER,
            }

            enum class Value {
                NONE,
                OTHER,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    NONE -> Value.NONE
                    OTHER -> Value.OTHER
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    NONE -> Known.NONE
                    OTHER -> Known.OTHER
                    else ->
                        throw LithicInvalidDataException("Unknown VerificationAttempted: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class VerificationResult
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is VerificationResult && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val CANCELLED = VerificationResult(JsonField.of("CANCELLED"))

                val FAILED = VerificationResult(JsonField.of("FAILED"))

                val FRICTIONLESS = VerificationResult(JsonField.of("FRICTIONLESS"))

                val NOT_ATTEMPTED = VerificationResult(JsonField.of("NOT_ATTEMPTED"))

                val REJECTED = VerificationResult(JsonField.of("REJECTED"))

                val SUCCESS = VerificationResult(JsonField.of("SUCCESS"))

                fun of(value: String) = VerificationResult(JsonField.of(value))
            }

            enum class Known {
                CANCELLED,
                FAILED,
                FRICTIONLESS,
                NOT_ATTEMPTED,
                REJECTED,
                SUCCESS,
            }

            enum class Value {
                CANCELLED,
                FAILED,
                FRICTIONLESS,
                NOT_ATTEMPTED,
                REJECTED,
                SUCCESS,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    CANCELLED -> Value.CANCELLED
                    FAILED -> Value.FAILED
                    FRICTIONLESS -> Value.FRICTIONLESS
                    NOT_ATTEMPTED -> Value.NOT_ATTEMPTED
                    REJECTED -> Value.REJECTED
                    SUCCESS -> Value.SUCCESS
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    CANCELLED -> Known.CANCELLED
                    FAILED -> Known.FAILED
                    FRICTIONLESS -> Known.FRICTIONLESS
                    NOT_ATTEMPTED -> Known.NOT_ATTEMPTED
                    REJECTED -> Known.REJECTED
                    SUCCESS -> Known.SUCCESS
                    else -> throw LithicInvalidDataException("Unknown VerificationResult: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

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

            return /* spotless:off */ other is CardholderAuthentication && this._3dsVersion == other._3dsVersion && this.acquirerExemption == other.acquirerExemption && this.authenticationResult == other.authenticationResult && this.decisionMadeBy == other.decisionMadeBy && this.liabilityShift == other.liabilityShift && this.threeDSAuthenticationToken == other.threeDSAuthenticationToken && this.verificationAttempted == other.verificationAttempted && this.verificationResult == other.verificationResult && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(_3dsVersion, acquirerExemption, authenticationResult, decisionMadeBy, liabilityShift, threeDSAuthenticationToken, verificationAttempted, verificationResult, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "CardholderAuthentication{_3dsVersion=$_3dsVersion, acquirerExemption=$acquirerExemption, authenticationResult=$authenticationResult, decisionMadeBy=$decisionMadeBy, liabilityShift=$liabilityShift, threeDSAuthenticationToken=$threeDSAuthenticationToken, verificationAttempted=$verificationAttempted, verificationResult=$verificationResult, additionalProperties=$additionalProperties}"
    }

    @JsonDeserialize(builder = Merchant.Builder::class)
    @NoAutoDetect
    class Merchant
    private constructor(
        private val acceptorId: JsonField,
        private val acquiringInstitutionId: JsonField,
        private val city: JsonField,
        private val country: JsonField,
        private val descriptor: JsonField,
        private val mcc: JsonField,
        private val state: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        /** Unique alphanumeric identifier for the payment card acceptor (merchant). */
        fun acceptorId(): String = acceptorId.getRequired("acceptor_id")

        /** Unique numeric identifier of the acquiring institution. */
        fun acquiringInstitutionId(): String =
            acquiringInstitutionId.getRequired("acquiring_institution_id")

        /**
         * City of card acceptor. Note that in many cases, particularly in card-not-present
         * transactions, merchants may send through a phone number or URL in this field.
         */
        fun city(): String = city.getRequired("city")

        /**
         * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3
         * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles.
         */
        fun country(): String = country.getRequired("country")

        /** Short description of card acceptor. */
        fun descriptor(): String = descriptor.getRequired("descriptor")

        /**
         * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to
         * classify a business by the types of goods or services it provides.
         */
        fun mcc(): String = mcc.getRequired("mcc")

        /** Geographic state of card acceptor. */
        fun state(): String = state.getRequired("state")

        /** Unique alphanumeric identifier for the payment card acceptor (merchant). */
        @JsonProperty("acceptor_id") @ExcludeMissing fun _acceptorId() = acceptorId

        /** Unique numeric identifier of the acquiring institution. */
        @JsonProperty("acquiring_institution_id")
        @ExcludeMissing
        fun _acquiringInstitutionId() = acquiringInstitutionId

        /**
         * City of card acceptor. Note that in many cases, particularly in card-not-present
         * transactions, merchants may send through a phone number or URL in this field.
         */
        @JsonProperty("city") @ExcludeMissing fun _city() = city

        /**
         * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3
         * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles.
         */
        @JsonProperty("country") @ExcludeMissing fun _country() = country

        /** Short description of card acceptor. */
        @JsonProperty("descriptor") @ExcludeMissing fun _descriptor() = descriptor

        /**
         * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used to
         * classify a business by the types of goods or services it provides.
         */
        @JsonProperty("mcc") @ExcludeMissing fun _mcc() = mcc

        /** Geographic state of card acceptor. */
        @JsonProperty("state") @ExcludeMissing fun _state() = state

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): Merchant = apply {
            if (!validated) {
                acceptorId()
                acquiringInstitutionId()
                city()
                country()
                descriptor()
                mcc()
                state()
                validated = true
            }
        }

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var acceptorId: JsonField = JsonMissing.of()
            private var acquiringInstitutionId: JsonField = JsonMissing.of()
            private var city: JsonField = JsonMissing.of()
            private var country: JsonField = JsonMissing.of()
            private var descriptor: JsonField = JsonMissing.of()
            private var mcc: JsonField = JsonMissing.of()
            private var state: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(merchant: Merchant) = apply {
                this.acceptorId = merchant.acceptorId
                this.acquiringInstitutionId = merchant.acquiringInstitutionId
                this.city = merchant.city
                this.country = merchant.country
                this.descriptor = merchant.descriptor
                this.mcc = merchant.mcc
                this.state = merchant.state
                additionalProperties(merchant.additionalProperties)
            }

            /** Unique alphanumeric identifier for the payment card acceptor (merchant). */
            fun acceptorId(acceptorId: String) = acceptorId(JsonField.of(acceptorId))

            /** Unique alphanumeric identifier for the payment card acceptor (merchant). */
            @JsonProperty("acceptor_id")
            @ExcludeMissing
            fun acceptorId(acceptorId: JsonField) = apply { this.acceptorId = acceptorId }

            /** Unique numeric identifier of the acquiring institution. */
            fun acquiringInstitutionId(acquiringInstitutionId: String) =
                acquiringInstitutionId(JsonField.of(acquiringInstitutionId))

            /** Unique numeric identifier of the acquiring institution. */
            @JsonProperty("acquiring_institution_id")
            @ExcludeMissing
            fun acquiringInstitutionId(acquiringInstitutionId: JsonField) = apply {
                this.acquiringInstitutionId = acquiringInstitutionId
            }

            /**
             * City of card acceptor. Note that in many cases, particularly in card-not-present
             * transactions, merchants may send through a phone number or URL in this field.
             */
            fun city(city: String) = city(JsonField.of(city))

            /**
             * City of card acceptor. Note that in many cases, particularly in card-not-present
             * transactions, merchants may send through a phone number or URL in this field.
             */
            @JsonProperty("city")
            @ExcludeMissing
            fun city(city: JsonField) = apply { this.city = city }

            /**
             * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3
             * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles.
             */
            fun country(country: String) = country(JsonField.of(country))

            /**
             * Country or entity of card acceptor. Possible values are: (1) all ISO 3166-1 alpha-3
             * country codes, (2) QZZ for Kosovo, and (3) ANT for Netherlands Antilles.
             */
            @JsonProperty("country")
            @ExcludeMissing
            fun country(country: JsonField) = apply { this.country = country }

            /** Short description of card acceptor. */
            fun descriptor(descriptor: String) = descriptor(JsonField.of(descriptor))

            /** Short description of card acceptor. */
            @JsonProperty("descriptor")
            @ExcludeMissing
            fun descriptor(descriptor: JsonField) = apply { this.descriptor = descriptor }

            /**
             * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used
             * to classify a business by the types of goods or services it provides.
             */
            fun mcc(mcc: String) = mcc(JsonField.of(mcc))

            /**
             * Merchant category code (MCC). A four-digit number listed in ISO 18245. An MCC is used
             * to classify a business by the types of goods or services it provides.
             */
            @JsonProperty("mcc")
            @ExcludeMissing
            fun mcc(mcc: JsonField) = apply { this.mcc = mcc }

            /** Geographic state of card acceptor. */
            fun state(state: String) = state(JsonField.of(state))

            /** Geographic state of card acceptor. */
            @JsonProperty("state")
            @ExcludeMissing
            fun state(state: JsonField) = apply { this.state = state }

            fun additionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.clear()
                this.additionalProperties.putAll(additionalProperties)
            }

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

            fun putAllAdditionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun build(): Merchant =
                Merchant(
                    acceptorId,
                    acquiringInstitutionId,
                    city,
                    country,
                    descriptor,
                    mcc,
                    state,
                    additionalProperties.toImmutable(),
                )
        }

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

            return /* spotless:off */ other is Merchant && this.acceptorId == other.acceptorId && this.acquiringInstitutionId == other.acquiringInstitutionId && this.city == other.city && this.country == other.country && this.descriptor == other.descriptor && this.mcc == other.mcc && this.state == other.state && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(acceptorId, acquiringInstitutionId, city, country, descriptor, mcc, state, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "Merchant{acceptorId=$acceptorId, acquiringInstitutionId=$acquiringInstitutionId, city=$city, country=$country, descriptor=$descriptor, mcc=$mcc, state=$state, additionalProperties=$additionalProperties}"
    }

    class Network
    @JsonCreator
    private constructor(
        private val value: JsonField,
    ) : Enum {

        @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

            return /* spotless:off */ other is Network && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val INTERLINK = Network(JsonField.of("INTERLINK"))

            val MAESTRO = Network(JsonField.of("MAESTRO"))

            val MASTERCARD = Network(JsonField.of("MASTERCARD"))

            val UNKNOWN = Network(JsonField.of("UNKNOWN"))

            val VISA = Network(JsonField.of("VISA"))

            fun of(value: String) = Network(JsonField.of(value))
        }

        enum class Known {
            INTERLINK,
            MAESTRO,
            MASTERCARD,
            UNKNOWN,
            VISA,
        }

        enum class Value {
            INTERLINK,
            MAESTRO,
            MASTERCARD,
            UNKNOWN,
            VISA,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                INTERLINK -> Value.INTERLINK
                MAESTRO -> Value.MAESTRO
                MASTERCARD -> Value.MASTERCARD
                UNKNOWN -> Value.UNKNOWN
                VISA -> Value.VISA
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                INTERLINK -> Known.INTERLINK
                MAESTRO -> Known.MAESTRO
                MASTERCARD -> Known.MASTERCARD
                UNKNOWN -> Known.UNKNOWN
                VISA -> Known.VISA
                else -> throw LithicInvalidDataException("Unknown Network: $value")
            }

        fun asString(): String = _value().asStringOrThrow()
    }

    @JsonDeserialize(builder = Pos.Builder::class)
    @NoAutoDetect
    class Pos
    private constructor(
        private val entryMode: JsonField,
        private val terminal: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        fun entryMode(): PosEntryMode = entryMode.getRequired("entry_mode")

        fun terminal(): PosTerminal = terminal.getRequired("terminal")

        @JsonProperty("entry_mode") @ExcludeMissing fun _entryMode() = entryMode

        @JsonProperty("terminal") @ExcludeMissing fun _terminal() = terminal

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): Pos = apply {
            if (!validated) {
                entryMode().validate()
                terminal().validate()
                validated = true
            }
        }

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var entryMode: JsonField = JsonMissing.of()
            private var terminal: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(pos: Pos) = apply {
                this.entryMode = pos.entryMode
                this.terminal = pos.terminal
                additionalProperties(pos.additionalProperties)
            }

            fun entryMode(entryMode: PosEntryMode) = entryMode(JsonField.of(entryMode))

            @JsonProperty("entry_mode")
            @ExcludeMissing
            fun entryMode(entryMode: JsonField) = apply { this.entryMode = entryMode }

            fun terminal(terminal: PosTerminal) = terminal(JsonField.of(terminal))

            @JsonProperty("terminal")
            @ExcludeMissing
            fun terminal(terminal: JsonField) = apply { this.terminal = terminal }

            fun additionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.clear()
                this.additionalProperties.putAll(additionalProperties)
            }

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

            fun putAllAdditionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun build(): Pos =
                Pos(
                    entryMode,
                    terminal,
                    additionalProperties.toImmutable(),
                )
        }

        @JsonDeserialize(builder = PosEntryMode.Builder::class)
        @NoAutoDetect
        class PosEntryMode
        private constructor(
            private val card: JsonField,
            private val cardholder: JsonField,
            private val pan: JsonField,
            private val pinEntered: JsonField,
            private val additionalProperties: Map,
        ) {

            private var validated: Boolean = false

            /** Card presence indicator */
            fun card(): Card = card.getRequired("card")

            /** Cardholder presence indicator */
            fun cardholder(): Cardholder = cardholder.getRequired("cardholder")

            /** Method of entry for the PAN */
            fun pan(): Pan = pan.getRequired("pan")

            /** Indicates whether the cardholder entered the PIN. True if the PIN was entered. */
            fun pinEntered(): Boolean = pinEntered.getRequired("pin_entered")

            /** Card presence indicator */
            @JsonProperty("card") @ExcludeMissing fun _card() = card

            /** Cardholder presence indicator */
            @JsonProperty("cardholder") @ExcludeMissing fun _cardholder() = cardholder

            /** Method of entry for the PAN */
            @JsonProperty("pan") @ExcludeMissing fun _pan() = pan

            /** Indicates whether the cardholder entered the PIN. True if the PIN was entered. */
            @JsonProperty("pin_entered") @ExcludeMissing fun _pinEntered() = pinEntered

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map = additionalProperties

            fun validate(): PosEntryMode = apply {
                if (!validated) {
                    card()
                    cardholder()
                    pan()
                    pinEntered()
                    validated = true
                }
            }

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

            companion object {

                fun builder() = Builder()
            }

            class Builder {

                private var card: JsonField = JsonMissing.of()
                private var cardholder: JsonField = JsonMissing.of()
                private var pan: JsonField = JsonMissing.of()
                private var pinEntered: JsonField = JsonMissing.of()
                private var additionalProperties: MutableMap = mutableMapOf()

                internal fun from(posEntryMode: PosEntryMode) = apply {
                    this.card = posEntryMode.card
                    this.cardholder = posEntryMode.cardholder
                    this.pan = posEntryMode.pan
                    this.pinEntered = posEntryMode.pinEntered
                    additionalProperties(posEntryMode.additionalProperties)
                }

                /** Card presence indicator */
                fun card(card: Card) = card(JsonField.of(card))

                /** Card presence indicator */
                @JsonProperty("card")
                @ExcludeMissing
                fun card(card: JsonField) = apply { this.card = card }

                /** Cardholder presence indicator */
                fun cardholder(cardholder: Cardholder) = cardholder(JsonField.of(cardholder))

                /** Cardholder presence indicator */
                @JsonProperty("cardholder")
                @ExcludeMissing
                fun cardholder(cardholder: JsonField) = apply {
                    this.cardholder = cardholder
                }

                /** Method of entry for the PAN */
                fun pan(pan: Pan) = pan(JsonField.of(pan))

                /** Method of entry for the PAN */
                @JsonProperty("pan")
                @ExcludeMissing
                fun pan(pan: JsonField) = apply { this.pan = pan }

                /**
                 * Indicates whether the cardholder entered the PIN. True if the PIN was entered.
                 */
                fun pinEntered(pinEntered: Boolean) = pinEntered(JsonField.of(pinEntered))

                /**
                 * Indicates whether the cardholder entered the PIN. True if the PIN was entered.
                 */
                @JsonProperty("pin_entered")
                @ExcludeMissing
                fun pinEntered(pinEntered: JsonField) = apply {
                    this.pinEntered = pinEntered
                }

                fun additionalProperties(additionalProperties: Map) = apply {
                    this.additionalProperties.clear()
                    this.additionalProperties.putAll(additionalProperties)
                }

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

                fun putAllAdditionalProperties(additionalProperties: Map) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun build(): PosEntryMode =
                    PosEntryMode(
                        card,
                        cardholder,
                        pan,
                        pinEntered,
                        additionalProperties.toImmutable(),
                    )
            }

            class Card
            @JsonCreator
            private constructor(
                private val value: JsonField,
            ) : Enum {

                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                    return /* spotless:off */ other is Card && this.value == other.value /* spotless:on */
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()

                companion object {

                    val NOT_PRESENT = Card(JsonField.of("NOT_PRESENT"))

                    val PREAUTHORIZED = Card(JsonField.of("PREAUTHORIZED"))

                    val PRESENT = Card(JsonField.of("PRESENT"))

                    val UNKNOWN = Card(JsonField.of("UNKNOWN"))

                    fun of(value: String) = Card(JsonField.of(value))
                }

                enum class Known {
                    NOT_PRESENT,
                    PREAUTHORIZED,
                    PRESENT,
                    UNKNOWN,
                }

                enum class Value {
                    NOT_PRESENT,
                    PREAUTHORIZED,
                    PRESENT,
                    UNKNOWN,
                    _UNKNOWN,
                }

                fun value(): Value =
                    when (this) {
                        NOT_PRESENT -> Value.NOT_PRESENT
                        PREAUTHORIZED -> Value.PREAUTHORIZED
                        PRESENT -> Value.PRESENT
                        UNKNOWN -> Value.UNKNOWN
                        else -> Value._UNKNOWN
                    }

                fun known(): Known =
                    when (this) {
                        NOT_PRESENT -> Known.NOT_PRESENT
                        PREAUTHORIZED -> Known.PREAUTHORIZED
                        PRESENT -> Known.PRESENT
                        UNKNOWN -> Known.UNKNOWN
                        else -> throw LithicInvalidDataException("Unknown Card: $value")
                    }

                fun asString(): String = _value().asStringOrThrow()
            }

            class Cardholder
            @JsonCreator
            private constructor(
                private val value: JsonField,
            ) : Enum {

                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                    return /* spotless:off */ other is Cardholder && this.value == other.value /* spotless:on */
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()

                companion object {

                    val DEFERRED_BILLING = Cardholder(JsonField.of("DEFERRED_BILLING"))

                    val ELECTRONIC_ORDER = Cardholder(JsonField.of("ELECTRONIC_ORDER"))

                    val INSTALLMENT = Cardholder(JsonField.of("INSTALLMENT"))

                    val MAIL_ORDER = Cardholder(JsonField.of("MAIL_ORDER"))

                    val NOT_PRESENT = Cardholder(JsonField.of("NOT_PRESENT"))

                    val PREAUTHORIZED = Cardholder(JsonField.of("PREAUTHORIZED"))

                    val PRESENT = Cardholder(JsonField.of("PRESENT"))

                    val REOCCURRING = Cardholder(JsonField.of("REOCCURRING"))

                    val TELEPHONE_ORDER = Cardholder(JsonField.of("TELEPHONE_ORDER"))

                    val UNKNOWN = Cardholder(JsonField.of("UNKNOWN"))

                    fun of(value: String) = Cardholder(JsonField.of(value))
                }

                enum class Known {
                    DEFERRED_BILLING,
                    ELECTRONIC_ORDER,
                    INSTALLMENT,
                    MAIL_ORDER,
                    NOT_PRESENT,
                    PREAUTHORIZED,
                    PRESENT,
                    REOCCURRING,
                    TELEPHONE_ORDER,
                    UNKNOWN,
                }

                enum class Value {
                    DEFERRED_BILLING,
                    ELECTRONIC_ORDER,
                    INSTALLMENT,
                    MAIL_ORDER,
                    NOT_PRESENT,
                    PREAUTHORIZED,
                    PRESENT,
                    REOCCURRING,
                    TELEPHONE_ORDER,
                    UNKNOWN,
                    _UNKNOWN,
                }

                fun value(): Value =
                    when (this) {
                        DEFERRED_BILLING -> Value.DEFERRED_BILLING
                        ELECTRONIC_ORDER -> Value.ELECTRONIC_ORDER
                        INSTALLMENT -> Value.INSTALLMENT
                        MAIL_ORDER -> Value.MAIL_ORDER
                        NOT_PRESENT -> Value.NOT_PRESENT
                        PREAUTHORIZED -> Value.PREAUTHORIZED
                        PRESENT -> Value.PRESENT
                        REOCCURRING -> Value.REOCCURRING
                        TELEPHONE_ORDER -> Value.TELEPHONE_ORDER
                        UNKNOWN -> Value.UNKNOWN
                        else -> Value._UNKNOWN
                    }

                fun known(): Known =
                    when (this) {
                        DEFERRED_BILLING -> Known.DEFERRED_BILLING
                        ELECTRONIC_ORDER -> Known.ELECTRONIC_ORDER
                        INSTALLMENT -> Known.INSTALLMENT
                        MAIL_ORDER -> Known.MAIL_ORDER
                        NOT_PRESENT -> Known.NOT_PRESENT
                        PREAUTHORIZED -> Known.PREAUTHORIZED
                        PRESENT -> Known.PRESENT
                        REOCCURRING -> Known.REOCCURRING
                        TELEPHONE_ORDER -> Known.TELEPHONE_ORDER
                        UNKNOWN -> Known.UNKNOWN
                        else -> throw LithicInvalidDataException("Unknown Cardholder: $value")
                    }

                fun asString(): String = _value().asStringOrThrow()
            }

            class Pan
            @JsonCreator
            private constructor(
                private val value: JsonField,
            ) : Enum {

                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                    return /* spotless:off */ other is Pan && this.value == other.value /* spotless:on */
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()

                companion object {

                    val AUTO_ENTRY = Pan(JsonField.of("AUTO_ENTRY"))

                    val BAR_CODE = Pan(JsonField.of("BAR_CODE"))

                    val CONTACTLESS = Pan(JsonField.of("CONTACTLESS"))

                    val CREDENTIAL_ON_FILE = Pan(JsonField.of("CREDENTIAL_ON_FILE"))

                    val ECOMMERCE = Pan(JsonField.of("ECOMMERCE"))

                    val ERROR_KEYED = Pan(JsonField.of("ERROR_KEYED"))

                    val ERROR_MAGNETIC_STRIPE = Pan(JsonField.of("ERROR_MAGNETIC_STRIPE"))

                    val ICC = Pan(JsonField.of("ICC"))

                    val KEY_ENTERED = Pan(JsonField.of("KEY_ENTERED"))

                    val MAGNETIC_STRIPE = Pan(JsonField.of("MAGNETIC_STRIPE"))

                    val MANUAL = Pan(JsonField.of("MANUAL"))

                    val OCR = Pan(JsonField.of("OCR"))

                    val SECURE_CARDLESS = Pan(JsonField.of("SECURE_CARDLESS"))

                    val UNKNOWN = Pan(JsonField.of("UNKNOWN"))

                    val UNSPECIFIED = Pan(JsonField.of("UNSPECIFIED"))

                    fun of(value: String) = Pan(JsonField.of(value))
                }

                enum class Known {
                    AUTO_ENTRY,
                    BAR_CODE,
                    CONTACTLESS,
                    CREDENTIAL_ON_FILE,
                    ECOMMERCE,
                    ERROR_KEYED,
                    ERROR_MAGNETIC_STRIPE,
                    ICC,
                    KEY_ENTERED,
                    MAGNETIC_STRIPE,
                    MANUAL,
                    OCR,
                    SECURE_CARDLESS,
                    UNKNOWN,
                    UNSPECIFIED,
                }

                enum class Value {
                    AUTO_ENTRY,
                    BAR_CODE,
                    CONTACTLESS,
                    CREDENTIAL_ON_FILE,
                    ECOMMERCE,
                    ERROR_KEYED,
                    ERROR_MAGNETIC_STRIPE,
                    ICC,
                    KEY_ENTERED,
                    MAGNETIC_STRIPE,
                    MANUAL,
                    OCR,
                    SECURE_CARDLESS,
                    UNKNOWN,
                    UNSPECIFIED,
                    _UNKNOWN,
                }

                fun value(): Value =
                    when (this) {
                        AUTO_ENTRY -> Value.AUTO_ENTRY
                        BAR_CODE -> Value.BAR_CODE
                        CONTACTLESS -> Value.CONTACTLESS
                        CREDENTIAL_ON_FILE -> Value.CREDENTIAL_ON_FILE
                        ECOMMERCE -> Value.ECOMMERCE
                        ERROR_KEYED -> Value.ERROR_KEYED
                        ERROR_MAGNETIC_STRIPE -> Value.ERROR_MAGNETIC_STRIPE
                        ICC -> Value.ICC
                        KEY_ENTERED -> Value.KEY_ENTERED
                        MAGNETIC_STRIPE -> Value.MAGNETIC_STRIPE
                        MANUAL -> Value.MANUAL
                        OCR -> Value.OCR
                        SECURE_CARDLESS -> Value.SECURE_CARDLESS
                        UNKNOWN -> Value.UNKNOWN
                        UNSPECIFIED -> Value.UNSPECIFIED
                        else -> Value._UNKNOWN
                    }

                fun known(): Known =
                    when (this) {
                        AUTO_ENTRY -> Known.AUTO_ENTRY
                        BAR_CODE -> Known.BAR_CODE
                        CONTACTLESS -> Known.CONTACTLESS
                        CREDENTIAL_ON_FILE -> Known.CREDENTIAL_ON_FILE
                        ECOMMERCE -> Known.ECOMMERCE
                        ERROR_KEYED -> Known.ERROR_KEYED
                        ERROR_MAGNETIC_STRIPE -> Known.ERROR_MAGNETIC_STRIPE
                        ICC -> Known.ICC
                        KEY_ENTERED -> Known.KEY_ENTERED
                        MAGNETIC_STRIPE -> Known.MAGNETIC_STRIPE
                        MANUAL -> Known.MANUAL
                        OCR -> Known.OCR
                        SECURE_CARDLESS -> Known.SECURE_CARDLESS
                        UNKNOWN -> Known.UNKNOWN
                        UNSPECIFIED -> Known.UNSPECIFIED
                        else -> throw LithicInvalidDataException("Unknown Pan: $value")
                    }

                fun asString(): String = _value().asStringOrThrow()
            }

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

                return /* spotless:off */ other is PosEntryMode && this.card == other.card && this.cardholder == other.cardholder && this.pan == other.pan && this.pinEntered == other.pinEntered && this.additionalProperties == other.additionalProperties /* spotless:on */
            }

            private var hashCode: Int = 0

            override fun hashCode(): Int {
                if (hashCode == 0) {
                    hashCode = /* spotless:off */ Objects.hash(card, cardholder, pan, pinEntered, additionalProperties) /* spotless:on */
                }
                return hashCode
            }

            override fun toString() =
                "PosEntryMode{card=$card, cardholder=$cardholder, pan=$pan, pinEntered=$pinEntered, additionalProperties=$additionalProperties}"
        }

        @JsonDeserialize(builder = PosTerminal.Builder::class)
        @NoAutoDetect
        class PosTerminal
        private constructor(
            private val attended: JsonField,
            private val cardRetentionCapable: JsonField,
            private val onPremise: JsonField,
            private val operator: JsonField,
            private val partialApprovalCapable: JsonField,
            private val pinCapability: JsonField,
            private val type: JsonField,
            private val additionalProperties: Map,
        ) {

            private var validated: Boolean = false

            /** True if a clerk is present at the sale. */
            fun attended(): Boolean = attended.getRequired("attended")

            /** True if the terminal is capable of retaining the card. */
            fun cardRetentionCapable(): Boolean =
                cardRetentionCapable.getRequired("card_retention_capable")

            /** True if the sale was made at the place of business (vs. mobile). */
            fun onPremise(): Boolean = onPremise.getRequired("on_premise")

            /** The person that is designated to swipe the card */
            fun operator(): Operator = operator.getRequired("operator")

            /**
             * True if the terminal is capable of partial approval. Partial approval is when part of
             * a transaction is approved and another payment must be used for the remainder. Example
             * scenario: A $40 transaction is attempted on a prepaid card with a $25 balance. If
             * partial approval is enabled, $25 can be authorized, at which point the POS will
             * prompt the user for an additional payment of $15.
             */
            fun partialApprovalCapable(): Boolean =
                partialApprovalCapable.getRequired("partial_approval_capable")

            /** Status of whether the POS is able to accept PINs */
            fun pinCapability(): PinCapability = pinCapability.getRequired("pin_capability")

            /** POS Type */
            fun type(): Type = type.getRequired("type")

            /** True if a clerk is present at the sale. */
            @JsonProperty("attended") @ExcludeMissing fun _attended() = attended

            /** True if the terminal is capable of retaining the card. */
            @JsonProperty("card_retention_capable")
            @ExcludeMissing
            fun _cardRetentionCapable() = cardRetentionCapable

            /** True if the sale was made at the place of business (vs. mobile). */
            @JsonProperty("on_premise") @ExcludeMissing fun _onPremise() = onPremise

            /** The person that is designated to swipe the card */
            @JsonProperty("operator") @ExcludeMissing fun _operator() = operator

            /**
             * True if the terminal is capable of partial approval. Partial approval is when part of
             * a transaction is approved and another payment must be used for the remainder. Example
             * scenario: A $40 transaction is attempted on a prepaid card with a $25 balance. If
             * partial approval is enabled, $25 can be authorized, at which point the POS will
             * prompt the user for an additional payment of $15.
             */
            @JsonProperty("partial_approval_capable")
            @ExcludeMissing
            fun _partialApprovalCapable() = partialApprovalCapable

            /** Status of whether the POS is able to accept PINs */
            @JsonProperty("pin_capability") @ExcludeMissing fun _pinCapability() = pinCapability

            /** POS Type */
            @JsonProperty("type") @ExcludeMissing fun _type() = type

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map = additionalProperties

            fun validate(): PosTerminal = apply {
                if (!validated) {
                    attended()
                    cardRetentionCapable()
                    onPremise()
                    operator()
                    partialApprovalCapable()
                    pinCapability()
                    type()
                    validated = true
                }
            }

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

            companion object {

                fun builder() = Builder()
            }

            class Builder {

                private var attended: JsonField = JsonMissing.of()
                private var cardRetentionCapable: JsonField = JsonMissing.of()
                private var onPremise: JsonField = JsonMissing.of()
                private var operator: JsonField = JsonMissing.of()
                private var partialApprovalCapable: JsonField = JsonMissing.of()
                private var pinCapability: JsonField = JsonMissing.of()
                private var type: JsonField = JsonMissing.of()
                private var additionalProperties: MutableMap = mutableMapOf()

                internal fun from(posTerminal: PosTerminal) = apply {
                    this.attended = posTerminal.attended
                    this.cardRetentionCapable = posTerminal.cardRetentionCapable
                    this.onPremise = posTerminal.onPremise
                    this.operator = posTerminal.operator
                    this.partialApprovalCapable = posTerminal.partialApprovalCapable
                    this.pinCapability = posTerminal.pinCapability
                    this.type = posTerminal.type
                    additionalProperties(posTerminal.additionalProperties)
                }

                /** True if a clerk is present at the sale. */
                fun attended(attended: Boolean) = attended(JsonField.of(attended))

                /** True if a clerk is present at the sale. */
                @JsonProperty("attended")
                @ExcludeMissing
                fun attended(attended: JsonField) = apply { this.attended = attended }

                /** True if the terminal is capable of retaining the card. */
                fun cardRetentionCapable(cardRetentionCapable: Boolean) =
                    cardRetentionCapable(JsonField.of(cardRetentionCapable))

                /** True if the terminal is capable of retaining the card. */
                @JsonProperty("card_retention_capable")
                @ExcludeMissing
                fun cardRetentionCapable(cardRetentionCapable: JsonField) = apply {
                    this.cardRetentionCapable = cardRetentionCapable
                }

                /** True if the sale was made at the place of business (vs. mobile). */
                fun onPremise(onPremise: Boolean) = onPremise(JsonField.of(onPremise))

                /** True if the sale was made at the place of business (vs. mobile). */
                @JsonProperty("on_premise")
                @ExcludeMissing
                fun onPremise(onPremise: JsonField) = apply { this.onPremise = onPremise }

                /** The person that is designated to swipe the card */
                fun operator(operator: Operator) = operator(JsonField.of(operator))

                /** The person that is designated to swipe the card */
                @JsonProperty("operator")
                @ExcludeMissing
                fun operator(operator: JsonField) = apply { this.operator = operator }

                /**
                 * True if the terminal is capable of partial approval. Partial approval is when
                 * part of a transaction is approved and another payment must be used for the
                 * remainder. Example scenario: A $40 transaction is attempted on a prepaid card
                 * with a $25 balance. If partial approval is enabled, $25 can be authorized, at
                 * which point the POS will prompt the user for an additional payment of $15.
                 */
                fun partialApprovalCapable(partialApprovalCapable: Boolean) =
                    partialApprovalCapable(JsonField.of(partialApprovalCapable))

                /**
                 * True if the terminal is capable of partial approval. Partial approval is when
                 * part of a transaction is approved and another payment must be used for the
                 * remainder. Example scenario: A $40 transaction is attempted on a prepaid card
                 * with a $25 balance. If partial approval is enabled, $25 can be authorized, at
                 * which point the POS will prompt the user for an additional payment of $15.
                 */
                @JsonProperty("partial_approval_capable")
                @ExcludeMissing
                fun partialApprovalCapable(partialApprovalCapable: JsonField) = apply {
                    this.partialApprovalCapable = partialApprovalCapable
                }

                /** Status of whether the POS is able to accept PINs */
                fun pinCapability(pinCapability: PinCapability) =
                    pinCapability(JsonField.of(pinCapability))

                /** Status of whether the POS is able to accept PINs */
                @JsonProperty("pin_capability")
                @ExcludeMissing
                fun pinCapability(pinCapability: JsonField) = apply {
                    this.pinCapability = pinCapability
                }

                /** POS Type */
                fun type(type: Type) = type(JsonField.of(type))

                /** POS Type */
                @JsonProperty("type")
                @ExcludeMissing
                fun type(type: JsonField) = apply { this.type = type }

                fun additionalProperties(additionalProperties: Map) = apply {
                    this.additionalProperties.clear()
                    this.additionalProperties.putAll(additionalProperties)
                }

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

                fun putAllAdditionalProperties(additionalProperties: Map) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun build(): PosTerminal =
                    PosTerminal(
                        attended,
                        cardRetentionCapable,
                        onPremise,
                        operator,
                        partialApprovalCapable,
                        pinCapability,
                        type,
                        additionalProperties.toImmutable(),
                    )
            }

            class Operator
            @JsonCreator
            private constructor(
                private val value: JsonField,
            ) : Enum {

                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                    return /* spotless:off */ other is Operator && this.value == other.value /* spotless:on */
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()

                companion object {

                    val ADMINISTRATIVE = Operator(JsonField.of("ADMINISTRATIVE"))

                    val CARDHOLDER = Operator(JsonField.of("CARDHOLDER"))

                    val CARD_ACCEPTOR = Operator(JsonField.of("CARD_ACCEPTOR"))

                    val UNKNOWN = Operator(JsonField.of("UNKNOWN"))

                    fun of(value: String) = Operator(JsonField.of(value))
                }

                enum class Known {
                    ADMINISTRATIVE,
                    CARDHOLDER,
                    CARD_ACCEPTOR,
                    UNKNOWN,
                }

                enum class Value {
                    ADMINISTRATIVE,
                    CARDHOLDER,
                    CARD_ACCEPTOR,
                    UNKNOWN,
                    _UNKNOWN,
                }

                fun value(): Value =
                    when (this) {
                        ADMINISTRATIVE -> Value.ADMINISTRATIVE
                        CARDHOLDER -> Value.CARDHOLDER
                        CARD_ACCEPTOR -> Value.CARD_ACCEPTOR
                        UNKNOWN -> Value.UNKNOWN
                        else -> Value._UNKNOWN
                    }

                fun known(): Known =
                    when (this) {
                        ADMINISTRATIVE -> Known.ADMINISTRATIVE
                        CARDHOLDER -> Known.CARDHOLDER
                        CARD_ACCEPTOR -> Known.CARD_ACCEPTOR
                        UNKNOWN -> Known.UNKNOWN
                        else -> throw LithicInvalidDataException("Unknown Operator: $value")
                    }

                fun asString(): String = _value().asStringOrThrow()
            }

            class PinCapability
            @JsonCreator
            private constructor(
                private val value: JsonField,
            ) : Enum {

                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                    return /* spotless:off */ other is PinCapability && this.value == other.value /* spotless:on */
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()

                companion object {

                    val CAPABLE = PinCapability(JsonField.of("CAPABLE"))

                    val INOPERATIVE = PinCapability(JsonField.of("INOPERATIVE"))

                    val NOT_CAPABLE = PinCapability(JsonField.of("NOT_CAPABLE"))

                    val UNSPECIFIED = PinCapability(JsonField.of("UNSPECIFIED"))

                    fun of(value: String) = PinCapability(JsonField.of(value))
                }

                enum class Known {
                    CAPABLE,
                    INOPERATIVE,
                    NOT_CAPABLE,
                    UNSPECIFIED,
                }

                enum class Value {
                    CAPABLE,
                    INOPERATIVE,
                    NOT_CAPABLE,
                    UNSPECIFIED,
                    _UNKNOWN,
                }

                fun value(): Value =
                    when (this) {
                        CAPABLE -> Value.CAPABLE
                        INOPERATIVE -> Value.INOPERATIVE
                        NOT_CAPABLE -> Value.NOT_CAPABLE
                        UNSPECIFIED -> Value.UNSPECIFIED
                        else -> Value._UNKNOWN
                    }

                fun known(): Known =
                    when (this) {
                        CAPABLE -> Known.CAPABLE
                        INOPERATIVE -> Known.INOPERATIVE
                        NOT_CAPABLE -> Known.NOT_CAPABLE
                        UNSPECIFIED -> Known.UNSPECIFIED
                        else -> throw LithicInvalidDataException("Unknown PinCapability: $value")
                    }

                fun asString(): String = _value().asStringOrThrow()
            }

            class Type
            @JsonCreator
            private constructor(
                private val value: JsonField,
            ) : Enum {

                @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                    return /* spotless:off */ other is Type && this.value == other.value /* spotless:on */
                }

                override fun hashCode() = value.hashCode()

                override fun toString() = value.toString()

                companion object {

                    val ADMINISTRATIVE = Type(JsonField.of("ADMINISTRATIVE"))

                    val ATM = Type(JsonField.of("ATM"))

                    val AUTHORIZATION = Type(JsonField.of("AUTHORIZATION"))

                    val COUPON_MACHINE = Type(JsonField.of("COUPON_MACHINE"))

                    val DIAL_TERMINAL = Type(JsonField.of("DIAL_TERMINAL"))

                    val ECOMMERCE = Type(JsonField.of("ECOMMERCE"))

                    val ECR = Type(JsonField.of("ECR"))

                    val FUEL_MACHINE = Type(JsonField.of("FUEL_MACHINE"))

                    val HOME_TERMINAL = Type(JsonField.of("HOME_TERMINAL"))

                    val MICR = Type(JsonField.of("MICR"))

                    val OFF_PREMISE = Type(JsonField.of("OFF_PREMISE"))

                    val PAYMENT = Type(JsonField.of("PAYMENT"))

                    val PDA = Type(JsonField.of("PDA"))

                    val PHONE = Type(JsonField.of("PHONE"))

                    val POINT = Type(JsonField.of("POINT"))

                    val POS_TERMINAL = Type(JsonField.of("POS_TERMINAL"))

                    val PUBLIC_UTILITY = Type(JsonField.of("PUBLIC_UTILITY"))

                    val SELF_SERVICE = Type(JsonField.of("SELF_SERVICE"))

                    val TELEVISION = Type(JsonField.of("TELEVISION"))

                    val TELLER = Type(JsonField.of("TELLER"))

                    val TRAVELERS_CHECK_MACHINE = Type(JsonField.of("TRAVELERS_CHECK_MACHINE"))

                    val VENDING = Type(JsonField.of("VENDING"))

                    val VOICE = Type(JsonField.of("VOICE"))

                    val UNKNOWN = Type(JsonField.of("UNKNOWN"))

                    fun of(value: String) = Type(JsonField.of(value))
                }

                enum class Known {
                    ADMINISTRATIVE,
                    ATM,
                    AUTHORIZATION,
                    COUPON_MACHINE,
                    DIAL_TERMINAL,
                    ECOMMERCE,
                    ECR,
                    FUEL_MACHINE,
                    HOME_TERMINAL,
                    MICR,
                    OFF_PREMISE,
                    PAYMENT,
                    PDA,
                    PHONE,
                    POINT,
                    POS_TERMINAL,
                    PUBLIC_UTILITY,
                    SELF_SERVICE,
                    TELEVISION,
                    TELLER,
                    TRAVELERS_CHECK_MACHINE,
                    VENDING,
                    VOICE,
                    UNKNOWN,
                }

                enum class Value {
                    ADMINISTRATIVE,
                    ATM,
                    AUTHORIZATION,
                    COUPON_MACHINE,
                    DIAL_TERMINAL,
                    ECOMMERCE,
                    ECR,
                    FUEL_MACHINE,
                    HOME_TERMINAL,
                    MICR,
                    OFF_PREMISE,
                    PAYMENT,
                    PDA,
                    PHONE,
                    POINT,
                    POS_TERMINAL,
                    PUBLIC_UTILITY,
                    SELF_SERVICE,
                    TELEVISION,
                    TELLER,
                    TRAVELERS_CHECK_MACHINE,
                    VENDING,
                    VOICE,
                    UNKNOWN,
                    _UNKNOWN,
                }

                fun value(): Value =
                    when (this) {
                        ADMINISTRATIVE -> Value.ADMINISTRATIVE
                        ATM -> Value.ATM
                        AUTHORIZATION -> Value.AUTHORIZATION
                        COUPON_MACHINE -> Value.COUPON_MACHINE
                        DIAL_TERMINAL -> Value.DIAL_TERMINAL
                        ECOMMERCE -> Value.ECOMMERCE
                        ECR -> Value.ECR
                        FUEL_MACHINE -> Value.FUEL_MACHINE
                        HOME_TERMINAL -> Value.HOME_TERMINAL
                        MICR -> Value.MICR
                        OFF_PREMISE -> Value.OFF_PREMISE
                        PAYMENT -> Value.PAYMENT
                        PDA -> Value.PDA
                        PHONE -> Value.PHONE
                        POINT -> Value.POINT
                        POS_TERMINAL -> Value.POS_TERMINAL
                        PUBLIC_UTILITY -> Value.PUBLIC_UTILITY
                        SELF_SERVICE -> Value.SELF_SERVICE
                        TELEVISION -> Value.TELEVISION
                        TELLER -> Value.TELLER
                        TRAVELERS_CHECK_MACHINE -> Value.TRAVELERS_CHECK_MACHINE
                        VENDING -> Value.VENDING
                        VOICE -> Value.VOICE
                        UNKNOWN -> Value.UNKNOWN
                        else -> Value._UNKNOWN
                    }

                fun known(): Known =
                    when (this) {
                        ADMINISTRATIVE -> Known.ADMINISTRATIVE
                        ATM -> Known.ATM
                        AUTHORIZATION -> Known.AUTHORIZATION
                        COUPON_MACHINE -> Known.COUPON_MACHINE
                        DIAL_TERMINAL -> Known.DIAL_TERMINAL
                        ECOMMERCE -> Known.ECOMMERCE
                        ECR -> Known.ECR
                        FUEL_MACHINE -> Known.FUEL_MACHINE
                        HOME_TERMINAL -> Known.HOME_TERMINAL
                        MICR -> Known.MICR
                        OFF_PREMISE -> Known.OFF_PREMISE
                        PAYMENT -> Known.PAYMENT
                        PDA -> Known.PDA
                        PHONE -> Known.PHONE
                        POINT -> Known.POINT
                        POS_TERMINAL -> Known.POS_TERMINAL
                        PUBLIC_UTILITY -> Known.PUBLIC_UTILITY
                        SELF_SERVICE -> Known.SELF_SERVICE
                        TELEVISION -> Known.TELEVISION
                        TELLER -> Known.TELLER
                        TRAVELERS_CHECK_MACHINE -> Known.TRAVELERS_CHECK_MACHINE
                        VENDING -> Known.VENDING
                        VOICE -> Known.VOICE
                        UNKNOWN -> Known.UNKNOWN
                        else -> throw LithicInvalidDataException("Unknown Type: $value")
                    }

                fun asString(): String = _value().asStringOrThrow()
            }

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

                return /* spotless:off */ other is PosTerminal && this.attended == other.attended && this.cardRetentionCapable == other.cardRetentionCapable && this.onPremise == other.onPremise && this.operator == other.operator && this.partialApprovalCapable == other.partialApprovalCapable && this.pinCapability == other.pinCapability && this.type == other.type && this.additionalProperties == other.additionalProperties /* spotless:on */
            }

            private var hashCode: Int = 0

            override fun hashCode(): Int {
                if (hashCode == 0) {
                    hashCode = /* spotless:off */ Objects.hash(attended, cardRetentionCapable, onPremise, operator, partialApprovalCapable, pinCapability, type, additionalProperties) /* spotless:on */
                }
                return hashCode
            }

            override fun toString() =
                "PosTerminal{attended=$attended, cardRetentionCapable=$cardRetentionCapable, onPremise=$onPremise, operator=$operator, partialApprovalCapable=$partialApprovalCapable, pinCapability=$pinCapability, type=$type, additionalProperties=$additionalProperties}"
        }

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

            return /* spotless:off */ other is Pos && this.entryMode == other.entryMode && this.terminal == other.terminal && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(entryMode, terminal, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "Pos{entryMode=$entryMode, terminal=$terminal, additionalProperties=$additionalProperties}"
    }

    class DeclineResult
    @JsonCreator
    private constructor(
        private val value: JsonField,
    ) : Enum {

        @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

            return /* spotless:off */ other is DeclineResult && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val ACCOUNT_STATE_TRANSACTION_FAIL =
                DeclineResult(JsonField.of("ACCOUNT_STATE_TRANSACTION_FAIL"))

            val APPROVED = DeclineResult(JsonField.of("APPROVED"))

            val BANK_CONNECTION_ERROR = DeclineResult(JsonField.of("BANK_CONNECTION_ERROR"))

            val BANK_NOT_VERIFIED = DeclineResult(JsonField.of("BANK_NOT_VERIFIED"))

            val CARD_CLOSED = DeclineResult(JsonField.of("CARD_CLOSED"))

            val CARD_PAUSED = DeclineResult(JsonField.of("CARD_PAUSED"))

            val DECLINED = DeclineResult(JsonField.of("DECLINED"))

            val FRAUD_ADVICE = DeclineResult(JsonField.of("FRAUD_ADVICE"))

            val IGNORED_TTL_EXPIRY = DeclineResult(JsonField.of("IGNORED_TTL_EXPIRY"))

            val INACTIVE_ACCOUNT = DeclineResult(JsonField.of("INACTIVE_ACCOUNT"))

            val INCORRECT_PIN = DeclineResult(JsonField.of("INCORRECT_PIN"))

            val INVALID_CARD_DETAILS = DeclineResult(JsonField.of("INVALID_CARD_DETAILS"))

            val INSUFFICIENT_FUNDS = DeclineResult(JsonField.of("INSUFFICIENT_FUNDS"))

            val INSUFFICIENT_FUNDS_PRELOAD =
                DeclineResult(JsonField.of("INSUFFICIENT_FUNDS_PRELOAD"))

            val INVALID_TRANSACTION = DeclineResult(JsonField.of("INVALID_TRANSACTION"))

            val MERCHANT_BLACKLIST = DeclineResult(JsonField.of("MERCHANT_BLACKLIST"))

            val ORIGINAL_NOT_FOUND = DeclineResult(JsonField.of("ORIGINAL_NOT_FOUND"))

            val PREVIOUSLY_COMPLETED = DeclineResult(JsonField.of("PREVIOUSLY_COMPLETED"))

            val SINGLE_USE_RECHARGED = DeclineResult(JsonField.of("SINGLE_USE_RECHARGED"))

            val SWITCH_INOPERATIVE_ADVICE = DeclineResult(JsonField.of("SWITCH_INOPERATIVE_ADVICE"))

            val UNAUTHORIZED_MERCHANT = DeclineResult(JsonField.of("UNAUTHORIZED_MERCHANT"))

            val UNKNOWN_HOST_TIMEOUT = DeclineResult(JsonField.of("UNKNOWN_HOST_TIMEOUT"))

            val USER_TRANSACTION_LIMIT = DeclineResult(JsonField.of("USER_TRANSACTION_LIMIT"))

            fun of(value: String) = DeclineResult(JsonField.of(value))
        }

        enum class Known {
            ACCOUNT_STATE_TRANSACTION_FAIL,
            APPROVED,
            BANK_CONNECTION_ERROR,
            BANK_NOT_VERIFIED,
            CARD_CLOSED,
            CARD_PAUSED,
            DECLINED,
            FRAUD_ADVICE,
            IGNORED_TTL_EXPIRY,
            INACTIVE_ACCOUNT,
            INCORRECT_PIN,
            INVALID_CARD_DETAILS,
            INSUFFICIENT_FUNDS,
            INSUFFICIENT_FUNDS_PRELOAD,
            INVALID_TRANSACTION,
            MERCHANT_BLACKLIST,
            ORIGINAL_NOT_FOUND,
            PREVIOUSLY_COMPLETED,
            SINGLE_USE_RECHARGED,
            SWITCH_INOPERATIVE_ADVICE,
            UNAUTHORIZED_MERCHANT,
            UNKNOWN_HOST_TIMEOUT,
            USER_TRANSACTION_LIMIT,
        }

        enum class Value {
            ACCOUNT_STATE_TRANSACTION_FAIL,
            APPROVED,
            BANK_CONNECTION_ERROR,
            BANK_NOT_VERIFIED,
            CARD_CLOSED,
            CARD_PAUSED,
            DECLINED,
            FRAUD_ADVICE,
            IGNORED_TTL_EXPIRY,
            INACTIVE_ACCOUNT,
            INCORRECT_PIN,
            INVALID_CARD_DETAILS,
            INSUFFICIENT_FUNDS,
            INSUFFICIENT_FUNDS_PRELOAD,
            INVALID_TRANSACTION,
            MERCHANT_BLACKLIST,
            ORIGINAL_NOT_FOUND,
            PREVIOUSLY_COMPLETED,
            SINGLE_USE_RECHARGED,
            SWITCH_INOPERATIVE_ADVICE,
            UNAUTHORIZED_MERCHANT,
            UNKNOWN_HOST_TIMEOUT,
            USER_TRANSACTION_LIMIT,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                ACCOUNT_STATE_TRANSACTION_FAIL -> Value.ACCOUNT_STATE_TRANSACTION_FAIL
                APPROVED -> Value.APPROVED
                BANK_CONNECTION_ERROR -> Value.BANK_CONNECTION_ERROR
                BANK_NOT_VERIFIED -> Value.BANK_NOT_VERIFIED
                CARD_CLOSED -> Value.CARD_CLOSED
                CARD_PAUSED -> Value.CARD_PAUSED
                DECLINED -> Value.DECLINED
                FRAUD_ADVICE -> Value.FRAUD_ADVICE
                IGNORED_TTL_EXPIRY -> Value.IGNORED_TTL_EXPIRY
                INACTIVE_ACCOUNT -> Value.INACTIVE_ACCOUNT
                INCORRECT_PIN -> Value.INCORRECT_PIN
                INVALID_CARD_DETAILS -> Value.INVALID_CARD_DETAILS
                INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS
                INSUFFICIENT_FUNDS_PRELOAD -> Value.INSUFFICIENT_FUNDS_PRELOAD
                INVALID_TRANSACTION -> Value.INVALID_TRANSACTION
                MERCHANT_BLACKLIST -> Value.MERCHANT_BLACKLIST
                ORIGINAL_NOT_FOUND -> Value.ORIGINAL_NOT_FOUND
                PREVIOUSLY_COMPLETED -> Value.PREVIOUSLY_COMPLETED
                SINGLE_USE_RECHARGED -> Value.SINGLE_USE_RECHARGED
                SWITCH_INOPERATIVE_ADVICE -> Value.SWITCH_INOPERATIVE_ADVICE
                UNAUTHORIZED_MERCHANT -> Value.UNAUTHORIZED_MERCHANT
                UNKNOWN_HOST_TIMEOUT -> Value.UNKNOWN_HOST_TIMEOUT
                USER_TRANSACTION_LIMIT -> Value.USER_TRANSACTION_LIMIT
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                ACCOUNT_STATE_TRANSACTION_FAIL -> Known.ACCOUNT_STATE_TRANSACTION_FAIL
                APPROVED -> Known.APPROVED
                BANK_CONNECTION_ERROR -> Known.BANK_CONNECTION_ERROR
                BANK_NOT_VERIFIED -> Known.BANK_NOT_VERIFIED
                CARD_CLOSED -> Known.CARD_CLOSED
                CARD_PAUSED -> Known.CARD_PAUSED
                DECLINED -> Known.DECLINED
                FRAUD_ADVICE -> Known.FRAUD_ADVICE
                IGNORED_TTL_EXPIRY -> Known.IGNORED_TTL_EXPIRY
                INACTIVE_ACCOUNT -> Known.INACTIVE_ACCOUNT
                INCORRECT_PIN -> Known.INCORRECT_PIN
                INVALID_CARD_DETAILS -> Known.INVALID_CARD_DETAILS
                INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS
                INSUFFICIENT_FUNDS_PRELOAD -> Known.INSUFFICIENT_FUNDS_PRELOAD
                INVALID_TRANSACTION -> Known.INVALID_TRANSACTION
                MERCHANT_BLACKLIST -> Known.MERCHANT_BLACKLIST
                ORIGINAL_NOT_FOUND -> Known.ORIGINAL_NOT_FOUND
                PREVIOUSLY_COMPLETED -> Known.PREVIOUSLY_COMPLETED
                SINGLE_USE_RECHARGED -> Known.SINGLE_USE_RECHARGED
                SWITCH_INOPERATIVE_ADVICE -> Known.SWITCH_INOPERATIVE_ADVICE
                UNAUTHORIZED_MERCHANT -> Known.UNAUTHORIZED_MERCHANT
                UNKNOWN_HOST_TIMEOUT -> Known.UNKNOWN_HOST_TIMEOUT
                USER_TRANSACTION_LIMIT -> Known.USER_TRANSACTION_LIMIT
                else -> throw LithicInvalidDataException("Unknown DeclineResult: $value")
            }

        fun asString(): String = _value().asStringOrThrow()
    }

    class Status
    @JsonCreator
    private constructor(
        private val value: JsonField,
    ) : Enum {

        @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

            return /* spotless:off */ other is Status && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val DECLINED = Status(JsonField.of("DECLINED"))

            val EXPIRED = Status(JsonField.of("EXPIRED"))

            val PENDING = Status(JsonField.of("PENDING"))

            val SETTLED = Status(JsonField.of("SETTLED"))

            val VOIDED = Status(JsonField.of("VOIDED"))

            fun of(value: String) = Status(JsonField.of(value))
        }

        enum class Known {
            DECLINED,
            EXPIRED,
            PENDING,
            SETTLED,
            VOIDED,
        }

        enum class Value {
            DECLINED,
            EXPIRED,
            PENDING,
            SETTLED,
            VOIDED,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                DECLINED -> Value.DECLINED
                EXPIRED -> Value.EXPIRED
                PENDING -> Value.PENDING
                SETTLED -> Value.SETTLED
                VOIDED -> Value.VOIDED
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                DECLINED -> Known.DECLINED
                EXPIRED -> Known.EXPIRED
                PENDING -> Known.PENDING
                SETTLED -> Known.SETTLED
                VOIDED -> Known.VOIDED
                else -> throw LithicInvalidDataException("Unknown Status: $value")
            }

        fun asString(): String = _value().asStringOrThrow()
    }

    @JsonDeserialize(builder = TokenInfo.Builder::class)
    @NoAutoDetect
    class TokenInfo
    private constructor(
        private val walletType: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        /**
         * The wallet_type field will indicate the source of the token. Possible token sources
         * include digital wallets (Apple, Google, or Samsung Pay), merchant tokenization, and
         * “other” sources like in-flight commerce. Masterpass is not currently supported and is
         * included for future use.
         */
        fun walletType(): WalletType = walletType.getRequired("wallet_type")

        /**
         * The wallet_type field will indicate the source of the token. Possible token sources
         * include digital wallets (Apple, Google, or Samsung Pay), merchant tokenization, and
         * “other” sources like in-flight commerce. Masterpass is not currently supported and is
         * included for future use.
         */
        @JsonProperty("wallet_type") @ExcludeMissing fun _walletType() = walletType

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): TokenInfo = apply {
            if (!validated) {
                walletType()
                validated = true
            }
        }

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var walletType: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(tokenInfo: TokenInfo) = apply {
                this.walletType = tokenInfo.walletType
                additionalProperties(tokenInfo.additionalProperties)
            }

            /**
             * The wallet_type field will indicate the source of the token. Possible token sources
             * include digital wallets (Apple, Google, or Samsung Pay), merchant tokenization, and
             * “other” sources like in-flight commerce. Masterpass is not currently supported and is
             * included for future use.
             */
            fun walletType(walletType: WalletType) = walletType(JsonField.of(walletType))

            /**
             * The wallet_type field will indicate the source of the token. Possible token sources
             * include digital wallets (Apple, Google, or Samsung Pay), merchant tokenization, and
             * “other” sources like in-flight commerce. Masterpass is not currently supported and is
             * included for future use.
             */
            @JsonProperty("wallet_type")
            @ExcludeMissing
            fun walletType(walletType: JsonField) = apply {
                this.walletType = walletType
            }

            fun additionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.clear()
                this.additionalProperties.putAll(additionalProperties)
            }

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

            fun putAllAdditionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun build(): TokenInfo = TokenInfo(walletType, additionalProperties.toImmutable())
        }

        class WalletType
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is WalletType && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val APPLE_PAY = WalletType(JsonField.of("APPLE_PAY"))

                val GOOGLE_PAY = WalletType(JsonField.of("GOOGLE_PAY"))

                val MASTERPASS = WalletType(JsonField.of("MASTERPASS"))

                val MERCHANT = WalletType(JsonField.of("MERCHANT"))

                val OTHER = WalletType(JsonField.of("OTHER"))

                val SAMSUNG_PAY = WalletType(JsonField.of("SAMSUNG_PAY"))

                fun of(value: String) = WalletType(JsonField.of(value))
            }

            enum class Known {
                APPLE_PAY,
                GOOGLE_PAY,
                MASTERPASS,
                MERCHANT,
                OTHER,
                SAMSUNG_PAY,
            }

            enum class Value {
                APPLE_PAY,
                GOOGLE_PAY,
                MASTERPASS,
                MERCHANT,
                OTHER,
                SAMSUNG_PAY,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    APPLE_PAY -> Value.APPLE_PAY
                    GOOGLE_PAY -> Value.GOOGLE_PAY
                    MASTERPASS -> Value.MASTERPASS
                    MERCHANT -> Value.MERCHANT
                    OTHER -> Value.OTHER
                    SAMSUNG_PAY -> Value.SAMSUNG_PAY
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    APPLE_PAY -> Known.APPLE_PAY
                    GOOGLE_PAY -> Known.GOOGLE_PAY
                    MASTERPASS -> Known.MASTERPASS
                    MERCHANT -> Known.MERCHANT
                    OTHER -> Known.OTHER
                    SAMSUNG_PAY -> Known.SAMSUNG_PAY
                    else -> throw LithicInvalidDataException("Unknown WalletType: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

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

            return /* spotless:off */ other is TokenInfo && this.walletType == other.walletType && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(walletType, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "TokenInfo{walletType=$walletType, additionalProperties=$additionalProperties}"
    }

    @JsonDeserialize(builder = TransactionEvent.Builder::class)
    @NoAutoDetect
    class TransactionEvent
    private constructor(
        private val amount: JsonField,
        private val amounts: JsonField,
        private val created: JsonField,
        private val detailedResults: JsonField>,
        private val effectivePolarity: JsonField,
        private val result: JsonField,
        private val token: JsonField,
        private val type: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        /** Amount of the event in the settlement currency. */
        fun amount(): Long = amount.getRequired("amount")

        fun amounts(): TransactionEventAmounts = amounts.getRequired("amounts")

        /** RFC 3339 date and time this event entered the system. UTC time zone. */
        fun created(): OffsetDateTime = created.getRequired("created")

        fun detailedResults(): List =
            detailedResults.getRequired("detailed_results")

        /** Indicates whether the transaction event is a credit or debit to the account. */
        fun effectivePolarity(): EffectivePolarity =
            effectivePolarity.getRequired("effective_polarity")

        fun result(): DeclineResult = result.getRequired("result")

        /** Transaction event identifier. */
        fun token(): String = token.getRequired("token")

        /** Type of transaction event */
        fun type(): Type = type.getRequired("type")

        /** Amount of the event in the settlement currency. */
        @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

        @JsonProperty("amounts") @ExcludeMissing fun _amounts() = amounts

        /** RFC 3339 date and time this event entered the system. UTC time zone. */
        @JsonProperty("created") @ExcludeMissing fun _created() = created

        @JsonProperty("detailed_results") @ExcludeMissing fun _detailedResults() = detailedResults

        /** Indicates whether the transaction event is a credit or debit to the account. */
        @JsonProperty("effective_polarity")
        @ExcludeMissing
        fun _effectivePolarity() = effectivePolarity

        @JsonProperty("result") @ExcludeMissing fun _result() = result

        /** Transaction event identifier. */
        @JsonProperty("token") @ExcludeMissing fun _token() = token

        /** Type of transaction event */
        @JsonProperty("type") @ExcludeMissing fun _type() = type

        @JsonAnyGetter
        @ExcludeMissing
        fun _additionalProperties(): Map = additionalProperties

        fun validate(): TransactionEvent = apply {
            if (!validated) {
                amount()
                amounts().validate()
                created()
                detailedResults()
                effectivePolarity()
                result()
                token()
                type()
                validated = true
            }
        }

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

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var amount: JsonField = JsonMissing.of()
            private var amounts: JsonField = JsonMissing.of()
            private var created: JsonField = JsonMissing.of()
            private var detailedResults: JsonField> = JsonMissing.of()
            private var effectivePolarity: JsonField = JsonMissing.of()
            private var result: JsonField = JsonMissing.of()
            private var token: JsonField = JsonMissing.of()
            private var type: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(transactionEvent: TransactionEvent) = apply {
                this.amount = transactionEvent.amount
                this.amounts = transactionEvent.amounts
                this.created = transactionEvent.created
                this.detailedResults = transactionEvent.detailedResults
                this.effectivePolarity = transactionEvent.effectivePolarity
                this.result = transactionEvent.result
                this.token = transactionEvent.token
                this.type = transactionEvent.type
                additionalProperties(transactionEvent.additionalProperties)
            }

            /** Amount of the event in the settlement currency. */
            fun amount(amount: Long) = amount(JsonField.of(amount))

            /** Amount of the event in the settlement currency. */
            @JsonProperty("amount")
            @ExcludeMissing
            fun amount(amount: JsonField) = apply { this.amount = amount }

            fun amounts(amounts: TransactionEventAmounts) = amounts(JsonField.of(amounts))

            @JsonProperty("amounts")
            @ExcludeMissing
            fun amounts(amounts: JsonField) = apply {
                this.amounts = amounts
            }

            /** RFC 3339 date and time this event entered the system. UTC time zone. */
            fun created(created: OffsetDateTime) = created(JsonField.of(created))

            /** RFC 3339 date and time this event entered the system. UTC time zone. */
            @JsonProperty("created")
            @ExcludeMissing
            fun created(created: JsonField) = apply { this.created = created }

            fun detailedResults(detailedResults: List) =
                detailedResults(JsonField.of(detailedResults))

            @JsonProperty("detailed_results")
            @ExcludeMissing
            fun detailedResults(detailedResults: JsonField>) = apply {
                this.detailedResults = detailedResults
            }

            /** Indicates whether the transaction event is a credit or debit to the account. */
            fun effectivePolarity(effectivePolarity: EffectivePolarity) =
                effectivePolarity(JsonField.of(effectivePolarity))

            /** Indicates whether the transaction event is a credit or debit to the account. */
            @JsonProperty("effective_polarity")
            @ExcludeMissing
            fun effectivePolarity(effectivePolarity: JsonField) = apply {
                this.effectivePolarity = effectivePolarity
            }

            fun result(result: DeclineResult) = result(JsonField.of(result))

            @JsonProperty("result")
            @ExcludeMissing
            fun result(result: JsonField) = apply { this.result = result }

            /** Transaction event identifier. */
            fun token(token: String) = token(JsonField.of(token))

            /** Transaction event identifier. */
            @JsonProperty("token")
            @ExcludeMissing
            fun token(token: JsonField) = apply { this.token = token }

            /** Type of transaction event */
            fun type(type: Type) = type(JsonField.of(type))

            /** Type of transaction event */
            @JsonProperty("type")
            @ExcludeMissing
            fun type(type: JsonField) = apply { this.type = type }

            fun additionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.clear()
                this.additionalProperties.putAll(additionalProperties)
            }

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

            fun putAllAdditionalProperties(additionalProperties: Map) = apply {
                this.additionalProperties.putAll(additionalProperties)
            }

            fun build(): TransactionEvent =
                TransactionEvent(
                    amount,
                    amounts,
                    created,
                    detailedResults.map { it.toImmutable() },
                    effectivePolarity,
                    result,
                    token,
                    type,
                    additionalProperties.toImmutable(),
                )
        }

        @JsonDeserialize(builder = TransactionEventAmounts.Builder::class)
        @NoAutoDetect
        class TransactionEventAmounts
        private constructor(
            private val cardholder: JsonField,
            private val merchant: JsonField,
            private val settlement: JsonField,
            private val additionalProperties: Map,
        ) {

            private var validated: Boolean = false

            fun cardholder(): Cardholder = cardholder.getRequired("cardholder")

            fun merchant(): Merchant = merchant.getRequired("merchant")

            fun settlement(): Settlement? = settlement.getNullable("settlement")

            @JsonProperty("cardholder") @ExcludeMissing fun _cardholder() = cardholder

            @JsonProperty("merchant") @ExcludeMissing fun _merchant() = merchant

            @JsonProperty("settlement") @ExcludeMissing fun _settlement() = settlement

            @JsonAnyGetter
            @ExcludeMissing
            fun _additionalProperties(): Map = additionalProperties

            fun validate(): TransactionEventAmounts = apply {
                if (!validated) {
                    cardholder().validate()
                    merchant().validate()
                    settlement()?.validate()
                    validated = true
                }
            }

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

            companion object {

                fun builder() = Builder()
            }

            class Builder {

                private var cardholder: JsonField = JsonMissing.of()
                private var merchant: JsonField = JsonMissing.of()
                private var settlement: JsonField = JsonMissing.of()
                private var additionalProperties: MutableMap = mutableMapOf()

                internal fun from(transactionEventAmounts: TransactionEventAmounts) = apply {
                    this.cardholder = transactionEventAmounts.cardholder
                    this.merchant = transactionEventAmounts.merchant
                    this.settlement = transactionEventAmounts.settlement
                    additionalProperties(transactionEventAmounts.additionalProperties)
                }

                fun cardholder(cardholder: Cardholder) = cardholder(JsonField.of(cardholder))

                @JsonProperty("cardholder")
                @ExcludeMissing
                fun cardholder(cardholder: JsonField) = apply {
                    this.cardholder = cardholder
                }

                fun merchant(merchant: Merchant) = merchant(JsonField.of(merchant))

                @JsonProperty("merchant")
                @ExcludeMissing
                fun merchant(merchant: JsonField) = apply { this.merchant = merchant }

                fun settlement(settlement: Settlement) = settlement(JsonField.of(settlement))

                @JsonProperty("settlement")
                @ExcludeMissing
                fun settlement(settlement: JsonField) = apply {
                    this.settlement = settlement
                }

                fun additionalProperties(additionalProperties: Map) = apply {
                    this.additionalProperties.clear()
                    this.additionalProperties.putAll(additionalProperties)
                }

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

                fun putAllAdditionalProperties(additionalProperties: Map) =
                    apply {
                        this.additionalProperties.putAll(additionalProperties)
                    }

                fun build(): TransactionEventAmounts =
                    TransactionEventAmounts(
                        cardholder,
                        merchant,
                        settlement,
                        additionalProperties.toImmutable(),
                    )
            }

            @JsonDeserialize(builder = Cardholder.Builder::class)
            @NoAutoDetect
            class Cardholder
            private constructor(
                private val amount: JsonField,
                private val conversionRate: JsonField,
                private val currency: JsonField,
                private val additionalProperties: Map,
            ) {

                private var validated: Boolean = false

                /** The amount in the cardholder billing currency. */
                fun amount(): Long = amount.getRequired("amount")

                /**
                 * The conversion rate used to convert the merchant amount to the cardholder billing
                 * amount.
                 */
                fun conversionRate(): String = conversionRate.getRequired("conversion_rate")

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /** The amount in the cardholder billing currency. */
                @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

                /**
                 * The conversion rate used to convert the merchant amount to the cardholder billing
                 * amount.
                 */
                @JsonProperty("conversion_rate")
                @ExcludeMissing
                fun _conversionRate() = conversionRate

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map = additionalProperties

                fun validate(): Cardholder = apply {
                    if (!validated) {
                        amount()
                        conversionRate()
                        currency()
                        validated = true
                    }
                }

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

                companion object {

                    fun builder() = Builder()
                }

                class Builder {

                    private var amount: JsonField = JsonMissing.of()
                    private var conversionRate: JsonField = JsonMissing.of()
                    private var currency: JsonField = JsonMissing.of()
                    private var additionalProperties: MutableMap = mutableMapOf()

                    internal fun from(cardholder: Cardholder) = apply {
                        this.amount = cardholder.amount
                        this.conversionRate = cardholder.conversionRate
                        this.currency = cardholder.currency
                        additionalProperties(cardholder.additionalProperties)
                    }

                    /** The amount in the cardholder billing currency. */
                    fun amount(amount: Long) = amount(JsonField.of(amount))

                    /** The amount in the cardholder billing currency. */
                    @JsonProperty("amount")
                    @ExcludeMissing
                    fun amount(amount: JsonField) = apply { this.amount = amount }

                    /**
                     * The conversion rate used to convert the merchant amount to the cardholder
                     * billing amount.
                     */
                    fun conversionRate(conversionRate: String) =
                        conversionRate(JsonField.of(conversionRate))

                    /**
                     * The conversion rate used to convert the merchant amount to the cardholder
                     * billing amount.
                     */
                    @JsonProperty("conversion_rate")
                    @ExcludeMissing
                    fun conversionRate(conversionRate: JsonField) = apply {
                        this.conversionRate = conversionRate
                    }

                    /**
                     * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some
                     * special currencies like `XXX`. Enumerants names are lowercase currency code
                     * e.g. `EUR`, `USD`.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some
                     * special currencies like `XXX`. Enumerants names are lowercase currency code
                     * e.g. `EUR`, `USD`.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun currency(currency: JsonField) = apply { this.currency = currency }

                    fun additionalProperties(additionalProperties: Map) = apply {
                        this.additionalProperties.clear()
                        this.additionalProperties.putAll(additionalProperties)
                    }

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

                    fun putAllAdditionalProperties(additionalProperties: Map) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun build(): Cardholder =
                        Cardholder(
                            amount,
                            conversionRate,
                            currency,
                            additionalProperties.toImmutable(),
                        )
                }

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

                    return /* spotless:off */ other is Cardholder && this.amount == other.amount && this.conversionRate == other.conversionRate && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */
                }

                private var hashCode: Int = 0

                override fun hashCode(): Int {
                    if (hashCode == 0) {
                        hashCode = /* spotless:off */ Objects.hash(amount, conversionRate, currency, additionalProperties) /* spotless:on */
                    }
                    return hashCode
                }

                override fun toString() =
                    "Cardholder{amount=$amount, conversionRate=$conversionRate, currency=$currency, additionalProperties=$additionalProperties}"
            }

            @JsonDeserialize(builder = Merchant.Builder::class)
            @NoAutoDetect
            class Merchant
            private constructor(
                private val amount: JsonField,
                private val currency: JsonField,
                private val additionalProperties: Map,
            ) {

                private var validated: Boolean = false

                /** The amount in the merchant currency. */
                fun amount(): Long = amount.getRequired("amount")

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /** The amount in the merchant currency. */
                @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map = additionalProperties

                fun validate(): Merchant = apply {
                    if (!validated) {
                        amount()
                        currency()
                        validated = true
                    }
                }

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

                companion object {

                    fun builder() = Builder()
                }

                class Builder {

                    private var amount: JsonField = JsonMissing.of()
                    private var currency: JsonField = JsonMissing.of()
                    private var additionalProperties: MutableMap = mutableMapOf()

                    internal fun from(merchant: Merchant) = apply {
                        this.amount = merchant.amount
                        this.currency = merchant.currency
                        additionalProperties(merchant.additionalProperties)
                    }

                    /** The amount in the merchant currency. */
                    fun amount(amount: Long) = amount(JsonField.of(amount))

                    /** The amount in the merchant currency. */
                    @JsonProperty("amount")
                    @ExcludeMissing
                    fun amount(amount: JsonField) = apply { this.amount = amount }

                    /**
                     * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some
                     * special currencies like `XXX`. Enumerants names are lowercase currency code
                     * e.g. `EUR`, `USD`.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some
                     * special currencies like `XXX`. Enumerants names are lowercase currency code
                     * e.g. `EUR`, `USD`.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun currency(currency: JsonField) = apply { this.currency = currency }

                    fun additionalProperties(additionalProperties: Map) = apply {
                        this.additionalProperties.clear()
                        this.additionalProperties.putAll(additionalProperties)
                    }

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

                    fun putAllAdditionalProperties(additionalProperties: Map) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun build(): Merchant =
                        Merchant(
                            amount,
                            currency,
                            additionalProperties.toImmutable(),
                        )
                }

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

                    return /* spotless:off */ other is Merchant && this.amount == other.amount && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */
                }

                private var hashCode: Int = 0

                override fun hashCode(): Int {
                    if (hashCode == 0) {
                        hashCode = /* spotless:off */ Objects.hash(amount, currency, additionalProperties) /* spotless:on */
                    }
                    return hashCode
                }

                override fun toString() =
                    "Merchant{amount=$amount, currency=$currency, additionalProperties=$additionalProperties}"
            }

            @JsonDeserialize(builder = Settlement.Builder::class)
            @NoAutoDetect
            class Settlement
            private constructor(
                private val amount: JsonField,
                private val conversionRate: JsonField,
                private val currency: JsonField,
                private val additionalProperties: Map,
            ) {

                private var validated: Boolean = false

                /** Amount of the event, if it is financial, in the settlement currency. */
                fun amount(): Long = amount.getRequired("amount")

                /** Conversion rate used to convert the merchant amount to the settlement amount. */
                fun conversionRate(): String = conversionRate.getRequired("conversion_rate")

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                fun currency(): Currency = currency.getRequired("currency")

                /** Amount of the event, if it is financial, in the settlement currency. */
                @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

                /** Conversion rate used to convert the merchant amount to the settlement amount. */
                @JsonProperty("conversion_rate")
                @ExcludeMissing
                fun _conversionRate() = conversionRate

                /**
                 * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some special
                 * currencies like `XXX`. Enumerants names are lowercase currency code e.g. `EUR`,
                 * `USD`.
                 */
                @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

                @JsonAnyGetter
                @ExcludeMissing
                fun _additionalProperties(): Map = additionalProperties

                fun validate(): Settlement = apply {
                    if (!validated) {
                        amount()
                        conversionRate()
                        currency()
                        validated = true
                    }
                }

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

                companion object {

                    fun builder() = Builder()
                }

                class Builder {

                    private var amount: JsonField = JsonMissing.of()
                    private var conversionRate: JsonField = JsonMissing.of()
                    private var currency: JsonField = JsonMissing.of()
                    private var additionalProperties: MutableMap = mutableMapOf()

                    internal fun from(settlement: Settlement) = apply {
                        this.amount = settlement.amount
                        this.conversionRate = settlement.conversionRate
                        this.currency = settlement.currency
                        additionalProperties(settlement.additionalProperties)
                    }

                    /** Amount of the event, if it is financial, in the settlement currency. */
                    fun amount(amount: Long) = amount(JsonField.of(amount))

                    /** Amount of the event, if it is financial, in the settlement currency. */
                    @JsonProperty("amount")
                    @ExcludeMissing
                    fun amount(amount: JsonField) = apply { this.amount = amount }

                    /**
                     * Conversion rate used to convert the merchant amount to the settlement amount.
                     */
                    fun conversionRate(conversionRate: String) =
                        conversionRate(JsonField.of(conversionRate))

                    /**
                     * Conversion rate used to convert the merchant amount to the settlement amount.
                     */
                    @JsonProperty("conversion_rate")
                    @ExcludeMissing
                    fun conversionRate(conversionRate: JsonField) = apply {
                        this.conversionRate = conversionRate
                    }

                    /**
                     * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some
                     * special currencies like `XXX`. Enumerants names are lowercase currency code
                     * e.g. `EUR`, `USD`.
                     */
                    fun currency(currency: Currency) = currency(JsonField.of(currency))

                    /**
                     * ISO 4217 currency. Its enumerants are ISO 4217 currencies except for some
                     * special currencies like `XXX`. Enumerants names are lowercase currency code
                     * e.g. `EUR`, `USD`.
                     */
                    @JsonProperty("currency")
                    @ExcludeMissing
                    fun currency(currency: JsonField) = apply { this.currency = currency }

                    fun additionalProperties(additionalProperties: Map) = apply {
                        this.additionalProperties.clear()
                        this.additionalProperties.putAll(additionalProperties)
                    }

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

                    fun putAllAdditionalProperties(additionalProperties: Map) =
                        apply {
                            this.additionalProperties.putAll(additionalProperties)
                        }

                    fun build(): Settlement =
                        Settlement(
                            amount,
                            conversionRate,
                            currency,
                            additionalProperties.toImmutable(),
                        )
                }

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

                    return /* spotless:off */ other is Settlement && this.amount == other.amount && this.conversionRate == other.conversionRate && this.currency == other.currency && this.additionalProperties == other.additionalProperties /* spotless:on */
                }

                private var hashCode: Int = 0

                override fun hashCode(): Int {
                    if (hashCode == 0) {
                        hashCode = /* spotless:off */ Objects.hash(amount, conversionRate, currency, additionalProperties) /* spotless:on */
                    }
                    return hashCode
                }

                override fun toString() =
                    "Settlement{amount=$amount, conversionRate=$conversionRate, currency=$currency, additionalProperties=$additionalProperties}"
            }

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

                return /* spotless:off */ other is TransactionEventAmounts && this.cardholder == other.cardholder && this.merchant == other.merchant && this.settlement == other.settlement && this.additionalProperties == other.additionalProperties /* spotless:on */
            }

            private var hashCode: Int = 0

            override fun hashCode(): Int {
                if (hashCode == 0) {
                    hashCode = /* spotless:off */ Objects.hash(cardholder, merchant, settlement, additionalProperties) /* spotless:on */
                }
                return hashCode
            }

            override fun toString() =
                "TransactionEventAmounts{cardholder=$cardholder, merchant=$merchant, settlement=$settlement, additionalProperties=$additionalProperties}"
        }

        class DetailedResult
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is DetailedResult && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED =
                    DetailedResult(JsonField.of("ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED"))

                val ACCOUNT_DELINQUENT = DetailedResult(JsonField.of("ACCOUNT_DELINQUENT"))

                val ACCOUNT_INACTIVE = DetailedResult(JsonField.of("ACCOUNT_INACTIVE"))

                val ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED =
                    DetailedResult(JsonField.of("ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED"))

                val ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED =
                    DetailedResult(JsonField.of("ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED"))

                val ACCOUNT_UNDER_REVIEW = DetailedResult(JsonField.of("ACCOUNT_UNDER_REVIEW"))

                val ADDRESS_INCORRECT = DetailedResult(JsonField.of("ADDRESS_INCORRECT"))

                val APPROVED = DetailedResult(JsonField.of("APPROVED"))

                val AUTH_RULE_ALLOWED_COUNTRY =
                    DetailedResult(JsonField.of("AUTH_RULE_ALLOWED_COUNTRY"))

                val AUTH_RULE_ALLOWED_MCC = DetailedResult(JsonField.of("AUTH_RULE_ALLOWED_MCC"))

                val AUTH_RULE_BLOCKED_COUNTRY =
                    DetailedResult(JsonField.of("AUTH_RULE_BLOCKED_COUNTRY"))

                val AUTH_RULE_BLOCKED_MCC = DetailedResult(JsonField.of("AUTH_RULE_BLOCKED_MCC"))

                val CARD_CLOSED = DetailedResult(JsonField.of("CARD_CLOSED"))

                val CARD_CRYPTOGRAM_VALIDATION_FAILURE =
                    DetailedResult(JsonField.of("CARD_CRYPTOGRAM_VALIDATION_FAILURE"))

                val CARD_EXPIRED = DetailedResult(JsonField.of("CARD_EXPIRED"))

                val CARD_EXPIRY_DATE_INCORRECT =
                    DetailedResult(JsonField.of("CARD_EXPIRY_DATE_INCORRECT"))

                val CARD_INVALID = DetailedResult(JsonField.of("CARD_INVALID"))

                val CARD_NOT_ACTIVATED = DetailedResult(JsonField.of("CARD_NOT_ACTIVATED"))

                val CARD_PAUSED = DetailedResult(JsonField.of("CARD_PAUSED"))

                val CARD_PIN_INCORRECT = DetailedResult(JsonField.of("CARD_PIN_INCORRECT"))

                val CARD_RESTRICTED = DetailedResult(JsonField.of("CARD_RESTRICTED"))

                val CARD_SECURITY_CODE_INCORRECT =
                    DetailedResult(JsonField.of("CARD_SECURITY_CODE_INCORRECT"))

                val CARD_SPEND_LIMIT_EXCEEDED =
                    DetailedResult(JsonField.of("CARD_SPEND_LIMIT_EXCEEDED"))

                val CONTACT_CARD_ISSUER = DetailedResult(JsonField.of("CONTACT_CARD_ISSUER"))

                val CUSTOMER_ASA_TIMEOUT = DetailedResult(JsonField.of("CUSTOMER_ASA_TIMEOUT"))

                val CUSTOM_ASA_RESULT = DetailedResult(JsonField.of("CUSTOM_ASA_RESULT"))

                val DECLINED = DetailedResult(JsonField.of("DECLINED"))

                val DO_NOT_HONOR = DetailedResult(JsonField.of("DO_NOT_HONOR"))

                val DRIVER_NUMBER_INVALID = DetailedResult(JsonField.of("DRIVER_NUMBER_INVALID"))

                val FORMAT_ERROR = DetailedResult(JsonField.of("FORMAT_ERROR"))

                val INSUFFICIENT_FUNDING_SOURCE_BALANCE =
                    DetailedResult(JsonField.of("INSUFFICIENT_FUNDING_SOURCE_BALANCE"))

                val INSUFFICIENT_FUNDS = DetailedResult(JsonField.of("INSUFFICIENT_FUNDS"))

                val LITHIC_SYSTEM_ERROR = DetailedResult(JsonField.of("LITHIC_SYSTEM_ERROR"))

                val LITHIC_SYSTEM_RATE_LIMIT =
                    DetailedResult(JsonField.of("LITHIC_SYSTEM_RATE_LIMIT"))

                val MALFORMED_ASA_RESPONSE = DetailedResult(JsonField.of("MALFORMED_ASA_RESPONSE"))

                val MERCHANT_INVALID = DetailedResult(JsonField.of("MERCHANT_INVALID"))

                val MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE =
                    DetailedResult(JsonField.of("MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE"))

                val MERCHANT_NOT_PERMITTED = DetailedResult(JsonField.of("MERCHANT_NOT_PERMITTED"))

                val OVER_REVERSAL_ATTEMPTED =
                    DetailedResult(JsonField.of("OVER_REVERSAL_ATTEMPTED"))

                val PIN_BLOCKED = DetailedResult(JsonField.of("PIN_BLOCKED"))

                val PROGRAM_CARD_SPEND_LIMIT_EXCEEDED =
                    DetailedResult(JsonField.of("PROGRAM_CARD_SPEND_LIMIT_EXCEEDED"))

                val PROGRAM_SUSPENDED = DetailedResult(JsonField.of("PROGRAM_SUSPENDED"))

                val PROGRAM_USAGE_RESTRICTION =
                    DetailedResult(JsonField.of("PROGRAM_USAGE_RESTRICTION"))

                val REVERSAL_UNMATCHED = DetailedResult(JsonField.of("REVERSAL_UNMATCHED"))

                val SECURITY_VIOLATION = DetailedResult(JsonField.of("SECURITY_VIOLATION"))

                val SINGLE_USE_CARD_REATTEMPTED =
                    DetailedResult(JsonField.of("SINGLE_USE_CARD_REATTEMPTED"))

                val TRANSACTION_INVALID = DetailedResult(JsonField.of("TRANSACTION_INVALID"))

                val TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL =
                    DetailedResult(
                        JsonField.of("TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL")
                    )

                val TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER =
                    DetailedResult(
                        JsonField.of("TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER")
                    )

                val TRANSACTION_PREVIOUSLY_COMPLETED =
                    DetailedResult(JsonField.of("TRANSACTION_PREVIOUSLY_COMPLETED"))

                val UNAUTHORIZED_MERCHANT = DetailedResult(JsonField.of("UNAUTHORIZED_MERCHANT"))

                val VEHICLE_NUMBER_INVALID = DetailedResult(JsonField.of("VEHICLE_NUMBER_INVALID"))

                fun of(value: String) = DetailedResult(JsonField.of(value))
            }

            enum class Known {
                ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED,
                ACCOUNT_DELINQUENT,
                ACCOUNT_INACTIVE,
                ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED,
                ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED,
                ACCOUNT_UNDER_REVIEW,
                ADDRESS_INCORRECT,
                APPROVED,
                AUTH_RULE_ALLOWED_COUNTRY,
                AUTH_RULE_ALLOWED_MCC,
                AUTH_RULE_BLOCKED_COUNTRY,
                AUTH_RULE_BLOCKED_MCC,
                CARD_CLOSED,
                CARD_CRYPTOGRAM_VALIDATION_FAILURE,
                CARD_EXPIRED,
                CARD_EXPIRY_DATE_INCORRECT,
                CARD_INVALID,
                CARD_NOT_ACTIVATED,
                CARD_PAUSED,
                CARD_PIN_INCORRECT,
                CARD_RESTRICTED,
                CARD_SECURITY_CODE_INCORRECT,
                CARD_SPEND_LIMIT_EXCEEDED,
                CONTACT_CARD_ISSUER,
                CUSTOMER_ASA_TIMEOUT,
                CUSTOM_ASA_RESULT,
                DECLINED,
                DO_NOT_HONOR,
                DRIVER_NUMBER_INVALID,
                FORMAT_ERROR,
                INSUFFICIENT_FUNDING_SOURCE_BALANCE,
                INSUFFICIENT_FUNDS,
                LITHIC_SYSTEM_ERROR,
                LITHIC_SYSTEM_RATE_LIMIT,
                MALFORMED_ASA_RESPONSE,
                MERCHANT_INVALID,
                MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE,
                MERCHANT_NOT_PERMITTED,
                OVER_REVERSAL_ATTEMPTED,
                PIN_BLOCKED,
                PROGRAM_CARD_SPEND_LIMIT_EXCEEDED,
                PROGRAM_SUSPENDED,
                PROGRAM_USAGE_RESTRICTION,
                REVERSAL_UNMATCHED,
                SECURITY_VIOLATION,
                SINGLE_USE_CARD_REATTEMPTED,
                TRANSACTION_INVALID,
                TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL,
                TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER,
                TRANSACTION_PREVIOUSLY_COMPLETED,
                UNAUTHORIZED_MERCHANT,
                VEHICLE_NUMBER_INVALID,
            }

            enum class Value {
                ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED,
                ACCOUNT_DELINQUENT,
                ACCOUNT_INACTIVE,
                ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED,
                ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED,
                ACCOUNT_UNDER_REVIEW,
                ADDRESS_INCORRECT,
                APPROVED,
                AUTH_RULE_ALLOWED_COUNTRY,
                AUTH_RULE_ALLOWED_MCC,
                AUTH_RULE_BLOCKED_COUNTRY,
                AUTH_RULE_BLOCKED_MCC,
                CARD_CLOSED,
                CARD_CRYPTOGRAM_VALIDATION_FAILURE,
                CARD_EXPIRED,
                CARD_EXPIRY_DATE_INCORRECT,
                CARD_INVALID,
                CARD_NOT_ACTIVATED,
                CARD_PAUSED,
                CARD_PIN_INCORRECT,
                CARD_RESTRICTED,
                CARD_SECURITY_CODE_INCORRECT,
                CARD_SPEND_LIMIT_EXCEEDED,
                CONTACT_CARD_ISSUER,
                CUSTOMER_ASA_TIMEOUT,
                CUSTOM_ASA_RESULT,
                DECLINED,
                DO_NOT_HONOR,
                DRIVER_NUMBER_INVALID,
                FORMAT_ERROR,
                INSUFFICIENT_FUNDING_SOURCE_BALANCE,
                INSUFFICIENT_FUNDS,
                LITHIC_SYSTEM_ERROR,
                LITHIC_SYSTEM_RATE_LIMIT,
                MALFORMED_ASA_RESPONSE,
                MERCHANT_INVALID,
                MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE,
                MERCHANT_NOT_PERMITTED,
                OVER_REVERSAL_ATTEMPTED,
                PIN_BLOCKED,
                PROGRAM_CARD_SPEND_LIMIT_EXCEEDED,
                PROGRAM_SUSPENDED,
                PROGRAM_USAGE_RESTRICTION,
                REVERSAL_UNMATCHED,
                SECURITY_VIOLATION,
                SINGLE_USE_CARD_REATTEMPTED,
                TRANSACTION_INVALID,
                TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL,
                TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER,
                TRANSACTION_PREVIOUSLY_COMPLETED,
                UNAUTHORIZED_MERCHANT,
                VEHICLE_NUMBER_INVALID,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> Value.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED
                    ACCOUNT_DELINQUENT -> Value.ACCOUNT_DELINQUENT
                    ACCOUNT_INACTIVE -> Value.ACCOUNT_INACTIVE
                    ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED ->
                        Value.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED
                    ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED ->
                        Value.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED
                    ACCOUNT_UNDER_REVIEW -> Value.ACCOUNT_UNDER_REVIEW
                    ADDRESS_INCORRECT -> Value.ADDRESS_INCORRECT
                    APPROVED -> Value.APPROVED
                    AUTH_RULE_ALLOWED_COUNTRY -> Value.AUTH_RULE_ALLOWED_COUNTRY
                    AUTH_RULE_ALLOWED_MCC -> Value.AUTH_RULE_ALLOWED_MCC
                    AUTH_RULE_BLOCKED_COUNTRY -> Value.AUTH_RULE_BLOCKED_COUNTRY
                    AUTH_RULE_BLOCKED_MCC -> Value.AUTH_RULE_BLOCKED_MCC
                    CARD_CLOSED -> Value.CARD_CLOSED
                    CARD_CRYPTOGRAM_VALIDATION_FAILURE -> Value.CARD_CRYPTOGRAM_VALIDATION_FAILURE
                    CARD_EXPIRED -> Value.CARD_EXPIRED
                    CARD_EXPIRY_DATE_INCORRECT -> Value.CARD_EXPIRY_DATE_INCORRECT
                    CARD_INVALID -> Value.CARD_INVALID
                    CARD_NOT_ACTIVATED -> Value.CARD_NOT_ACTIVATED
                    CARD_PAUSED -> Value.CARD_PAUSED
                    CARD_PIN_INCORRECT -> Value.CARD_PIN_INCORRECT
                    CARD_RESTRICTED -> Value.CARD_RESTRICTED
                    CARD_SECURITY_CODE_INCORRECT -> Value.CARD_SECURITY_CODE_INCORRECT
                    CARD_SPEND_LIMIT_EXCEEDED -> Value.CARD_SPEND_LIMIT_EXCEEDED
                    CONTACT_CARD_ISSUER -> Value.CONTACT_CARD_ISSUER
                    CUSTOMER_ASA_TIMEOUT -> Value.CUSTOMER_ASA_TIMEOUT
                    CUSTOM_ASA_RESULT -> Value.CUSTOM_ASA_RESULT
                    DECLINED -> Value.DECLINED
                    DO_NOT_HONOR -> Value.DO_NOT_HONOR
                    DRIVER_NUMBER_INVALID -> Value.DRIVER_NUMBER_INVALID
                    FORMAT_ERROR -> Value.FORMAT_ERROR
                    INSUFFICIENT_FUNDING_SOURCE_BALANCE -> Value.INSUFFICIENT_FUNDING_SOURCE_BALANCE
                    INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS
                    LITHIC_SYSTEM_ERROR -> Value.LITHIC_SYSTEM_ERROR
                    LITHIC_SYSTEM_RATE_LIMIT -> Value.LITHIC_SYSTEM_RATE_LIMIT
                    MALFORMED_ASA_RESPONSE -> Value.MALFORMED_ASA_RESPONSE
                    MERCHANT_INVALID -> Value.MERCHANT_INVALID
                    MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE ->
                        Value.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE
                    MERCHANT_NOT_PERMITTED -> Value.MERCHANT_NOT_PERMITTED
                    OVER_REVERSAL_ATTEMPTED -> Value.OVER_REVERSAL_ATTEMPTED
                    PIN_BLOCKED -> Value.PIN_BLOCKED
                    PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> Value.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED
                    PROGRAM_SUSPENDED -> Value.PROGRAM_SUSPENDED
                    PROGRAM_USAGE_RESTRICTION -> Value.PROGRAM_USAGE_RESTRICTION
                    REVERSAL_UNMATCHED -> Value.REVERSAL_UNMATCHED
                    SECURITY_VIOLATION -> Value.SECURITY_VIOLATION
                    SINGLE_USE_CARD_REATTEMPTED -> Value.SINGLE_USE_CARD_REATTEMPTED
                    TRANSACTION_INVALID -> Value.TRANSACTION_INVALID
                    TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL ->
                        Value.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL
                    TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER ->
                        Value.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER
                    TRANSACTION_PREVIOUSLY_COMPLETED -> Value.TRANSACTION_PREVIOUSLY_COMPLETED
                    UNAUTHORIZED_MERCHANT -> Value.UNAUTHORIZED_MERCHANT
                    VEHICLE_NUMBER_INVALID -> Value.VEHICLE_NUMBER_INVALID
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED -> Known.ACCOUNT_DAILY_SPEND_LIMIT_EXCEEDED
                    ACCOUNT_DELINQUENT -> Known.ACCOUNT_DELINQUENT
                    ACCOUNT_INACTIVE -> Known.ACCOUNT_INACTIVE
                    ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED ->
                        Known.ACCOUNT_LIFETIME_SPEND_LIMIT_EXCEEDED
                    ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED ->
                        Known.ACCOUNT_MONTHLY_SPEND_LIMIT_EXCEEDED
                    ACCOUNT_UNDER_REVIEW -> Known.ACCOUNT_UNDER_REVIEW
                    ADDRESS_INCORRECT -> Known.ADDRESS_INCORRECT
                    APPROVED -> Known.APPROVED
                    AUTH_RULE_ALLOWED_COUNTRY -> Known.AUTH_RULE_ALLOWED_COUNTRY
                    AUTH_RULE_ALLOWED_MCC -> Known.AUTH_RULE_ALLOWED_MCC
                    AUTH_RULE_BLOCKED_COUNTRY -> Known.AUTH_RULE_BLOCKED_COUNTRY
                    AUTH_RULE_BLOCKED_MCC -> Known.AUTH_RULE_BLOCKED_MCC
                    CARD_CLOSED -> Known.CARD_CLOSED
                    CARD_CRYPTOGRAM_VALIDATION_FAILURE -> Known.CARD_CRYPTOGRAM_VALIDATION_FAILURE
                    CARD_EXPIRED -> Known.CARD_EXPIRED
                    CARD_EXPIRY_DATE_INCORRECT -> Known.CARD_EXPIRY_DATE_INCORRECT
                    CARD_INVALID -> Known.CARD_INVALID
                    CARD_NOT_ACTIVATED -> Known.CARD_NOT_ACTIVATED
                    CARD_PAUSED -> Known.CARD_PAUSED
                    CARD_PIN_INCORRECT -> Known.CARD_PIN_INCORRECT
                    CARD_RESTRICTED -> Known.CARD_RESTRICTED
                    CARD_SECURITY_CODE_INCORRECT -> Known.CARD_SECURITY_CODE_INCORRECT
                    CARD_SPEND_LIMIT_EXCEEDED -> Known.CARD_SPEND_LIMIT_EXCEEDED
                    CONTACT_CARD_ISSUER -> Known.CONTACT_CARD_ISSUER
                    CUSTOMER_ASA_TIMEOUT -> Known.CUSTOMER_ASA_TIMEOUT
                    CUSTOM_ASA_RESULT -> Known.CUSTOM_ASA_RESULT
                    DECLINED -> Known.DECLINED
                    DO_NOT_HONOR -> Known.DO_NOT_HONOR
                    DRIVER_NUMBER_INVALID -> Known.DRIVER_NUMBER_INVALID
                    FORMAT_ERROR -> Known.FORMAT_ERROR
                    INSUFFICIENT_FUNDING_SOURCE_BALANCE -> Known.INSUFFICIENT_FUNDING_SOURCE_BALANCE
                    INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS
                    LITHIC_SYSTEM_ERROR -> Known.LITHIC_SYSTEM_ERROR
                    LITHIC_SYSTEM_RATE_LIMIT -> Known.LITHIC_SYSTEM_RATE_LIMIT
                    MALFORMED_ASA_RESPONSE -> Known.MALFORMED_ASA_RESPONSE
                    MERCHANT_INVALID -> Known.MERCHANT_INVALID
                    MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE ->
                        Known.MERCHANT_LOCKED_CARD_ATTEMPTED_ELSEWHERE
                    MERCHANT_NOT_PERMITTED -> Known.MERCHANT_NOT_PERMITTED
                    OVER_REVERSAL_ATTEMPTED -> Known.OVER_REVERSAL_ATTEMPTED
                    PIN_BLOCKED -> Known.PIN_BLOCKED
                    PROGRAM_CARD_SPEND_LIMIT_EXCEEDED -> Known.PROGRAM_CARD_SPEND_LIMIT_EXCEEDED
                    PROGRAM_SUSPENDED -> Known.PROGRAM_SUSPENDED
                    PROGRAM_USAGE_RESTRICTION -> Known.PROGRAM_USAGE_RESTRICTION
                    REVERSAL_UNMATCHED -> Known.REVERSAL_UNMATCHED
                    SECURITY_VIOLATION -> Known.SECURITY_VIOLATION
                    SINGLE_USE_CARD_REATTEMPTED -> Known.SINGLE_USE_CARD_REATTEMPTED
                    TRANSACTION_INVALID -> Known.TRANSACTION_INVALID
                    TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL ->
                        Known.TRANSACTION_NOT_PERMITTED_TO_ACQUIRER_OR_TERMINAL
                    TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER ->
                        Known.TRANSACTION_NOT_PERMITTED_TO_ISSUER_OR_CARDHOLDER
                    TRANSACTION_PREVIOUSLY_COMPLETED -> Known.TRANSACTION_PREVIOUSLY_COMPLETED
                    UNAUTHORIZED_MERCHANT -> Known.UNAUTHORIZED_MERCHANT
                    VEHICLE_NUMBER_INVALID -> Known.VEHICLE_NUMBER_INVALID
                    else -> throw LithicInvalidDataException("Unknown DetailedResult: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class EffectivePolarity
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is EffectivePolarity && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val CREDIT = EffectivePolarity(JsonField.of("CREDIT"))

                val DEBIT = EffectivePolarity(JsonField.of("DEBIT"))

                fun of(value: String) = EffectivePolarity(JsonField.of(value))
            }

            enum class Known {
                CREDIT,
                DEBIT,
            }

            enum class Value {
                CREDIT,
                DEBIT,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    CREDIT -> Value.CREDIT
                    DEBIT -> Value.DEBIT
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    CREDIT -> Known.CREDIT
                    DEBIT -> Known.DEBIT
                    else -> throw LithicInvalidDataException("Unknown EffectivePolarity: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class DeclineResult
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is DeclineResult && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val ACCOUNT_STATE_TRANSACTION_FAIL =
                    DeclineResult(JsonField.of("ACCOUNT_STATE_TRANSACTION_FAIL"))

                val APPROVED = DeclineResult(JsonField.of("APPROVED"))

                val BANK_CONNECTION_ERROR = DeclineResult(JsonField.of("BANK_CONNECTION_ERROR"))

                val BANK_NOT_VERIFIED = DeclineResult(JsonField.of("BANK_NOT_VERIFIED"))

                val CARD_CLOSED = DeclineResult(JsonField.of("CARD_CLOSED"))

                val CARD_PAUSED = DeclineResult(JsonField.of("CARD_PAUSED"))

                val DECLINED = DeclineResult(JsonField.of("DECLINED"))

                val FRAUD_ADVICE = DeclineResult(JsonField.of("FRAUD_ADVICE"))

                val IGNORED_TTL_EXPIRY = DeclineResult(JsonField.of("IGNORED_TTL_EXPIRY"))

                val INACTIVE_ACCOUNT = DeclineResult(JsonField.of("INACTIVE_ACCOUNT"))

                val INCORRECT_PIN = DeclineResult(JsonField.of("INCORRECT_PIN"))

                val INVALID_CARD_DETAILS = DeclineResult(JsonField.of("INVALID_CARD_DETAILS"))

                val INSUFFICIENT_FUNDS = DeclineResult(JsonField.of("INSUFFICIENT_FUNDS"))

                val INSUFFICIENT_FUNDS_PRELOAD =
                    DeclineResult(JsonField.of("INSUFFICIENT_FUNDS_PRELOAD"))

                val INVALID_TRANSACTION = DeclineResult(JsonField.of("INVALID_TRANSACTION"))

                val MERCHANT_BLACKLIST = DeclineResult(JsonField.of("MERCHANT_BLACKLIST"))

                val ORIGINAL_NOT_FOUND = DeclineResult(JsonField.of("ORIGINAL_NOT_FOUND"))

                val PREVIOUSLY_COMPLETED = DeclineResult(JsonField.of("PREVIOUSLY_COMPLETED"))

                val SINGLE_USE_RECHARGED = DeclineResult(JsonField.of("SINGLE_USE_RECHARGED"))

                val SWITCH_INOPERATIVE_ADVICE =
                    DeclineResult(JsonField.of("SWITCH_INOPERATIVE_ADVICE"))

                val UNAUTHORIZED_MERCHANT = DeclineResult(JsonField.of("UNAUTHORIZED_MERCHANT"))

                val UNKNOWN_HOST_TIMEOUT = DeclineResult(JsonField.of("UNKNOWN_HOST_TIMEOUT"))

                val USER_TRANSACTION_LIMIT = DeclineResult(JsonField.of("USER_TRANSACTION_LIMIT"))

                fun of(value: String) = DeclineResult(JsonField.of(value))
            }

            enum class Known {
                ACCOUNT_STATE_TRANSACTION_FAIL,
                APPROVED,
                BANK_CONNECTION_ERROR,
                BANK_NOT_VERIFIED,
                CARD_CLOSED,
                CARD_PAUSED,
                DECLINED,
                FRAUD_ADVICE,
                IGNORED_TTL_EXPIRY,
                INACTIVE_ACCOUNT,
                INCORRECT_PIN,
                INVALID_CARD_DETAILS,
                INSUFFICIENT_FUNDS,
                INSUFFICIENT_FUNDS_PRELOAD,
                INVALID_TRANSACTION,
                MERCHANT_BLACKLIST,
                ORIGINAL_NOT_FOUND,
                PREVIOUSLY_COMPLETED,
                SINGLE_USE_RECHARGED,
                SWITCH_INOPERATIVE_ADVICE,
                UNAUTHORIZED_MERCHANT,
                UNKNOWN_HOST_TIMEOUT,
                USER_TRANSACTION_LIMIT,
            }

            enum class Value {
                ACCOUNT_STATE_TRANSACTION_FAIL,
                APPROVED,
                BANK_CONNECTION_ERROR,
                BANK_NOT_VERIFIED,
                CARD_CLOSED,
                CARD_PAUSED,
                DECLINED,
                FRAUD_ADVICE,
                IGNORED_TTL_EXPIRY,
                INACTIVE_ACCOUNT,
                INCORRECT_PIN,
                INVALID_CARD_DETAILS,
                INSUFFICIENT_FUNDS,
                INSUFFICIENT_FUNDS_PRELOAD,
                INVALID_TRANSACTION,
                MERCHANT_BLACKLIST,
                ORIGINAL_NOT_FOUND,
                PREVIOUSLY_COMPLETED,
                SINGLE_USE_RECHARGED,
                SWITCH_INOPERATIVE_ADVICE,
                UNAUTHORIZED_MERCHANT,
                UNKNOWN_HOST_TIMEOUT,
                USER_TRANSACTION_LIMIT,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    ACCOUNT_STATE_TRANSACTION_FAIL -> Value.ACCOUNT_STATE_TRANSACTION_FAIL
                    APPROVED -> Value.APPROVED
                    BANK_CONNECTION_ERROR -> Value.BANK_CONNECTION_ERROR
                    BANK_NOT_VERIFIED -> Value.BANK_NOT_VERIFIED
                    CARD_CLOSED -> Value.CARD_CLOSED
                    CARD_PAUSED -> Value.CARD_PAUSED
                    DECLINED -> Value.DECLINED
                    FRAUD_ADVICE -> Value.FRAUD_ADVICE
                    IGNORED_TTL_EXPIRY -> Value.IGNORED_TTL_EXPIRY
                    INACTIVE_ACCOUNT -> Value.INACTIVE_ACCOUNT
                    INCORRECT_PIN -> Value.INCORRECT_PIN
                    INVALID_CARD_DETAILS -> Value.INVALID_CARD_DETAILS
                    INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS
                    INSUFFICIENT_FUNDS_PRELOAD -> Value.INSUFFICIENT_FUNDS_PRELOAD
                    INVALID_TRANSACTION -> Value.INVALID_TRANSACTION
                    MERCHANT_BLACKLIST -> Value.MERCHANT_BLACKLIST
                    ORIGINAL_NOT_FOUND -> Value.ORIGINAL_NOT_FOUND
                    PREVIOUSLY_COMPLETED -> Value.PREVIOUSLY_COMPLETED
                    SINGLE_USE_RECHARGED -> Value.SINGLE_USE_RECHARGED
                    SWITCH_INOPERATIVE_ADVICE -> Value.SWITCH_INOPERATIVE_ADVICE
                    UNAUTHORIZED_MERCHANT -> Value.UNAUTHORIZED_MERCHANT
                    UNKNOWN_HOST_TIMEOUT -> Value.UNKNOWN_HOST_TIMEOUT
                    USER_TRANSACTION_LIMIT -> Value.USER_TRANSACTION_LIMIT
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    ACCOUNT_STATE_TRANSACTION_FAIL -> Known.ACCOUNT_STATE_TRANSACTION_FAIL
                    APPROVED -> Known.APPROVED
                    BANK_CONNECTION_ERROR -> Known.BANK_CONNECTION_ERROR
                    BANK_NOT_VERIFIED -> Known.BANK_NOT_VERIFIED
                    CARD_CLOSED -> Known.CARD_CLOSED
                    CARD_PAUSED -> Known.CARD_PAUSED
                    DECLINED -> Known.DECLINED
                    FRAUD_ADVICE -> Known.FRAUD_ADVICE
                    IGNORED_TTL_EXPIRY -> Known.IGNORED_TTL_EXPIRY
                    INACTIVE_ACCOUNT -> Known.INACTIVE_ACCOUNT
                    INCORRECT_PIN -> Known.INCORRECT_PIN
                    INVALID_CARD_DETAILS -> Known.INVALID_CARD_DETAILS
                    INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS
                    INSUFFICIENT_FUNDS_PRELOAD -> Known.INSUFFICIENT_FUNDS_PRELOAD
                    INVALID_TRANSACTION -> Known.INVALID_TRANSACTION
                    MERCHANT_BLACKLIST -> Known.MERCHANT_BLACKLIST
                    ORIGINAL_NOT_FOUND -> Known.ORIGINAL_NOT_FOUND
                    PREVIOUSLY_COMPLETED -> Known.PREVIOUSLY_COMPLETED
                    SINGLE_USE_RECHARGED -> Known.SINGLE_USE_RECHARGED
                    SWITCH_INOPERATIVE_ADVICE -> Known.SWITCH_INOPERATIVE_ADVICE
                    UNAUTHORIZED_MERCHANT -> Known.UNAUTHORIZED_MERCHANT
                    UNKNOWN_HOST_TIMEOUT -> Known.UNKNOWN_HOST_TIMEOUT
                    USER_TRANSACTION_LIMIT -> Known.USER_TRANSACTION_LIMIT
                    else -> throw LithicInvalidDataException("Unknown DeclineResult: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

        class Type
        @JsonCreator
        private constructor(
            private val value: JsonField,
        ) : Enum {

            @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value

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

                return /* spotless:off */ other is Type && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val AUTHORIZATION = Type(JsonField.of("AUTHORIZATION"))

                val AUTHORIZATION_ADVICE = Type(JsonField.of("AUTHORIZATION_ADVICE"))

                val AUTHORIZATION_EXPIRY = Type(JsonField.of("AUTHORIZATION_EXPIRY"))

                val AUTHORIZATION_REVERSAL = Type(JsonField.of("AUTHORIZATION_REVERSAL"))

                val BALANCE_INQUIRY = Type(JsonField.of("BALANCE_INQUIRY"))

                val CLEARING = Type(JsonField.of("CLEARING"))

                val CORRECTION_CREDIT = Type(JsonField.of("CORRECTION_CREDIT"))

                val CORRECTION_DEBIT = Type(JsonField.of("CORRECTION_DEBIT"))

                val CREDIT_AUTHORIZATION = Type(JsonField.of("CREDIT_AUTHORIZATION"))

                val CREDIT_AUTHORIZATION_ADVICE = Type(JsonField.of("CREDIT_AUTHORIZATION_ADVICE"))

                val FINANCIAL_AUTHORIZATION = Type(JsonField.of("FINANCIAL_AUTHORIZATION"))

                val FINANCIAL_CREDIT_AUTHORIZATION =
                    Type(JsonField.of("FINANCIAL_CREDIT_AUTHORIZATION"))

                val RETURN = Type(JsonField.of("RETURN"))

                val RETURN_REVERSAL = Type(JsonField.of("RETURN_REVERSAL"))

                fun of(value: String) = Type(JsonField.of(value))
            }

            enum class Known {
                AUTHORIZATION,
                AUTHORIZATION_ADVICE,
                AUTHORIZATION_EXPIRY,
                AUTHORIZATION_REVERSAL,
                BALANCE_INQUIRY,
                CLEARING,
                CORRECTION_CREDIT,
                CORRECTION_DEBIT,
                CREDIT_AUTHORIZATION,
                CREDIT_AUTHORIZATION_ADVICE,
                FINANCIAL_AUTHORIZATION,
                FINANCIAL_CREDIT_AUTHORIZATION,
                RETURN,
                RETURN_REVERSAL,
            }

            enum class Value {
                AUTHORIZATION,
                AUTHORIZATION_ADVICE,
                AUTHORIZATION_EXPIRY,
                AUTHORIZATION_REVERSAL,
                BALANCE_INQUIRY,
                CLEARING,
                CORRECTION_CREDIT,
                CORRECTION_DEBIT,
                CREDIT_AUTHORIZATION,
                CREDIT_AUTHORIZATION_ADVICE,
                FINANCIAL_AUTHORIZATION,
                FINANCIAL_CREDIT_AUTHORIZATION,
                RETURN,
                RETURN_REVERSAL,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    AUTHORIZATION -> Value.AUTHORIZATION
                    AUTHORIZATION_ADVICE -> Value.AUTHORIZATION_ADVICE
                    AUTHORIZATION_EXPIRY -> Value.AUTHORIZATION_EXPIRY
                    AUTHORIZATION_REVERSAL -> Value.AUTHORIZATION_REVERSAL
                    BALANCE_INQUIRY -> Value.BALANCE_INQUIRY
                    CLEARING -> Value.CLEARING
                    CORRECTION_CREDIT -> Value.CORRECTION_CREDIT
                    CORRECTION_DEBIT -> Value.CORRECTION_DEBIT
                    CREDIT_AUTHORIZATION -> Value.CREDIT_AUTHORIZATION
                    CREDIT_AUTHORIZATION_ADVICE -> Value.CREDIT_AUTHORIZATION_ADVICE
                    FINANCIAL_AUTHORIZATION -> Value.FINANCIAL_AUTHORIZATION
                    FINANCIAL_CREDIT_AUTHORIZATION -> Value.FINANCIAL_CREDIT_AUTHORIZATION
                    RETURN -> Value.RETURN
                    RETURN_REVERSAL -> Value.RETURN_REVERSAL
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    AUTHORIZATION -> Known.AUTHORIZATION
                    AUTHORIZATION_ADVICE -> Known.AUTHORIZATION_ADVICE
                    AUTHORIZATION_EXPIRY -> Known.AUTHORIZATION_EXPIRY
                    AUTHORIZATION_REVERSAL -> Known.AUTHORIZATION_REVERSAL
                    BALANCE_INQUIRY -> Known.BALANCE_INQUIRY
                    CLEARING -> Known.CLEARING
                    CORRECTION_CREDIT -> Known.CORRECTION_CREDIT
                    CORRECTION_DEBIT -> Known.CORRECTION_DEBIT
                    CREDIT_AUTHORIZATION -> Known.CREDIT_AUTHORIZATION
                    CREDIT_AUTHORIZATION_ADVICE -> Known.CREDIT_AUTHORIZATION_ADVICE
                    FINANCIAL_AUTHORIZATION -> Known.FINANCIAL_AUTHORIZATION
                    FINANCIAL_CREDIT_AUTHORIZATION -> Known.FINANCIAL_CREDIT_AUTHORIZATION
                    RETURN -> Known.RETURN
                    RETURN_REVERSAL -> Known.RETURN_REVERSAL
                    else -> throw LithicInvalidDataException("Unknown Type: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }

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

            return /* spotless:off */ other is TransactionEvent && this.amount == other.amount && this.amounts == other.amounts && this.created == other.created && this.detailedResults == other.detailedResults && this.effectivePolarity == other.effectivePolarity && this.result == other.result && this.token == other.token && this.type == other.type && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(amount, amounts, created, detailedResults, effectivePolarity, result, token, type, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "TransactionEvent{amount=$amount, amounts=$amounts, created=$created, detailedResults=$detailedResults, effectivePolarity=$effectivePolarity, result=$result, token=$token, type=$type, additionalProperties=$additionalProperties}"
    }

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

        return /* spotless:off */ other is Transaction && this.acquirerFee == other.acquirerFee && this.acquirerReferenceNumber == other.acquirerReferenceNumber && this.accountToken == other.accountToken && this.amount == other.amount && this.amounts == other.amounts && this.authorizationAmount == other.authorizationAmount && this.authorizationCode == other.authorizationCode && this.avs == other.avs && this.cardToken == other.cardToken && this.cardholderAuthentication == other.cardholderAuthentication && this.created == other.created && this.events == other.events && this.merchant == other.merchant && this.merchantAmount == other.merchantAmount && this.merchantAuthorizationAmount == other.merchantAuthorizationAmount && this.merchantCurrency == other.merchantCurrency && this.network == other.network && this.networkRiskScore == other.networkRiskScore && this.result == other.result && this.pos == other.pos && this.settledAmount == other.settledAmount && this.status == other.status && this.token == other.token && this.tokenInfo == other.tokenInfo && this.updated == other.updated && this.additionalProperties == other.additionalProperties /* spotless:on */
    }

    private var hashCode: Int = 0

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode = /* spotless:off */ Objects.hash(acquirerFee, acquirerReferenceNumber, accountToken, amount, amounts, authorizationAmount, authorizationCode, avs, cardToken, cardholderAuthentication, created, events, merchant, merchantAmount, merchantAuthorizationAmount, merchantCurrency, network, networkRiskScore, result, pos, settledAmount, status, token, tokenInfo, updated, additionalProperties) /* spotless:on */
        }
        return hashCode
    }

    override fun toString() =
        "Transaction{acquirerFee=$acquirerFee, acquirerReferenceNumber=$acquirerReferenceNumber, accountToken=$accountToken, amount=$amount, amounts=$amounts, authorizationAmount=$authorizationAmount, authorizationCode=$authorizationCode, avs=$avs, cardToken=$cardToken, cardholderAuthentication=$cardholderAuthentication, created=$created, events=$events, merchant=$merchant, merchantAmount=$merchantAmount, merchantAuthorizationAmount=$merchantAuthorizationAmount, merchantCurrency=$merchantCurrency, network=$network, networkRiskScore=$networkRiskScore, result=$result, pos=$pos, settledAmount=$settledAmount, status=$status, token=$token, tokenInfo=$tokenInfo, updated=$updated, additionalProperties=$additionalProperties}"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy