@@ -4,14 +4,17 @@ package com.tryfinch.api.models
44
55import com.fasterxml.jackson.annotation.JsonAnyGetter
66import com.fasterxml.jackson.annotation.JsonAnySetter
7+ import com.fasterxml.jackson.annotation.JsonCreator
78import com.fasterxml.jackson.annotation.JsonProperty
89import com.fasterxml.jackson.databind.annotation.JsonDeserialize
10+ import com.tryfinch.api.core.Enum
911import com.tryfinch.api.core.ExcludeMissing
1012import com.tryfinch.api.core.JsonField
1113import com.tryfinch.api.core.JsonMissing
1214import com.tryfinch.api.core.JsonValue
1315import com.tryfinch.api.core.NoAutoDetect
1416import com.tryfinch.api.core.toUnmodifiable
17+ import com.tryfinch.api.errors.FinchInvalidDataException
1518import java.util.Objects
1619import java.util.Optional
1720
@@ -29,6 +32,8 @@ private constructor(
2932 private val employerTaxes: JsonField <Money >,
3033 private val employeeTaxes: JsonField <Money >,
3134 private val individualIds: JsonField <List <String >>,
35+ private val payGroupIds: JsonField <List <String >>,
36+ private val payFrequencies: JsonField <List <PayFrequency >>,
3237 private val additionalProperties: Map <String , JsonValue >,
3338) {
3439
@@ -63,6 +68,14 @@ private constructor(
6368 fun individualIds (): Optional <List <String >> =
6469 Optional .ofNullable(individualIds.getNullable(" individual_ids" ))
6570
71+ /* * Array of the Finch id (uuidv4) of every pay group associated with this payment. */
72+ fun payGroupIds (): Optional <List <String >> =
73+ Optional .ofNullable(payGroupIds.getNullable(" pay_group_ids" ))
74+
75+ /* * List of pay frequencies associated with this payment. */
76+ fun payFrequencies (): Optional <List <PayFrequency >> =
77+ Optional .ofNullable(payFrequencies.getNullable(" pay_frequencies" ))
78+
6679 /* * The unique id for the payment. */
6780 @JsonProperty(" id" ) @ExcludeMissing fun _id () = id
6881
@@ -86,6 +99,12 @@ private constructor(
8699 /* * Array of every individual on this payment. */
87100 @JsonProperty(" individual_ids" ) @ExcludeMissing fun _individualIds () = individualIds
88101
102+ /* * Array of the Finch id (uuidv4) of every pay group associated with this payment. */
103+ @JsonProperty(" pay_group_ids" ) @ExcludeMissing fun _payGroupIds () = payGroupIds
104+
105+ /* * List of pay frequencies associated with this payment. */
106+ @JsonProperty(" pay_frequencies" ) @ExcludeMissing fun _payFrequencies () = payFrequencies
107+
89108 @JsonAnyGetter
90109 @ExcludeMissing
91110 fun _additionalProperties (): Map <String , JsonValue > = additionalProperties
@@ -102,6 +121,8 @@ private constructor(
102121 employerTaxes().map { it.validate() }
103122 employeeTaxes().map { it.validate() }
104123 individualIds()
124+ payGroupIds()
125+ payFrequencies()
105126 validated = true
106127 }
107128 }
@@ -124,6 +145,8 @@ private constructor(
124145 this .employerTaxes == other.employerTaxes &&
125146 this .employeeTaxes == other.employeeTaxes &&
126147 this .individualIds == other.individualIds &&
148+ this .payGroupIds == other.payGroupIds &&
149+ this .payFrequencies == other.payFrequencies &&
127150 this .additionalProperties == other.additionalProperties
128151 }
129152
@@ -141,14 +164,16 @@ private constructor(
141164 employerTaxes,
142165 employeeTaxes,
143166 individualIds,
167+ payGroupIds,
168+ payFrequencies,
144169 additionalProperties,
145170 )
146171 }
147172 return hashCode
148173 }
149174
150175 override fun toString () =
151- " Payment{id=$id , payPeriod=$payPeriod , payDate=$payDate , debitDate=$debitDate , companyDebit=$companyDebit , grossPay=$grossPay , netPay=$netPay , employerTaxes=$employerTaxes , employeeTaxes=$employeeTaxes , individualIds=$individualIds , additionalProperties=$additionalProperties }"
176+ " Payment{id=$id , payPeriod=$payPeriod , payDate=$payDate , debitDate=$debitDate , companyDebit=$companyDebit , grossPay=$grossPay , netPay=$netPay , employerTaxes=$employerTaxes , employeeTaxes=$employeeTaxes , individualIds=$individualIds , payGroupIds= $payGroupIds , payFrequencies= $payFrequencies , additionalProperties=$additionalProperties }"
152177
153178 companion object {
154179
@@ -167,6 +192,8 @@ private constructor(
167192 private var employerTaxes: JsonField <Money > = JsonMissing .of()
168193 private var employeeTaxes: JsonField <Money > = JsonMissing .of()
169194 private var individualIds: JsonField <List <String >> = JsonMissing .of()
195+ private var payGroupIds: JsonField <List <String >> = JsonMissing .of()
196+ private var payFrequencies: JsonField <List <PayFrequency >> = JsonMissing .of()
170197 private var additionalProperties: MutableMap <String , JsonValue > = mutableMapOf ()
171198
172199 @JvmSynthetic
@@ -181,6 +208,8 @@ private constructor(
181208 this .employerTaxes = payment.employerTaxes
182209 this .employeeTaxes = payment.employeeTaxes
183210 this .individualIds = payment.individualIds
211+ this .payGroupIds = payment.payGroupIds
212+ this .payFrequencies = payment.payFrequencies
184213 additionalProperties(payment.additionalProperties)
185214 }
186215
@@ -256,6 +285,27 @@ private constructor(
256285 this .individualIds = individualIds
257286 }
258287
288+ /* * Array of the Finch id (uuidv4) of every pay group associated with this payment. */
289+ fun payGroupIds (payGroupIds : List <String >) = payGroupIds(JsonField .of(payGroupIds))
290+
291+ /* * Array of the Finch id (uuidv4) of every pay group associated with this payment. */
292+ @JsonProperty(" pay_group_ids" )
293+ @ExcludeMissing
294+ fun payGroupIds (payGroupIds : JsonField <List <String >>) = apply {
295+ this .payGroupIds = payGroupIds
296+ }
297+
298+ /* * List of pay frequencies associated with this payment. */
299+ fun payFrequencies (payFrequencies : List <PayFrequency >) =
300+ payFrequencies(JsonField .of(payFrequencies))
301+
302+ /* * List of pay frequencies associated with this payment. */
303+ @JsonProperty(" pay_frequencies" )
304+ @ExcludeMissing
305+ fun payFrequencies (payFrequencies : JsonField <List <PayFrequency >>) = apply {
306+ this .payFrequencies = payFrequencies
307+ }
308+
259309 fun additionalProperties (additionalProperties : Map <String , JsonValue >) = apply {
260310 this .additionalProperties.clear()
261311 this .additionalProperties.putAll(additionalProperties)
@@ -282,10 +332,111 @@ private constructor(
282332 employerTaxes,
283333 employeeTaxes,
284334 individualIds.map { it.toUnmodifiable() },
335+ payGroupIds.map { it.toUnmodifiable() },
336+ payFrequencies.map { it.toUnmodifiable() },
285337 additionalProperties.toUnmodifiable(),
286338 )
287339 }
288340
341+ class PayFrequency
342+ @JsonCreator
343+ private constructor (
344+ private val value: JsonField <String >,
345+ ) : Enum {
346+
347+ @com.fasterxml.jackson.annotation.JsonValue fun _value (): JsonField <String > = value
348+
349+ override fun equals (other : Any? ): Boolean {
350+ if (this == = other) {
351+ return true
352+ }
353+
354+ return other is PayFrequency && this .value == other.value
355+ }
356+
357+ override fun hashCode () = value.hashCode()
358+
359+ override fun toString () = value.toString()
360+
361+ companion object {
362+
363+ @JvmField val ANNUALLY = PayFrequency (JsonField .of(" annually" ))
364+
365+ @JvmField val SEMI_ANNUALLY = PayFrequency (JsonField .of(" semi_annually" ))
366+
367+ @JvmField val QUARTERLY = PayFrequency (JsonField .of(" quarterly" ))
368+
369+ @JvmField val MONTHLY = PayFrequency (JsonField .of(" monthly" ))
370+
371+ @JvmField val SEMI_MONTHLY = PayFrequency (JsonField .of(" semi_monthly" ))
372+
373+ @JvmField val BI_WEEKLY = PayFrequency (JsonField .of(" bi_weekly" ))
374+
375+ @JvmField val WEEKLY = PayFrequency (JsonField .of(" weekly" ))
376+
377+ @JvmField val DAILY = PayFrequency (JsonField .of(" daily" ))
378+
379+ @JvmField val OTHER = PayFrequency (JsonField .of(" other" ))
380+
381+ @JvmStatic fun of (value : String ) = PayFrequency (JsonField .of(value))
382+ }
383+
384+ enum class Known {
385+ ANNUALLY ,
386+ SEMI_ANNUALLY ,
387+ QUARTERLY ,
388+ MONTHLY ,
389+ SEMI_MONTHLY ,
390+ BI_WEEKLY ,
391+ WEEKLY ,
392+ DAILY ,
393+ OTHER ,
394+ }
395+
396+ enum class Value {
397+ ANNUALLY ,
398+ SEMI_ANNUALLY ,
399+ QUARTERLY ,
400+ MONTHLY ,
401+ SEMI_MONTHLY ,
402+ BI_WEEKLY ,
403+ WEEKLY ,
404+ DAILY ,
405+ OTHER ,
406+ _UNKNOWN ,
407+ }
408+
409+ fun value (): Value =
410+ when (this ) {
411+ ANNUALLY -> Value .ANNUALLY
412+ SEMI_ANNUALLY -> Value .SEMI_ANNUALLY
413+ QUARTERLY -> Value .QUARTERLY
414+ MONTHLY -> Value .MONTHLY
415+ SEMI_MONTHLY -> Value .SEMI_MONTHLY
416+ BI_WEEKLY -> Value .BI_WEEKLY
417+ WEEKLY -> Value .WEEKLY
418+ DAILY -> Value .DAILY
419+ OTHER -> Value .OTHER
420+ else -> Value ._UNKNOWN
421+ }
422+
423+ fun known (): Known =
424+ when (this ) {
425+ ANNUALLY -> Known .ANNUALLY
426+ SEMI_ANNUALLY -> Known .SEMI_ANNUALLY
427+ QUARTERLY -> Known .QUARTERLY
428+ MONTHLY -> Known .MONTHLY
429+ SEMI_MONTHLY -> Known .SEMI_MONTHLY
430+ BI_WEEKLY -> Known .BI_WEEKLY
431+ WEEKLY -> Known .WEEKLY
432+ DAILY -> Known .DAILY
433+ OTHER -> Known .OTHER
434+ else -> throw FinchInvalidDataException (" Unknown PayFrequency: $value " )
435+ }
436+
437+ fun asString (): String = _value ().asStringOrThrow()
438+ }
439+
289440 /* * The pay period object. */
290441 @JsonDeserialize(builder = PayPeriod .Builder ::class )
291442 @NoAutoDetect
0 commit comments