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

com.lithic.api.models.BookTransferResponse.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.

There is a newer version: 0.71.0
Show 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.toUnmodifiable
import com.lithic.api.errors.LithicInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects

@JsonDeserialize(builder = BookTransferResponse.Builder::class)
@NoAutoDetect
class BookTransferResponse
private constructor(
    private val category: JsonField,
    private val created: JsonField,
    private val currency: JsonField,
    private val events: JsonField>,
    private val fromFinancialAccountToken: JsonField,
    private val pendingAmount: JsonField,
    private val result: JsonField,
    private val settledAmount: JsonField,
    private val status: JsonField,
    private val toFinancialAccountToken: JsonValue,
    private val token: JsonField,
    private val updated: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    /** Category of the book transfer */
    fun category(): Category = category.getRequired("category")

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

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

    /** A list of all financial events that have modified this transfer. */
    fun events(): List = events.getRequired("events")

    /**
     * Globally unique identifier for the financial account or card that will send the funds.
     * Accepted type dependent on the program's use case.
     */
    fun fromFinancialAccountToken(): String =
        fromFinancialAccountToken.getRequired("from_financial_account_token")

    /**
     * Pending amount of the transaction in the currency's smallest unit (e.g., cents), including
     * any acquirer fees. The value of this field will go to zero over time once the financial
     * transaction is settled.
     */
    fun pendingAmount(): Long = pendingAmount.getRequired("pending_amount")

    /**
     * APPROVED transactions were successful while DECLINED transactions were declined by user,
     * Lithic, or the network.
     */
    fun result(): Result = result.getRequired("result")

    /**
     * Amount of the transaction that has been settled in the currency's smallest unit (e.g.,
     * cents).
     */
    fun settledAmount(): Long = settledAmount.getRequired("settled_amount")

    /**
     * Status types: _ `DECLINED` - The transfer was declined. _ `REVERSED` - The transfer was
     * reversed \* `SETTLED` - The transfer is completed.
     */
    fun status(): Status = status.getRequired("status")

    /**
     * Customer-provided token that will serve as an idempotency token. This token will become the
     * transaction token.
     */
    fun token(): String = token.getRequired("token")

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

    /** Category of the book transfer */
    @JsonProperty("category") @ExcludeMissing fun _category() = category

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

    /** 3-digit alphabetic ISO 4217 code for the settling currency of the transaction. */
    @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

    /** A list of all financial events that have modified this transfer. */
    @JsonProperty("events") @ExcludeMissing fun _events() = events

    /**
     * Globally unique identifier for the financial account or card that will send the funds.
     * Accepted type dependent on the program's use case.
     */
    @JsonProperty("from_financial_account_token")
    @ExcludeMissing
    fun _fromFinancialAccountToken() = fromFinancialAccountToken

    /**
     * Pending amount of the transaction in the currency's smallest unit (e.g., cents), including
     * any acquirer fees. The value of this field will go to zero over time once the financial
     * transaction is settled.
     */
    @JsonProperty("pending_amount") @ExcludeMissing fun _pendingAmount() = pendingAmount

    /**
     * APPROVED transactions were successful while DECLINED transactions were declined by user,
     * Lithic, or the network.
     */
    @JsonProperty("result") @ExcludeMissing fun _result() = result

    /**
     * Amount of the transaction that has been settled in the currency's smallest unit (e.g.,
     * cents).
     */
    @JsonProperty("settled_amount") @ExcludeMissing fun _settledAmount() = settledAmount

    /**
     * Status types: _ `DECLINED` - The transfer was declined. _ `REVERSED` - The transfer was
     * reversed \* `SETTLED` - The transfer is completed.
     */
    @JsonProperty("status") @ExcludeMissing fun _status() = status

    /**
     * Globally unique identifier for the financial account or card that will receive the funds.
     * Accepted type dependent on the program's use case.
     */
    @JsonProperty("to_financial_account_token")
    @ExcludeMissing
    fun _toFinancialAccountToken() = toFinancialAccountToken

    /**
     * Customer-provided token that will serve as an idempotency token. This token will become the
     * transaction token.
     */
    @JsonProperty("token") @ExcludeMissing fun _token() = token

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

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

    fun validate(): BookTransferResponse = apply {
        if (!validated) {
            category()
            created()
            currency()
            events().forEach { it.validate() }
            fromFinancialAccountToken()
            pendingAmount()
            result()
            settledAmount()
            status()
            token()
            updated()
            validated = true
        }
    }

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

    companion object {

        @JvmStatic fun builder() = Builder()
    }

    class Builder {

        private var category: JsonField = JsonMissing.of()
        private var created: JsonField = JsonMissing.of()
        private var currency: JsonField = JsonMissing.of()
        private var events: JsonField> = JsonMissing.of()
        private var fromFinancialAccountToken: JsonField = JsonMissing.of()
        private var pendingAmount: JsonField = JsonMissing.of()
        private var result: JsonField = JsonMissing.of()
        private var settledAmount: JsonField = JsonMissing.of()
        private var status: JsonField = JsonMissing.of()
        private var toFinancialAccountToken: JsonValue = JsonMissing.of()
        private var token: JsonField = JsonMissing.of()
        private var updated: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        @JvmSynthetic
        internal fun from(bookTransferResponse: BookTransferResponse) = apply {
            this.category = bookTransferResponse.category
            this.created = bookTransferResponse.created
            this.currency = bookTransferResponse.currency
            this.events = bookTransferResponse.events
            this.fromFinancialAccountToken = bookTransferResponse.fromFinancialAccountToken
            this.pendingAmount = bookTransferResponse.pendingAmount
            this.result = bookTransferResponse.result
            this.settledAmount = bookTransferResponse.settledAmount
            this.status = bookTransferResponse.status
            this.toFinancialAccountToken = bookTransferResponse.toFinancialAccountToken
            this.token = bookTransferResponse.token
            this.updated = bookTransferResponse.updated
            additionalProperties(bookTransferResponse.additionalProperties)
        }

        /** Category of the book transfer */
        fun category(category: Category) = category(JsonField.of(category))

        /** Category of the book transfer */
        @JsonProperty("category")
        @ExcludeMissing
        fun category(category: JsonField) = apply { this.category = category }

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

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

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

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

        /** A list of all financial events that have modified this transfer. */
        fun events(events: List) = events(JsonField.of(events))

        /** A list of all financial events that have modified this transfer. */
        @JsonProperty("events")
        @ExcludeMissing
        fun events(events: JsonField>) = apply { this.events = events }

        /**
         * Globally unique identifier for the financial account or card that will send the funds.
         * Accepted type dependent on the program's use case.
         */
        fun fromFinancialAccountToken(fromFinancialAccountToken: String) =
            fromFinancialAccountToken(JsonField.of(fromFinancialAccountToken))

        /**
         * Globally unique identifier for the financial account or card that will send the funds.
         * Accepted type dependent on the program's use case.
         */
        @JsonProperty("from_financial_account_token")
        @ExcludeMissing
        fun fromFinancialAccountToken(fromFinancialAccountToken: JsonField) = apply {
            this.fromFinancialAccountToken = fromFinancialAccountToken
        }

        /**
         * Pending amount of the transaction in the currency's smallest unit (e.g., cents),
         * including any acquirer fees. The value of this field will go to zero over time once the
         * financial transaction is settled.
         */
        fun pendingAmount(pendingAmount: Long) = pendingAmount(JsonField.of(pendingAmount))

        /**
         * Pending amount of the transaction in the currency's smallest unit (e.g., cents),
         * including any acquirer fees. The value of this field will go to zero over time once the
         * financial transaction is settled.
         */
        @JsonProperty("pending_amount")
        @ExcludeMissing
        fun pendingAmount(pendingAmount: JsonField) = apply {
            this.pendingAmount = pendingAmount
        }

        /**
         * APPROVED transactions were successful while DECLINED transactions were declined by user,
         * Lithic, or the network.
         */
        fun result(result: Result) = result(JsonField.of(result))

        /**
         * APPROVED transactions were successful while DECLINED transactions were declined by user,
         * Lithic, or the network.
         */
        @JsonProperty("result")
        @ExcludeMissing
        fun result(result: JsonField) = apply { this.result = result }

        /**
         * Amount of the transaction that has been settled in the currency's smallest unit (e.g.,
         * cents).
         */
        fun settledAmount(settledAmount: Long) = settledAmount(JsonField.of(settledAmount))

        /**
         * Amount of the transaction that has been settled in the currency's smallest unit (e.g.,
         * cents).
         */
        @JsonProperty("settled_amount")
        @ExcludeMissing
        fun settledAmount(settledAmount: JsonField) = apply {
            this.settledAmount = settledAmount
        }

        /**
         * Status types: _ `DECLINED` - The transfer was declined. _ `REVERSED` - The transfer was
         * reversed \* `SETTLED` - The transfer is completed.
         */
        fun status(status: Status) = status(JsonField.of(status))

        /**
         * Status types: _ `DECLINED` - The transfer was declined. _ `REVERSED` - The transfer was
         * reversed \* `SETTLED` - The transfer is completed.
         */
        @JsonProperty("status")
        @ExcludeMissing
        fun status(status: JsonField) = apply { this.status = status }

        /**
         * Globally unique identifier for the financial account or card that will receive the funds.
         * Accepted type dependent on the program's use case.
         */
        @JsonProperty("to_financial_account_token")
        @ExcludeMissing
        fun toFinancialAccountToken(toFinancialAccountToken: JsonValue) = apply {
            this.toFinancialAccountToken = toFinancialAccountToken
        }

        /**
         * Customer-provided token that will serve as an idempotency token. This token will become
         * the transaction token.
         */
        fun token(token: String) = token(JsonField.of(token))

        /**
         * Customer-provided token that will serve as an idempotency token. This token will become
         * the transaction token.
         */
        @JsonProperty("token")
        @ExcludeMissing
        fun token(token: JsonField) = apply { this.token = token }

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

        /** Date and time when the financial transaction was 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(): BookTransferResponse =
            BookTransferResponse(
                category,
                created,
                currency,
                events.map { it.toUnmodifiable() },
                fromFinancialAccountToken,
                pendingAmount,
                result,
                settledAmount,
                status,
                toFinancialAccountToken,
                token,
                updated,
                additionalProperties.toUnmodifiable(),
            )
    }

    class Category
    @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 Category && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            @JvmField val ADJUSTMENT = Category(JsonField.of("ADJUSTMENT"))

            @JvmField val BALANCE_OR_FUNDING = Category(JsonField.of("BALANCE_OR_FUNDING"))

            @JvmField val DERECOGNITION = Category(JsonField.of("DERECOGNITION"))

            @JvmField val DISPUTE = Category(JsonField.of("DISPUTE"))

            @JvmField val FEE = Category(JsonField.of("FEE"))

            @JvmField val REWARD = Category(JsonField.of("REWARD"))

            @JvmField val TRANSFER = Category(JsonField.of("TRANSFER"))

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

        enum class Known {
            ADJUSTMENT,
            BALANCE_OR_FUNDING,
            DERECOGNITION,
            DISPUTE,
            FEE,
            REWARD,
            TRANSFER,
        }

        enum class Value {
            ADJUSTMENT,
            BALANCE_OR_FUNDING,
            DERECOGNITION,
            DISPUTE,
            FEE,
            REWARD,
            TRANSFER,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                ADJUSTMENT -> Value.ADJUSTMENT
                BALANCE_OR_FUNDING -> Value.BALANCE_OR_FUNDING
                DERECOGNITION -> Value.DERECOGNITION
                DISPUTE -> Value.DISPUTE
                FEE -> Value.FEE
                REWARD -> Value.REWARD
                TRANSFER -> Value.TRANSFER
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                ADJUSTMENT -> Known.ADJUSTMENT
                BALANCE_OR_FUNDING -> Known.BALANCE_OR_FUNDING
                DERECOGNITION -> Known.DERECOGNITION
                DISPUTE -> Known.DISPUTE
                FEE -> Known.FEE
                REWARD -> Known.REWARD
                TRANSFER -> Known.TRANSFER
                else -> throw LithicInvalidDataException("Unknown Category: $value")
            }

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

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

        private var validated: Boolean = false

        /**
         * Amount of the financial event that has been settled in the currency's smallest unit
         * (e.g., cents).
         */
        fun amount(): Long = amount.getRequired("amount")

        /** Type of the book transfer */
        fun type(): String = type.getRequired("type")

        /**
         * APPROVED financial events were successful while DECLINED financial events were declined
         * by user, Lithic, or the network.
         */
        fun result(): Result = result.getRequired("result")

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

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

        /** The program specific subtype code for the specified category/type. */
        fun subtype(): String = subtype.getRequired("subtype")

        /** Memo for the transfer. */
        fun memo(): String = memo.getRequired("memo")

        /** Detailed Results */
        fun detailedResults(): List =
            detailedResults.getRequired("detailed_results")

        /**
         * Amount of the financial event that has been settled in the currency's smallest unit
         * (e.g., cents).
         */
        @JsonProperty("amount") @ExcludeMissing fun _amount() = amount

        /** Type of the book transfer */
        @JsonProperty("type") @ExcludeMissing fun _type() = type

        /**
         * APPROVED financial events were successful while DECLINED financial events were declined
         * by user, Lithic, or the network.
         */
        @JsonProperty("result") @ExcludeMissing fun _result() = result

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

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

        /** The program specific subtype code for the specified category/type. */
        @JsonProperty("subtype") @ExcludeMissing fun _subtype() = subtype

        /** Memo for the transfer. */
        @JsonProperty("memo") @ExcludeMissing fun _memo() = memo

        /** Detailed Results */
        @JsonProperty("detailed_results") @ExcludeMissing fun _detailedResults() = detailedResults

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

        fun validate(): BookTransferEvent = apply {
            if (!validated) {
                amount()
                type()
                result()
                created()
                token()
                subtype()
                memo()
                detailedResults()
                validated = true
            }
        }

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

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

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

            @JvmSynthetic
            internal fun from(bookTransferEvent: BookTransferEvent) = apply {
                this.amount = bookTransferEvent.amount
                this.type = bookTransferEvent.type
                this.result = bookTransferEvent.result
                this.created = bookTransferEvent.created
                this.token = bookTransferEvent.token
                this.subtype = bookTransferEvent.subtype
                this.memo = bookTransferEvent.memo
                this.detailedResults = bookTransferEvent.detailedResults
                additionalProperties(bookTransferEvent.additionalProperties)
            }

            /**
             * Amount of the financial event that has been settled in the currency's smallest unit
             * (e.g., cents).
             */
            fun amount(amount: Long) = amount(JsonField.of(amount))

            /**
             * Amount of the financial event that has been settled in the currency's smallest unit
             * (e.g., cents).
             */
            @JsonProperty("amount")
            @ExcludeMissing
            fun amount(amount: JsonField) = apply { this.amount = amount }

            /** Type of the book transfer */
            fun type(type: String) = type(JsonField.of(type))

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

            /**
             * APPROVED financial events were successful while DECLINED financial events were
             * declined by user, Lithic, or the network.
             */
            fun result(result: Result) = result(JsonField.of(result))

            /**
             * APPROVED financial events were successful while DECLINED financial events were
             * declined by user, Lithic, or the network.
             */
            @JsonProperty("result")
            @ExcludeMissing
            fun result(result: JsonField) = apply { this.result = result }

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

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

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

            /** The program specific subtype code for the specified category/type. */
            fun subtype(subtype: String) = subtype(JsonField.of(subtype))

            /** The program specific subtype code for the specified category/type. */
            @JsonProperty("subtype")
            @ExcludeMissing
            fun subtype(subtype: JsonField) = apply { this.subtype = subtype }

            /** Memo for the transfer. */
            fun memo(memo: String) = memo(JsonField.of(memo))

            /** Memo for the transfer. */
            @JsonProperty("memo")
            @ExcludeMissing
            fun memo(memo: JsonField) = apply { this.memo = memo }

            /** Detailed Results */
            fun detailedResults(detailedResults: List) =
                detailedResults(JsonField.of(detailedResults))

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

            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(): BookTransferEvent =
                BookTransferEvent(
                    amount,
                    type,
                    result,
                    created,
                    token,
                    subtype,
                    memo,
                    detailedResults.map { it.toUnmodifiable() },
                    additionalProperties.toUnmodifiable(),
                )
        }

        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 {

                @JvmField val APPROVED = DetailedResult(JsonField.of("APPROVED"))

                @JvmField
                val FUNDS_INSUFFICIENT = DetailedResult(JsonField.of("FUNDS_INSUFFICIENT"))

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

            enum class Known {
                APPROVED,
                FUNDS_INSUFFICIENT,
            }

            enum class Value {
                APPROVED,
                FUNDS_INSUFFICIENT,
                _UNKNOWN,
            }

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

            fun known(): Known =
                when (this) {
                    APPROVED -> Known.APPROVED
                    FUNDS_INSUFFICIENT -> Known.FUNDS_INSUFFICIENT
                    else -> throw LithicInvalidDataException("Unknown DetailedResult: $value")
                }

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

        class Result
        @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 Result && this.value == other.value /* spotless:on */
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                @JvmField val APPROVED = Result(JsonField.of("APPROVED"))

                @JvmField val DECLINED = Result(JsonField.of("DECLINED"))

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

            enum class Known {
                APPROVED,
                DECLINED,
            }

            enum class Value {
                APPROVED,
                DECLINED,
                _UNKNOWN,
            }

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

            fun known(): Known =
                when (this) {
                    APPROVED -> Known.APPROVED
                    DECLINED -> Known.DECLINED
                    else -> throw LithicInvalidDataException("Unknown Result: $value")
                }

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

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

            return /* spotless:off */ other is BookTransferEvent && this.amount == other.amount && this.type == other.type && this.result == other.result && this.created == other.created && this.token == other.token && this.subtype == other.subtype && this.memo == other.memo && this.detailedResults == other.detailedResults && this.additionalProperties == other.additionalProperties /* spotless:on */
        }

        private var hashCode: Int = 0

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = /* spotless:off */ Objects.hash(amount, type, result, created, token, subtype, memo, detailedResults, additionalProperties) /* spotless:on */
            }
            return hashCode
        }

        override fun toString() =
            "BookTransferEvent{amount=$amount, type=$type, result=$result, created=$created, token=$token, subtype=$subtype, memo=$memo, detailedResults=$detailedResults, additionalProperties=$additionalProperties}"
    }

    class Result
    @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 Result && this.value == other.value /* spotless:on */
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            @JvmField val APPROVED = Result(JsonField.of("APPROVED"))

            @JvmField val DECLINED = Result(JsonField.of("DECLINED"))

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

        enum class Known {
            APPROVED,
            DECLINED,
        }

        enum class Value {
            APPROVED,
            DECLINED,
            _UNKNOWN,
        }

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

        fun known(): Known =
            when (this) {
                APPROVED -> Known.APPROVED
                DECLINED -> Known.DECLINED
                else -> throw LithicInvalidDataException("Unknown Result: $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 {

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

            @JvmField val REVERSED = Status(JsonField.of("REVERSED"))

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

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

        enum class Known {
            DECLINED,
            REVERSED,
            SETTLED,
        }

        enum class Value {
            DECLINED,
            REVERSED,
            SETTLED,
            _UNKNOWN,
        }

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

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

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

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

        return /* spotless:off */ other is BookTransferResponse && this.category == other.category && this.created == other.created && this.currency == other.currency && this.events == other.events && this.fromFinancialAccountToken == other.fromFinancialAccountToken && this.pendingAmount == other.pendingAmount && this.result == other.result && this.settledAmount == other.settledAmount && this.status == other.status && this.toFinancialAccountToken == other.toFinancialAccountToken && this.token == other.token && 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(category, created, currency, events, fromFinancialAccountToken, pendingAmount, result, settledAmount, status, toFinancialAccountToken, token, updated, additionalProperties) /* spotless:on */
        }
        return hashCode
    }

    override fun toString() =
        "BookTransferResponse{category=$category, created=$created, currency=$currency, events=$events, fromFinancialAccountToken=$fromFinancialAccountToken, pendingAmount=$pendingAmount, result=$result, settledAmount=$settledAmount, status=$status, toFinancialAccountToken=$toFinancialAccountToken, token=$token, updated=$updated, additionalProperties=$additionalProperties}"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy