# This file was auto-generated by Fern from our API Definition.

from __future__ import annotations

import typing

import pydantic
import typing_extensions
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class ChatRequestToolsItem_Function(UniversalBaseModel):
    type: typing.Literal["function"] = "function"
    name: str
    description: typing.Optional[str] = None
    parameters: typing.Dict[str, typing.Any]
    strict: typing.Optional[bool] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class ChatRequestToolsItem_Mcp(UniversalBaseModel):
    type: typing.Literal["mcp"] = "mcp"
    server_label: str
    configuration_id: typing.Optional[str] = None
    server_url: typing.Optional[str] = None
    authorization: typing.Optional[str] = None
    headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
    allowed_tools: typing.Optional[typing.List[str]] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


class ChatRequestToolsItem_PersonalConnector(UniversalBaseModel):
    type: typing.Literal["personalConnector"] = "personalConnector"
    configuration_ids: typing.Optional[typing.List[str]] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow


ChatRequestToolsItem = typing_extensions.Annotated[
    typing.Union[ChatRequestToolsItem_Function, ChatRequestToolsItem_Mcp, ChatRequestToolsItem_PersonalConnector],
    pydantic.Field(discriminator="type"),
]
