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

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

Go to download

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

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

package com.lithic.api.models

import com.fasterxml.jackson.annotation.JsonCreator
import com.lithic.api.core.Enum
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonValue
import com.lithic.api.errors.LithicInvalidDataException

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

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

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

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

    override fun hashCode() = value.hashCode()

    override fun toString() = value.toString()

    companion object {

        val ANNUALLY = SpendLimitDuration(JsonField.of("ANNUALLY"))

        val FOREVER = SpendLimitDuration(JsonField.of("FOREVER"))

        val MONTHLY = SpendLimitDuration(JsonField.of("MONTHLY"))

        val TRANSACTION = SpendLimitDuration(JsonField.of("TRANSACTION"))

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

    enum class Known {
        ANNUALLY,
        FOREVER,
        MONTHLY,
        TRANSACTION,
    }

    enum class Value {
        ANNUALLY,
        FOREVER,
        MONTHLY,
        TRANSACTION,
        _UNKNOWN,
    }

    fun value(): Value =
        when (this) {
            ANNUALLY -> Value.ANNUALLY
            FOREVER -> Value.FOREVER
            MONTHLY -> Value.MONTHLY
            TRANSACTION -> Value.TRANSACTION
            else -> Value._UNKNOWN
        }

    fun known(): Known =
        when (this) {
            ANNUALLY -> Known.ANNUALLY
            FOREVER -> Known.FOREVER
            MONTHLY -> Known.MONTHLY
            TRANSACTION -> Known.TRANSACTION
            else -> throw LithicInvalidDataException("Unknown SpendLimitDuration: $value")
        }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy