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

com.increase.api.models.IntrafiExclusion.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

/**
 * Certain institutions may be excluded per Entity when sweeping funds into the IntraFi network.
 * This is useful when an Entity already has deposits at a particular bank, and does not want to
 * sweep additional funds to it. It may take 5 business days for an exclusion to be processed.
 */
@JsonDeserialize(builder = IntrafiExclusion.Builder::class)
@NoAutoDetect
class IntrafiExclusion
private constructor(
    private val bankName: JsonField,
    private val entityId: JsonField,
    private val excludedAt: JsonField,
    private val fdicCertificateNumber: JsonField,
    private val id: JsonField,
    private val idempotencyKey: JsonField,
    private val status: JsonField,
    private val submittedAt: JsonField,
    private val type: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    /** The name of the excluded institution. */
    fun bankName(): String = bankName.getRequired("bank_name")

    /** The entity for which this institution is excluded. */
    fun entityId(): String = entityId.getRequired("entity_id")

    /** When this was exclusion was confirmed by IntraFi. */
    fun excludedAt(): OffsetDateTime? = excludedAt.getNullable("excluded_at")

    /** The Federal Deposit Insurance Corporation's certificate number for the institution. */
    fun fdicCertificateNumber(): String? =
        fdicCertificateNumber.getNullable("fdic_certificate_number")

    /** The identifier of this exclusion request. */
    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 status of the exclusion request. */
    fun status(): Status = status.getRequired("status")

    /** When this was exclusion was submitted to IntraFi by Increase. */
    fun submittedAt(): OffsetDateTime? = submittedAt.getNullable("submitted_at")

    /**
     * A constant representing the object's type. For this resource it will always be
     * `intrafi_exclusion`.
     */
    fun type(): Type = type.getRequired("type")

    /** The name of the excluded institution. */
    @JsonProperty("bank_name") @ExcludeMissing fun _bankName() = bankName

    /** The entity for which this institution is excluded. */
    @JsonProperty("entity_id") @ExcludeMissing fun _entityId() = entityId

    /** When this was exclusion was confirmed by IntraFi. */
    @JsonProperty("excluded_at") @ExcludeMissing fun _excludedAt() = excludedAt

    /** The Federal Deposit Insurance Corporation's certificate number for the institution. */
    @JsonProperty("fdic_certificate_number")
    @ExcludeMissing
    fun _fdicCertificateNumber() = fdicCertificateNumber

    /** The identifier of this exclusion request. */
    @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 status of the exclusion request. */
    @JsonProperty("status") @ExcludeMissing fun _status() = status

    /** When this was exclusion was submitted to IntraFi by Increase. */
    @JsonProperty("submitted_at") @ExcludeMissing fun _submittedAt() = submittedAt

    /**
     * A constant representing the object's type. For this resource it will always be
     * `intrafi_exclusion`.
     */
    @JsonProperty("type") @ExcludeMissing fun _type() = type

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

    fun validate(): IntrafiExclusion = apply {
        if (!validated) {
            bankName()
            entityId()
            excludedAt()
            fdicCertificateNumber()
            id()
            idempotencyKey()
            status()
            submittedAt()
            type()
            validated = true
        }
    }

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

    companion object {

        fun builder() = Builder()
    }

    class Builder {

        private var bankName: JsonField = JsonMissing.of()
        private var entityId: JsonField = JsonMissing.of()
        private var excludedAt: JsonField = JsonMissing.of()
        private var fdicCertificateNumber: JsonField = JsonMissing.of()
        private var id: JsonField = JsonMissing.of()
        private var idempotencyKey: JsonField = JsonMissing.of()
        private var status: JsonField = JsonMissing.of()
        private var submittedAt: JsonField = JsonMissing.of()
        private var type: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        internal fun from(intrafiExclusion: IntrafiExclusion) = apply {
            this.bankName = intrafiExclusion.bankName
            this.entityId = intrafiExclusion.entityId
            this.excludedAt = intrafiExclusion.excludedAt
            this.fdicCertificateNumber = intrafiExclusion.fdicCertificateNumber
            this.id = intrafiExclusion.id
            this.idempotencyKey = intrafiExclusion.idempotencyKey
            this.status = intrafiExclusion.status
            this.submittedAt = intrafiExclusion.submittedAt
            this.type = intrafiExclusion.type
            additionalProperties(intrafiExclusion.additionalProperties)
        }

        /** The name of the excluded institution. */
        fun bankName(bankName: String) = bankName(JsonField.of(bankName))

        /** The name of the excluded institution. */
        @JsonProperty("bank_name")
        @ExcludeMissing
        fun bankName(bankName: JsonField) = apply { this.bankName = bankName }

        /** The entity for which this institution is excluded. */
        fun entityId(entityId: String) = entityId(JsonField.of(entityId))

        /** The entity for which this institution is excluded. */
        @JsonProperty("entity_id")
        @ExcludeMissing
        fun entityId(entityId: JsonField) = apply { this.entityId = entityId }

        /** When this was exclusion was confirmed by IntraFi. */
        fun excludedAt(excludedAt: OffsetDateTime) = excludedAt(JsonField.of(excludedAt))

        /** When this was exclusion was confirmed by IntraFi. */
        @JsonProperty("excluded_at")
        @ExcludeMissing
        fun excludedAt(excludedAt: JsonField) = apply {
            this.excludedAt = excludedAt
        }

        /** The Federal Deposit Insurance Corporation's certificate number for the institution. */
        fun fdicCertificateNumber(fdicCertificateNumber: String) =
            fdicCertificateNumber(JsonField.of(fdicCertificateNumber))

        /** The Federal Deposit Insurance Corporation's certificate number for the institution. */
        @JsonProperty("fdic_certificate_number")
        @ExcludeMissing
        fun fdicCertificateNumber(fdicCertificateNumber: JsonField) = apply {
            this.fdicCertificateNumber = fdicCertificateNumber
        }

        /** The identifier of this exclusion request. */
        fun id(id: String) = id(JsonField.of(id))

        /** The identifier of this exclusion request. */
        @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 status of the exclusion request. */
        fun status(status: Status) = status(JsonField.of(status))

        /** The status of the exclusion request. */
        @JsonProperty("status")
        @ExcludeMissing
        fun status(status: JsonField) = apply { this.status = status }

        /** When this was exclusion was submitted to IntraFi by Increase. */
        fun submittedAt(submittedAt: OffsetDateTime) = submittedAt(JsonField.of(submittedAt))

        /** When this was exclusion was submitted to IntraFi by Increase. */
        @JsonProperty("submitted_at")
        @ExcludeMissing
        fun submittedAt(submittedAt: JsonField) = apply {
            this.submittedAt = submittedAt
        }

        /**
         * A constant representing the object's type. For this resource it will always be
         * `intrafi_exclusion`.
         */
        fun type(type: Type) = type(JsonField.of(type))

        /**
         * A constant representing the object's type. For this resource it will always be
         * `intrafi_exclusion`.
         */
        @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(): IntrafiExclusion =
            IntrafiExclusion(
                bankName,
                entityId,
                excludedAt,
                fdicCertificateNumber,
                id,
                idempotencyKey,
                status,
                submittedAt,
                type,
                additionalProperties.toImmutable(),
            )
    }

    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 PENDING = Status(JsonField.of("pending"))

            val COMPLETED = Status(JsonField.of("completed"))

            val ARCHIVED = Status(JsonField.of("archived"))

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

        enum class Known {
            PENDING,
            COMPLETED,
            ARCHIVED,
        }

        enum class Value {
            PENDING,
            COMPLETED,
            ARCHIVED,
            _UNKNOWN,
        }

        fun value(): Value =
            when (this) {
                PENDING -> Value.PENDING
                COMPLETED -> Value.COMPLETED
                ARCHIVED -> Value.ARCHIVED
                else -> Value._UNKNOWN
            }

        fun known(): Known =
            when (this) {
                PENDING -> Known.PENDING
                COMPLETED -> Known.COMPLETED
                ARCHIVED -> Known.ARCHIVED
                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 INTRAFI_EXCLUSION = Type(JsonField.of("intrafi_exclusion"))

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

        enum class Known {
            INTRAFI_EXCLUSION,
        }

        enum class Value {
            INTRAFI_EXCLUSION,
            _UNKNOWN,
        }

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

        fun known(): Known =
            when (this) {
                INTRAFI_EXCLUSION -> Known.INTRAFI_EXCLUSION
                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 IntrafiExclusion && this.bankName == other.bankName && this.entityId == other.entityId && this.excludedAt == other.excludedAt && this.fdicCertificateNumber == other.fdicCertificateNumber && this.id == other.id && this.idempotencyKey == other.idempotencyKey && this.status == other.status && this.submittedAt == other.submittedAt && 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(bankName, entityId, excludedAt, fdicCertificateNumber, id, idempotencyKey, status, submittedAt, type, additionalProperties) /* spotless:on */
        }
        return hashCode
    }

    override fun toString() =
        "IntrafiExclusion{bankName=$bankName, entityId=$entityId, excludedAt=$excludedAt, fdicCertificateNumber=$fdicCertificateNumber, id=$id, idempotencyKey=$idempotencyKey, status=$status, submittedAt=$submittedAt, type=$type, additionalProperties=$additionalProperties}"
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy