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

from __future__ import annotations
from .getatsapplicationspositiveresponse import (
    GetAtsApplicationsPositiveResponse,
    GetAtsApplicationsPositiveResponseTypedDict,
)
from datetime import datetime
from kombo.types import BaseModel
from kombo.utils import FieldMetadata, HeaderMetadata, QueryParamMetadata
import pydantic
from typing import Awaitable, Callable, List, Optional, Union
from typing_extensions import Annotated, NotRequired, TypedDict


class GetAtsApplicationsGlobalsTypedDict(TypedDict):
    integration_id: NotRequired[str]
    r"""ID of the integration you want to interact with."""


class GetAtsApplicationsGlobals(BaseModel):
    integration_id: Annotated[
        Optional[str],
        pydantic.Field(alias="X-Integration-Id"),
        FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
    ] = None
    r"""ID of the integration you want to interact with."""


class GetAtsApplicationsRequestTypedDict(TypedDict):
    cursor: NotRequired[str]
    r"""An optional cursor string used for pagination. This can be retrieved from the `next` property of the previous page response."""
    page_size: NotRequired[int]
    r"""The number of results to return per page. Maximum is 250."""
    updated_after: NotRequired[datetime]
    r"""Filter the entries based on the modification date in format `YYYY-MM-DDTHH:mm:ss.sssZ`. Returns records where either the record itself **OR** its nested data has been updated since this timestamp, even if the record's own `changed_at` field remains unchanged.

    If you want to track entry deletion, also set the `include_deleted=true` query parameter, because otherwise, deleted entries will be hidden.

    For more details, see [Understanding changed_at vs updated_after Behavior](https://docs.kombo.dev/ats/getting-started/fetching-data#understanding-changed_at-vs-updated_after-behavior).
    """
    include_deleted: NotRequired[bool]
    r"""By default, deleted entries are not returned. Use the `include_deleted` query param to include deleted entries too."""
    ids: NotRequired[List[str]]
    r"""Filter by a comma-separated list of IDs such as `222k7eCGyUdgt2JWZDNnkDs3,B5DVmypWENfU6eMe6gYDyJG3`."""
    remote_ids: NotRequired[List[str]]
    r"""Filter by a comma-separated list of remote IDs."""
    outcomes: NotRequired[List[str]]
    r"""Filter by a comma-separated list of `PENDING`, `HIRED`, `DECLINED`
    * `PENDING`: The application is still being processed.
    * `HIRED`: The candidate was hired.
    * `DECLINED`: The candidate was declined.


    Leave this blank to get results matching all values.
    """
    job_ids: NotRequired[List[str]]
    r"""Filter by a comma-separated list of job IDs. We will only return applications that are related to _any_ of the jobs."""
    job_remote_ids: NotRequired[List[str]]
    r"""Filter by a comma-separated list of job remote IDs. We will only return applications that are related to _any_ of the jobs."""
    current_stage_ids: NotRequired[List[str]]
    r"""Filter by a comma-separated list of application stage IDs. We will only return applications that are currently in _any_ of the stages."""
    remote_created_after: NotRequired[datetime]
    r"""Filter applications by the day they were created in the remote system. This allows you to get applications that were created on or after a certain day."""


class GetAtsApplicationsRequest(BaseModel):
    cursor: Annotated[
        Optional[str],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""An optional cursor string used for pagination. This can be retrieved from the `next` property of the previous page response."""

    page_size: Annotated[
        Optional[int],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = 100
    r"""The number of results to return per page. Maximum is 250."""

    updated_after: Annotated[
        Optional[datetime],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Filter the entries based on the modification date in format `YYYY-MM-DDTHH:mm:ss.sssZ`. Returns records where either the record itself **OR** its nested data has been updated since this timestamp, even if the record's own `changed_at` field remains unchanged.

    If you want to track entry deletion, also set the `include_deleted=true` query parameter, because otherwise, deleted entries will be hidden.

    For more details, see [Understanding changed_at vs updated_after Behavior](https://docs.kombo.dev/ats/getting-started/fetching-data#understanding-changed_at-vs-updated_after-behavior).
    """

    include_deleted: Annotated[
        Optional[bool],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = False
    r"""By default, deleted entries are not returned. Use the `include_deleted` query param to include deleted entries too."""

    ids: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Filter by a comma-separated list of IDs such as `222k7eCGyUdgt2JWZDNnkDs3,B5DVmypWENfU6eMe6gYDyJG3`."""

    remote_ids: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Filter by a comma-separated list of remote IDs."""

    outcomes: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Filter by a comma-separated list of `PENDING`, `HIRED`, `DECLINED`
    * `PENDING`: The application is still being processed.
    * `HIRED`: The candidate was hired.
    * `DECLINED`: The candidate was declined.


    Leave this blank to get results matching all values.
    """

    job_ids: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Filter by a comma-separated list of job IDs. We will only return applications that are related to _any_ of the jobs."""

    job_remote_ids: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Filter by a comma-separated list of job remote IDs. We will only return applications that are related to _any_ of the jobs."""

    current_stage_ids: Annotated[
        Optional[List[str]],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
    ] = None
    r"""Filter by a comma-separated list of application stage IDs. We will only return applications that are currently in _any_ of the stages."""

    remote_created_after: Annotated[
        Optional[datetime],
        FieldMetadata(query=QueryParamMetadata(style="form", explode=True)),
    ] = None
    r"""Filter applications by the day they were created in the remote system. This allows you to get applications that were created on or after a certain day."""


class GetAtsApplicationsResponseTypedDict(TypedDict):
    result: GetAtsApplicationsPositiveResponseTypedDict


class GetAtsApplicationsResponse(BaseModel):
    next: Union[
        Callable[[], Optional[GetAtsApplicationsResponse]],
        Callable[[], Awaitable[Optional[GetAtsApplicationsResponse]]],
    ]

    result: GetAtsApplicationsPositiveResponse
