"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""

from __future__ import annotations
from kombo.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Literal, Optional
from typing_extensions import NotRequired, TypedDict


PostConnectCreateLinkRequestBodyIntegrationCategory = Literal[
    "HRIS",
    "ATS",
    "ASSESSMENT",
    "LMS",
]
r"""Category of the integration you want your customer to create."""


IntegrationTool = Literal[
    "workday",
    "successfactors",
    "smartrecruiters",
    "factorial",
    "oraclerecruiting",
    "lever",
    "icims",
    "cornerstonetalentlink",
    "recruitee",
    "recruiterflow",
    "greenhouse",
    "greenhousejobboard",
    "teamtailor",
    "teamtailorjobboards",
    "ashby",
    "talentsoft",
    "talentsoftcustomer",
    "concludis",
    "talention",
    "piloga",
    "onlyfy",
    "personio",
    "ukgpro",
    "ukgready",
    "adpworkforcenow",
    "taleo",
    "rexx",
    "afas",
    "bamboohr",
    "bullhorn",
    "bullhornlogin",
    "workable",
    "jobvite",
    "fountain",
    "softgarden",
    "softgardenpartner",
    "pinpoint",
    "welcometothejungle",
    "dvinci",
    "dvinciadmin",
    "join",
    "sagehr",
    "traffit",
    "erecruiter",
    "abacusumantis",
    "umantis",
    "jobylon",
    "taleez",
    "hrworks",
    "otys",
    "zohorecruit",
    "ceipal",
    "eploy",
    "jobdiva",
    "careerplug",
    "perview",
    "eightfold",
    "paylocity",
    "paycor",
    "avature",
    "apploi",
    "phenom",
    "paradox",
    "heyrecruit",
    "recruhr",
    "recruitcrm",
    "jazzhr",
    "bite",
    "homerun",
    "mysolution",
    "carerix",
    "hroffice",
    "talentclue",
    "inrecruiting",
    "ubeeo",
    "connexys",
    "hr4you",
    "cornerstoneondemand",
    "zvooverecruit",
    "odoo",
    "comeet",
    "compleet",
    "compleetpitcher",
    "gem",
    "laura",
    "covetorest",
    "coveto",
    "crelate",
    "manatal",
    "avionte",
    "mhmhr",
    "asymbl",
    "breezyhr",
    "flatchr",
    "dayforce",
    "digitalrecruiters",
    "applicantstack",
    "reachmee",
    "talentadore",
    "sandbox",
    "guidecom",
    "spott",
    "loxo",
    "workdaycustomreport",
    "workdaycustomreportsftp",
    "payfitcustomer",
    "payfitpartner",
    "payfit",
    "employmenthero",
    "fourth",
    "kenjo",
    "heavenhr",
    "hibob",
    "cezannehr",
    "entraid",
    "azuread",
    "googleworkspace",
    "nmbrs",
    "deel",
    "remotecom",
    "iriscascade",
    "okta",
    "sagepeople",
    "humaans",
    "eurecia",
    "oraclehcm",
    "officient",
    "sesamehr",
    "charliehr",
    "abacus",
    "zohopeople",
    "gusto",
    "breathehr",
    "catalystone",
    "mirus",
    "alexishr",
    "simployer",
    "peple",
    "youserve",
    "hansalog",
    "lattice",
    "latticetalent",
    "hoorayhr",
    "trinet",
    "trinetpeo",
    "namely",
    "paycom",
    "insperity",
    "paychex",
    "rippling",
    "sapling",
    "peoplehr",
    "lucca",
    "zelt",
    "planday",
    "boondmanager",
    "haileyhr",
    "silae",
    "oysterhr",
    "kiwihr",
    "square",
    "perbilityhelix",
    "leapsome",
    "loket",
    "workforcecom",
    "peoplefirst",
    "sdworx",
    "itrent",
    "absenceio",
    "a3innuvanomina",
    "scim",
    "datevhr",
    "datev",
    "datevlug",
    "sympa",
    "youforce",
    "nibelis",
    "peoplexd",
    "sftp",
    "sftpfetch",
    "360learning",
    "talentlms",
    "udemy",
    "linkedinlearning",
]
r"""Pre-define a tool this integration link can be used for."""


PostConnectCreateLinkRequestBodyLanguage = Literal[
    "en",
    "de",
    "fr",
    "it",
    "es",
]
r"""Language of the connection flow UI."""


PostConnectCreateLinkRequestBodyLinkType = Literal[
    "EMBEDDED",
    "MAGIC_LINK",
]
r"""The type of link you want to create. `EMBEDDED` is for the [embedded flow](../guides/connect/embedded-flow) using the Kombo Connect SDK (these links are valid for 1 hour) and `MAGIC_LINK` is for [magic links](../guides/connect/magic-links) which you send out manually to customers (there are valid for 1 year).

This defaults to `EMBEDDED`, which is our recommended method of implementing the connection flow for a seamless user experience.
"""


class PostConnectCreateLinkRequestBodyTypedDict(TypedDict):
    end_user_email: str
    r"""The email of the user this link is meant for."""
    end_user_organization_name: str
    r"""The name of the user's organization."""
    end_user_origin_id: NotRequired[Nullable[str]]
    r"""The id the user/organization has in your own database."""
    remote_environment: NotRequired[Nullable[str]]
    r"""If the tool you want to connect offers different environments, you can specify which one you want to connect to here. If you don't specify this, we'll assume you want to use the production environment. Note that this can only be used if you've also specified a tool through `integration_tool`."""
    integration_category: NotRequired[
        PostConnectCreateLinkRequestBodyIntegrationCategory
    ]
    r"""Category of the integration you want your customer to create."""
    integration_tool: NotRequired[Nullable[IntegrationTool]]
    r"""Pre-define a tool this integration link can be used for."""
    language: NotRequired[Nullable[PostConnectCreateLinkRequestBodyLanguage]]
    r"""Language of the connection flow UI."""
    scope_config_id: NotRequired[Nullable[str]]
    r"""Specify a scope config that should be used for this integration. This is an advanced feature, only use it if you know what you're doing!"""
    enable_filtering: NotRequired[bool]
    r"""Enable the [filtering feature](https://docs.kombo.dev/other/filtering) for the integration. HRIS only."""
    enable_field_mapping: NotRequired[bool]
    r"""Enable the [field mapping feature](https://docs.kombo.dev/hris/features/setup-flow/introduction#field-mapping) for this integration."""
    link_type: NotRequired[PostConnectCreateLinkRequestBodyLinkType]
    r"""The type of link you want to create. `EMBEDDED` is for the [embedded flow](../guides/connect/embedded-flow) using the Kombo Connect SDK (these links are valid for 1 hour) and `MAGIC_LINK` is for [magic links](../guides/connect/magic-links) which you send out manually to customers (there are valid for 1 year).

    This defaults to `EMBEDDED`, which is our recommended method of implementing the connection flow for a seamless user experience.
    """


class PostConnectCreateLinkRequestBody(BaseModel):
    end_user_email: str
    r"""The email of the user this link is meant for."""

    end_user_organization_name: str
    r"""The name of the user's organization."""

    end_user_origin_id: OptionalNullable[str] = UNSET
    r"""The id the user/organization has in your own database."""

    remote_environment: OptionalNullable[str] = UNSET
    r"""If the tool you want to connect offers different environments, you can specify which one you want to connect to here. If you don't specify this, we'll assume you want to use the production environment. Note that this can only be used if you've also specified a tool through `integration_tool`."""

    integration_category: Optional[
        PostConnectCreateLinkRequestBodyIntegrationCategory
    ] = "HRIS"
    r"""Category of the integration you want your customer to create."""

    integration_tool: OptionalNullable[IntegrationTool] = UNSET
    r"""Pre-define a tool this integration link can be used for."""

    language: OptionalNullable[PostConnectCreateLinkRequestBodyLanguage] = "en"
    r"""Language of the connection flow UI."""

    scope_config_id: OptionalNullable[str] = UNSET
    r"""Specify a scope config that should be used for this integration. This is an advanced feature, only use it if you know what you're doing!"""

    enable_filtering: Optional[bool] = False
    r"""Enable the [filtering feature](https://docs.kombo.dev/other/filtering) for the integration. HRIS only."""

    enable_field_mapping: Optional[bool] = False
    r"""Enable the [field mapping feature](https://docs.kombo.dev/hris/features/setup-flow/introduction#field-mapping) for this integration."""

    link_type: Optional[PostConnectCreateLinkRequestBodyLinkType] = "EMBEDDED"
    r"""The type of link you want to create. `EMBEDDED` is for the [embedded flow](../guides/connect/embedded-flow) using the Kombo Connect SDK (these links are valid for 1 hour) and `MAGIC_LINK` is for [magic links](../guides/connect/magic-links) which you send out manually to customers (there are valid for 1 year).

    This defaults to `EMBEDDED`, which is our recommended method of implementing the connection flow for a seamless user experience.
    """

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(
            [
                "end_user_origin_id",
                "remote_environment",
                "integration_category",
                "integration_tool",
                "language",
                "scope_config_id",
                "enable_filtering",
                "enable_field_mapping",
                "link_type",
            ]
        )
        nullable_fields = set(
            [
                "end_user_origin_id",
                "remote_environment",
                "integration_tool",
                "language",
                "scope_config_id",
            ]
        )
        serialized = handler(self)
        m = {}

        for n, f in type(self).model_fields.items():
            k = f.alias or n
            val = serialized.get(k, serialized.get(n))
            is_nullable_and_explicitly_set = (
                k in nullable_fields
                and (self.__pydantic_fields_set__.intersection({n}))  # pylint: disable=no-member
            )

            if val != UNSET_SENTINEL:
                if (
                    val is not None
                    or k not in optional_fields
                    or is_nullable_and_explicitly_set
                ):
                    m[k] = val

        return m
