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

com.increase.api.models.Lockbox.kt Maven / Gradle / Ivy

There is a newer version: 0.142.0
Show newest version
// File generated from our OpenAPI spec by Stainless.

package com.increase.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.increase.api.core.Enum
import com.increase.api.core.ExcludeMissing
import com.increase.api.core.JsonField
import com.increase.api.core.JsonMissing
import com.increase.api.core.JsonValue
import com.increase.api.core.NoAutoDetect
import com.increase.api.core.toImmutable
import com.increase.api.errors.IncreaseInvalidDataException
import java.time.OffsetDateTime
import java.util.Objects

/**
 * Lockboxes are physical locations that can receive mail containing paper checks. Increase will
 * automatically create a Check Deposit for checks received this way.
 */
@JsonDeserialize(builder = Lockbox.Builder::class)
@NoAutoDetect
class Lockbox
private constructor(
    private val accountId: JsonField,
    private val address: JsonField
, private val createdAt: JsonField, private val description: JsonField, private val id: JsonField, private val idempotencyKey: JsonField, private val recipientName: JsonField, private val status: JsonField, private val type: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false /** The identifier for the Account checks sent to this lockbox will be deposited into. */ fun accountId(): String = accountId.getRequired("account_id") /** The mailing address for the Lockbox. */ fun address(): Address = address.getRequired("address") /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Lockbox was created. */ fun createdAt(): OffsetDateTime = createdAt.getRequired("created_at") /** The description you choose for the Lockbox. */ fun description(): String? = description.getNullable("description") /** The Lockbox identifier. */ fun id(): String = id.getRequired("id") /** * The idempotency key you chose for this object. This value is unique across Increase and is * used to ensure that a request is only processed once. Learn more about * [idempotency](https://increase.com/documentation/idempotency-keys). */ fun idempotencyKey(): String? = idempotencyKey.getNullable("idempotency_key") /** The recipient name you choose for the Lockbox. */ fun recipientName(): String? = recipientName.getNullable("recipient_name") /** This indicates if mail can be sent to this address. */ fun status(): Status = status.getRequired("status") /** A constant representing the object's type. For this resource it will always be `lockbox`. */ fun type(): Type = type.getRequired("type") /** The identifier for the Account checks sent to this lockbox will be deposited into. */ @JsonProperty("account_id") @ExcludeMissing fun _accountId() = accountId /** The mailing address for the Lockbox. */ @JsonProperty("address") @ExcludeMissing fun _address() = address /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Lockbox was created. */ @JsonProperty("created_at") @ExcludeMissing fun _createdAt() = createdAt /** The description you choose for the Lockbox. */ @JsonProperty("description") @ExcludeMissing fun _description() = description /** The Lockbox identifier. */ @JsonProperty("id") @ExcludeMissing fun _id() = id /** * The idempotency key you chose for this object. This value is unique across Increase and is * used to ensure that a request is only processed once. Learn more about * [idempotency](https://increase.com/documentation/idempotency-keys). */ @JsonProperty("idempotency_key") @ExcludeMissing fun _idempotencyKey() = idempotencyKey /** The recipient name you choose for the Lockbox. */ @JsonProperty("recipient_name") @ExcludeMissing fun _recipientName() = recipientName /** This indicates if mail can be sent to this address. */ @JsonProperty("status") @ExcludeMissing fun _status() = status /** A constant representing the object's type. For this resource it will always be `lockbox`. */ @JsonProperty("type") @ExcludeMissing fun _type() = type @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): Lockbox = apply { if (!validated) { accountId() address().validate() createdAt() description() id() idempotencyKey() recipientName() status() type() validated = true } } fun toBuilder() = Builder().from(this) companion object { fun builder() = Builder() } class Builder { private var accountId: JsonField = JsonMissing.of() private var address: JsonField
= JsonMissing.of() private var createdAt: JsonField = JsonMissing.of() private var description: JsonField = JsonMissing.of() private var id: JsonField = JsonMissing.of() private var idempotencyKey: JsonField = JsonMissing.of() private var recipientName: JsonField = JsonMissing.of() private var status: JsonField = JsonMissing.of() private var type: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(lockbox: Lockbox) = apply { this.accountId = lockbox.accountId this.address = lockbox.address this.createdAt = lockbox.createdAt this.description = lockbox.description this.id = lockbox.id this.idempotencyKey = lockbox.idempotencyKey this.recipientName = lockbox.recipientName this.status = lockbox.status this.type = lockbox.type additionalProperties(lockbox.additionalProperties) } /** The identifier for the Account checks sent to this lockbox will be deposited into. */ fun accountId(accountId: String) = accountId(JsonField.of(accountId)) /** The identifier for the Account checks sent to this lockbox will be deposited into. */ @JsonProperty("account_id") @ExcludeMissing fun accountId(accountId: JsonField) = apply { this.accountId = accountId } /** The mailing address for the Lockbox. */ fun address(address: Address) = address(JsonField.of(address)) /** The mailing address for the Lockbox. */ @JsonProperty("address") @ExcludeMissing fun address(address: JsonField
) = apply { this.address = address } /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Lockbox was * created. */ fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt)) /** * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Lockbox was * created. */ @JsonProperty("created_at") @ExcludeMissing fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } /** The description you choose for the Lockbox. */ fun description(description: String) = description(JsonField.of(description)) /** The description you choose for the Lockbox. */ @JsonProperty("description") @ExcludeMissing fun description(description: JsonField) = apply { this.description = description } /** The Lockbox identifier. */ fun id(id: String) = id(JsonField.of(id)) /** The Lockbox identifier. */ @JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id } /** * The idempotency key you chose for this object. This value is unique across Increase and * is used to ensure that a request is only processed once. Learn more about * [idempotency](https://increase.com/documentation/idempotency-keys). */ fun idempotencyKey(idempotencyKey: String) = idempotencyKey(JsonField.of(idempotencyKey)) /** * The idempotency key you chose for this object. This value is unique across Increase and * is used to ensure that a request is only processed once. Learn more about * [idempotency](https://increase.com/documentation/idempotency-keys). */ @JsonProperty("idempotency_key") @ExcludeMissing fun idempotencyKey(idempotencyKey: JsonField) = apply { this.idempotencyKey = idempotencyKey } /** The recipient name you choose for the Lockbox. */ fun recipientName(recipientName: String) = recipientName(JsonField.of(recipientName)) /** The recipient name you choose for the Lockbox. */ @JsonProperty("recipient_name") @ExcludeMissing fun recipientName(recipientName: JsonField) = apply { this.recipientName = recipientName } /** This indicates if mail can be sent to this address. */ fun status(status: Status) = status(JsonField.of(status)) /** This indicates if mail can be sent to this address. */ @JsonProperty("status") @ExcludeMissing fun status(status: JsonField) = apply { this.status = status } /** * A constant representing the object's type. For this resource it will always be `lockbox`. */ fun type(type: Type) = type(JsonField.of(type)) /** * A constant representing the object's type. For this resource it will always be `lockbox`. */ @JsonProperty("type") @ExcludeMissing fun type(type: JsonField) = apply { this.type = type } 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(): Lockbox = Lockbox( accountId, address, createdAt, description, id, idempotencyKey, recipientName, status, type, additionalProperties.toImmutable(), ) } /** The mailing address for the Lockbox. */ @JsonDeserialize(builder = Address.Builder::class) @NoAutoDetect class Address private constructor( private val city: JsonField, private val line1: JsonField, private val line2: JsonField, private val postalCode: JsonField, private val recipient: JsonField, private val state: JsonField, private val additionalProperties: Map, ) { private var validated: Boolean = false /** The city of the address. */ fun city(): String = city.getRequired("city") /** The first line of the address. */ fun line1(): String = line1.getRequired("line1") /** The second line of the address. */ fun line2(): String = line2.getRequired("line2") /** The postal code of the address. */ fun postalCode(): String = postalCode.getRequired("postal_code") /** * The recipient line of the address. This will include the recipient name you provide when * creating the address, as well as an ATTN suffix to help route the mail to your lockbox. * Mail senders must include this ATTN line to receive mail at this Lockbox. */ fun recipient(): String? = recipient.getNullable("recipient") /** * The two-letter United States Postal Service (USPS) abbreviation for the state of the * address. */ fun state(): String = state.getRequired("state") /** The city of the address. */ @JsonProperty("city") @ExcludeMissing fun _city() = city /** The first line of the address. */ @JsonProperty("line1") @ExcludeMissing fun _line1() = line1 /** The second line of the address. */ @JsonProperty("line2") @ExcludeMissing fun _line2() = line2 /** The postal code of the address. */ @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode /** * The recipient line of the address. This will include the recipient name you provide when * creating the address, as well as an ATTN suffix to help route the mail to your lockbox. * Mail senders must include this ATTN line to receive mail at this Lockbox. */ @JsonProperty("recipient") @ExcludeMissing fun _recipient() = recipient /** * The two-letter United States Postal Service (USPS) abbreviation for the state of the * address. */ @JsonProperty("state") @ExcludeMissing fun _state() = state @JsonAnyGetter @ExcludeMissing fun _additionalProperties(): Map = additionalProperties fun validate(): Address = apply { if (!validated) { city() line1() line2() postalCode() recipient() state() validated = true } } fun toBuilder() = Builder().from(this) companion object { fun builder() = Builder() } class Builder { private var city: JsonField = JsonMissing.of() private var line1: JsonField = JsonMissing.of() private var line2: JsonField = JsonMissing.of() private var postalCode: JsonField = JsonMissing.of() private var recipient: JsonField = JsonMissing.of() private var state: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() internal fun from(address: Address) = apply { this.city = address.city this.line1 = address.line1 this.line2 = address.line2 this.postalCode = address.postalCode this.recipient = address.recipient this.state = address.state additionalProperties(address.additionalProperties) } /** The city of the address. */ fun city(city: String) = city(JsonField.of(city)) /** The city of the address. */ @JsonProperty("city") @ExcludeMissing fun city(city: JsonField) = apply { this.city = city } /** The first line of the address. */ fun line1(line1: String) = line1(JsonField.of(line1)) /** The first line of the address. */ @JsonProperty("line1") @ExcludeMissing fun line1(line1: JsonField) = apply { this.line1 = line1 } /** The second line of the address. */ fun line2(line2: String) = line2(JsonField.of(line2)) /** The second line of the address. */ @JsonProperty("line2") @ExcludeMissing fun line2(line2: JsonField) = apply { this.line2 = line2 } /** The postal code of the address. */ fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode)) /** The postal code of the address. */ @JsonProperty("postal_code") @ExcludeMissing fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode } /** * The recipient line of the address. This will include the recipient name you provide * when creating the address, as well as an ATTN suffix to help route the mail to your * lockbox. Mail senders must include this ATTN line to receive mail at this Lockbox. */ fun recipient(recipient: String) = recipient(JsonField.of(recipient)) /** * The recipient line of the address. This will include the recipient name you provide * when creating the address, as well as an ATTN suffix to help route the mail to your * lockbox. Mail senders must include this ATTN line to receive mail at this Lockbox. */ @JsonProperty("recipient") @ExcludeMissing fun recipient(recipient: JsonField) = apply { this.recipient = recipient } /** * The two-letter United States Postal Service (USPS) abbreviation for the state of the * address. */ fun state(state: String) = state(JsonField.of(state)) /** * The two-letter United States Postal Service (USPS) abbreviation for the state of the * address. */ @JsonProperty("state") @ExcludeMissing fun state(state: JsonField) = apply { this.state = state } 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(): Address = Address( city, line1, line2, postalCode, recipient, state, additionalProperties.toImmutable(), ) } override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is Address && this.city == other.city && this.line1 == other.line1 && this.line2 == other.line2 && this.postalCode == other.postalCode && this.recipient == other.recipient && this.state == other.state && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { hashCode = /* spotless:off */ Objects.hash(city, line1, line2, postalCode, recipient, state, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = "Address{city=$city, line1=$line1, line2=$line2, postalCode=$postalCode, recipient=$recipient, state=$state, additionalProperties=$additionalProperties}" } class Status @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 Status && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() companion object { val ACTIVE = Status(JsonField.of("active")) val INACTIVE = Status(JsonField.of("inactive")) fun of(value: String) = Status(JsonField.of(value)) } enum class Known { ACTIVE, INACTIVE, } enum class Value { ACTIVE, INACTIVE, _UNKNOWN, } fun value(): Value = when (this) { ACTIVE -> Value.ACTIVE INACTIVE -> Value.INACTIVE else -> Value._UNKNOWN } fun known(): Known = when (this) { ACTIVE -> Known.ACTIVE INACTIVE -> Known.INACTIVE else -> throw IncreaseInvalidDataException("Unknown Status: $value") } fun asString(): String = _value().asStringOrThrow() } class Type @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 Type && this.value == other.value /* spotless:on */ } override fun hashCode() = value.hashCode() override fun toString() = value.toString() companion object { val LOCKBOX = Type(JsonField.of("lockbox")) fun of(value: String) = Type(JsonField.of(value)) } enum class Known { LOCKBOX, } enum class Value { LOCKBOX, _UNKNOWN, } fun value(): Value = when (this) { LOCKBOX -> Value.LOCKBOX else -> Value._UNKNOWN } fun known(): Known = when (this) { LOCKBOX -> Known.LOCKBOX else -> throw IncreaseInvalidDataException("Unknown Type: $value") } fun asString(): String = _value().asStringOrThrow() } override fun equals(other: Any?): Boolean { if (this === other) { return true } return /* spotless:off */ other is Lockbox && this.accountId == other.accountId && this.address == other.address && this.createdAt == other.createdAt && this.description == other.description && this.id == other.id && this.idempotencyKey == other.idempotencyKey && this.recipientName == other.recipientName && this.status == other.status && this.type == other.type && this.additionalProperties == other.additionalProperties /* spotless:on */ } private var hashCode: Int = 0 override fun hashCode(): Int { if (hashCode == 0) { hashCode = /* spotless:off */ Objects.hash(accountId, address, createdAt, description, id, idempotencyKey, recipientName, status, type, additionalProperties) /* spotless:on */ } return hashCode } override fun toString() = "Lockbox{accountId=$accountId, address=$address, createdAt=$createdAt, description=$description, id=$id, idempotencyKey=$idempotencyKey, recipientName=$recipientName, status=$status, type=$type, additionalProperties=$additionalProperties}" }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy