# 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, update_forward_refs
from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata
from .dynamic_variable_assignment import DynamicVariableAssignment
from .dynamic_variables_config_input import DynamicVariablesConfigInput
from .pre_tool_speech_mode import PreToolSpeechMode
from .system_tool_config_input_params import SystemToolConfigInputParams
from .tool_call_sound_behavior import ToolCallSoundBehavior
from .tool_call_sound_type import ToolCallSoundType
from .tool_error_handling_mode import ToolErrorHandlingMode
from .tool_execution_mode import ToolExecutionMode
from .webhook_tool_api_schema_config_input import WebhookToolApiSchemaConfigInput


class ToolRequestModelToolConfig_Client(UncheckedBaseModel):
    """
    Configuration for the tool
    """

    type: typing.Literal["client"] = "client"
    name: str
    description: str
    response_timeout_secs: typing.Optional[int] = None
    disable_interruptions: typing.Optional[bool] = None
    force_pre_tool_speech: typing.Optional[bool] = None
    pre_tool_speech: typing.Optional[PreToolSpeechMode] = None
    assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None
    tool_call_sound: typing.Optional[ToolCallSoundType] = None
    tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None
    tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None
    parameters: typing.Optional["ObjectJsonSchemaPropertyInput"] = None
    expects_response: typing.Optional[bool] = None
    dynamic_variables: typing.Optional[DynamicVariablesConfigInput] = None
    execution_mode: typing.Optional[ToolExecutionMode] = 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 ToolRequestModelToolConfig_Mcp(UncheckedBaseModel):
    value: typing.Any
    type: typing.Literal["mcp"] = "mcp"

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

        class Config:
            frozen = True
            smart_union = True


class ToolRequestModelToolConfig_System(UncheckedBaseModel):
    """
    Configuration for the tool
    """

    type: typing.Literal["system"] = "system"
    name: str
    description: typing.Optional[str] = None
    response_timeout_secs: typing.Optional[int] = None
    disable_interruptions: typing.Optional[bool] = None
    force_pre_tool_speech: typing.Optional[bool] = None
    pre_tool_speech: typing.Optional[PreToolSpeechMode] = None
    assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None
    tool_call_sound: typing.Optional[ToolCallSoundType] = None
    tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None
    tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None
    params: SystemToolConfigInputParams

    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 ToolRequestModelToolConfig_Webhook(UncheckedBaseModel):
    """
    Configuration for the tool
    """

    type: typing.Literal["webhook"] = "webhook"
    name: str
    description: str
    response_timeout_secs: typing.Optional[int] = None
    disable_interruptions: typing.Optional[bool] = None
    force_pre_tool_speech: typing.Optional[bool] = None
    pre_tool_speech: typing.Optional[PreToolSpeechMode] = None
    assignments: typing.Optional[typing.List[DynamicVariableAssignment]] = None
    tool_call_sound: typing.Optional[ToolCallSoundType] = None
    tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = None
    tool_error_handling_mode: typing.Optional[ToolErrorHandlingMode] = None
    dynamic_variables: typing.Optional[DynamicVariablesConfigInput] = None
    execution_mode: typing.Optional[ToolExecutionMode] = None
    api_schema: WebhookToolApiSchemaConfigInput

    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


from .object_json_schema_property_input import ObjectJsonSchemaPropertyInput  # noqa: E402, I001

ToolRequestModelToolConfig = typing_extensions.Annotated[
    typing.Union[
        ToolRequestModelToolConfig_Client,
        ToolRequestModelToolConfig_Mcp,
        ToolRequestModelToolConfig_System,
        ToolRequestModelToolConfig_Webhook,
    ],
    UnionMetadata(discriminant="type"),
]
update_forward_refs(ToolRequestModelToolConfig_Client)
update_forward_refs(ToolRequestModelToolConfig_Webhook)
