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

com.lithic.api.models.ExternalBankAccountRetrieveResponse.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.72.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.LocalDate
import java.time.OffsetDateTime
import java.util.Objects

@JsonDeserialize(builder = ExternalBankAccountRetrieveResponse.Builder::class)
@NoAutoDetect
class ExternalBankAccountRetrieveResponse
private constructor(
    private val token: JsonField,
    private val owner: JsonField,
    private val routingNumber: JsonField,
    private val lastFour: JsonField,
    private val name: JsonField,
    private val currency: JsonField,
    private val country: JsonField,
    private val accountToken: JsonField,
    private val created: JsonField,
    private val companyId: JsonField,
    private val dob: JsonField,
    private val doingBusinessAs: JsonField,
    private val userDefinedId: JsonField,
    private val verificationFailedReason: JsonField,
    private val verificationAttempts: JsonField,
    private val financialAccountToken: JsonField,
    private val type: JsonField,
    private val verificationMethod: JsonField,
    private val ownerType: JsonField,
    private val state: JsonField,
    private val verificationState: JsonField,
    private val address: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    private var hashCode: Int = 0

    /**
     * A globally unique identifier for this record of an external bank account association. If a
     * program links an external bank account to more than one end-user or to both the program and
     * the end-user, then Lithic will return each record of the association
     */
    fun token(): String = token.getRequired("token")

    /**
     * Legal Name of the business or individual who owns the external account. This will appear in
     * statements
     */
    fun owner(): String = owner.getRequired("owner")

    /** Routing Number */
    fun routingNumber(): String = routingNumber.getRequired("routing_number")

    /** The last 4 digits of the bank account. Derived by Lithic from the account number passed */
    fun lastFour(): String = lastFour.getRequired("last_four")

    /** The nickname for this External Bank Account */
    fun name(): String? = name.getNullable("name")

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

    /**
     * The country that the bank account is located in using ISO 3166-1. We will only accept USA
     * bank accounts e.g., USA
     */
    fun country(): String = country.getRequired("country")

    /**
     * Indicates which Lithic account the external account is associated with. For external accounts
     * that are associated with the program, account_token field returned will be null
     */
    fun accountToken(): String? = accountToken.getNullable("account_token")

    /** An ISO 8601 string representing when this funding source was added to the Lithic account. */
    fun created(): OffsetDateTime = created.getRequired("created")

    /** Optional field that helps identify bank accounts in receipts */
    fun companyId(): String? = companyId.getNullable("company_id")

    /** Date of Birth of the Individual that owns the external bank account */
    fun dob(): LocalDate? = dob.getNullable("dob")

    /** Doing Business As */
    fun doingBusinessAs(): String? = doingBusinessAs.getNullable("doing_business_as")

    /** User Defined ID */
    fun userDefinedId(): String? = userDefinedId.getNullable("user_defined_id")

    /**
     * Optional free text description of the reason for the failed verification. For ACH
     * micro-deposits returned, this field will display the reason return code sent by the ACH
     * network
     */
    fun verificationFailedReason(): String? =
        verificationFailedReason.getNullable("verification_failed_reason")

    /** The number of attempts at verification */
    fun verificationAttempts(): Long = verificationAttempts.getRequired("verification_attempts")

    /** The financial account token of the operating account to fund the micro deposits */
    fun financialAccountToken(): String? =
        financialAccountToken.getNullable("financial_account_token")

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

    /** Verification Method */
    fun verificationMethod(): VerificationMethod =
        verificationMethod.getRequired("verification_method")

    /** Owner Type */
    fun ownerType(): OwnerType = ownerType.getRequired("owner_type")

    /** Account State */
    fun state(): State = state.getRequired("state")

    /** Verification State */
    fun verificationState(): VerificationState = verificationState.getRequired("verification_state")

    /** Address */
    fun address(): ExternalBankAccountAddress? = address.getNullable("address")

    /**
     * A globally unique identifier for this record of an external bank account association. If a
     * program links an external bank account to more than one end-user or to both the program and
     * the end-user, then Lithic will return each record of the association
     */
    @JsonProperty("token") @ExcludeMissing fun _token() = token

    /**
     * Legal Name of the business or individual who owns the external account. This will appear in
     * statements
     */
    @JsonProperty("owner") @ExcludeMissing fun _owner() = owner

    /** Routing Number */
    @JsonProperty("routing_number") @ExcludeMissing fun _routingNumber() = routingNumber

    /** The last 4 digits of the bank account. Derived by Lithic from the account number passed */
    @JsonProperty("last_four") @ExcludeMissing fun _lastFour() = lastFour

    /** The nickname for this External Bank Account */
    @JsonProperty("name") @ExcludeMissing fun _name() = name

    /** currency of the external account 3-digit alphabetic ISO 4217 code */
    @JsonProperty("currency") @ExcludeMissing fun _currency() = currency

    /**
     * The country that the bank account is located in using ISO 3166-1. We will only accept USA
     * bank accounts e.g., USA
     */
    @JsonProperty("country") @ExcludeMissing fun _country() = country

    /**
     * Indicates which Lithic account the external account is associated with. For external accounts
     * that are associated with the program, account_token field returned will be null
     */
    @JsonProperty("account_token") @ExcludeMissing fun _accountToken() = accountToken

    /** An ISO 8601 string representing when this funding source was added to the Lithic account. */
    @JsonProperty("created") @ExcludeMissing fun _created() = created

    /** Optional field that helps identify bank accounts in receipts */
    @JsonProperty("company_id") @ExcludeMissing fun _companyId() = companyId

    /** Date of Birth of the Individual that owns the external bank account */
    @JsonProperty("dob") @ExcludeMissing fun _dob() = dob

    /** Doing Business As */
    @JsonProperty("doing_business_as") @ExcludeMissing fun _doingBusinessAs() = doingBusinessAs

    /** User Defined ID */
    @JsonProperty("user_defined_id") @ExcludeMissing fun _userDefinedId() = userDefinedId

    /**
     * Optional free text description of the reason for the failed verification. For ACH
     * micro-deposits returned, this field will display the reason return code sent by the ACH
     * network
     */
    @JsonProperty("verification_failed_reason")
    @ExcludeMissing
    fun _verificationFailedReason() = verificationFailedReason

    /** The number of attempts at verification */
    @JsonProperty("verification_attempts")
    @ExcludeMissing
    fun _verificationAttempts() = verificationAttempts

    /** The financial account token of the operating account to fund the micro deposits */
    @JsonProperty("financial_account_token")
    @ExcludeMissing
    fun _financialAccountToken() = financialAccountToken

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

    /** Verification Method */
    @JsonProperty("verification_method")
    @ExcludeMissing
    fun _verificationMethod() = verificationMethod

    /** Owner Type */
    @JsonProperty("owner_type") @ExcludeMissing fun _ownerType() = ownerType

    /** Account State */
    @JsonProperty("state") @ExcludeMissing fun _state() = state

    /** Verification State */
    @JsonProperty("verification_state") @ExcludeMissing fun _verificationState() = verificationState

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

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

    fun validate(): ExternalBankAccountRetrieveResponse = apply {
        if (!validated) {
            token()
            owner()
            routingNumber()
            lastFour()
            name()
            currency()
            country()
            accountToken()
            created()
            companyId()
            dob()
            doingBusinessAs()
            userDefinedId()
            verificationFailedReason()
            verificationAttempts()
            financialAccountToken()
            type()
            verificationMethod()
            ownerType()
            state()
            verificationState()
            address()?.validate()
            validated = true
        }
    }

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

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

        return other is ExternalBankAccountRetrieveResponse &&
            this.token == other.token &&
            this.owner == other.owner &&
            this.routingNumber == other.routingNumber &&
            this.lastFour == other.lastFour &&
            this.name == other.name &&
            this.currency == other.currency &&
            this.country == other.country &&
            this.accountToken == other.accountToken &&
            this.created == other.created &&
            this.companyId == other.companyId &&
            this.dob == other.dob &&
            this.doingBusinessAs == other.doingBusinessAs &&
            this.userDefinedId == other.userDefinedId &&
            this.verificationFailedReason == other.verificationFailedReason &&
            this.verificationAttempts == other.verificationAttempts &&
            this.financialAccountToken == other.financialAccountToken &&
            this.type == other.type &&
            this.verificationMethod == other.verificationMethod &&
            this.ownerType == other.ownerType &&
            this.state == other.state &&
            this.verificationState == other.verificationState &&
            this.address == other.address &&
            this.additionalProperties == other.additionalProperties
    }

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode =
                Objects.hash(
                    token,
                    owner,
                    routingNumber,
                    lastFour,
                    name,
                    currency,
                    country,
                    accountToken,
                    created,
                    companyId,
                    dob,
                    doingBusinessAs,
                    userDefinedId,
                    verificationFailedReason,
                    verificationAttempts,
                    financialAccountToken,
                    type,
                    verificationMethod,
                    ownerType,
                    state,
                    verificationState,
                    address,
                    additionalProperties,
                )
        }
        return hashCode
    }

    override fun toString() =
        "ExternalBankAccountRetrieveResponse{token=$token, owner=$owner, routingNumber=$routingNumber, lastFour=$lastFour, name=$name, currency=$currency, country=$country, accountToken=$accountToken, created=$created, companyId=$companyId, dob=$dob, doingBusinessAs=$doingBusinessAs, userDefinedId=$userDefinedId, verificationFailedReason=$verificationFailedReason, verificationAttempts=$verificationAttempts, financialAccountToken=$financialAccountToken, type=$type, verificationMethod=$verificationMethod, ownerType=$ownerType, state=$state, verificationState=$verificationState, address=$address, additionalProperties=$additionalProperties}"

    companion object {

        fun builder() = Builder()
    }

    class Builder {

        private var token: JsonField = JsonMissing.of()
        private var owner: JsonField = JsonMissing.of()
        private var routingNumber: JsonField = JsonMissing.of()
        private var lastFour: JsonField = JsonMissing.of()
        private var name: JsonField = JsonMissing.of()
        private var currency: JsonField = JsonMissing.of()
        private var country: JsonField = JsonMissing.of()
        private var accountToken: JsonField = JsonMissing.of()
        private var created: JsonField = JsonMissing.of()
        private var companyId: JsonField = JsonMissing.of()
        private var dob: JsonField = JsonMissing.of()
        private var doingBusinessAs: JsonField = JsonMissing.of()
        private var userDefinedId: JsonField = JsonMissing.of()
        private var verificationFailedReason: JsonField = JsonMissing.of()
        private var verificationAttempts: JsonField = JsonMissing.of()
        private var financialAccountToken: JsonField = JsonMissing.of()
        private var type: JsonField = JsonMissing.of()
        private var verificationMethod: JsonField = JsonMissing.of()
        private var ownerType: JsonField = JsonMissing.of()
        private var state: JsonField = JsonMissing.of()
        private var verificationState: JsonField = JsonMissing.of()
        private var address: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        internal fun from(
            externalBankAccountRetrieveResponse: ExternalBankAccountRetrieveResponse
        ) = apply {
            this.token = externalBankAccountRetrieveResponse.token
            this.owner = externalBankAccountRetrieveResponse.owner
            this.routingNumber = externalBankAccountRetrieveResponse.routingNumber
            this.lastFour = externalBankAccountRetrieveResponse.lastFour
            this.name = externalBankAccountRetrieveResponse.name
            this.currency = externalBankAccountRetrieveResponse.currency
            this.country = externalBankAccountRetrieveResponse.country
            this.accountToken = externalBankAccountRetrieveResponse.accountToken
            this.created = externalBankAccountRetrieveResponse.created
            this.companyId = externalBankAccountRetrieveResponse.companyId
            this.dob = externalBankAccountRetrieveResponse.dob
            this.doingBusinessAs = externalBankAccountRetrieveResponse.doingBusinessAs
            this.userDefinedId = externalBankAccountRetrieveResponse.userDefinedId
            this.verificationFailedReason =
                externalBankAccountRetrieveResponse.verificationFailedReason
            this.verificationAttempts = externalBankAccountRetrieveResponse.verificationAttempts
            this.financialAccountToken = externalBankAccountRetrieveResponse.financialAccountToken
            this.type = externalBankAccountRetrieveResponse.type
            this.verificationMethod = externalBankAccountRetrieveResponse.verificationMethod
            this.ownerType = externalBankAccountRetrieveResponse.ownerType
            this.state = externalBankAccountRetrieveResponse.state
            this.verificationState = externalBankAccountRetrieveResponse.verificationState
            this.address = externalBankAccountRetrieveResponse.address
            additionalProperties(externalBankAccountRetrieveResponse.additionalProperties)
        }

        /**
         * A globally unique identifier for this record of an external bank account association. If
         * a program links an external bank account to more than one end-user or to both the program
         * and the end-user, then Lithic will return each record of the association
         */
        fun token(token: String) = token(JsonField.of(token))

        /**
         * A globally unique identifier for this record of an external bank account association. If
         * a program links an external bank account to more than one end-user or to both the program
         * and the end-user, then Lithic will return each record of the association
         */
        @JsonProperty("token")
        @ExcludeMissing
        fun token(token: JsonField) = apply { this.token = token }

        /**
         * Legal Name of the business or individual who owns the external account. This will appear
         * in statements
         */
        fun owner(owner: String) = owner(JsonField.of(owner))

        /**
         * Legal Name of the business or individual who owns the external account. This will appear
         * in statements
         */
        @JsonProperty("owner")
        @ExcludeMissing
        fun owner(owner: JsonField) = apply { this.owner = owner }

        /** Routing Number */
        fun routingNumber(routingNumber: String) = routingNumber(JsonField.of(routingNumber))

        /** Routing Number */
        @JsonProperty("routing_number")
        @ExcludeMissing
        fun routingNumber(routingNumber: JsonField) = apply {
            this.routingNumber = routingNumber
        }

        /**
         * The last 4 digits of the bank account. Derived by Lithic from the account number passed
         */
        fun lastFour(lastFour: String) = lastFour(JsonField.of(lastFour))

        /**
         * The last 4 digits of the bank account. Derived by Lithic from the account number passed
         */
        @JsonProperty("last_four")
        @ExcludeMissing
        fun lastFour(lastFour: JsonField) = apply { this.lastFour = lastFour }

        /** The nickname for this External Bank Account */
        fun name(name: String) = name(JsonField.of(name))

        /** The nickname for this External Bank Account */
        @JsonProperty("name")
        @ExcludeMissing
        fun name(name: JsonField) = apply { this.name = name }

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

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

        /**
         * The country that the bank account is located in using ISO 3166-1. We will only accept USA
         * bank accounts e.g., USA
         */
        fun country(country: String) = country(JsonField.of(country))

        /**
         * The country that the bank account is located in using ISO 3166-1. We will only accept USA
         * bank accounts e.g., USA
         */
        @JsonProperty("country")
        @ExcludeMissing
        fun country(country: JsonField) = apply { this.country = country }

        /**
         * Indicates which Lithic account the external account is associated with. For external
         * accounts that are associated with the program, account_token field returned will be null
         */
        fun accountToken(accountToken: String) = accountToken(JsonField.of(accountToken))

        /**
         * Indicates which Lithic account the external account is associated with. For external
         * accounts that are associated with the program, account_token field returned will be null
         */
        @JsonProperty("account_token")
        @ExcludeMissing
        fun accountToken(accountToken: JsonField) = apply {
            this.accountToken = accountToken
        }

        /**
         * An ISO 8601 string representing when this funding source was added to the Lithic account.
         */
        fun created(created: OffsetDateTime) = created(JsonField.of(created))

        /**
         * An ISO 8601 string representing when this funding source was added to the Lithic account.
         */
        @JsonProperty("created")
        @ExcludeMissing
        fun created(created: JsonField) = apply { this.created = created }

        /** Optional field that helps identify bank accounts in receipts */
        fun companyId(companyId: String) = companyId(JsonField.of(companyId))

        /** Optional field that helps identify bank accounts in receipts */
        @JsonProperty("company_id")
        @ExcludeMissing
        fun companyId(companyId: JsonField) = apply { this.companyId = companyId }

        /** Date of Birth of the Individual that owns the external bank account */
        fun dob(dob: LocalDate) = dob(JsonField.of(dob))

        /** Date of Birth of the Individual that owns the external bank account */
        @JsonProperty("dob")
        @ExcludeMissing
        fun dob(dob: JsonField) = apply { this.dob = dob }

        /** Doing Business As */
        fun doingBusinessAs(doingBusinessAs: String) =
            doingBusinessAs(JsonField.of(doingBusinessAs))

        /** Doing Business As */
        @JsonProperty("doing_business_as")
        @ExcludeMissing
        fun doingBusinessAs(doingBusinessAs: JsonField) = apply {
            this.doingBusinessAs = doingBusinessAs
        }

        /** User Defined ID */
        fun userDefinedId(userDefinedId: String) = userDefinedId(JsonField.of(userDefinedId))

        /** User Defined ID */
        @JsonProperty("user_defined_id")
        @ExcludeMissing
        fun userDefinedId(userDefinedId: JsonField) = apply {
            this.userDefinedId = userDefinedId
        }

        /**
         * Optional free text description of the reason for the failed verification. For ACH
         * micro-deposits returned, this field will display the reason return code sent by the ACH
         * network
         */
        fun verificationFailedReason(verificationFailedReason: String) =
            verificationFailedReason(JsonField.of(verificationFailedReason))

        /**
         * Optional free text description of the reason for the failed verification. For ACH
         * micro-deposits returned, this field will display the reason return code sent by the ACH
         * network
         */
        @JsonProperty("verification_failed_reason")
        @ExcludeMissing
        fun verificationFailedReason(verificationFailedReason: JsonField) = apply {
            this.verificationFailedReason = verificationFailedReason
        }

        /** The number of attempts at verification */
        fun verificationAttempts(verificationAttempts: Long) =
            verificationAttempts(JsonField.of(verificationAttempts))

        /** The number of attempts at verification */
        @JsonProperty("verification_attempts")
        @ExcludeMissing
        fun verificationAttempts(verificationAttempts: JsonField) = apply {
            this.verificationAttempts = verificationAttempts
        }

        /** The financial account token of the operating account to fund the micro deposits */
        fun financialAccountToken(financialAccountToken: String) =
            financialAccountToken(JsonField.of(financialAccountToken))

        /** The financial account token of the operating account to fund the micro deposits */
        @JsonProperty("financial_account_token")
        @ExcludeMissing
        fun financialAccountToken(financialAccountToken: JsonField) = apply {
            this.financialAccountToken = financialAccountToken
        }

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

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

        /** Verification Method */
        fun verificationMethod(verificationMethod: VerificationMethod) =
            verificationMethod(JsonField.of(verificationMethod))

        /** Verification Method */
        @JsonProperty("verification_method")
        @ExcludeMissing
        fun verificationMethod(verificationMethod: JsonField) = apply {
            this.verificationMethod = verificationMethod
        }

        /** Owner Type */
        fun ownerType(ownerType: OwnerType) = ownerType(JsonField.of(ownerType))

        /** Owner Type */
        @JsonProperty("owner_type")
        @ExcludeMissing
        fun ownerType(ownerType: JsonField) = apply { this.ownerType = ownerType }

        /** Account State */
        fun state(state: State) = state(JsonField.of(state))

        /** Account State */
        @JsonProperty("state")
        @ExcludeMissing
        fun state(state: JsonField) = apply { this.state = state }

        /** Verification State */
        fun verificationState(verificationState: VerificationState) =
            verificationState(JsonField.of(verificationState))

        /** Verification State */
        @JsonProperty("verification_state")
        @ExcludeMissing
        fun verificationState(verificationState: JsonField) = apply {
            this.verificationState = verificationState
        }

        /** Address */
        fun address(address: ExternalBankAccountAddress) = address(JsonField.of(address))

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

        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(): ExternalBankAccountRetrieveResponse =
            ExternalBankAccountRetrieveResponse(
                token,
                owner,
                routingNumber,
                lastFour,
                name,
                currency,
                country,
                accountToken,
                created,
                companyId,
                dob,
                doingBusinessAs,
                userDefinedId,
                verificationFailedReason,
                verificationAttempts,
                financialAccountToken,
                type,
                verificationMethod,
                ownerType,
                state,
                verificationState,
                address,
                additionalProperties.toUnmodifiable(),
            )
    }

    class OwnerType
    @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 other is OwnerType && this.value == other.value
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val BUSINESS = OwnerType(JsonField.of("BUSINESS"))

            val INDIVIDUAL = OwnerType(JsonField.of("INDIVIDUAL"))

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

        enum class Known {
            BUSINESS,
            INDIVIDUAL,
        }

        enum class Value {
            BUSINESS,
            INDIVIDUAL,
            _UNKNOWN,
        }

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

        fun known(): Known =
            when (this) {
                BUSINESS -> Known.BUSINESS
                INDIVIDUAL -> Known.INDIVIDUAL
                else -> throw LithicInvalidDataException("Unknown OwnerType: $value")
            }

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

    class State
    @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 other is State && this.value == other.value
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            val ENABLED = State(JsonField.of("ENABLED"))

            val CLOSED = State(JsonField.of("CLOSED"))

            val PAUSED = State(JsonField.of("PAUSED"))

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

        enum class Known {
            ENABLED,
            CLOSED,
            PAUSED,
        }

        enum class Value {
            ENABLED,
            CLOSED,
            PAUSED,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                ENABLED -> Value.ENABLED
                CLOSED -> Value.CLOSED
                PAUSED -> Value.PAUSED
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                ENABLED -> Known.ENABLED
                CLOSED -> Known.CLOSED
                PAUSED -> Known.PAUSED
                else -> throw LithicInvalidDataException("Unknown State: $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 other is Type && this.value == other.value
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

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

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

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

        enum class Known {
            CHECKING,
            SAVINGS,
        }

        enum class Value {
            CHECKING,
            SAVINGS,
            _UNKNOWN,
        }

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

        fun known(): Known =
            when (this) {
                CHECKING -> Known.CHECKING
                SAVINGS -> Known.SAVINGS
                else -> throw LithicInvalidDataException("Unknown Type: $value")
            }

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

    class VerificationMethod
    @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 other is VerificationMethod && this.value == other.value
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

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

            val MICRO_DEPOSIT = VerificationMethod(JsonField.of("MICRO_DEPOSIT"))

            val PLAID = VerificationMethod(JsonField.of("PLAID"))

            val PRENOTE = VerificationMethod(JsonField.of("PRENOTE"))

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

        enum class Known {
            MANUAL,
            MICRO_DEPOSIT,
            PLAID,
            PRENOTE,
        }

        enum class Value {
            MANUAL,
            MICRO_DEPOSIT,
            PLAID,
            PRENOTE,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                MANUAL -> Value.MANUAL
                MICRO_DEPOSIT -> Value.MICRO_DEPOSIT
                PLAID -> Value.PLAID
                PRENOTE -> Value.PRENOTE
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                MANUAL -> Known.MANUAL
                MICRO_DEPOSIT -> Known.MICRO_DEPOSIT
                PLAID -> Known.PLAID
                PRENOTE -> Known.PRENOTE
                else -> throw LithicInvalidDataException("Unknown VerificationMethod: $value")
            }

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

    class VerificationState
    @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 other is VerificationState && this.value == other.value
        }

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

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

            val ENABLED = VerificationState(JsonField.of("ENABLED"))

            val FAILED_VERIFICATION = VerificationState(JsonField.of("FAILED_VERIFICATION"))

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

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

        enum class Known {
            PENDING,
            ENABLED,
            FAILED_VERIFICATION,
            INSUFFICIENT_FUNDS,
        }

        enum class Value {
            PENDING,
            ENABLED,
            FAILED_VERIFICATION,
            INSUFFICIENT_FUNDS,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                PENDING -> Value.PENDING
                ENABLED -> Value.ENABLED
                FAILED_VERIFICATION -> Value.FAILED_VERIFICATION
                INSUFFICIENT_FUNDS -> Value.INSUFFICIENT_FUNDS
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                PENDING -> Known.PENDING
                ENABLED -> Known.ENABLED
                FAILED_VERIFICATION -> Known.FAILED_VERIFICATION
                INSUFFICIENT_FUNDS -> Known.INSUFFICIENT_FUNDS
                else -> throw LithicInvalidDataException("Unknown VerificationState: $value")
            }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy