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

com.tryfinch.api.models.SandboxEmploymentUpdateParams.kt Maven / Gradle / Ivy

Go to download

The Finch HRIS API provides a unified way to connect to a multitide of HRIS systems. The API requires an access token issued by Finch. By default, Organization and Payroll requests use Finch's [Data Syncs](/developer-resources/Data-Syncs). If a request is made before the initial sync has completed, Finch will request data live from the provider. The latency on live requests may range from seconds to minutes depending on the provider and batch size. For automated integrations, Deductions requests (both read and write) are always made live to the provider. Latencies may range from seconds to minutes depending on the provider and batch size. Employer products are specified by the product parameter, a space-separated list of products that your application requests from an employer authenticating through Finch Connect. Valid product names are— - `company`: Read basic company data - `directory`: Read company directory and organization structure - `individual`: Read individual data, excluding income and employment data - `employment`: Read individual employment and income data - `payment`: Read payroll and contractor related payments by the company - `pay_statement`: Read detailed pay statements for each individual - `benefits`: Create and manage deductions and contributions and enrollment for an employer [![Open in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4?action=collection%2Ffork&collection-url=entityId%3D21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4%26entityType%3Dcollection%26workspaceId%3D1edf19bc-e0a8-41e9-ac55-481a4b50790b)

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

package com.tryfinch.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.tryfinch.api.core.Enum
import com.tryfinch.api.core.ExcludeMissing
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.NoAutoDetect
import com.tryfinch.api.core.toUnmodifiable
import com.tryfinch.api.errors.FinchInvalidDataException
import com.tryfinch.api.models.*
import java.util.Objects
import java.util.Optional

class SandboxEmploymentUpdateParams
constructor(
    private val individualId: String,
    private val classCode: String?,
    private val customFields: List?,
    private val department: Department?,
    private val employment: Employment?,
    private val endDate: String?,
    private val firstName: String?,
    private val income: Income?,
    private val incomeHistory: List?,
    private val isActive: Boolean?,
    private val lastName: String?,
    private val latestRehireDate: String?,
    private val location: Location?,
    private val manager: Manager?,
    private val middleName: String?,
    private val sourceId: String?,
    private val startDate: String?,
    private val title: String?,
    private val additionalQueryParams: Map>,
    private val additionalHeaders: Map>,
    private val additionalBodyProperties: Map,
) {

    fun individualId(): String = individualId

    fun classCode(): Optional = Optional.ofNullable(classCode)

    fun customFields(): Optional> = Optional.ofNullable(customFields)

    fun department(): Optional = Optional.ofNullable(department)

    fun employment(): Optional = Optional.ofNullable(employment)

    fun endDate(): Optional = Optional.ofNullable(endDate)

    fun firstName(): Optional = Optional.ofNullable(firstName)

    fun income(): Optional = Optional.ofNullable(income)

    fun incomeHistory(): Optional> = Optional.ofNullable(incomeHistory)

    fun isActive(): Optional = Optional.ofNullable(isActive)

    fun lastName(): Optional = Optional.ofNullable(lastName)

    fun latestRehireDate(): Optional = Optional.ofNullable(latestRehireDate)

    fun location(): Optional = Optional.ofNullable(location)

    fun manager(): Optional = Optional.ofNullable(manager)

    fun middleName(): Optional = Optional.ofNullable(middleName)

    fun sourceId(): Optional = Optional.ofNullable(sourceId)

    fun startDate(): Optional = Optional.ofNullable(startDate)

    fun title(): Optional = Optional.ofNullable(title)

    @JvmSynthetic
    internal fun getBody(): SandboxEmploymentUpdateBody {
        return SandboxEmploymentUpdateBody(
            classCode,
            customFields,
            department,
            employment,
            endDate,
            firstName,
            income,
            incomeHistory,
            isActive,
            lastName,
            latestRehireDate,
            location,
            manager,
            middleName,
            sourceId,
            startDate,
            title,
            additionalBodyProperties,
        )
    }

    @JvmSynthetic internal fun getQueryParams(): Map> = additionalQueryParams

    @JvmSynthetic internal fun getHeaders(): Map> = additionalHeaders

    fun getPathParam(index: Int): String {
        return when (index) {
            0 -> individualId
            else -> ""
        }
    }

    @JsonDeserialize(builder = SandboxEmploymentUpdateBody.Builder::class)
    @NoAutoDetect
    class SandboxEmploymentUpdateBody
    internal constructor(
        private val classCode: String?,
        private val customFields: List?,
        private val department: Department?,
        private val employment: Employment?,
        private val endDate: String?,
        private val firstName: String?,
        private val income: Income?,
        private val incomeHistory: List?,
        private val isActive: Boolean?,
        private val lastName: String?,
        private val latestRehireDate: String?,
        private val location: Location?,
        private val manager: Manager?,
        private val middleName: String?,
        private val sourceId: String?,
        private val startDate: String?,
        private val title: String?,
        private val additionalProperties: Map,
    ) {

        private var hashCode: Int = 0

        /** Worker's compensation classification code for this employee */
        @JsonProperty("class_code") fun classCode(): String? = classCode

        /**
         * Custom fields for the individual. These are fields which are defined by the employer in
         * the system. Custom fields are not currently supported for assisted connections.
         */
        @JsonProperty("custom_fields") fun customFields(): List? = customFields

        /** The department object. */
        @JsonProperty("department") fun department(): Department? = department

        /** The employment object. */
        @JsonProperty("employment") fun employment(): Employment? = employment

        @JsonProperty("end_date") fun endDate(): String? = endDate

        /** The legal first name of the individual. */
        @JsonProperty("first_name") fun firstName(): String? = firstName

        /**
         * The employee's income as reported by the provider. This may not always be annualized
         * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what
         * information the provider returns.
         */
        @JsonProperty("income") fun income(): Income? = income

        /** The array of income history. */
        @JsonProperty("income_history") fun incomeHistory(): List? = incomeHistory

        /** `true` if the individual an an active employee or contractor at the company. */
        @JsonProperty("is_active") fun isActive(): Boolean? = isActive

        /** The legal last name of the individual. */
        @JsonProperty("last_name") fun lastName(): String? = lastName

        @JsonProperty("latest_rehire_date") fun latestRehireDate(): String? = latestRehireDate

        @JsonProperty("location") fun location(): Location? = location

        /** The manager object representing the manager of the individual within the org. */
        @JsonProperty("manager") fun manager(): Manager? = manager

        /** The legal middle name of the individual. */
        @JsonProperty("middle_name") fun middleName(): String? = middleName

        /** The source system's unique employment identifier for this individual */
        @JsonProperty("source_id") fun sourceId(): String? = sourceId

        @JsonProperty("start_date") fun startDate(): String? = startDate

        /** The current title of the individual. */
        @JsonProperty("title") fun title(): String? = title

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

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

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is SandboxEmploymentUpdateBody &&
                this.classCode == other.classCode &&
                this.customFields == other.customFields &&
                this.department == other.department &&
                this.employment == other.employment &&
                this.endDate == other.endDate &&
                this.firstName == other.firstName &&
                this.income == other.income &&
                this.incomeHistory == other.incomeHistory &&
                this.isActive == other.isActive &&
                this.lastName == other.lastName &&
                this.latestRehireDate == other.latestRehireDate &&
                this.location == other.location &&
                this.manager == other.manager &&
                this.middleName == other.middleName &&
                this.sourceId == other.sourceId &&
                this.startDate == other.startDate &&
                this.title == other.title &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        classCode,
                        customFields,
                        department,
                        employment,
                        endDate,
                        firstName,
                        income,
                        incomeHistory,
                        isActive,
                        lastName,
                        latestRehireDate,
                        location,
                        manager,
                        middleName,
                        sourceId,
                        startDate,
                        title,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "SandboxEmploymentUpdateBody{classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var classCode: String? = null
            private var customFields: List? = null
            private var department: Department? = null
            private var employment: Employment? = null
            private var endDate: String? = null
            private var firstName: String? = null
            private var income: Income? = null
            private var incomeHistory: List? = null
            private var isActive: Boolean? = null
            private var lastName: String? = null
            private var latestRehireDate: String? = null
            private var location: Location? = null
            private var manager: Manager? = null
            private var middleName: String? = null
            private var sourceId: String? = null
            private var startDate: String? = null
            private var title: String? = null
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(sandboxEmploymentUpdateBody: SandboxEmploymentUpdateBody) = apply {
                this.classCode = sandboxEmploymentUpdateBody.classCode
                this.customFields = sandboxEmploymentUpdateBody.customFields
                this.department = sandboxEmploymentUpdateBody.department
                this.employment = sandboxEmploymentUpdateBody.employment
                this.endDate = sandboxEmploymentUpdateBody.endDate
                this.firstName = sandboxEmploymentUpdateBody.firstName
                this.income = sandboxEmploymentUpdateBody.income
                this.incomeHistory = sandboxEmploymentUpdateBody.incomeHistory
                this.isActive = sandboxEmploymentUpdateBody.isActive
                this.lastName = sandboxEmploymentUpdateBody.lastName
                this.latestRehireDate = sandboxEmploymentUpdateBody.latestRehireDate
                this.location = sandboxEmploymentUpdateBody.location
                this.manager = sandboxEmploymentUpdateBody.manager
                this.middleName = sandboxEmploymentUpdateBody.middleName
                this.sourceId = sandboxEmploymentUpdateBody.sourceId
                this.startDate = sandboxEmploymentUpdateBody.startDate
                this.title = sandboxEmploymentUpdateBody.title
                additionalProperties(sandboxEmploymentUpdateBody.additionalProperties)
            }

            /** Worker's compensation classification code for this employee */
            @JsonProperty("class_code")
            fun classCode(classCode: String) = apply { this.classCode = classCode }

            /**
             * Custom fields for the individual. These are fields which are defined by the employer
             * in the system. Custom fields are not currently supported for assisted connections.
             */
            @JsonProperty("custom_fields")
            fun customFields(customFields: List) = apply {
                this.customFields = customFields
            }

            /** The department object. */
            @JsonProperty("department")
            fun department(department: Department) = apply { this.department = department }

            /** The employment object. */
            @JsonProperty("employment")
            fun employment(employment: Employment) = apply { this.employment = employment }

            @JsonProperty("end_date")
            fun endDate(endDate: String) = apply { this.endDate = endDate }

            /** The legal first name of the individual. */
            @JsonProperty("first_name")
            fun firstName(firstName: String) = apply { this.firstName = firstName }

            /**
             * The employee's income as reported by the provider. This may not always be annualized
             * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what
             * information the provider returns.
             */
            @JsonProperty("income") fun income(income: Income) = apply { this.income = income }

            /** The array of income history. */
            @JsonProperty("income_history")
            fun incomeHistory(incomeHistory: List) = apply {
                this.incomeHistory = incomeHistory
            }

            /** `true` if the individual an an active employee or contractor at the company. */
            @JsonProperty("is_active")
            fun isActive(isActive: Boolean) = apply { this.isActive = isActive }

            /** The legal last name of the individual. */
            @JsonProperty("last_name")
            fun lastName(lastName: String) = apply { this.lastName = lastName }

            @JsonProperty("latest_rehire_date")
            fun latestRehireDate(latestRehireDate: String) = apply {
                this.latestRehireDate = latestRehireDate
            }

            @JsonProperty("location")
            fun location(location: Location) = apply { this.location = location }

            /** The manager object representing the manager of the individual within the org. */
            @JsonProperty("manager")
            fun manager(manager: Manager) = apply { this.manager = manager }

            /** The legal middle name of the individual. */
            @JsonProperty("middle_name")
            fun middleName(middleName: String) = apply { this.middleName = middleName }

            /** The source system's unique employment identifier for this individual */
            @JsonProperty("source_id")
            fun sourceId(sourceId: String) = apply { this.sourceId = sourceId }

            @JsonProperty("start_date")
            fun startDate(startDate: String) = apply { this.startDate = startDate }

            /** The current title of the individual. */
            @JsonProperty("title") fun title(title: String) = apply { this.title = title }

            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(): SandboxEmploymentUpdateBody =
                SandboxEmploymentUpdateBody(
                    classCode,
                    customFields?.toUnmodifiable(),
                    department,
                    employment,
                    endDate,
                    firstName,
                    income,
                    incomeHistory?.toUnmodifiable(),
                    isActive,
                    lastName,
                    latestRehireDate,
                    location,
                    manager,
                    middleName,
                    sourceId,
                    startDate,
                    title,
                    additionalProperties.toUnmodifiable(),
                )
        }
    }

    fun _additionalQueryParams(): Map> = additionalQueryParams

    fun _additionalHeaders(): Map> = additionalHeaders

    fun _additionalBodyProperties(): Map = additionalBodyProperties

    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        }

        return other is SandboxEmploymentUpdateParams &&
            this.individualId == other.individualId &&
            this.classCode == other.classCode &&
            this.customFields == other.customFields &&
            this.department == other.department &&
            this.employment == other.employment &&
            this.endDate == other.endDate &&
            this.firstName == other.firstName &&
            this.income == other.income &&
            this.incomeHistory == other.incomeHistory &&
            this.isActive == other.isActive &&
            this.lastName == other.lastName &&
            this.latestRehireDate == other.latestRehireDate &&
            this.location == other.location &&
            this.manager == other.manager &&
            this.middleName == other.middleName &&
            this.sourceId == other.sourceId &&
            this.startDate == other.startDate &&
            this.title == other.title &&
            this.additionalQueryParams == other.additionalQueryParams &&
            this.additionalHeaders == other.additionalHeaders &&
            this.additionalBodyProperties == other.additionalBodyProperties
    }

    override fun hashCode(): Int {
        return Objects.hash(
            individualId,
            classCode,
            customFields,
            department,
            employment,
            endDate,
            firstName,
            income,
            incomeHistory,
            isActive,
            lastName,
            latestRehireDate,
            location,
            manager,
            middleName,
            sourceId,
            startDate,
            title,
            additionalQueryParams,
            additionalHeaders,
            additionalBodyProperties,
        )
    }

    override fun toString() =
        "SandboxEmploymentUpdateParams{individualId=$individualId, classCode=$classCode, customFields=$customFields, department=$department, employment=$employment, endDate=$endDate, firstName=$firstName, income=$income, incomeHistory=$incomeHistory, isActive=$isActive, lastName=$lastName, latestRehireDate=$latestRehireDate, location=$location, manager=$manager, middleName=$middleName, sourceId=$sourceId, startDate=$startDate, title=$title, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"

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

    companion object {

        @JvmStatic fun builder() = Builder()
    }

    @NoAutoDetect
    class Builder {

        private var individualId: String? = null
        private var classCode: String? = null
        private var customFields: MutableList = mutableListOf()
        private var department: Department? = null
        private var employment: Employment? = null
        private var endDate: String? = null
        private var firstName: String? = null
        private var income: Income? = null
        private var incomeHistory: MutableList = mutableListOf()
        private var isActive: Boolean? = null
        private var lastName: String? = null
        private var latestRehireDate: String? = null
        private var location: Location? = null
        private var manager: Manager? = null
        private var middleName: String? = null
        private var sourceId: String? = null
        private var startDate: String? = null
        private var title: String? = null
        private var additionalQueryParams: MutableMap> = mutableMapOf()
        private var additionalHeaders: MutableMap> = mutableMapOf()
        private var additionalBodyProperties: MutableMap = mutableMapOf()

        @JvmSynthetic
        internal fun from(sandboxEmploymentUpdateParams: SandboxEmploymentUpdateParams) = apply {
            this.individualId = sandboxEmploymentUpdateParams.individualId
            this.classCode = sandboxEmploymentUpdateParams.classCode
            this.customFields(sandboxEmploymentUpdateParams.customFields ?: listOf())
            this.department = sandboxEmploymentUpdateParams.department
            this.employment = sandboxEmploymentUpdateParams.employment
            this.endDate = sandboxEmploymentUpdateParams.endDate
            this.firstName = sandboxEmploymentUpdateParams.firstName
            this.income = sandboxEmploymentUpdateParams.income
            this.incomeHistory(sandboxEmploymentUpdateParams.incomeHistory ?: listOf())
            this.isActive = sandboxEmploymentUpdateParams.isActive
            this.lastName = sandboxEmploymentUpdateParams.lastName
            this.latestRehireDate = sandboxEmploymentUpdateParams.latestRehireDate
            this.location = sandboxEmploymentUpdateParams.location
            this.manager = sandboxEmploymentUpdateParams.manager
            this.middleName = sandboxEmploymentUpdateParams.middleName
            this.sourceId = sandboxEmploymentUpdateParams.sourceId
            this.startDate = sandboxEmploymentUpdateParams.startDate
            this.title = sandboxEmploymentUpdateParams.title
            additionalQueryParams(sandboxEmploymentUpdateParams.additionalQueryParams)
            additionalHeaders(sandboxEmploymentUpdateParams.additionalHeaders)
            additionalBodyProperties(sandboxEmploymentUpdateParams.additionalBodyProperties)
        }

        fun individualId(individualId: String) = apply { this.individualId = individualId }

        /** Worker's compensation classification code for this employee */
        fun classCode(classCode: String) = apply { this.classCode = classCode }

        /**
         * Custom fields for the individual. These are fields which are defined by the employer in
         * the system. Custom fields are not currently supported for assisted connections.
         */
        fun customFields(customFields: List) = apply {
            this.customFields.clear()
            this.customFields.addAll(customFields)
        }

        /**
         * Custom fields for the individual. These are fields which are defined by the employer in
         * the system. Custom fields are not currently supported for assisted connections.
         */
        fun addCustomField(customField: CustomField) = apply { this.customFields.add(customField) }

        /** The department object. */
        fun department(department: Department) = apply { this.department = department }

        /** The employment object. */
        fun employment(employment: Employment) = apply { this.employment = employment }

        fun endDate(endDate: String) = apply { this.endDate = endDate }

        /** The legal first name of the individual. */
        fun firstName(firstName: String) = apply { this.firstName = firstName }

        /**
         * The employee's income as reported by the provider. This may not always be annualized
         * income, but may be in units of bi-weekly, semi-monthly, daily, etc, depending on what
         * information the provider returns.
         */
        fun income(income: Income) = apply { this.income = income }

        /** The array of income history. */
        fun incomeHistory(incomeHistory: List) = apply {
            this.incomeHistory.clear()
            this.incomeHistory.addAll(incomeHistory)
        }

        /** The array of income history. */
        fun addIncomeHistory(incomeHistory: Income) = apply {
            this.incomeHistory.add(incomeHistory)
        }

        /** `true` if the individual an an active employee or contractor at the company. */
        fun isActive(isActive: Boolean) = apply { this.isActive = isActive }

        /** The legal last name of the individual. */
        fun lastName(lastName: String) = apply { this.lastName = lastName }

        fun latestRehireDate(latestRehireDate: String) = apply {
            this.latestRehireDate = latestRehireDate
        }

        fun location(location: Location) = apply { this.location = location }

        /** The manager object representing the manager of the individual within the org. */
        fun manager(manager: Manager) = apply { this.manager = manager }

        /** The legal middle name of the individual. */
        fun middleName(middleName: String) = apply { this.middleName = middleName }

        /** The source system's unique employment identifier for this individual */
        fun sourceId(sourceId: String) = apply { this.sourceId = sourceId }

        fun startDate(startDate: String) = apply { this.startDate = startDate }

        /** The current title of the individual. */
        fun title(title: String) = apply { this.title = title }

        fun additionalQueryParams(additionalQueryParams: Map>) = apply {
            this.additionalQueryParams.clear()
            putAllQueryParams(additionalQueryParams)
        }

        fun putQueryParam(name: String, value: String) = apply {
            this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value)
        }

        fun putQueryParams(name: String, values: Iterable) = apply {
            this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values)
        }

        fun putAllQueryParams(additionalQueryParams: Map>) = apply {
            additionalQueryParams.forEach(this::putQueryParams)
        }

        fun removeQueryParam(name: String) = apply {
            this.additionalQueryParams.put(name, mutableListOf())
        }

        fun additionalHeaders(additionalHeaders: Map>) = apply {
            this.additionalHeaders.clear()
            putAllHeaders(additionalHeaders)
        }

        fun putHeader(name: String, value: String) = apply {
            this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value)
        }

        fun putHeaders(name: String, values: Iterable) = apply {
            this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values)
        }

        fun putAllHeaders(additionalHeaders: Map>) = apply {
            additionalHeaders.forEach(this::putHeaders)
        }

        fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }

        fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
            this.additionalBodyProperties.clear()
            this.additionalBodyProperties.putAll(additionalBodyProperties)
        }

        fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
            this.additionalBodyProperties.put(key, value)
        }

        fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
            apply {
                this.additionalBodyProperties.putAll(additionalBodyProperties)
            }

        fun build(): SandboxEmploymentUpdateParams =
            SandboxEmploymentUpdateParams(
                checkNotNull(individualId) { "`individualId` is required but was not set" },
                classCode,
                if (customFields.size == 0) null else customFields.toUnmodifiable(),
                department,
                employment,
                endDate,
                firstName,
                income,
                if (incomeHistory.size == 0) null else incomeHistory.toUnmodifiable(),
                isActive,
                lastName,
                latestRehireDate,
                location,
                manager,
                middleName,
                sourceId,
                startDate,
                title,
                additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
                additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
                additionalBodyProperties.toUnmodifiable(),
            )
    }

    @JsonDeserialize(builder = CustomField.Builder::class)
    @NoAutoDetect
    class CustomField
    private constructor(
        private val name: String?,
        private val value: JsonValue?,
        private val additionalProperties: Map,
    ) {

        private var hashCode: Int = 0

        @JsonProperty("name") fun name(): String? = name

        @JsonProperty("value") fun value(): JsonValue? = value

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

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

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is CustomField &&
                this.name == other.name &&
                this.value == other.value &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        name,
                        value,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "CustomField{name=$name, value=$value, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var name: String? = null
            private var value: JsonValue? = null
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(customField: CustomField) = apply {
                this.name = customField.name
                this.value = customField.value
                additionalProperties(customField.additionalProperties)
            }

            @JsonProperty("name") fun name(name: String) = apply { this.name = name }

            @JsonProperty("value") fun value(value: JsonValue) = apply { this.value = value }

            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(): CustomField =
                CustomField(
                    name,
                    value,
                    additionalProperties.toUnmodifiable(),
                )
        }
    }

    /** The department object. */
    @JsonDeserialize(builder = Department.Builder::class)
    @NoAutoDetect
    class Department
    private constructor(
        private val name: String?,
        private val additionalProperties: Map,
    ) {

        private var hashCode: Int = 0

        /** The name of the department associated with the individual. */
        @JsonProperty("name") fun name(): String? = name

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

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

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is Department &&
                this.name == other.name &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = Objects.hash(name, additionalProperties)
            }
            return hashCode
        }

        override fun toString() =
            "Department{name=$name, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var name: String? = null
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(department: Department) = apply {
                this.name = department.name
                additionalProperties(department.additionalProperties)
            }

            /** The name of the department associated with the individual. */
            @JsonProperty("name") fun name(name: String) = apply { this.name = name }

            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(): Department = Department(name, additionalProperties.toUnmodifiable())
        }
    }

    /** The employment object. */
    @JsonDeserialize(builder = Employment.Builder::class)
    @NoAutoDetect
    class Employment
    private constructor(
        private val type: Type?,
        private val subtype: Subtype?,
        private val additionalProperties: Map,
    ) {

        private var hashCode: Int = 0

        /** The main employment type of the individual. */
        @JsonProperty("type") fun type(): Type? = type

        /**
         * The secondary employment type of the individual. Options: `full_time`, `part_time`,
         * `intern`, `temp`, `seasonal` and `individual_contractor`.
         */
        @JsonProperty("subtype") fun subtype(): Subtype? = subtype

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

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

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is Employment &&
                this.type == other.type &&
                this.subtype == other.subtype &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode =
                    Objects.hash(
                        type,
                        subtype,
                        additionalProperties,
                    )
            }
            return hashCode
        }

        override fun toString() =
            "Employment{type=$type, subtype=$subtype, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var type: Type? = null
            private var subtype: Subtype? = null
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(employment: Employment) = apply {
                this.type = employment.type
                this.subtype = employment.subtype
                additionalProperties(employment.additionalProperties)
            }

            /** The main employment type of the individual. */
            @JsonProperty("type") fun type(type: Type) = apply { this.type = type }

            /**
             * The secondary employment type of the individual. Options: `full_time`, `part_time`,
             * `intern`, `temp`, `seasonal` and `individual_contractor`.
             */
            @JsonProperty("subtype")
            fun subtype(subtype: Subtype) = apply { this.subtype = subtype }

            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(): Employment =
                Employment(
                    type,
                    subtype,
                    additionalProperties.toUnmodifiable(),
                )
        }

        class Subtype
        @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 other is Subtype && this.value == other.value
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                @JvmField val FULL_TIME = Subtype(JsonField.of("full_time"))

                @JvmField val INTERN = Subtype(JsonField.of("intern"))

                @JvmField val PART_TIME = Subtype(JsonField.of("part_time"))

                @JvmField val TEMP = Subtype(JsonField.of("temp"))

                @JvmField val SEASONAL = Subtype(JsonField.of("seasonal"))

                @JvmField val INDIVIDUAL_CONTRACTOR = Subtype(JsonField.of("individual_contractor"))

                @JvmStatic fun of(value: String) = Subtype(JsonField.of(value))
            }

            enum class Known {
                FULL_TIME,
                INTERN,
                PART_TIME,
                TEMP,
                SEASONAL,
                INDIVIDUAL_CONTRACTOR,
            }

            enum class Value {
                FULL_TIME,
                INTERN,
                PART_TIME,
                TEMP,
                SEASONAL,
                INDIVIDUAL_CONTRACTOR,
                _UNKNOWN,
            }

            fun value(): Value =
                when (this) {
                    FULL_TIME -> Value.FULL_TIME
                    INTERN -> Value.INTERN
                    PART_TIME -> Value.PART_TIME
                    TEMP -> Value.TEMP
                    SEASONAL -> Value.SEASONAL
                    INDIVIDUAL_CONTRACTOR -> Value.INDIVIDUAL_CONTRACTOR
                    else -> Value._UNKNOWN
                }

            fun known(): Known =
                when (this) {
                    FULL_TIME -> Known.FULL_TIME
                    INTERN -> Known.INTERN
                    PART_TIME -> Known.PART_TIME
                    TEMP -> Known.TEMP
                    SEASONAL -> Known.SEASONAL
                    INDIVIDUAL_CONTRACTOR -> Known.INDIVIDUAL_CONTRACTOR
                    else -> throw FinchInvalidDataException("Unknown Subtype: $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 other is Type && this.value == other.value
            }

            override fun hashCode() = value.hashCode()

            override fun toString() = value.toString()

            companion object {

                @JvmField val EMPLOYEE = Type(JsonField.of("employee"))

                @JvmField val CONTRACTOR = Type(JsonField.of("contractor"))

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

            enum class Known {
                EMPLOYEE,
                CONTRACTOR,
            }

            enum class Value {
                EMPLOYEE,
                CONTRACTOR,
                _UNKNOWN,
            }

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

            fun known(): Known =
                when (this) {
                    EMPLOYEE -> Known.EMPLOYEE
                    CONTRACTOR -> Known.CONTRACTOR
                    else -> throw FinchInvalidDataException("Unknown Type: $value")
                }

            fun asString(): String = _value().asStringOrThrow()
        }
    }

    /** The manager object representing the manager of the individual within the org. */
    @JsonDeserialize(builder = Manager.Builder::class)
    @NoAutoDetect
    class Manager
    private constructor(
        private val id: String?,
        private val additionalProperties: Map,
    ) {

        private var hashCode: Int = 0

        /** A stable Finch `id` (UUID v4) for an individual in the company. */
        @JsonProperty("id") fun id(): String? = id

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

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

        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }

            return other is Manager &&
                this.id == other.id &&
                this.additionalProperties == other.additionalProperties
        }

        override fun hashCode(): Int {
            if (hashCode == 0) {
                hashCode = Objects.hash(id, additionalProperties)
            }
            return hashCode
        }

        override fun toString() = "Manager{id=$id, additionalProperties=$additionalProperties}"

        companion object {

            @JvmStatic fun builder() = Builder()
        }

        class Builder {

            private var id: String? = null
            private var additionalProperties: MutableMap = mutableMapOf()

            @JvmSynthetic
            internal fun from(manager: Manager) = apply {
                this.id = manager.id
                additionalProperties(manager.additionalProperties)
            }

            /** A stable Finch `id` (UUID v4) for an individual in the company. */
            @JsonProperty("id") fun id(id: String) = apply { this.id = id }

            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(): Manager = Manager(id, additionalProperties.toUnmodifiable())
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy