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

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

@JsonDeserialize(builder = CardProgram.Builder::class)
@NoAutoDetect
class CardProgram
private constructor(
    private val created: JsonField,
    private val name: JsonField,
    private val panRangeEnd: JsonField,
    private val panRangeStart: JsonField,
    private val token: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    private var hashCode: Int = 0

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

    /** The name of the card program. */
    fun name(): String = name.getRequired("name")

    /** The first digits of the card number that this card program ends with. */
    fun panRangeEnd(): String = panRangeEnd.getRequired("pan_range_end")

    /** The first digits of the card number that this card program starts with. */
    fun panRangeStart(): String = panRangeStart.getRequired("pan_range_start")

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

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

    /** The name of the card program. */
    @JsonProperty("name") @ExcludeMissing fun _name() = name

    /** The first digits of the card number that this card program ends with. */
    @JsonProperty("pan_range_end") @ExcludeMissing fun _panRangeEnd() = panRangeEnd

    /** The first digits of the card number that this card program starts with. */
    @JsonProperty("pan_range_start") @ExcludeMissing fun _panRangeStart() = panRangeStart

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

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

    fun validate(): CardProgram = apply {
        if (!validated) {
            created()
            name()
            panRangeEnd()
            panRangeStart()
            token()
            validated = true
        }
    }

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

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

        return other is CardProgram &&
            this.created == other.created &&
            this.name == other.name &&
            this.panRangeEnd == other.panRangeEnd &&
            this.panRangeStart == other.panRangeStart &&
            this.token == other.token &&
            this.additionalProperties == other.additionalProperties
    }

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode =
                Objects.hash(
                    created,
                    name,
                    panRangeEnd,
                    panRangeStart,
                    token,
                    additionalProperties,
                )
        }
        return hashCode
    }

    override fun toString() =
        "CardProgram{created=$created, name=$name, panRangeEnd=$panRangeEnd, panRangeStart=$panRangeStart, token=$token, additionalProperties=$additionalProperties}"

    companion object {

        fun builder() = Builder()
    }

    class Builder {

        private var created: JsonField = JsonMissing.of()
        private var name: JsonField = JsonMissing.of()
        private var panRangeEnd: JsonField = JsonMissing.of()
        private var panRangeStart: JsonField = JsonMissing.of()
        private var token: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        internal fun from(cardProgram: CardProgram) = apply {
            this.created = cardProgram.created
            this.name = cardProgram.name
            this.panRangeEnd = cardProgram.panRangeEnd
            this.panRangeStart = cardProgram.panRangeStart
            this.token = cardProgram.token
            additionalProperties(cardProgram.additionalProperties)
        }

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

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

        /** The name of the card program. */
        fun name(name: String) = name(JsonField.of(name))

        /** The name of the card program. */
        @JsonProperty("name")
        @ExcludeMissing
        fun name(name: JsonField) = apply { this.name = name }

        /** The first digits of the card number that this card program ends with. */
        fun panRangeEnd(panRangeEnd: String) = panRangeEnd(JsonField.of(panRangeEnd))

        /** The first digits of the card number that this card program ends with. */
        @JsonProperty("pan_range_end")
        @ExcludeMissing
        fun panRangeEnd(panRangeEnd: JsonField) = apply { this.panRangeEnd = panRangeEnd }

        /** The first digits of the card number that this card program starts with. */
        fun panRangeStart(panRangeStart: String) = panRangeStart(JsonField.of(panRangeStart))

        /** The first digits of the card number that this card program starts with. */
        @JsonProperty("pan_range_start")
        @ExcludeMissing
        fun panRangeStart(panRangeStart: JsonField) = apply {
            this.panRangeStart = panRangeStart
        }

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

        /** Globally unique identifier. */
        @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(): CardProgram =
            CardProgram(
                created,
                name,
                panRangeEnd,
                panRangeStart,
                token,
                additionalProperties.toUnmodifiable(),
            )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy