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

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


StepType = Literal[
    "Next_Step_Reference",
    "Disposition_Step_Reference",
]
r"""The type of step reference to use. Use \"Next_Step_Reference\" for regular stage moves and \"Disposition_Step_Reference\" for conclusion/disposition stages (e.g., rejected, declined). Defaults to \"Next_Step_Reference\"."""


class PutAtsApplicationsApplicationIDStageRequestBodyWorkdayTypedDict(TypedDict):
    r"""Fields specific to Workday."""

    workflow_step_id: NotRequired[str]
    r"""The Workflow_Step_ID to pass directly to the Move_Candidate request. When provided, the automatic workflow step matching logic is skipped."""
    step_type: NotRequired[StepType]
    r"""The type of step reference to use. Use \"Next_Step_Reference\" for regular stage moves and \"Disposition_Step_Reference\" for conclusion/disposition stages (e.g., rejected, declined). Defaults to \"Next_Step_Reference\"."""


class PutAtsApplicationsApplicationIDStageRequestBodyWorkday(BaseModel):
    r"""Fields specific to Workday."""

    workflow_step_id: Annotated[
        Optional[str], pydantic.Field(alias="Workflow_Step_ID")
    ] = None
    r"""The Workflow_Step_ID to pass directly to the Move_Candidate request. When provided, the automatic workflow step matching logic is skipped."""

    step_type: Annotated[Optional[StepType], pydantic.Field(alias="Step_Type")] = None
    r"""The type of step reference to use. Use \"Next_Step_Reference\" for regular stage moves and \"Disposition_Step_Reference\" for conclusion/disposition stages (e.g., rejected, declined). Defaults to \"Next_Step_Reference\"."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["Workflow_Step_ID", "Step_Type"])
        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))

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

        return m


class PutAtsApplicationsApplicationIDStageRequestBodyPostHeadersTypedDict(TypedDict):
    r"""Headers we will pass with `POST` requests to Greenhouse."""

    on_behalf_of: NotRequired[Nullable[str]]
    r"""ID of the the user that will show up as having performed the action in Greenhouse. We already pass a value by default, but you can use this to override it."""


class PutAtsApplicationsApplicationIDStageRequestBodyPostHeaders(BaseModel):
    r"""Headers we will pass with `POST` requests to Greenhouse."""

    on_behalf_of: Annotated[
        OptionalNullable[str], pydantic.Field(alias="On-Behalf-Of")
    ] = UNSET
    r"""ID of the the user that will show up as having performed the action in Greenhouse. We already pass a value by default, but you can use this to override it."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["On-Behalf-Of"])
        nullable_fields = set(["On-Behalf-Of"])
        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


class PutAtsApplicationsApplicationIDStageRequestBodyGreenhouseTypedDict(TypedDict):
    r"""Fields specific to Greenhouse."""

    post_headers: NotRequired[
        PutAtsApplicationsApplicationIDStageRequestBodyPostHeadersTypedDict
    ]
    r"""Headers we will pass with `POST` requests to Greenhouse."""


class PutAtsApplicationsApplicationIDStageRequestBodyGreenhouse(BaseModel):
    r"""Fields specific to Greenhouse."""

    post_headers: Optional[
        PutAtsApplicationsApplicationIDStageRequestBodyPostHeaders
    ] = None
    r"""Headers we will pass with `POST` requests to Greenhouse."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["post_headers"])
        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))

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

        return m


class PutAtsApplicationsApplicationIDStageRequestBodyWorkableTypedDict(TypedDict):
    r"""Workable specific remote fields for ATS actions."""

    on_behalf_of_user_remote_id: NotRequired[str]
    r"""The remote ID of the user that will be displayed in the UI as the one that performed the action."""


class PutAtsApplicationsApplicationIDStageRequestBodyWorkable(BaseModel):
    r"""Workable specific remote fields for ATS actions."""

    on_behalf_of_user_remote_id: Optional[str] = None
    r"""The remote ID of the user that will be displayed in the UI as the one that performed the action."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["on_behalf_of_user_remote_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))

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

        return m


class PutAtsApplicationsApplicationIDStageRequestBodyRemoteFieldsTypedDict(TypedDict):
    r"""Additional fields that we will pass through to specific ATS systems."""

    workday: NotRequired[
        PutAtsApplicationsApplicationIDStageRequestBodyWorkdayTypedDict
    ]
    r"""Fields specific to Workday."""
    greenhouse: NotRequired[
        PutAtsApplicationsApplicationIDStageRequestBodyGreenhouseTypedDict
    ]
    r"""Fields specific to Greenhouse."""
    workable: NotRequired[
        PutAtsApplicationsApplicationIDStageRequestBodyWorkableTypedDict
    ]
    r"""Workable specific remote fields for ATS actions."""


class PutAtsApplicationsApplicationIDStageRequestBodyRemoteFields(BaseModel):
    r"""Additional fields that we will pass through to specific ATS systems."""

    workday: Optional[PutAtsApplicationsApplicationIDStageRequestBodyWorkday] = None
    r"""Fields specific to Workday."""

    greenhouse: Optional[PutAtsApplicationsApplicationIDStageRequestBodyGreenhouse] = (
        None
    )
    r"""Fields specific to Greenhouse."""

    workable: Optional[PutAtsApplicationsApplicationIDStageRequestBodyWorkable] = None
    r"""Workable specific remote fields for ATS actions."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["workday", "greenhouse", "workable"])
        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))

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

        return m


class PutAtsApplicationsApplicationIDStageRequestBodyTypedDict(TypedDict):
    stage_id: str
    r"""The Kombo ID of the stage to move the application to. This stage must be allowed for the job that the application is connected to. Get available stages from the `stages` property on the job, not from the deprecated application-stages endpoint."""
    remote_fields: NotRequired[
        PutAtsApplicationsApplicationIDStageRequestBodyRemoteFieldsTypedDict
    ]
    r"""Additional fields that we will pass through to specific ATS systems."""


class PutAtsApplicationsApplicationIDStageRequestBody(BaseModel):
    stage_id: str
    r"""The Kombo ID of the stage to move the application to. This stage must be allowed for the job that the application is connected to. Get available stages from the `stages` property on the job, not from the deprecated application-stages endpoint."""

    remote_fields: Optional[
        PutAtsApplicationsApplicationIDStageRequestBodyRemoteFields
    ] = None
    r"""Additional fields that we will pass through to specific ATS systems."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["remote_fields"])
        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))

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

        return m


try:
    PutAtsApplicationsApplicationIDStageRequestBodyWorkday.model_rebuild()
except NameError:
    pass
try:
    PutAtsApplicationsApplicationIDStageRequestBodyPostHeaders.model_rebuild()
except NameError:
    pass
