# 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
from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata


class TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain(UncheckedBaseModel):
    branch_reason: typing.Literal["defaulting_to_main"] = "defaulting_to_main"
    branch_id: str

    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 TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit(UncheckedBaseModel):
    branch_reason: typing.Literal["traffic_split"] = "traffic_split"
    branch_id: str
    traffic_percentage: float

    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


TransferToAgentToolResultSuccessModelOutputBranchInfo = typing_extensions.Annotated[
    typing.Union[
        TransferToAgentToolResultSuccessModelOutputBranchInfo_DefaultingToMain,
        TransferToAgentToolResultSuccessModelOutputBranchInfo_TrafficSplit,
    ],
    UnionMetadata(discriminant="branch_reason"),
]
