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

from __future__ import annotations
from ...core.unchecked_base_model import UncheckedBaseModel
import typing
from ...core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
from .agents_search_request_search_item_name_operator import AgentsSearchRequestSearchItemNameOperator
from .agents_search_request_search_item_order_by_value import AgentsSearchRequestSearchItemOrderByValue
from .agents_search_request_search_item_order_by_direction import AgentsSearchRequestSearchItemOrderByDirection
import typing_extensions
from ...core.unchecked_base_model import UnionMetadata


class AgentsSearchRequestSearchItem_Version(UncheckedBaseModel):
    field: typing.Literal["version"] = "version"
    value: 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 AgentsSearchRequestSearchItem_Name(UncheckedBaseModel):
    field: typing.Literal["name"] = "name"
    operator: AgentsSearchRequestSearchItemNameOperator
    value: 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 AgentsSearchRequestSearchItem_OrderBy(UncheckedBaseModel):
    field: typing.Literal["order_by"] = "order_by"
    value: AgentsSearchRequestSearchItemOrderByValue
    direction: AgentsSearchRequestSearchItemOrderByDirection

    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


AgentsSearchRequestSearchItem = typing_extensions.Annotated[
    typing.Union[
        AgentsSearchRequestSearchItem_Version, AgentsSearchRequestSearchItem_Name, AgentsSearchRequestSearchItem_OrderBy
    ],
    UnionMetadata(discriminant="field"),
]
