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

from __future__ import annotations
from .postatsjobsjobidapplicationsrequestbody import (
    PostAtsJobsJobIDApplicationsRequestBody,
    PostAtsJobsJobIDApplicationsRequestBodyTypedDict,
)
from kombo.types import BaseModel, UNSET_SENTINEL
from kombo.utils import (
    FieldMetadata,
    HeaderMetadata,
    PathParamMetadata,
    RequestMetadata,
)
import pydantic
from pydantic import model_serializer
from typing import Optional
from typing_extensions import Annotated, NotRequired, TypedDict


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


class PostAtsJobsJobIDApplicationsGlobals(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."""

    @model_serializer(mode="wrap")
    def serialize_model(self, handler):
        optional_fields = set(["integration_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 PostAtsJobsJobIDApplicationsRequestTypedDict(TypedDict):
    job_id: str
    r"""The Kombo ID or Remote ID of the Job this candidate should apply for. If you want to use the ID of the integrated system (remote_id) you need to prefix the id with \"remote:\". You can use the remote ID if you do not want to sync jobs."""
    body: PostAtsJobsJobIDApplicationsRequestBodyTypedDict
    r"""POST /ats/jobs/:job_id/applications Request body"""


class PostAtsJobsJobIDApplicationsRequest(BaseModel):
    job_id: Annotated[
        str, FieldMetadata(path=PathParamMetadata(style="simple", explode=False))
    ]
    r"""The Kombo ID or Remote ID of the Job this candidate should apply for. If you want to use the ID of the integrated system (remote_id) you need to prefix the id with \"remote:\". You can use the remote ID if you do not want to sync jobs."""

    body: Annotated[
        PostAtsJobsJobIDApplicationsRequestBody,
        FieldMetadata(request=RequestMetadata(media_type="application/json")),
    ]
    r"""POST /ats/jobs/:job_id/applications Request body"""
