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

from __future__ import annotations
from .email import Email, EmailTypedDict
from .phone import Phone, PhoneTypedDict
from .unifiedatsapplicationoutput import UnifiedAtsApplicationOutput, UnifiedAtsApplicationOutputTypedDict
from .unifiedatsattachmentoutput import UnifiedAtsAttachmentOutput, UnifiedAtsAttachmentOutputTypedDict
from .unifiedatstagoutput import UnifiedAtsTagOutput, UnifiedAtsTagOutputTypedDict
from .url import URL, URLTypedDict
from datetime import datetime
from panora_sdk.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
from pydantic import model_serializer
from typing import Any, Dict, List, TypedDict, Union
from typing_extensions import NotRequired


class UnifiedAtsCandidateInputTypedDict(TypedDict):
    first_name: NotRequired[Nullable[str]]
    r"""The first name of the candidate"""
    last_name: NotRequired[Nullable[str]]
    r"""The last name of the candidate"""
    company: NotRequired[Nullable[str]]
    r"""The company of the candidate"""
    title: NotRequired[Nullable[str]]
    r"""The title of the candidate"""
    locations: NotRequired[Nullable[str]]
    r"""The locations of the candidate"""
    is_private: NotRequired[Nullable[bool]]
    r"""Whether the candidate is private"""
    email_reachable: NotRequired[Nullable[bool]]
    r"""Whether the candidate is reachable by email"""
    remote_created_at: NotRequired[Nullable[datetime]]
    r"""The remote creation date of the candidate"""
    remote_modified_at: NotRequired[Nullable[datetime]]
    r"""The remote modification date of the candidate"""
    last_interaction_at: NotRequired[Nullable[datetime]]
    r"""The last interaction date with the candidate"""
    attachments: NotRequired[Nullable[List[UnifiedAtsCandidateInputAttachmentsTypedDict]]]
    r"""The attachments UUIDs of the candidate"""
    applications: NotRequired[Nullable[List[UnifiedAtsCandidateInputApplicationsTypedDict]]]
    r"""The applications UUIDs of the candidate"""
    tags: NotRequired[Nullable[List[UnifiedAtsCandidateInputTagsTypedDict]]]
    r"""The tags of the candidate"""
    urls: NotRequired[Nullable[List[URLTypedDict]]]
    r"""The urls of the candidate, possible values for Url type are WEBSITE, BLOG, LINKEDIN, GITHUB, or OTHER"""
    phone_numbers: NotRequired[Nullable[List[PhoneTypedDict]]]
    r"""The phone numbers of the candidate"""
    email_addresses: NotRequired[Nullable[List[EmailTypedDict]]]
    r"""The email addresses of the candidate"""
    field_mappings: NotRequired[Nullable[Dict[str, Any]]]
    r"""The custom field mappings of the object between the remote 3rd party & Panora"""
    

class UnifiedAtsCandidateInput(BaseModel):
    first_name: OptionalNullable[str] = UNSET
    r"""The first name of the candidate"""
    last_name: OptionalNullable[str] = UNSET
    r"""The last name of the candidate"""
    company: OptionalNullable[str] = UNSET
    r"""The company of the candidate"""
    title: OptionalNullable[str] = UNSET
    r"""The title of the candidate"""
    locations: OptionalNullable[str] = UNSET
    r"""The locations of the candidate"""
    is_private: OptionalNullable[bool] = UNSET
    r"""Whether the candidate is private"""
    email_reachable: OptionalNullable[bool] = UNSET
    r"""Whether the candidate is reachable by email"""
    remote_created_at: OptionalNullable[datetime] = UNSET
    r"""The remote creation date of the candidate"""
    remote_modified_at: OptionalNullable[datetime] = UNSET
    r"""The remote modification date of the candidate"""
    last_interaction_at: OptionalNullable[datetime] = UNSET
    r"""The last interaction date with the candidate"""
    attachments: OptionalNullable[List[UnifiedAtsCandidateInputAttachments]] = UNSET
    r"""The attachments UUIDs of the candidate"""
    applications: OptionalNullable[List[UnifiedAtsCandidateInputApplications]] = UNSET
    r"""The applications UUIDs of the candidate"""
    tags: OptionalNullable[List[UnifiedAtsCandidateInputTags]] = UNSET
    r"""The tags of the candidate"""
    urls: OptionalNullable[List[URL]] = UNSET
    r"""The urls of the candidate, possible values for Url type are WEBSITE, BLOG, LINKEDIN, GITHUB, or OTHER"""
    phone_numbers: OptionalNullable[List[Phone]] = UNSET
    r"""The phone numbers of the candidate"""
    email_addresses: OptionalNullable[List[Email]] = UNSET
    r"""The email addresses of the candidate"""
    field_mappings: OptionalNullable[Dict[str, Any]] = UNSET
    r"""The custom field mappings of the object between the remote 3rd party & Panora"""
    
    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = ["first_name", "last_name", "company", "title", "locations", "is_private", "email_reachable", "remote_created_at", "remote_modified_at", "last_interaction_at", "attachments", "applications", "tags", "urls", "phone_numbers", "email_addresses", "field_mappings"]
        nullable_fields = ["first_name", "last_name", "company", "title", "locations", "is_private", "email_reachable", "remote_created_at", "remote_modified_at", "last_interaction_at", "attachments", "applications", "tags", "urls", "phone_numbers", "email_addresses", "field_mappings"]
        null_default_fields = []

        serialized = handler(self)

        m = {}

        for n, f in self.model_fields.items():
            k = f.alias or n
            val = serialized.get(k)

            if val is not None and val != UNSET_SENTINEL:
                m[k] = val
            elif val != UNSET_SENTINEL and (
                not k in optional_fields
                or (
                    k in optional_fields
                    and k in nullable_fields
                    and (
                        self.__pydantic_fields_set__.intersection({n})
                        or k in null_default_fields
                    )  # pylint: disable=no-member
                )
            ):
                m[k] = val

        return m
        

UnifiedAtsCandidateInputAttachmentsTypedDict = Union[UnifiedAtsAttachmentOutputTypedDict, str]


UnifiedAtsCandidateInputAttachments = Union[UnifiedAtsAttachmentOutput, str]


UnifiedAtsCandidateInputApplicationsTypedDict = Union[UnifiedAtsApplicationOutputTypedDict, str]


UnifiedAtsCandidateInputApplications = Union[UnifiedAtsApplicationOutput, str]


UnifiedAtsCandidateInputTagsTypedDict = Union[UnifiedAtsTagOutputTypedDict, str]


UnifiedAtsCandidateInputTags = Union[UnifiedAtsTagOutput, str]

