@@ -249,6 +249,7 @@ private constructor(
249249 private val firstName: JsonField <String >,
250250 private val gender: JsonField <Gender >,
251251 private val lastName: JsonField <String >,
252+ private val maritalStatus: JsonField <MaritalStatus >,
252253 private val middleName: JsonField <String >,
253254 private val phoneNumbers: JsonField <List <PhoneNumber ?>>,
254255 private val preferredName: JsonField <String >,
@@ -273,6 +274,9 @@ private constructor(
273274 @JsonProperty(" last_name" )
274275 @ExcludeMissing
275276 lastName: JsonField <String > = JsonMissing .of(),
277+ @JsonProperty(" marital_status" )
278+ @ExcludeMissing
279+ maritalStatus: JsonField <MaritalStatus > = JsonMissing .of(),
276280 @JsonProperty(" middle_name" )
277281 @ExcludeMissing
278282 middleName: JsonField <String > = JsonMissing .of(),
@@ -299,6 +303,7 @@ private constructor(
299303 firstName,
300304 gender,
301305 lastName,
306+ maritalStatus,
302307 middleName,
303308 phoneNumbers,
304309 preferredName,
@@ -355,6 +360,15 @@ private constructor(
355360 */
356361 fun lastName (): Optional <String > = lastName.getOptional(" last_name" )
357362
363+ /* *
364+ * The employee's marital status, used for beneficiary designation and spousal consent
365+ * workflows.
366+ *
367+ * @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
368+ * server responded with an unexpected value).
369+ */
370+ fun maritalStatus (): Optional <MaritalStatus > = maritalStatus.getOptional(" marital_status" )
371+
358372 /* *
359373 * The legal middle name of the individual.
360374 *
@@ -453,6 +467,16 @@ private constructor(
453467 */
454468 @JsonProperty(" last_name" ) @ExcludeMissing fun _lastName (): JsonField <String > = lastName
455469
470+ /* *
471+ * Returns the raw JSON value of [maritalStatus].
472+ *
473+ * Unlike [maritalStatus], this method doesn't throw if the JSON field has an unexpected
474+ * type.
475+ */
476+ @JsonProperty(" marital_status" )
477+ @ExcludeMissing
478+ fun _maritalStatus (): JsonField <MaritalStatus > = maritalStatus
479+
456480 /* *
457481 * Returns the raw JSON value of [middleName].
458482 *
@@ -538,6 +562,7 @@ private constructor(
538562 * .firstName()
539563 * .gender()
540564 * .lastName()
565+ * .maritalStatus()
541566 * .middleName()
542567 * .phoneNumbers()
543568 * .preferredName()
@@ -556,6 +581,7 @@ private constructor(
556581 private var firstName: JsonField <String >? = null
557582 private var gender: JsonField <Gender >? = null
558583 private var lastName: JsonField <String >? = null
584+ private var maritalStatus: JsonField <MaritalStatus >? = null
559585 private var middleName: JsonField <String >? = null
560586 private var phoneNumbers: JsonField <MutableList <PhoneNumber ?>>? = null
561587 private var preferredName: JsonField <String >? = null
@@ -573,6 +599,7 @@ private constructor(
573599 firstName = individualResponseBody.firstName
574600 gender = individualResponseBody.gender
575601 lastName = individualResponseBody.lastName
602+ maritalStatus = individualResponseBody.maritalStatus
576603 middleName = individualResponseBody.middleName
577604 phoneNumbers = individualResponseBody.phoneNumbers.map { it.toMutableList() }
578605 preferredName = individualResponseBody.preferredName
@@ -669,6 +696,28 @@ private constructor(
669696 */
670697 fun lastName (lastName : JsonField <String >) = apply { this .lastName = lastName }
671698
699+ /* *
700+ * The employee's marital status, used for beneficiary designation and spousal consent
701+ * workflows.
702+ */
703+ fun maritalStatus (maritalStatus : MaritalStatus ? ) =
704+ maritalStatus(JsonField .ofNullable(maritalStatus))
705+
706+ /* * Alias for calling [Builder.maritalStatus] with `maritalStatus.orElse(null)`. */
707+ fun maritalStatus (maritalStatus : Optional <MaritalStatus >) =
708+ maritalStatus(maritalStatus.getOrNull())
709+
710+ /* *
711+ * Sets [Builder.maritalStatus] to an arbitrary JSON value.
712+ *
713+ * You should usually call [Builder.maritalStatus] with a well-typed [MaritalStatus]
714+ * value instead. This method is primarily for setting the field to an undocumented or
715+ * not yet supported value.
716+ */
717+ fun maritalStatus (maritalStatus : JsonField <MaritalStatus >) = apply {
718+ this .maritalStatus = maritalStatus
719+ }
720+
672721 /* * The legal middle name of the individual. */
673722 fun middleName (middleName : String? ) = middleName(JsonField .ofNullable(middleName))
674723
@@ -849,6 +898,7 @@ private constructor(
849898 * .firstName()
850899 * .gender()
851900 * .lastName()
901+ * .maritalStatus()
852902 * .middleName()
853903 * .phoneNumbers()
854904 * .preferredName()
@@ -865,6 +915,7 @@ private constructor(
865915 checkRequired(" firstName" , firstName),
866916 checkRequired(" gender" , gender),
867917 checkRequired(" lastName" , lastName),
918+ checkRequired(" maritalStatus" , maritalStatus),
868919 checkRequired(" middleName" , middleName),
869920 checkRequired(" phoneNumbers" , phoneNumbers).map { it.toImmutable() },
870921 checkRequired(" preferredName" , preferredName),
@@ -898,6 +949,7 @@ private constructor(
898949 firstName()
899950 gender().ifPresent { it.validate() }
900951 lastName()
952+ maritalStatus().ifPresent { it.validate() }
901953 middleName()
902954 phoneNumbers().ifPresent { it.forEach { it?.validate() } }
903955 preferredName()
@@ -930,6 +982,7 @@ private constructor(
930982 (if (firstName.asKnown().isPresent) 1 else 0 ) +
931983 (gender.asKnown().getOrNull()?.validity() ? : 0 ) +
932984 (if (lastName.asKnown().isPresent) 1 else 0 ) +
985+ (maritalStatus.asKnown().getOrNull()?.validity() ? : 0 ) +
933986 (if (middleName.asKnown().isPresent) 1 else 0 ) +
934987 (phoneNumbers.asKnown().getOrNull()?.sumOf { (it?.validity() ? : 0 ).toInt() } ? : 0 ) +
935988 (if (preferredName.asKnown().isPresent) 1 else 0 ) +
@@ -1270,6 +1323,175 @@ private constructor(
12701323 override fun toString () = value.toString()
12711324 }
12721325
1326+ /* *
1327+ * The employee's marital status, used for beneficiary designation and spousal consent
1328+ * workflows.
1329+ */
1330+ class MaritalStatus @JsonCreator private constructor(private val value : JsonField <String >) :
1331+ Enum {
1332+
1333+ /* *
1334+ * Returns this class instance's raw value.
1335+ *
1336+ * This is usually only useful if this instance was deserialized from data that doesn't
1337+ * match any known member, and you want to know that value. For example, if the SDK is
1338+ * on an older version than the API, then the API may respond with new members that the
1339+ * SDK is unaware of.
1340+ */
1341+ @com.fasterxml.jackson.annotation.JsonValue fun _value (): JsonField <String > = value
1342+
1343+ companion object {
1344+
1345+ @JvmField val SINGLE = of(" single" )
1346+
1347+ @JvmField val MARRIED = of(" married" )
1348+
1349+ @JvmField val DIVORCED = of(" divorced" )
1350+
1351+ @JvmField val WIDOWED = of(" widowed" )
1352+
1353+ @JvmField val DOMESTIC_PARTNER = of(" domestic_partner" )
1354+
1355+ @JvmField val UNKNOWN = of(" unknown" )
1356+
1357+ @JvmStatic fun of (value : String ) = MaritalStatus (JsonField .of(value))
1358+ }
1359+
1360+ /* * An enum containing [MaritalStatus]'s known values. */
1361+ enum class Known {
1362+ SINGLE ,
1363+ MARRIED ,
1364+ DIVORCED ,
1365+ WIDOWED ,
1366+ DOMESTIC_PARTNER ,
1367+ UNKNOWN ,
1368+ }
1369+
1370+ /* *
1371+ * An enum containing [MaritalStatus]'s known values, as well as an [_UNKNOWN] member.
1372+ *
1373+ * An instance of [MaritalStatus] can contain an unknown value in a couple of cases:
1374+ * - It was deserialized from data that doesn't match any known member. For example, if
1375+ * the SDK is on an older version than the API, then the API may respond with new
1376+ * members that the SDK is unaware of.
1377+ * - It was constructed with an arbitrary value using the [of] method.
1378+ */
1379+ enum class Value {
1380+ SINGLE ,
1381+ MARRIED ,
1382+ DIVORCED ,
1383+ WIDOWED ,
1384+ DOMESTIC_PARTNER ,
1385+ UNKNOWN ,
1386+ /* *
1387+ * An enum member indicating that [MaritalStatus] was instantiated with an unknown
1388+ * value.
1389+ */
1390+ _UNKNOWN ,
1391+ }
1392+
1393+ /* *
1394+ * Returns an enum member corresponding to this class instance's value, or
1395+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
1396+ *
1397+ * Use the [known] method instead if you're certain the value is always known or if you
1398+ * want to throw for the unknown case.
1399+ */
1400+ fun value (): Value =
1401+ when (this ) {
1402+ SINGLE -> Value .SINGLE
1403+ MARRIED -> Value .MARRIED
1404+ DIVORCED -> Value .DIVORCED
1405+ WIDOWED -> Value .WIDOWED
1406+ DOMESTIC_PARTNER -> Value .DOMESTIC_PARTNER
1407+ UNKNOWN -> Value .UNKNOWN
1408+ else -> Value ._UNKNOWN
1409+ }
1410+
1411+ /* *
1412+ * Returns an enum member corresponding to this class instance's value.
1413+ *
1414+ * Use the [value] method instead if you're uncertain the value is always known and
1415+ * don't want to throw for the unknown case.
1416+ *
1417+ * @throws FinchInvalidDataException if this class instance's value is a not a known
1418+ * member.
1419+ */
1420+ fun known (): Known =
1421+ when (this ) {
1422+ SINGLE -> Known .SINGLE
1423+ MARRIED -> Known .MARRIED
1424+ DIVORCED -> Known .DIVORCED
1425+ WIDOWED -> Known .WIDOWED
1426+ DOMESTIC_PARTNER -> Known .DOMESTIC_PARTNER
1427+ UNKNOWN -> Known .UNKNOWN
1428+ else -> throw FinchInvalidDataException (" Unknown MaritalStatus: $value " )
1429+ }
1430+
1431+ /* *
1432+ * Returns this class instance's primitive wire representation.
1433+ *
1434+ * This differs from the [toString] method because that method is primarily for
1435+ * debugging and generally doesn't throw.
1436+ *
1437+ * @throws FinchInvalidDataException if this class instance's value does not have the
1438+ * expected primitive type.
1439+ */
1440+ fun asString (): String =
1441+ _value ().asString().orElseThrow {
1442+ FinchInvalidDataException (" Value is not a String" )
1443+ }
1444+
1445+ private var validated: Boolean = false
1446+
1447+ /* *
1448+ * Validates that the types of all values in this object match their expected types
1449+ * recursively.
1450+ *
1451+ * This method is _not_ forwards compatible with new types from the API for existing
1452+ * fields.
1453+ *
1454+ * @throws FinchInvalidDataException if any value type in this object doesn't match its
1455+ * expected type.
1456+ */
1457+ fun validate (): MaritalStatus = apply {
1458+ if (validated) {
1459+ return @apply
1460+ }
1461+
1462+ known()
1463+ validated = true
1464+ }
1465+
1466+ fun isValid (): Boolean =
1467+ try {
1468+ validate()
1469+ true
1470+ } catch (e: FinchInvalidDataException ) {
1471+ false
1472+ }
1473+
1474+ /* *
1475+ * Returns a score indicating how many valid values are contained in this object
1476+ * recursively.
1477+ *
1478+ * Used for best match union deserialization.
1479+ */
1480+ @JvmSynthetic internal fun validity (): Int = if (value() == Value ._UNKNOWN ) 0 else 1
1481+
1482+ override fun equals (other : Any? ): Boolean {
1483+ if (this == = other) {
1484+ return true
1485+ }
1486+
1487+ return other is MaritalStatus && value == other.value
1488+ }
1489+
1490+ override fun hashCode () = value.hashCode()
1491+
1492+ override fun toString () = value.toString()
1493+ }
1494+
12731495 class PhoneNumber
12741496 @JsonCreator(mode = JsonCreator .Mode .DISABLED )
12751497 private constructor (
@@ -1982,6 +2204,7 @@ private constructor(
19822204 firstName == other.firstName &&
19832205 gender == other.gender &&
19842206 lastName == other.lastName &&
2207+ maritalStatus == other.maritalStatus &&
19852208 middleName == other.middleName &&
19862209 phoneNumbers == other.phoneNumbers &&
19872210 preferredName == other.preferredName &&
@@ -2000,6 +2223,7 @@ private constructor(
20002223 firstName,
20012224 gender,
20022225 lastName,
2226+ maritalStatus,
20032227 middleName,
20042228 phoneNumbers,
20052229 preferredName,
@@ -2014,7 +2238,7 @@ private constructor(
20142238 override fun hashCode (): Int = hashCode
20152239
20162240 override fun toString () =
2017- " IndividualResponseBody{id=$id , dob=$dob , ethnicity=$ethnicity , firstName=$firstName , gender=$gender , lastName=$lastName , middleName=$middleName , phoneNumbers=$phoneNumbers , preferredName=$preferredName , residence=$residence , emails=$emails , encryptedSsn=$encryptedSsn , ssn=$ssn , additionalProperties=$additionalProperties }"
2241+ " IndividualResponseBody{id=$id , dob=$dob , ethnicity=$ethnicity , firstName=$firstName , gender=$gender , lastName=$lastName , maritalStatus= $maritalStatus , middleName=$middleName , phoneNumbers=$phoneNumbers , preferredName=$preferredName , residence=$residence , emails=$emails , encryptedSsn=$encryptedSsn , ssn=$ssn , additionalProperties=$additionalProperties }"
20182242 }
20192243
20202244 class BatchError
0 commit comments