# 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 .api_integration_webhook_overrides import ApiIntegrationWebhookOverrides
from .dynamic_variable_assignment import DynamicVariableAssignment
from .dynamic_variables_config import DynamicVariablesConfig
from .pre_tool_speech_mode import PreToolSpeechMode
from .system_tool_config_output_params import SystemToolConfigOutputParams
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 .tool_interruption_mode import ToolInterruptionMode
from .webhook_tool_api_schema_config_output import WebhookToolApiSchemaConfigOutput


class PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook(UncheckedBaseModel):
    """
    The type of tool
    """

    type: typing.Literal["api_integration_webhook"] = "api_integration_webhook"
    name: str
    description: str
    response_timeout_secs: int
    disable_interruptions: bool
    interruption_mode: ToolInterruptionMode
    force_pre_tool_speech: bool
    pre_tool_speech: PreToolSpeechMode
    assignments: typing.List[DynamicVariableAssignment]
    tool_call_sound: typing.Optional[ToolCallSoundType] = None
    tool_call_sound_behavior: ToolCallSoundBehavior
    tool_error_handling_mode: ToolErrorHandlingMode
    dynamic_variables: DynamicVariablesConfig
    execution_mode: ToolExecutionMode
    tool_version: str
    api_integration_id: str
    api_integration_connection_id: str
    api_schema_overrides: typing.Optional[ApiIntegrationWebhookOverrides] = 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 PromptAgentApiModelOutputToolsItem_Client(UncheckedBaseModel):
    """
    The type of tool
    """

    type: typing.Literal["client"] = "client"
    name: str
    description: str
    response_timeout_secs: typing.Optional[int] = None
    disable_interruptions: typing.Optional[bool] = None
    interruption_mode: typing.Optional[ToolInterruptionMode] = 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["ObjectJsonSchemaPropertyOutput"] = None
    expects_response: typing.Optional[bool] = None
    dynamic_variables: typing.Optional[DynamicVariablesConfig] = 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 PromptAgentApiModelOutputToolsItem_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 PromptAgentApiModelOutputToolsItem_Smb(UncheckedBaseModel):
    value: typing.Any
    type: typing.Literal["smb"] = "smb"

    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 PromptAgentApiModelOutputToolsItem_System(UncheckedBaseModel):
    """
    The type of 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
    interruption_mode: typing.Optional[ToolInterruptionMode] = 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: SystemToolConfigOutputParams

    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 PromptAgentApiModelOutputToolsItem_Webhook(UncheckedBaseModel):
    """
    The type of tool
    """

    type: typing.Literal["webhook"] = "webhook"
    name: str
    description: str
    response_timeout_secs: typing.Optional[int] = None
    disable_interruptions: typing.Optional[bool] = None
    interruption_mode: typing.Optional[ToolInterruptionMode] = 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[DynamicVariablesConfig] = None
    execution_mode: typing.Optional[ToolExecutionMode] = None
    api_schema: WebhookToolApiSchemaConfigOutput

    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


PromptAgentApiModelOutputToolsItem = typing_extensions.Annotated[
    typing.Union[
        PromptAgentApiModelOutputToolsItem_ApiIntegrationWebhook,
        PromptAgentApiModelOutputToolsItem_Client,
        PromptAgentApiModelOutputToolsItem_Mcp,
        PromptAgentApiModelOutputToolsItem_Smb,
        PromptAgentApiModelOutputToolsItem_System,
        PromptAgentApiModelOutputToolsItem_Webhook,
    ],
    UnionMetadata(discriminant="type"),
]
from .array_json_schema_property_output import ArrayJsonSchemaPropertyOutput  # noqa: E402, I001
from .array_json_schema_property_output_items import ArrayJsonSchemaPropertyOutputItems  # noqa: E402, I001
from .object_json_schema_property_output import ObjectJsonSchemaPropertyOutput  # noqa: E402, I001
from .object_json_schema_property_output_properties_value import ObjectJsonSchemaPropertyOutputPropertiesValue  # noqa: E402, I001

update_forward_refs(
    PromptAgentApiModelOutputToolsItem_Client,
    ArrayJsonSchemaPropertyOutput=ArrayJsonSchemaPropertyOutput,
    ArrayJsonSchemaPropertyOutputItems=ArrayJsonSchemaPropertyOutputItems,
    ObjectJsonSchemaPropertyOutput=ObjectJsonSchemaPropertyOutput,
    ObjectJsonSchemaPropertyOutputPropertiesValue=ObjectJsonSchemaPropertyOutputPropertiesValue,
)
update_forward_refs(PromptAgentApiModelOutputToolsItem_System)
update_forward_refs(PromptAgentApiModelOutputToolsItem_Webhook)
