# 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 .agent_transfer_output import AgentTransferOutput
from .phone_number_transfer import PhoneNumberTransfer
from .procedure_at_version_output import ProcedureAtVersionOutput
from .search_strategy import SearchStrategy
from .sub_agent_output import SubAgentOutput


class SystemToolConfigOutputParams_EndCall(UncheckedBaseModel):
    system_tool_type: typing.Literal["end_call"] = "end_call"

    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 SystemToolConfigOutputParams_EndProcedure(UncheckedBaseModel):
    system_tool_type: typing.Literal["end_procedure"] = "end_procedure"
    procedures: typing.Optional[typing.Dict[str, ProcedureAtVersionOutput]] = 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 SystemToolConfigOutputParams_KnowledgeBase(UncheckedBaseModel):
    system_tool_type: typing.Literal["knowledge_base"] = "knowledge_base"
    enabled_strategies: typing.Optional[typing.List[SearchStrategy]] = 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 SystemToolConfigOutputParams_KnowledgeBaseRag(UncheckedBaseModel):
    system_tool_type: typing.Literal["knowledge_base_rag"] = "knowledge_base_rag"

    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 SystemToolConfigOutputParams_LanguageDetection(UncheckedBaseModel):
    system_tool_type: typing.Literal["language_detection"] = "language_detection"

    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 SystemToolConfigOutputParams_PlayKeypadTouchTone(UncheckedBaseModel):
    system_tool_type: typing.Literal["play_keypad_touch_tone"] = "play_keypad_touch_tone"
    use_out_of_band_dtmf: typing.Optional[bool] = None
    suppress_turn_after_dtmf: 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 SystemToolConfigOutputParams_RunSubagent(UncheckedBaseModel):
    system_tool_type: typing.Literal["run_subagent"] = "run_subagent"
    agents: typing.List[SubAgentOutput]

    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 SystemToolConfigOutputParams_SkipTurn(UncheckedBaseModel):
    system_tool_type: typing.Literal["skip_turn"] = "skip_turn"

    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 SystemToolConfigOutputParams_StartProcedure(UncheckedBaseModel):
    system_tool_type: typing.Literal["start_procedure"] = "start_procedure"
    procedures: typing.Optional[typing.Dict[str, ProcedureAtVersionOutput]] = 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 SystemToolConfigOutputParams_TransferToAgent(UncheckedBaseModel):
    system_tool_type: typing.Literal["transfer_to_agent"] = "transfer_to_agent"
    transfers: typing.List[AgentTransferOutput]

    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 SystemToolConfigOutputParams_TransferToNumber(UncheckedBaseModel):
    system_tool_type: typing.Literal["transfer_to_number"] = "transfer_to_number"
    transfers: typing.List[PhoneNumberTransfer]
    enable_client_message: 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 SystemToolConfigOutputParams_VoicemailDetection(UncheckedBaseModel):
    system_tool_type: typing.Literal["voicemail_detection"] = "voicemail_detection"
    voicemail_message: typing.Optional[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


SystemToolConfigOutputParams = typing_extensions.Annotated[
    typing.Union[
        SystemToolConfigOutputParams_EndCall,
        SystemToolConfigOutputParams_EndProcedure,
        SystemToolConfigOutputParams_KnowledgeBase,
        SystemToolConfigOutputParams_KnowledgeBaseRag,
        SystemToolConfigOutputParams_LanguageDetection,
        SystemToolConfigOutputParams_PlayKeypadTouchTone,
        SystemToolConfigOutputParams_RunSubagent,
        SystemToolConfigOutputParams_SkipTurn,
        SystemToolConfigOutputParams_StartProcedure,
        SystemToolConfigOutputParams_TransferToAgent,
        SystemToolConfigOutputParams_TransferToNumber,
        SystemToolConfigOutputParams_VoicemailDetection,
    ],
    UnionMetadata(discriminant="system_tool_type"),
]
update_forward_refs(SystemToolConfigOutputParams_RunSubagent)
