
com.lithic.api.models.FinancialAccount.kt Maven / Gradle / Ivy
// 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.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.OffsetDateTime
import java.util.Objects
/** Financial Account */
@JsonDeserialize(builder = FinancialAccount.Builder::class)
@NoAutoDetect
class FinancialAccount
private constructor(
private val accountNumber: JsonField,
private val created: JsonField,
private val routingNumber: JsonField,
private val token: JsonField,
private val type: JsonField,
private val updated: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** Account number for your Lithic-assigned bank account number, if applicable. */
fun accountNumber(): String? = accountNumber.getNullable("account_number")
/** Date and time for when the financial account was first created. */
fun created(): OffsetDateTime = created.getRequired("created")
/** Routing number for your Lithic-assigned bank account number, if applicable. */
fun routingNumber(): String? = routingNumber.getNullable("routing_number")
/** Globally unique identifier for the financial account. */
fun token(): String = token.getRequired("token")
/** Type of financial account */
fun type(): Type = type.getRequired("type")
/** Date and time for when the financial account was last updated. */
fun updated(): OffsetDateTime = updated.getRequired("updated")
/** Account number for your Lithic-assigned bank account number, if applicable. */
@JsonProperty("account_number") @ExcludeMissing fun _accountNumber() = accountNumber
/** Date and time for when the financial account was first created. */
@JsonProperty("created") @ExcludeMissing fun _created() = created
/** Routing number for your Lithic-assigned bank account number, if applicable. */
@JsonProperty("routing_number") @ExcludeMissing fun _routingNumber() = routingNumber
/** Globally unique identifier for the financial account. */
@JsonProperty("token") @ExcludeMissing fun _token() = token
/** Type of financial account */
@JsonProperty("type") @ExcludeMissing fun _type() = type
/** Date and time for when the financial account was last updated. */
@JsonProperty("updated") @ExcludeMissing fun _updated() = updated
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): FinancialAccount = apply {
if (!validated) {
accountNumber()
created()
routingNumber()
token()
type()
updated()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is FinancialAccount &&
this.accountNumber == other.accountNumber &&
this.created == other.created &&
this.routingNumber == other.routingNumber &&
this.token == other.token &&
this.type == other.type &&
this.updated == other.updated &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
accountNumber,
created,
routingNumber,
token,
type,
updated,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"FinancialAccount{accountNumber=$accountNumber, created=$created, routingNumber=$routingNumber, token=$token, type=$type, updated=$updated, additionalProperties=$additionalProperties}"
companion object {
fun builder() = Builder()
}
class Builder {
private var accountNumber: JsonField = JsonMissing.of()
private var created: JsonField = JsonMissing.of()
private var routingNumber: JsonField = JsonMissing.of()
private var token: JsonField = JsonMissing.of()
private var type: JsonField = JsonMissing.of()
private var updated: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
internal fun from(financialAccount: FinancialAccount) = apply {
this.accountNumber = financialAccount.accountNumber
this.created = financialAccount.created
this.routingNumber = financialAccount.routingNumber
this.token = financialAccount.token
this.type = financialAccount.type
this.updated = financialAccount.updated
additionalProperties(financialAccount.additionalProperties)
}
/** Account number for your Lithic-assigned bank account number, if applicable. */
fun accountNumber(accountNumber: String) = accountNumber(JsonField.of(accountNumber))
/** Account number for your Lithic-assigned bank account number, if applicable. */
@JsonProperty("account_number")
@ExcludeMissing
fun accountNumber(accountNumber: JsonField) = apply {
this.accountNumber = accountNumber
}
/** Date and time for when the financial account was first created. */
fun created(created: OffsetDateTime) = created(JsonField.of(created))
/** Date and time for when the financial account was first created. */
@JsonProperty("created")
@ExcludeMissing
fun created(created: JsonField) = apply { this.created = created }
/** Routing number for your Lithic-assigned bank account number, if applicable. */
fun routingNumber(routingNumber: String) = routingNumber(JsonField.of(routingNumber))
/** Routing number for your Lithic-assigned bank account number, if applicable. */
@JsonProperty("routing_number")
@ExcludeMissing
fun routingNumber(routingNumber: JsonField) = apply {
this.routingNumber = routingNumber
}
/** Globally unique identifier for the financial account. */
fun token(token: String) = token(JsonField.of(token))
/** Globally unique identifier for the financial account. */
@JsonProperty("token")
@ExcludeMissing
fun token(token: JsonField) = apply { this.token = token }
/** Type of financial account */
fun type(type: Type) = type(JsonField.of(type))
/** Type of financial account */
@JsonProperty("type")
@ExcludeMissing
fun type(type: JsonField) = apply { this.type = type }
/** Date and time for when the financial account was last updated. */
fun updated(updated: OffsetDateTime) = updated(JsonField.of(updated))
/** Date and time for when the financial account was last updated. */
@JsonProperty("updated")
@ExcludeMissing
fun updated(updated: JsonField) = apply { this.updated = updated }
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(): FinancialAccount =
FinancialAccount(
accountNumber,
created,
routingNumber,
token,
type,
updated,
additionalProperties.toUnmodifiable(),
)
}
class Type
@JsonCreator
private constructor(
private val value: JsonField,
) {
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Type && this.value == other.value
}
override fun hashCode() = value.hashCode()
override fun toString() = value.toString()
companion object {
val ISSUING = Type(JsonField.of("ISSUING"))
val RESERVE = Type(JsonField.of("RESERVE"))
fun of(value: String) = Type(JsonField.of(value))
}
enum class Known {
ISSUING,
RESERVE,
}
enum class Value {
ISSUING,
RESERVE,
_UNKNOWN,
}
fun value(): Value =
when (this) {
ISSUING -> Value.ISSUING
RESERVE -> Value.RESERVE
else -> Value._UNKNOWN
}
fun known(): Known =
when (this) {
ISSUING -> Known.ISSUING
RESERVE -> Known.RESERVE
else -> throw LithicInvalidDataException("Unknown Type: $value")
}
fun asString(): String = _value().asStringOrThrow()
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy