|
| 1 | +// File generated from our OpenAPI spec by Stainless. |
| 2 | + |
| 3 | +package com.lithic.api.models |
| 4 | + |
| 5 | +import com.fasterxml.jackson.annotation.JsonAnyGetter |
| 6 | +import com.fasterxml.jackson.annotation.JsonAnySetter |
| 7 | +import com.fasterxml.jackson.annotation.JsonProperty |
| 8 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize |
| 9 | +import com.lithic.api.core.ExcludeMissing |
| 10 | +import com.lithic.api.core.JsonField |
| 11 | +import com.lithic.api.core.JsonMissing |
| 12 | +import com.lithic.api.core.JsonValue |
| 13 | +import com.lithic.api.core.NoAutoDetect |
| 14 | +import com.lithic.api.core.toUnmodifiable |
| 15 | +import java.time.OffsetDateTime |
| 16 | +import java.util.Objects |
| 17 | + |
| 18 | +@JsonDeserialize(builder = CardProgram.Builder::class) |
| 19 | +@NoAutoDetect |
| 20 | +class CardProgram |
| 21 | +private constructor( |
| 22 | + private val created: JsonField<OffsetDateTime>, |
| 23 | + private val token: JsonField<String>, |
| 24 | + private val panRangeStart: JsonField<String>, |
| 25 | + private val panRangeEnd: JsonField<String>, |
| 26 | + private val name: JsonField<String>, |
| 27 | + private val additionalProperties: Map<String, JsonValue>, |
| 28 | +) { |
| 29 | + |
| 30 | + private var validated: Boolean = false |
| 31 | + |
| 32 | + private var hashCode: Int = 0 |
| 33 | + |
| 34 | + /** Timestamp of when the card program was created. */ |
| 35 | + fun created(): OffsetDateTime = created.getRequired("created") |
| 36 | + |
| 37 | + /** Globally unique identifier. */ |
| 38 | + fun token(): String = token.getRequired("token") |
| 39 | + |
| 40 | + /** The first digits of the card number that this card program starts with. */ |
| 41 | + fun panRangeStart(): String = panRangeStart.getRequired("pan_range_start") |
| 42 | + |
| 43 | + /** The first digits of the card number that this card program ends with. */ |
| 44 | + fun panRangeEnd(): String = panRangeEnd.getRequired("pan_range_end") |
| 45 | + |
| 46 | + /** The name of the card program. */ |
| 47 | + fun name(): String = name.getRequired("name") |
| 48 | + |
| 49 | + /** Timestamp of when the card program was created. */ |
| 50 | + @JsonProperty("created") @ExcludeMissing fun _created() = created |
| 51 | + |
| 52 | + /** Globally unique identifier. */ |
| 53 | + @JsonProperty("token") @ExcludeMissing fun _token() = token |
| 54 | + |
| 55 | + /** The first digits of the card number that this card program starts with. */ |
| 56 | + @JsonProperty("pan_range_start") @ExcludeMissing fun _panRangeStart() = panRangeStart |
| 57 | + |
| 58 | + /** The first digits of the card number that this card program ends with. */ |
| 59 | + @JsonProperty("pan_range_end") @ExcludeMissing fun _panRangeEnd() = panRangeEnd |
| 60 | + |
| 61 | + /** The name of the card program. */ |
| 62 | + @JsonProperty("name") @ExcludeMissing fun _name() = name |
| 63 | + |
| 64 | + @JsonAnyGetter |
| 65 | + @ExcludeMissing |
| 66 | + fun _additionalProperties(): Map<String, JsonValue> = additionalProperties |
| 67 | + |
| 68 | + fun validate(): CardProgram = apply { |
| 69 | + if (!validated) { |
| 70 | + created() |
| 71 | + token() |
| 72 | + panRangeStart() |
| 73 | + panRangeEnd() |
| 74 | + name() |
| 75 | + validated = true |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + fun toBuilder() = Builder().from(this) |
| 80 | + |
| 81 | + override fun equals(other: Any?): Boolean { |
| 82 | + if (this === other) { |
| 83 | + return true |
| 84 | + } |
| 85 | + |
| 86 | + return other is CardProgram && |
| 87 | + this.created == other.created && |
| 88 | + this.token == other.token && |
| 89 | + this.panRangeStart == other.panRangeStart && |
| 90 | + this.panRangeEnd == other.panRangeEnd && |
| 91 | + this.name == other.name && |
| 92 | + this.additionalProperties == other.additionalProperties |
| 93 | + } |
| 94 | + |
| 95 | + override fun hashCode(): Int { |
| 96 | + if (hashCode == 0) { |
| 97 | + hashCode = |
| 98 | + Objects.hash( |
| 99 | + created, |
| 100 | + token, |
| 101 | + panRangeStart, |
| 102 | + panRangeEnd, |
| 103 | + name, |
| 104 | + additionalProperties, |
| 105 | + ) |
| 106 | + } |
| 107 | + return hashCode |
| 108 | + } |
| 109 | + |
| 110 | + override fun toString() = |
| 111 | + "CardProgram{created=$created, token=$token, panRangeStart=$panRangeStart, panRangeEnd=$panRangeEnd, name=$name, additionalProperties=$additionalProperties}" |
| 112 | + |
| 113 | + companion object { |
| 114 | + |
| 115 | + @JvmStatic fun builder() = Builder() |
| 116 | + } |
| 117 | + |
| 118 | + class Builder { |
| 119 | + |
| 120 | + private var created: JsonField<OffsetDateTime> = JsonMissing.of() |
| 121 | + private var token: JsonField<String> = JsonMissing.of() |
| 122 | + private var panRangeStart: JsonField<String> = JsonMissing.of() |
| 123 | + private var panRangeEnd: JsonField<String> = JsonMissing.of() |
| 124 | + private var name: JsonField<String> = JsonMissing.of() |
| 125 | + private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf() |
| 126 | + |
| 127 | + @JvmSynthetic |
| 128 | + internal fun from(cardProgram: CardProgram) = apply { |
| 129 | + this.created = cardProgram.created |
| 130 | + this.token = cardProgram.token |
| 131 | + this.panRangeStart = cardProgram.panRangeStart |
| 132 | + this.panRangeEnd = cardProgram.panRangeEnd |
| 133 | + this.name = cardProgram.name |
| 134 | + additionalProperties(cardProgram.additionalProperties) |
| 135 | + } |
| 136 | + |
| 137 | + /** Timestamp of when the card program was created. */ |
| 138 | + fun created(created: OffsetDateTime) = created(JsonField.of(created)) |
| 139 | + |
| 140 | + /** Timestamp of when the card program was created. */ |
| 141 | + @JsonProperty("created") |
| 142 | + @ExcludeMissing |
| 143 | + fun created(created: JsonField<OffsetDateTime>) = apply { this.created = created } |
| 144 | + |
| 145 | + /** Globally unique identifier. */ |
| 146 | + fun token(token: String) = token(JsonField.of(token)) |
| 147 | + |
| 148 | + /** Globally unique identifier. */ |
| 149 | + @JsonProperty("token") |
| 150 | + @ExcludeMissing |
| 151 | + fun token(token: JsonField<String>) = apply { this.token = token } |
| 152 | + |
| 153 | + /** The first digits of the card number that this card program starts with. */ |
| 154 | + fun panRangeStart(panRangeStart: String) = panRangeStart(JsonField.of(panRangeStart)) |
| 155 | + |
| 156 | + /** The first digits of the card number that this card program starts with. */ |
| 157 | + @JsonProperty("pan_range_start") |
| 158 | + @ExcludeMissing |
| 159 | + fun panRangeStart(panRangeStart: JsonField<String>) = apply { |
| 160 | + this.panRangeStart = panRangeStart |
| 161 | + } |
| 162 | + |
| 163 | + /** The first digits of the card number that this card program ends with. */ |
| 164 | + fun panRangeEnd(panRangeEnd: String) = panRangeEnd(JsonField.of(panRangeEnd)) |
| 165 | + |
| 166 | + /** The first digits of the card number that this card program ends with. */ |
| 167 | + @JsonProperty("pan_range_end") |
| 168 | + @ExcludeMissing |
| 169 | + fun panRangeEnd(panRangeEnd: JsonField<String>) = apply { this.panRangeEnd = panRangeEnd } |
| 170 | + |
| 171 | + /** The name of the card program. */ |
| 172 | + fun name(name: String) = name(JsonField.of(name)) |
| 173 | + |
| 174 | + /** The name of the card program. */ |
| 175 | + @JsonProperty("name") |
| 176 | + @ExcludeMissing |
| 177 | + fun name(name: JsonField<String>) = apply { this.name = name } |
| 178 | + |
| 179 | + fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply { |
| 180 | + this.additionalProperties.clear() |
| 181 | + this.additionalProperties.putAll(additionalProperties) |
| 182 | + } |
| 183 | + |
| 184 | + @JsonAnySetter |
| 185 | + fun putAdditionalProperty(key: String, value: JsonValue) = apply { |
| 186 | + this.additionalProperties.put(key, value) |
| 187 | + } |
| 188 | + |
| 189 | + fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply { |
| 190 | + this.additionalProperties.putAll(additionalProperties) |
| 191 | + } |
| 192 | + |
| 193 | + fun build(): CardProgram = |
| 194 | + CardProgram( |
| 195 | + created, |
| 196 | + token, |
| 197 | + panRangeStart, |
| 198 | + panRangeEnd, |
| 199 | + name, |
| 200 | + additionalProperties.toUnmodifiable(), |
| 201 | + ) |
| 202 | + } |
| 203 | +} |
0 commit comments