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

com.lithic.api.models.DigitalCardArt.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.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.toImmutable
import com.lithic.api.errors.LithicInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects
import java.util.Optional

@JsonDeserialize(builder = DigitalCardArt.Builder::class)
@NoAutoDetect
class DigitalCardArt
private constructor(
    private val cardProgramToken: JsonField,
    private val created: JsonField,
    private val description: JsonField,
    private val isCardProgramDefault: JsonField,
    private val isEnabled: JsonField,
    private val network: JsonField,
    private val token: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    /** Globally unique identifier for the card program. */
    fun cardProgramToken(): String = cardProgramToken.getRequired("card_program_token")

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

    /** Description of the card art. */
    fun description(): String = description.getRequired("description")

    /** Whether the card art is the default card art to be added upon tokenization. */
    fun isCardProgramDefault(): Optional =
        Optional.ofNullable(isCardProgramDefault.getNullable("is_card_program_default"))

    /** Whether the card art is enabled. */
    fun isEnabled(): Boolean = isEnabled.getRequired("is_enabled")

    /** Card network. */
    fun network(): Network = network.getRequired("network")

    /** Globally unique identifier for the card art. */
    fun token(): String = token.getRequired("token")

    /** Globally unique identifier for the card program. */
    @JsonProperty("card_program_token") @ExcludeMissing fun _cardProgramToken() = cardProgramToken

    /** Timestamp of when card art was created. */
    @JsonProperty("created") @ExcludeMissing fun _created() = created

    /** Description of the card art. */
    @JsonProperty("description") @ExcludeMissing fun _description() = description

    /** Whether the card art is the default card art to be added upon tokenization. */
    @JsonProperty("is_card_program_default")
    @ExcludeMissing
    fun _isCardProgramDefault() = isCardProgramDefault

    /** Whether the card art is enabled. */
    @JsonProperty("is_enabled") @ExcludeMissing fun _isEnabled() = isEnabled

    /** Card network. */
    @JsonProperty("network") @ExcludeMissing fun _network() = network

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

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

    fun validate(): DigitalCardArt = apply {
        if (!validated) {
            cardProgramToken()
            created()
            description()
            isCardProgramDefault()
            isEnabled()
            network()
            token()
            validated = true
        }
    }

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

    companion object {

        @JvmStatic fun builder() = Builder()
    }

    class Builder {

        private var cardProgramToken: JsonField = JsonMissing.of()
        private var created: JsonField = JsonMissing.of()
        private var description: JsonField = JsonMissing.of()
        private var isCardProgramDefault: JsonField = JsonMissing.of()
        private var isEnabled: JsonField = JsonMissing.of()
        private var network: JsonField = JsonMissing.of()
        private var token: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        @JvmSynthetic
        internal fun from(digitalCardArt: DigitalCardArt) = apply {
            this.cardProgramToken = digitalCardArt.cardProgramToken
            this.created = digitalCardArt.created
            this.description = digitalCardArt.description
            this.isCardProgramDefault = digitalCardArt.isCardProgramDefault
            this.isEnabled = digitalCardArt.isEnabled
            this.network = digitalCardArt.network
            this.token = digitalCardArt.token
            additionalProperties(digitalCardArt.additionalProperties)
        }

        /** Globally unique identifier for the card program. */
        fun cardProgramToken(cardProgramToken: String) =
            cardProgramToken(JsonField.of(cardProgramToken))

        /** Globally unique identifier for the card program. */
        @JsonProperty("card_program_token")
        @ExcludeMissing
        fun cardProgramToken(cardProgramToken: JsonField) = apply {
            this.cardProgramToken = cardProgramToken
        }

        /** Timestamp of when card art was created. */
        fun created(created: OffsetDateTime) = created(JsonField.of(created))

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

        /** Description of the card art. */
        fun description(description: String) = description(JsonField.of(description))

        /** Description of the card art. */
        @JsonProperty("description")
        @ExcludeMissing
        fun description(description: JsonField) = apply { this.description = description }

        /** Whether the card art is the default card art to be added upon tokenization. */
        fun isCardProgramDefault(isCardProgramDefault: Boolean) =
            isCardProgramDefault(JsonField.of(isCardProgramDefault))

        /** Whether the card art is the default card art to be added upon tokenization. */
        @JsonProperty("is_card_program_default")
        @ExcludeMissing
        fun isCardProgramDefault(isCardProgramDefault: JsonField) = apply {
            this.isCardProgramDefault = isCardProgramDefault
        }

        /** Whether the card art is enabled. */
        fun isEnabled(isEnabled: Boolean) = isEnabled(JsonField.of(isEnabled))

        /** Whether the card art is enabled. */
        @JsonProperty("is_enabled")
        @ExcludeMissing
        fun isEnabled(isEnabled: JsonField) = apply { this.isEnabled = isEnabled }

        /** Card network. */
        fun network(network: Network) = network(JsonField.of(network))

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

        /** Globally unique identifier for the card art. */
        fun token(token: String) = token(JsonField.of(token))

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

        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(): DigitalCardArt =
            DigitalCardArt(
                cardProgramToken,
                created,
                description,
                isCardProgramDefault,
                isEnabled,
                network,
                token,
                additionalProperties.toImmutable(),
            )
    }

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

        override fun hashCode() = value.hashCode()

        override fun toString() = value.toString()

        companion object {

            @JvmField val MASTERCARD = Network(JsonField.of("MASTERCARD"))

            @JvmField val VISA = Network(JsonField.of("VISA"))

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

        enum class Known {
            MASTERCARD,
            VISA,
        }

        enum class Value {
            MASTERCARD,
            VISA,
            _UNKNOWN,
        }

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

        fun known(): Known =
            when (this) {
                MASTERCARD -> Known.MASTERCARD
                VISA -> Known.VISA
                else -> throw LithicInvalidDataException("Unknown Network: $value")
            }

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

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

        return /* spotless:off */ other is DigitalCardArt && this.cardProgramToken == other.cardProgramToken && this.created == other.created && this.description == other.description && this.isCardProgramDefault == other.isCardProgramDefault && this.isEnabled == other.isEnabled && this.network == other.network && this.token == other.token && this.additionalProperties == other.additionalProperties /* spotless:on */
    }

    private var hashCode: Int = 0

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode = /* spotless:off */ Objects.hash(cardProgramToken, created, description, isCardProgramDefault, isEnabled, network, token, additionalProperties) /* spotless:on */
        }
        return hashCode
    }

    override fun toString() =
        "DigitalCardArt{cardProgramToken=$cardProgramToken, created=$created, description=$description, isCardProgramDefault=$isCardProgramDefault, isEnabled=$isEnabled, network=$network, token=$token, additionalProperties=$additionalProperties}"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy