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

com.lithic.api.models.Statement.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 = Statement.Builder::class)
@NoAutoDetect
class Statement
private constructor(
    private val token: JsonField,
    private val financialAccountToken: JsonField,
    private val statementStartDate: JsonField,
    private val statementEndDate: JsonField,
    private val nextStatementEndDate: JsonField,
    private val paymentDueDate: JsonField,
    private val nextPaymentDueDate: JsonField,
    private val daysInBillingCycle: JsonField,
    private val creditLimit: JsonField,
    private val availableCredit: JsonField,
    private val startingBalance: JsonField,
    private val endingBalance: JsonField,
    private val amountDue: JsonField,
    private val amountPastDue: JsonField,
    private val periodTotals: JsonField,
    private val ytdTotals: JsonField,
    private val created: JsonField,
    private val updated: JsonField,
    private val creditProductToken: JsonField,
    private val accountStanding: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    private var hashCode: Int = 0

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

    /** Globally unique identifier for a financial account */
    fun financialAccountToken(): String =
        financialAccountToken.getRequired("financial_account_token")

    /** Date when the billing period began */
    fun statementStartDate(): LocalDate = statementStartDate.getRequired("statement_start_date")

    /** Date when the billing period ended */
    fun statementEndDate(): LocalDate = statementEndDate.getRequired("statement_end_date")

    /** Date when the next billing period will end */
    fun nextStatementEndDate(): LocalDate? =
        nextStatementEndDate.getNullable("next_statement_end_date")

    /** Date when the payment is due */
    fun paymentDueDate(): LocalDate = paymentDueDate.getRequired("payment_due_date")

    /** Date when the next payment is due */
    fun nextPaymentDueDate(): LocalDate? = nextPaymentDueDate.getNullable("next_payment_due_date")

    /** Number of days in the billing cycle */
    fun daysInBillingCycle(): Long = daysInBillingCycle.getRequired("days_in_billing_cycle")

    /**
     * For prepay accounts, this is the minimum prepay balance that must be maintained. For charge
     * card accounts, this is the maximum credit balance extended by a lender.
     */
    fun creditLimit(): Long = creditLimit.getRequired("credit_limit")

    /** Amount of credit available to spend */
    fun availableCredit(): Long = availableCredit.getRequired("available_credit")

    /** Balance at the start of the billing period */
    fun startingBalance(): Long = startingBalance.getRequired("starting_balance")

    /**
     * Balance at the end of the billing period. For charge cards, this should be the same at the
     * statement amount due.
     */
    fun endingBalance(): Long = endingBalance.getRequired("ending_balance")

    /**
     * Payment due at the end of the billing period. Negative amount indicates something is owed. If
     * the amount owed is positive (e.g., there was a net credit), then payment should be returned
     * to the cardholder via ACH.
     */
    fun amountDue(): Long = amountDue.getRequired("amount_due")

    /** Payment past due at the end of the billing period. */
    fun amountPastDue(): Long = amountPastDue.getRequired("amount_past_due")

    fun periodTotals(): StatementTotals = periodTotals.getRequired("period_totals")

    fun ytdTotals(): StatementTotals = ytdTotals.getRequired("ytd_totals")

    /** Timestamp of when the statement was created */
    fun created(): OffsetDateTime = created.getRequired("created")

    /** Timestamp of when the statement was updated */
    fun updated(): OffsetDateTime = updated.getRequired("updated")

    /** Globally unique identifier for a credit product */
    fun creditProductToken(): String = creditProductToken.getRequired("credit_product_token")

    fun accountStanding(): AccountStanding = accountStanding.getRequired("account_standing")

    /** Globally unique identifier for a statement */
    @JsonProperty("token") @ExcludeMissing fun _token() = token

    /** Globally unique identifier for a financial account */
    @JsonProperty("financial_account_token")
    @ExcludeMissing
    fun _financialAccountToken() = financialAccountToken

    /** Date when the billing period began */
    @JsonProperty("statement_start_date")
    @ExcludeMissing
    fun _statementStartDate() = statementStartDate

    /** Date when the billing period ended */
    @JsonProperty("statement_end_date") @ExcludeMissing fun _statementEndDate() = statementEndDate

    /** Date when the next billing period will end */
    @JsonProperty("next_statement_end_date")
    @ExcludeMissing
    fun _nextStatementEndDate() = nextStatementEndDate

    /** Date when the payment is due */
    @JsonProperty("payment_due_date") @ExcludeMissing fun _paymentDueDate() = paymentDueDate

    /** Date when the next payment is due */
    @JsonProperty("next_payment_due_date")
    @ExcludeMissing
    fun _nextPaymentDueDate() = nextPaymentDueDate

    /** Number of days in the billing cycle */
    @JsonProperty("days_in_billing_cycle")
    @ExcludeMissing
    fun _daysInBillingCycle() = daysInBillingCycle

    /**
     * For prepay accounts, this is the minimum prepay balance that must be maintained. For charge
     * card accounts, this is the maximum credit balance extended by a lender.
     */
    @JsonProperty("credit_limit") @ExcludeMissing fun _creditLimit() = creditLimit

    /** Amount of credit available to spend */
    @JsonProperty("available_credit") @ExcludeMissing fun _availableCredit() = availableCredit

    /** Balance at the start of the billing period */
    @JsonProperty("starting_balance") @ExcludeMissing fun _startingBalance() = startingBalance

    /**
     * Balance at the end of the billing period. For charge cards, this should be the same at the
     * statement amount due.
     */
    @JsonProperty("ending_balance") @ExcludeMissing fun _endingBalance() = endingBalance

    /**
     * Payment due at the end of the billing period. Negative amount indicates something is owed. If
     * the amount owed is positive (e.g., there was a net credit), then payment should be returned
     * to the cardholder via ACH.
     */
    @JsonProperty("amount_due") @ExcludeMissing fun _amountDue() = amountDue

    /** Payment past due at the end of the billing period. */
    @JsonProperty("amount_past_due") @ExcludeMissing fun _amountPastDue() = amountPastDue

    @JsonProperty("period_totals") @ExcludeMissing fun _periodTotals() = periodTotals

    @JsonProperty("ytd_totals") @ExcludeMissing fun _ytdTotals() = ytdTotals

    /** Timestamp of when the statement was created */
    @JsonProperty("created") @ExcludeMissing fun _created() = created

    /** Timestamp of when the statement was updated */
    @JsonProperty("updated") @ExcludeMissing fun _updated() = updated

    /** Globally unique identifier for a credit product */
    @JsonProperty("credit_product_token")
    @ExcludeMissing
    fun _creditProductToken() = creditProductToken

    @JsonProperty("account_standing") @ExcludeMissing fun _accountStanding() = accountStanding

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

    fun validate(): Statement = apply {
        if (!validated) {
            token()
            financialAccountToken()
            statementStartDate()
            statementEndDate()
            nextStatementEndDate()
            paymentDueDate()
            nextPaymentDueDate()
            daysInBillingCycle()
            creditLimit()
            availableCredit()
            startingBalance()
            endingBalance()
            amountDue()
            amountPastDue()
            periodTotals().validate()
            ytdTotals().validate()
            created()
            updated()
            creditProductToken()
            accountStanding().validate()
            validated = true
        }
    }

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

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

        return other is Statement &&
            this.token == other.token &&
            this.financialAccountToken == other.financialAccountToken &&
            this.statementStartDate == other.statementStartDate &&
            this.statementEndDate == other.statementEndDate &&
            this.nextStatementEndDate == other.nextStatementEndDate &&
            this.paymentDueDate == other.paymentDueDate &&
            this.nextPaymentDueDate == other.nextPaymentDueDate &&
            this.daysInBillingCycle == other.daysInBillingCycle &&
            this.creditLimit == other.creditLimit &&
            this.availableCredit == other.availableCredit &&
            this.startingBalance == other.startingBalance &&
            this.endingBalance == other.endingBalance &&
            this.amountDue == other.amountDue &&
            this.amountPastDue == other.amountPastDue &&
            this.periodTotals == other.periodTotals &&
            this.ytdTotals == other.ytdTotals &&
            this.created == other.created &&
            this.updated == other.updated &&
            this.creditProductToken == other.creditProductToken &&
            this.accountStanding == other.accountStanding &&
            this.additionalProperties == other.additionalProperties
    }

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode =
                Objects.hash(
                    token,
                    financialAccountToken,
                    statementStartDate,
                    statementEndDate,
                    nextStatementEndDate,
                    paymentDueDate,
                    nextPaymentDueDate,
                    daysInBillingCycle,
                    creditLimit,
                    availableCredit,
                    startingBalance,
                    endingBalance,
                    amountDue,
                    amountPastDue,
                    periodTotals,
                    ytdTotals,
                    created,
                    updated,
                    creditProductToken,
                    accountStanding,
                    additionalProperties,
                )
        }
        return hashCode
    }

    override fun toString() =
        "Statement{token=$token, financialAccountToken=$financialAccountToken, statementStartDate=$statementStartDate, statementEndDate=$statementEndDate, nextStatementEndDate=$nextStatementEndDate, paymentDueDate=$paymentDueDate, nextPaymentDueDate=$nextPaymentDueDate, daysInBillingCycle=$daysInBillingCycle, creditLimit=$creditLimit, availableCredit=$availableCredit, startingBalance=$startingBalance, endingBalance=$endingBalance, amountDue=$amountDue, amountPastDue=$amountPastDue, periodTotals=$periodTotals, ytdTotals=$ytdTotals, created=$created, updated=$updated, creditProductToken=$creditProductToken, accountStanding=$accountStanding, additionalProperties=$additionalProperties}"

    companion object {

        fun builder() = Builder()
    }

    class Builder {

        private var token: JsonField = JsonMissing.of()
        private var financialAccountToken: JsonField = JsonMissing.of()
        private var statementStartDate: JsonField = JsonMissing.of()
        private var statementEndDate: JsonField = JsonMissing.of()
        private var nextStatementEndDate: JsonField = JsonMissing.of()
        private var paymentDueDate: JsonField = JsonMissing.of()
        private var nextPaymentDueDate: JsonField = JsonMissing.of()
        private var daysInBillingCycle: JsonField = JsonMissing.of()
        private var creditLimit: JsonField = JsonMissing.of()
        private var availableCredit: JsonField = JsonMissing.of()
        private var startingBalance: JsonField = JsonMissing.of()
        private var endingBalance: JsonField = JsonMissing.of()
        private var amountDue: JsonField = JsonMissing.of()
        private var amountPastDue: JsonField = JsonMissing.of()
        private var periodTotals: JsonField = JsonMissing.of()
        private var ytdTotals: JsonField = JsonMissing.of()
        private var created: JsonField = JsonMissing.of()
        private var updated: JsonField = JsonMissing.of()
        private var creditProductToken: JsonField = JsonMissing.of()
        private var accountStanding: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        internal fun from(statement: Statement) = apply {
            this.token = statement.token
            this.financialAccountToken = statement.financialAccountToken
            this.statementStartDate = statement.statementStartDate
            this.statementEndDate = statement.statementEndDate
            this.nextStatementEndDate = statement.nextStatementEndDate
            this.paymentDueDate = statement.paymentDueDate
            this.nextPaymentDueDate = statement.nextPaymentDueDate
            this.daysInBillingCycle = statement.daysInBillingCycle
            this.creditLimit = statement.creditLimit
            this.availableCredit = statement.availableCredit
            this.startingBalance = statement.startingBalance
            this.endingBalance = statement.endingBalance
            this.amountDue = statement.amountDue
            this.amountPastDue = statement.amountPastDue
            this.periodTotals = statement.periodTotals
            this.ytdTotals = statement.ytdTotals
            this.created = statement.created
            this.updated = statement.updated
            this.creditProductToken = statement.creditProductToken
            this.accountStanding = statement.accountStanding
            additionalProperties(statement.additionalProperties)
        }

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

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

        /** Globally unique identifier for a financial account */
        fun financialAccountToken(financialAccountToken: String) =
            financialAccountToken(JsonField.of(financialAccountToken))

        /** Globally unique identifier for a financial account */
        @JsonProperty("financial_account_token")
        @ExcludeMissing
        fun financialAccountToken(financialAccountToken: JsonField) = apply {
            this.financialAccountToken = financialAccountToken
        }

        /** Date when the billing period began */
        fun statementStartDate(statementStartDate: LocalDate) =
            statementStartDate(JsonField.of(statementStartDate))

        /** Date when the billing period began */
        @JsonProperty("statement_start_date")
        @ExcludeMissing
        fun statementStartDate(statementStartDate: JsonField) = apply {
            this.statementStartDate = statementStartDate
        }

        /** Date when the billing period ended */
        fun statementEndDate(statementEndDate: LocalDate) =
            statementEndDate(JsonField.of(statementEndDate))

        /** Date when the billing period ended */
        @JsonProperty("statement_end_date")
        @ExcludeMissing
        fun statementEndDate(statementEndDate: JsonField) = apply {
            this.statementEndDate = statementEndDate
        }

        /** Date when the next billing period will end */
        fun nextStatementEndDate(nextStatementEndDate: LocalDate) =
            nextStatementEndDate(JsonField.of(nextStatementEndDate))

        /** Date when the next billing period will end */
        @JsonProperty("next_statement_end_date")
        @ExcludeMissing
        fun nextStatementEndDate(nextStatementEndDate: JsonField) = apply {
            this.nextStatementEndDate = nextStatementEndDate
        }

        /** Date when the payment is due */
        fun paymentDueDate(paymentDueDate: LocalDate) = paymentDueDate(JsonField.of(paymentDueDate))

        /** Date when the payment is due */
        @JsonProperty("payment_due_date")
        @ExcludeMissing
        fun paymentDueDate(paymentDueDate: JsonField) = apply {
            this.paymentDueDate = paymentDueDate
        }

        /** Date when the next payment is due */
        fun nextPaymentDueDate(nextPaymentDueDate: LocalDate) =
            nextPaymentDueDate(JsonField.of(nextPaymentDueDate))

        /** Date when the next payment is due */
        @JsonProperty("next_payment_due_date")
        @ExcludeMissing
        fun nextPaymentDueDate(nextPaymentDueDate: JsonField) = apply {
            this.nextPaymentDueDate = nextPaymentDueDate
        }

        /** Number of days in the billing cycle */
        fun daysInBillingCycle(daysInBillingCycle: Long) =
            daysInBillingCycle(JsonField.of(daysInBillingCycle))

        /** Number of days in the billing cycle */
        @JsonProperty("days_in_billing_cycle")
        @ExcludeMissing
        fun daysInBillingCycle(daysInBillingCycle: JsonField) = apply {
            this.daysInBillingCycle = daysInBillingCycle
        }

        /**
         * For prepay accounts, this is the minimum prepay balance that must be maintained. For
         * charge card accounts, this is the maximum credit balance extended by a lender.
         */
        fun creditLimit(creditLimit: Long) = creditLimit(JsonField.of(creditLimit))

        /**
         * For prepay accounts, this is the minimum prepay balance that must be maintained. For
         * charge card accounts, this is the maximum credit balance extended by a lender.
         */
        @JsonProperty("credit_limit")
        @ExcludeMissing
        fun creditLimit(creditLimit: JsonField) = apply { this.creditLimit = creditLimit }

        /** Amount of credit available to spend */
        fun availableCredit(availableCredit: Long) = availableCredit(JsonField.of(availableCredit))

        /** Amount of credit available to spend */
        @JsonProperty("available_credit")
        @ExcludeMissing
        fun availableCredit(availableCredit: JsonField) = apply {
            this.availableCredit = availableCredit
        }

        /** Balance at the start of the billing period */
        fun startingBalance(startingBalance: Long) = startingBalance(JsonField.of(startingBalance))

        /** Balance at the start of the billing period */
        @JsonProperty("starting_balance")
        @ExcludeMissing
        fun startingBalance(startingBalance: JsonField) = apply {
            this.startingBalance = startingBalance
        }

        /**
         * Balance at the end of the billing period. For charge cards, this should be the same at
         * the statement amount due.
         */
        fun endingBalance(endingBalance: Long) = endingBalance(JsonField.of(endingBalance))

        /**
         * Balance at the end of the billing period. For charge cards, this should be the same at
         * the statement amount due.
         */
        @JsonProperty("ending_balance")
        @ExcludeMissing
        fun endingBalance(endingBalance: JsonField) = apply {
            this.endingBalance = endingBalance
        }

        /**
         * Payment due at the end of the billing period. Negative amount indicates something is
         * owed. If the amount owed is positive (e.g., there was a net credit), then payment should
         * be returned to the cardholder via ACH.
         */
        fun amountDue(amountDue: Long) = amountDue(JsonField.of(amountDue))

        /**
         * Payment due at the end of the billing period. Negative amount indicates something is
         * owed. If the amount owed is positive (e.g., there was a net credit), then payment should
         * be returned to the cardholder via ACH.
         */
        @JsonProperty("amount_due")
        @ExcludeMissing
        fun amountDue(amountDue: JsonField) = apply { this.amountDue = amountDue }

        /** Payment past due at the end of the billing period. */
        fun amountPastDue(amountPastDue: Long) = amountPastDue(JsonField.of(amountPastDue))

        /** Payment past due at the end of the billing period. */
        @JsonProperty("amount_past_due")
        @ExcludeMissing
        fun amountPastDue(amountPastDue: JsonField) = apply {
            this.amountPastDue = amountPastDue
        }

        fun periodTotals(periodTotals: StatementTotals) = periodTotals(JsonField.of(periodTotals))

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

        fun ytdTotals(ytdTotals: StatementTotals) = ytdTotals(JsonField.of(ytdTotals))

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

        /** Timestamp of when the statement was created */
        fun created(created: OffsetDateTime) = created(JsonField.of(created))

        /** Timestamp of when the statement was created */
        @JsonProperty("created")
        @ExcludeMissing
        fun created(created: JsonField) = apply { this.created = created }

        /** Timestamp of when the statement was updated */
        fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))

        /** Timestamp of when the statement was updated */
        @JsonProperty("updated")
        @ExcludeMissing
        fun updated(updated: JsonField) = apply { this.updated = updated }

        /** Globally unique identifier for a credit product */
        fun creditProductToken(creditProductToken: String) =
            creditProductToken(JsonField.of(creditProductToken))

        /** Globally unique identifier for a credit product */
        @JsonProperty("credit_product_token")
        @ExcludeMissing
        fun creditProductToken(creditProductToken: JsonField) = apply {
            this.creditProductToken = creditProductToken
        }

        fun accountStanding(accountStanding: AccountStanding) =
            accountStanding(JsonField.of(accountStanding))

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

        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(): Statement =
            Statement(
                token,
                financialAccountToken,
                statementStartDate,
                statementEndDate,
                nextStatementEndDate,
                paymentDueDate,
                nextPaymentDueDate,
                daysInBillingCycle,
                creditLimit,
                availableCredit,
                startingBalance,
                endingBalance,
                amountDue,
                amountPastDue,
                periodTotals,
                ytdTotals,
                created,
                updated,
                creditProductToken,
                accountStanding,
                additionalProperties.toUnmodifiable(),
            )
    }

    @JsonDeserialize(builder = AccountStanding.Builder::class)
    @NoAutoDetect
    class AccountStanding
    private constructor(
        private val periodState: JsonField,
        private val periodNumber: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        private var hashCode: Int = 0

        fun periodState(): PeriodState = periodState.getRequired("period_state")

        /** Current overall period number */
        fun periodNumber(): Long = periodNumber.getRequired("period_number")

        @JsonProperty("period_state") @ExcludeMissing fun _periodState() = periodState

        /** Current overall period number */
        @JsonProperty("period_number") @ExcludeMissing fun _periodNumber() = periodNumber

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

        fun validate(): AccountStanding = apply {
            if (!validated) {
                periodState()
                periodNumber()
                validated = true
            }
        }

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

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

            return other is AccountStanding &&
                this.periodState == other.periodState &&
                this.periodNumber == other.periodNumber &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        periodState,
                        periodNumber,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "AccountStanding{periodState=$periodState, periodNumber=$periodNumber, additionalProperties=$additionalProperties}"

        companion object {

            fun builder() = Builder()
        }

        class Builder {

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

            internal fun from(accountStanding: AccountStanding) = apply {
                this.periodState = accountStanding.periodState
                this.periodNumber = accountStanding.periodNumber
                additionalProperties(accountStanding.additionalProperties)
            }

            fun periodState(periodState: PeriodState) = periodState(JsonField.of(periodState))

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

            /** Current overall period number */
            fun periodNumber(periodNumber: Long) = periodNumber(JsonField.of(periodNumber))

            /** Current overall period number */
            @JsonProperty("period_number")
            @ExcludeMissing
            fun periodNumber(periodNumber: JsonField) = apply {
                this.periodNumber = periodNumber
            }

            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(): AccountStanding =
                AccountStanding(
                    periodState,
                    periodNumber,
                    additionalProperties.toUnmodifiable(),
                )
        }

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

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                val STANDARD = PeriodState(JsonField.of("STANDARD"))

                val PROMO = PeriodState(JsonField.of("PROMO"))

                val PENALTY = PeriodState(JsonField.of("PENALTY"))

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

            enum class Known {
                STANDARD,
                PROMO,
                PENALTY,
            }

            enum class Value {
                STANDARD,
                PROMO,
                PENALTY,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    STANDARD -> Value.STANDARD
                    PROMO -> Value.PROMO
                    PENALTY -> Value.PENALTY
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    STANDARD -> Known.STANDARD
                    PROMO -> Known.PROMO
                    PENALTY -> Known.PENALTY
                    else -> throw LithicInvalidDataException("Unknown PeriodState: $value")
                }

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

    @JsonDeserialize(builder = StatementTotals.Builder::class)
    @NoAutoDetect
    class StatementTotals
    private constructor(
        private val payments: JsonField,
        private val purchases: JsonField,
        private val fees: JsonField,
        private val credits: JsonField,
        private val interest: JsonField,
        private val cashAdvances: JsonField,
        private val balanceTransfers: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        private var hashCode: Int = 0

        fun payments(): Long = payments.getRequired("payments")

        fun purchases(): Long = purchases.getRequired("purchases")

        fun fees(): Long = fees.getRequired("fees")

        fun credits(): Long = credits.getRequired("credits")

        fun interest(): Long = interest.getRequired("interest")

        fun cashAdvances(): Long = cashAdvances.getRequired("cash_advances")

        fun balanceTransfers(): Long = balanceTransfers.getRequired("balance_transfers")

        @JsonProperty("payments") @ExcludeMissing fun _payments() = payments

        @JsonProperty("purchases") @ExcludeMissing fun _purchases() = purchases

        @JsonProperty("fees") @ExcludeMissing fun _fees() = fees

        @JsonProperty("credits") @ExcludeMissing fun _credits() = credits

        @JsonProperty("interest") @ExcludeMissing fun _interest() = interest

        @JsonProperty("cash_advances") @ExcludeMissing fun _cashAdvances() = cashAdvances

        @JsonProperty("balance_transfers")
        @ExcludeMissing
        fun _balanceTransfers() = balanceTransfers

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

        fun validate(): StatementTotals = apply {
            if (!validated) {
                payments()
                purchases()
                fees()
                credits()
                interest()
                cashAdvances()
                balanceTransfers()
                validated = true
            }
        }

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

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

            return other is StatementTotals &&
                this.payments == other.payments &&
                this.purchases == other.purchases &&
                this.fees == other.fees &&
                this.credits == other.credits &&
                this.interest == other.interest &&
                this.cashAdvances == other.cashAdvances &&
                this.balanceTransfers == other.balanceTransfers &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        payments,
                        purchases,
                        fees,
                        credits,
                        interest,
                        cashAdvances,
                        balanceTransfers,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "StatementTotals{payments=$payments, purchases=$purchases, fees=$fees, credits=$credits, interest=$interest, cashAdvances=$cashAdvances, balanceTransfers=$balanceTransfers, additionalProperties=$additionalProperties}"

        companion object {

            fun builder() = Builder()
        }

        class Builder {

            private var payments: JsonField = JsonMissing.of()
            private var purchases: JsonField = JsonMissing.of()
            private var fees: JsonField = JsonMissing.of()
            private var credits: JsonField = JsonMissing.of()
            private var interest: JsonField = JsonMissing.of()
            private var cashAdvances: JsonField = JsonMissing.of()
            private var balanceTransfers: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            internal fun from(statementTotals: StatementTotals) = apply {
                this.payments = statementTotals.payments
                this.purchases = statementTotals.purchases
                this.fees = statementTotals.fees
                this.credits = statementTotals.credits
                this.interest = statementTotals.interest
                this.cashAdvances = statementTotals.cashAdvances
                this.balanceTransfers = statementTotals.balanceTransfers
                additionalProperties(statementTotals.additionalProperties)
            }

            fun payments(payments: Long) = payments(JsonField.of(payments))

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

            fun purchases(purchases: Long) = purchases(JsonField.of(purchases))

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

            fun fees(fees: Long) = fees(JsonField.of(fees))

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

            fun credits(credits: Long) = credits(JsonField.of(credits))

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

            fun interest(interest: Long) = interest(JsonField.of(interest))

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

            fun cashAdvances(cashAdvances: Long) = cashAdvances(JsonField.of(cashAdvances))

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

            fun balanceTransfers(balanceTransfers: Long) =
                balanceTransfers(JsonField.of(balanceTransfers))

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

            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(): StatementTotals =
                StatementTotals(
                    payments,
                    purchases,
                    fees,
                    credits,
                    interest,
                    cashAdvances,
                    balanceTransfers,
                    additionalProperties.toUnmodifiable(),
                )
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy