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

com.lithic.api.models.CardSpendLimits.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.61.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.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
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 java.util.Objects
import java.util.Optional

@JsonDeserialize(builder = CardSpendLimits.Builder::class)
@NoAutoDetect
class CardSpendLimits
private constructor(
    private val availableSpendLimit: JsonField,
    private val spendLimit: JsonField,
    private val spendVelocity: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    private var hashCode: Int = 0

    fun availableSpendLimit(): AvailableSpendLimit =
        availableSpendLimit.getRequired("available_spend_limit")

    fun spendLimit(): Optional =
        Optional.ofNullable(spendLimit.getNullable("spend_limit"))

    fun spendVelocity(): Optional =
        Optional.ofNullable(spendVelocity.getNullable("spend_velocity"))

    @JsonProperty("available_spend_limit")
    @ExcludeMissing
    fun _availableSpendLimit() = availableSpendLimit

    @JsonProperty("spend_limit") @ExcludeMissing fun _spendLimit() = spendLimit

    @JsonProperty("spend_velocity") @ExcludeMissing fun _spendVelocity() = spendVelocity

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

    fun validate(): CardSpendLimits = apply {
        if (!validated) {
            availableSpendLimit().validate()
            spendLimit().map { it.validate() }
            spendVelocity().map { it.validate() }
            validated = true
        }
    }

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

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

        return other is CardSpendLimits &&
            this.availableSpendLimit == other.availableSpendLimit &&
            this.spendLimit == other.spendLimit &&
            this.spendVelocity == other.spendVelocity &&
            this.additionalProperties == other.additionalProperties
    }

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode =
                Objects.hash(
                    availableSpendLimit,
                    spendLimit,
                    spendVelocity,
                    additionalProperties,
                )
        }
        return hashCode
    }

    override fun toString() =
        "CardSpendLimits{availableSpendLimit=$availableSpendLimit, spendLimit=$spendLimit, spendVelocity=$spendVelocity, additionalProperties=$additionalProperties}"

    companion object {

        @JvmStatic fun builder() = Builder()
    }

    class Builder {

        private var availableSpendLimit: JsonField = JsonMissing.of()
        private var spendLimit: JsonField = JsonMissing.of()
        private var spendVelocity: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        @JvmSynthetic
        internal fun from(cardSpendLimits: CardSpendLimits) = apply {
            this.availableSpendLimit = cardSpendLimits.availableSpendLimit
            this.spendLimit = cardSpendLimits.spendLimit
            this.spendVelocity = cardSpendLimits.spendVelocity
            additionalProperties(cardSpendLimits.additionalProperties)
        }

        fun availableSpendLimit(availableSpendLimit: AvailableSpendLimit) =
            availableSpendLimit(JsonField.of(availableSpendLimit))

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

        fun spendLimit(spendLimit: SpendLimit) = spendLimit(JsonField.of(spendLimit))

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

        fun spendVelocity(spendVelocity: SpendVelocity) = spendVelocity(JsonField.of(spendVelocity))

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

        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(): CardSpendLimits =
            CardSpendLimits(
                availableSpendLimit,
                spendLimit,
                spendVelocity,
                additionalProperties.toUnmodifiable(),
            )
    }

    @JsonDeserialize(builder = AvailableSpendLimit.Builder::class)
    @NoAutoDetect
    class AvailableSpendLimit
    private constructor(
        private val annually: JsonField,
        private val forever: JsonField,
        private val monthly: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        private var hashCode: Int = 0

        /**
         * The available spend limit (in cents) relative to the annual limit configured on the Card.
         */
        fun annually(): Optional = Optional.ofNullable(annually.getNullable("annually"))

        /**
         * The available spend limit (in cents) relative to the forever limit configured on the
         * Card.
         */
        fun forever(): Optional = Optional.ofNullable(forever.getNullable("forever"))

        /**
         * The available spend limit (in cents) relative to the monthly limit configured on the
         * Card.
         */
        fun monthly(): Optional = Optional.ofNullable(monthly.getNullable("monthly"))

        /**
         * The available spend limit (in cents) relative to the annual limit configured on the Card.
         */
        @JsonProperty("annually") @ExcludeMissing fun _annually() = annually

        /**
         * The available spend limit (in cents) relative to the forever limit configured on the
         * Card.
         */
        @JsonProperty("forever") @ExcludeMissing fun _forever() = forever

        /**
         * The available spend limit (in cents) relative to the monthly limit configured on the
         * Card.
         */
        @JsonProperty("monthly") @ExcludeMissing fun _monthly() = monthly

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

        fun validate(): AvailableSpendLimit = apply {
            if (!validated) {
                annually()
                forever()
                monthly()
                validated = true
            }
        }

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

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

            return other is AvailableSpendLimit &&
                this.annually == other.annually &&
                this.forever == other.forever &&
                this.monthly == other.monthly &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        annually,
                        forever,
                        monthly,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "AvailableSpendLimit{annually=$annually, forever=$forever, monthly=$monthly, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var annually: JsonField = JsonMissing.of()
            private var forever: JsonField = JsonMissing.of()
            private var monthly: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(availableSpendLimit: AvailableSpendLimit) = apply {
                this.annually = availableSpendLimit.annually
                this.forever = availableSpendLimit.forever
                this.monthly = availableSpendLimit.monthly
                additionalProperties(availableSpendLimit.additionalProperties)
            }

            /**
             * The available spend limit (in cents) relative to the annual limit configured on the
             * Card.
             */
            fun annually(annually: Long) = annually(JsonField.of(annually))

            /**
             * The available spend limit (in cents) relative to the annual limit configured on the
             * Card.
             */
            @JsonProperty("annually")
            @ExcludeMissing
            fun annually(annually: JsonField) = apply { this.annually = annually }

            /**
             * The available spend limit (in cents) relative to the forever limit configured on the
             * Card.
             */
            fun forever(forever: Long) = forever(JsonField.of(forever))

            /**
             * The available spend limit (in cents) relative to the forever limit configured on the
             * Card.
             */
            @JsonProperty("forever")
            @ExcludeMissing
            fun forever(forever: JsonField) = apply { this.forever = forever }

            /**
             * The available spend limit (in cents) relative to the monthly limit configured on the
             * Card.
             */
            fun monthly(monthly: Long) = monthly(JsonField.of(monthly))

            /**
             * The available spend limit (in cents) relative to the monthly limit configured on the
             * Card.
             */
            @JsonProperty("monthly")
            @ExcludeMissing
            fun monthly(monthly: JsonField) = apply { this.monthly = monthly }

            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(): AvailableSpendLimit =
                AvailableSpendLimit(
                    annually,
                    forever,
                    monthly,
                    additionalProperties.toUnmodifiable(),
                )
        }
    }

    @JsonDeserialize(builder = SpendLimit.Builder::class)
    @NoAutoDetect
    class SpendLimit
    private constructor(
        private val annually: JsonField,
        private val forever: JsonField,
        private val monthly: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        private var hashCode: Int = 0

        /** The configured annual spend limit (in cents) on the Card. */
        fun annually(): Optional = Optional.ofNullable(annually.getNullable("annually"))

        /** The configured forever spend limit (in cents) on the Card. */
        fun forever(): Optional = Optional.ofNullable(forever.getNullable("forever"))

        /** The configured monthly spend limit (in cents) on the Card. */
        fun monthly(): Optional = Optional.ofNullable(monthly.getNullable("monthly"))

        /** The configured annual spend limit (in cents) on the Card. */
        @JsonProperty("annually") @ExcludeMissing fun _annually() = annually

        /** The configured forever spend limit (in cents) on the Card. */
        @JsonProperty("forever") @ExcludeMissing fun _forever() = forever

        /** The configured monthly spend limit (in cents) on the Card. */
        @JsonProperty("monthly") @ExcludeMissing fun _monthly() = monthly

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

        fun validate(): SpendLimit = apply {
            if (!validated) {
                annually()
                forever()
                monthly()
                validated = true
            }
        }

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

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

            return other is SpendLimit &&
                this.annually == other.annually &&
                this.forever == other.forever &&
                this.monthly == other.monthly &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        annually,
                        forever,
                        monthly,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "SpendLimit{annually=$annually, forever=$forever, monthly=$monthly, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var annually: JsonField = JsonMissing.of()
            private var forever: JsonField = JsonMissing.of()
            private var monthly: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(spendLimit: SpendLimit) = apply {
                this.annually = spendLimit.annually
                this.forever = spendLimit.forever
                this.monthly = spendLimit.monthly
                additionalProperties(spendLimit.additionalProperties)
            }

            /** The configured annual spend limit (in cents) on the Card. */
            fun annually(annually: Long) = annually(JsonField.of(annually))

            /** The configured annual spend limit (in cents) on the Card. */
            @JsonProperty("annually")
            @ExcludeMissing
            fun annually(annually: JsonField) = apply { this.annually = annually }

            /** The configured forever spend limit (in cents) on the Card. */
            fun forever(forever: Long) = forever(JsonField.of(forever))

            /** The configured forever spend limit (in cents) on the Card. */
            @JsonProperty("forever")
            @ExcludeMissing
            fun forever(forever: JsonField) = apply { this.forever = forever }

            /** The configured monthly spend limit (in cents) on the Card. */
            fun monthly(monthly: Long) = monthly(JsonField.of(monthly))

            /** The configured monthly spend limit (in cents) on the Card. */
            @JsonProperty("monthly")
            @ExcludeMissing
            fun monthly(monthly: JsonField) = apply { this.monthly = monthly }

            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(): SpendLimit =
                SpendLimit(
                    annually,
                    forever,
                    monthly,
                    additionalProperties.toUnmodifiable(),
                )
        }
    }

    @JsonDeserialize(builder = SpendVelocity.Builder::class)
    @NoAutoDetect
    class SpendVelocity
    private constructor(
        private val annually: JsonField,
        private val forever: JsonField,
        private val monthly: JsonField,
        private val additionalProperties: Map,
    ) {

        private var validated: Boolean = false

        private var hashCode: Int = 0

        /**
         * Current annual spend velocity (in cents) on the Card. Present if annual spend limit is
         * set.
         */
        fun annually(): Optional = Optional.ofNullable(annually.getNullable("annually"))

        /**
         * Current forever spend velocity (in cents) on the Card. Present if forever spend limit is
         * set.
         */
        fun forever(): Optional = Optional.ofNullable(forever.getNullable("forever"))

        /**
         * Current monthly spend velocity (in cents) on the Card. Present if monthly spend limit is
         * set.
         */
        fun monthly(): Optional = Optional.ofNullable(monthly.getNullable("monthly"))

        /**
         * Current annual spend velocity (in cents) on the Card. Present if annual spend limit is
         * set.
         */
        @JsonProperty("annually") @ExcludeMissing fun _annually() = annually

        /**
         * Current forever spend velocity (in cents) on the Card. Present if forever spend limit is
         * set.
         */
        @JsonProperty("forever") @ExcludeMissing fun _forever() = forever

        /**
         * Current monthly spend velocity (in cents) on the Card. Present if monthly spend limit is
         * set.
         */
        @JsonProperty("monthly") @ExcludeMissing fun _monthly() = monthly

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

        fun validate(): SpendVelocity = apply {
            if (!validated) {
                annually()
                forever()
                monthly()
                validated = true
            }
        }

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

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

            return other is SpendVelocity &&
                this.annually == other.annually &&
                this.forever == other.forever &&
                this.monthly == other.monthly &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        annually,
                        forever,
                        monthly,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "SpendVelocity{annually=$annually, forever=$forever, monthly=$monthly, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var annually: JsonField = JsonMissing.of()
            private var forever: JsonField = JsonMissing.of()
            private var monthly: JsonField = JsonMissing.of()
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(spendVelocity: SpendVelocity) = apply {
                this.annually = spendVelocity.annually
                this.forever = spendVelocity.forever
                this.monthly = spendVelocity.monthly
                additionalProperties(spendVelocity.additionalProperties)
            }

            /**
             * Current annual spend velocity (in cents) on the Card. Present if annual spend limit
             * is set.
             */
            fun annually(annually: Long) = annually(JsonField.of(annually))

            /**
             * Current annual spend velocity (in cents) on the Card. Present if annual spend limit
             * is set.
             */
            @JsonProperty("annually")
            @ExcludeMissing
            fun annually(annually: JsonField) = apply { this.annually = annually }

            /**
             * Current forever spend velocity (in cents) on the Card. Present if forever spend limit
             * is set.
             */
            fun forever(forever: Long) = forever(JsonField.of(forever))

            /**
             * Current forever spend velocity (in cents) on the Card. Present if forever spend limit
             * is set.
             */
            @JsonProperty("forever")
            @ExcludeMissing
            fun forever(forever: JsonField) = apply { this.forever = forever }

            /**
             * Current monthly spend velocity (in cents) on the Card. Present if monthly spend limit
             * is set.
             */
            fun monthly(monthly: Long) = monthly(JsonField.of(monthly))

            /**
             * Current monthly spend velocity (in cents) on the Card. Present if monthly spend limit
             * is set.
             */
            @JsonProperty("monthly")
            @ExcludeMissing
            fun monthly(monthly: JsonField) = apply { this.monthly = monthly }

            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(): SpendVelocity =
                SpendVelocity(
                    annually,
                    forever,
                    monthly,
                    additionalProperties.toUnmodifiable(),
                )
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy