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

from __future__ import annotations
from datetime import datetime
from kombo.types import BaseModel, Nullable, UNSET_SENTINEL
from kombo.utils import validate_const
import pydantic
from pydantic import model_serializer
from pydantic.functional_validators import AfterValidator
from typing import Any, Dict, List, Literal
from typing_extensions import Annotated, TypedDict


ModelType = Literal[
    "JOB",
    "POSITION",
    "REQUISITION",
]
r"""The remote model type of the record. Possible values are \"JOB\", \"POSITION\" or \"REQUISITION\". We recommend that users of our `create employee` endpoint ask the customer whether they want to hire into positions or requisitions."""


GetHrisStaffingEntitiesPositiveResponseStatus = Literal[
    "OPEN_LIMITED",
    "OPEN_UNLIMITED",
    "PENDING",
    "FROZEN",
    "FILLED",
    "CLOSED",
]
r"""The status of the staffing entity.
OPEN_LIMITED: The staffing entity is open and has a limited number of openings. Refer to the `number_of_openings` field to get the number of openings.
OPEN_UNLIMITED: The staffing entity is open and has an unlimited number of openings. Some enterprise systems refer to this as \"Evergreen\".
PENDING: The staffing entity is pending approval or is waiting to be published.
FROZEN: The staffing entity is frozen (hiring freeze) and does not accept applications/hires.
FILLED: The staffing entity is filled (to its maximum capacity) and not available for new hires.
CLOSED: The staffing entity is closed and not available for new hires.
"""


GetHrisStaffingEntitiesPositiveResponseUnifiedType = Literal[
    "FULL_TIME",
    "PART_TIME",
    "CONTRACT",
    "INTERNSHIP",
    "FREELANCE",
    "WORKING_STUDENT",
    "APPRENTICESHIP",
    "TRAINING",
]
r"""The unified type, how Kombo categorize this label."""


class GetHrisStaffingEntitiesPositiveResponseEmploymentTypeTypedDict(TypedDict):
    remote_label: str
    r"""The label of the employment type how it appears in the remote system."""
    unified_type: Nullable[GetHrisStaffingEntitiesPositiveResponseUnifiedType]
    r"""The unified type, how Kombo categorize this label."""


class GetHrisStaffingEntitiesPositiveResponseEmploymentType(BaseModel):
    remote_label: str
    r"""The label of the employment type how it appears in the remote system."""

    unified_type: Nullable[GetHrisStaffingEntitiesPositiveResponseUnifiedType]
    r"""The unified type, how Kombo categorize this label."""

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

        return m


class GetHrisStaffingEntitiesPositiveResponseLocationTypedDict(TypedDict):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""
    remote_id: Nullable[str]
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""
    name: Nullable[str]
    r"""The work location’s name"""
    type: Nullable[str]
    r"""The work location’s type. A freeform string."""


class GetHrisStaffingEntitiesPositiveResponseLocation(BaseModel):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""

    remote_id: Nullable[str]
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""

    name: Nullable[str]
    r"""The work location’s name"""

    type: Nullable[str]
    r"""The work location’s type. A freeform string."""

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

        return m


class GetHrisStaffingEntitiesPositiveResponseLegalEntityTypedDict(TypedDict):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""
    remote_id: Nullable[str]
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""
    name: Nullable[str]
    r"""The legal entity’s name."""


class GetHrisStaffingEntitiesPositiveResponseLegalEntity(BaseModel):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""

    remote_id: Nullable[str]
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""

    name: Nullable[str]
    r"""The legal entity’s name."""

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

        return m


GetHrisStaffingEntitiesPositiveResponseType = Literal[
    "DEPARTMENT",
    "TEAM",
    "COST_CENTER",
]
r"""Type of the group."""


class GetHrisStaffingEntitiesPositiveResponseGroupTypedDict(TypedDict):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""
    remote_id: str
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""
    name: Nullable[str]
    r"""The name of the group."""
    type: Nullable[GetHrisStaffingEntitiesPositiveResponseType]
    r"""Type of the group."""


class GetHrisStaffingEntitiesPositiveResponseGroup(BaseModel):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""

    remote_id: str
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""

    name: Nullable[str]
    r"""The name of the group."""

    type: Nullable[GetHrisStaffingEntitiesPositiveResponseType]
    r"""Type of the group."""

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

        return m


class GetHrisStaffingEntitiesPositiveResponseResultTypedDict(TypedDict):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""
    remote_id: str
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""
    name: Nullable[str]
    r"""The name/title of the staffing entity."""
    model_type: Nullable[ModelType]
    r"""The remote model type of the record. Possible values are \"JOB\", \"POSITION\" or \"REQUISITION\". We recommend that users of our `create employee` endpoint ask the customer whether they want to hire into positions or requisitions."""
    description: Nullable[str]
    r"""A text description of the staffing entity — typically covering responsibilities, requirements, and scope. Commonly referred to as the \"job description\" in HRIS systems. May contain HTML, depending on the source system."""
    status: Nullable[GetHrisStaffingEntitiesPositiveResponseStatus]
    r"""The status of the staffing entity.
    OPEN_LIMITED: The staffing entity is open and has a limited number of openings. Refer to the `number_of_openings` field to get the number of openings.
    OPEN_UNLIMITED: The staffing entity is open and has an unlimited number of openings. Some enterprise systems refer to this as \"Evergreen\".
    PENDING: The staffing entity is pending approval or is waiting to be published.
    FROZEN: The staffing entity is frozen (hiring freeze) and does not accept applications/hires.
    FILLED: The staffing entity is filled (to its maximum capacity) and not available for new hires.
    CLOSED: The staffing entity is closed and not available for new hires.
    """
    employment_types: Nullable[
        List[GetHrisStaffingEntitiesPositiveResponseEmploymentTypeTypedDict]
    ]
    r"""The employment types available for/used by the staffing entity. Use the `remote_label` for display in your UI as it is consistent with the language of the remote system. Use the `unified_type` for internal categorization as it is unified across all tools."""
    number_of_openings: Nullable[float]
    r"""The number of openings for the staffing entity. Only meaningful for staffing entities with the status \"OPEN_LIMITED\"."""
    parent_id: Nullable[str]
    r"""The Kombo ID of the staffing entity’s parent. Usually it’s the position/job that was used to create the requisition. The ID can be used to retrieve the parent staffing entity from the `get staffing entity` endpoint."""
    remote_url: Nullable[str]
    r"""URL to the staffing entity in the HRIS system. Use this to implement backlinks into the HRIS/Enterprise System."""
    remote_created_at: Nullable[datetime]
    r"""The date and time the object was created in the remote system.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """
    remote_updated_at: Nullable[datetime]
    r"""A timestamp retrieved from the remote system, describing when the resource was last updated.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """
    changed_at: datetime
    r"""The timestamp when this specific record was last modified. This field only updates when properties directly on this record change, NOT when related or nested models change. For filtering that considers nested data changes, use the `updated_after` parameter which will return records when either the record itself OR its related models have been updated.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """
    remote_deleted_at: Nullable[datetime]
    r"""The date and time the object was deleted in the remote system. Objects are automatically marked as deleted when Kombo can't retrieve them from the remote system anymore. Kombo will also anonymize entries 14 days after they disappear.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """
    custom_fields: Nullable[Dict[str, Any]]
    r"""A key-value store of fields not covered by the schema. [Read more](/custom-fields)"""
    locations: List[GetHrisStaffingEntitiesPositiveResponseLocationTypedDict]
    r"""The physical work locations associated with this staffing entity. A position or requisition can be linked to one or more offices or sites where the role is to be filled."""
    legal_entities: List[GetHrisStaffingEntitiesPositiveResponseLegalEntityTypedDict]
    r"""The legal entities (companies or sub-companies) associated with this staffing entity. Indicates which employing entities within the organization the position or requisition belongs to."""
    groups: List[GetHrisStaffingEntitiesPositiveResponseGroupTypedDict]
    r"""The organizational groups (such as departments, teams, or cost centers) associated with this staffing entity."""


class GetHrisStaffingEntitiesPositiveResponseResult(BaseModel):
    id: str
    r"""The globally unique ID of this object generated by Kombo. We recommend using this as a stable primary key for syncing."""

    remote_id: str
    r"""The raw ID of the object in the remote system. We don't recommend using this as a primary key on your side as it might sometimes be compromised of multiple identifiers if a system doesn't provide a clear primary key."""

    name: Nullable[str]
    r"""The name/title of the staffing entity."""

    model_type: Nullable[ModelType]
    r"""The remote model type of the record. Possible values are \"JOB\", \"POSITION\" or \"REQUISITION\". We recommend that users of our `create employee` endpoint ask the customer whether they want to hire into positions or requisitions."""

    description: Nullable[str]
    r"""A text description of the staffing entity — typically covering responsibilities, requirements, and scope. Commonly referred to as the \"job description\" in HRIS systems. May contain HTML, depending on the source system."""

    status: Nullable[GetHrisStaffingEntitiesPositiveResponseStatus]
    r"""The status of the staffing entity.
    OPEN_LIMITED: The staffing entity is open and has a limited number of openings. Refer to the `number_of_openings` field to get the number of openings.
    OPEN_UNLIMITED: The staffing entity is open and has an unlimited number of openings. Some enterprise systems refer to this as \"Evergreen\".
    PENDING: The staffing entity is pending approval or is waiting to be published.
    FROZEN: The staffing entity is frozen (hiring freeze) and does not accept applications/hires.
    FILLED: The staffing entity is filled (to its maximum capacity) and not available for new hires.
    CLOSED: The staffing entity is closed and not available for new hires.
    """

    employment_types: Nullable[
        List[GetHrisStaffingEntitiesPositiveResponseEmploymentType]
    ]
    r"""The employment types available for/used by the staffing entity. Use the `remote_label` for display in your UI as it is consistent with the language of the remote system. Use the `unified_type` for internal categorization as it is unified across all tools."""

    number_of_openings: Nullable[float]
    r"""The number of openings for the staffing entity. Only meaningful for staffing entities with the status \"OPEN_LIMITED\"."""

    parent_id: Nullable[str]
    r"""The Kombo ID of the staffing entity’s parent. Usually it’s the position/job that was used to create the requisition. The ID can be used to retrieve the parent staffing entity from the `get staffing entity` endpoint."""

    remote_url: Nullable[str]
    r"""URL to the staffing entity in the HRIS system. Use this to implement backlinks into the HRIS/Enterprise System."""

    remote_created_at: Nullable[datetime]
    r"""The date and time the object was created in the remote system.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """

    remote_updated_at: Nullable[datetime]
    r"""A timestamp retrieved from the remote system, describing when the resource was last updated.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """

    changed_at: datetime
    r"""The timestamp when this specific record was last modified. This field only updates when properties directly on this record change, NOT when related or nested models change. For filtering that considers nested data changes, use the `updated_after` parameter which will return records when either the record itself OR its related models have been updated.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """

    remote_deleted_at: Nullable[datetime]
    r"""The date and time the object was deleted in the remote system. Objects are automatically marked as deleted when Kombo can't retrieve them from the remote system anymore. Kombo will also anonymize entries 14 days after they disappear.
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
    """

    custom_fields: Nullable[Dict[str, Any]]
    r"""A key-value store of fields not covered by the schema. [Read more](/custom-fields)"""

    locations: List[GetHrisStaffingEntitiesPositiveResponseLocation]
    r"""The physical work locations associated with this staffing entity. A position or requisition can be linked to one or more offices or sites where the role is to be filled."""

    legal_entities: List[GetHrisStaffingEntitiesPositiveResponseLegalEntity]
    r"""The legal entities (companies or sub-companies) associated with this staffing entity. Indicates which employing entities within the organization the position or requisition belongs to."""

    groups: List[GetHrisStaffingEntitiesPositiveResponseGroup]
    r"""The organizational groups (such as departments, teams, or cost centers) associated with this staffing entity."""

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

        return m


class GetHrisStaffingEntitiesPositiveResponseDataTypedDict(TypedDict):
    next: Nullable[str]
    r"""Cursor string that can be passed to the `cursor` query parameter to get the next page. If this is `null`, then there are no more pages."""
    results: List[GetHrisStaffingEntitiesPositiveResponseResultTypedDict]


class GetHrisStaffingEntitiesPositiveResponseData(BaseModel):
    next: Nullable[str]
    r"""Cursor string that can be passed to the `cursor` query parameter to get the next page. If this is `null`, then there are no more pages."""

    results: List[GetHrisStaffingEntitiesPositiveResponseResult]

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

        return m


class GetHrisStaffingEntitiesPositiveResponseTypedDict(TypedDict):
    data: GetHrisStaffingEntitiesPositiveResponseDataTypedDict
    status: Literal["success"]


class GetHrisStaffingEntitiesPositiveResponse(BaseModel):
    data: GetHrisStaffingEntitiesPositiveResponseData

    STATUS: Annotated[
        Annotated[Literal["success"], AfterValidator(validate_const("success"))],
        pydantic.Field(alias="status"),
    ] = "success"


try:
    GetHrisStaffingEntitiesPositiveResponse.model_rebuild()
except NameError:
    pass
