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

from __future__ import annotations

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .act_action_data import ActActionData
from .click_action_data import ClickActionData
from .extract_action_data import ExtractActionData
from .extract_action_extract_schema import ExtractActionExtractSchema
from .input_text_action_data import InputTextActionData
from .select_option_action_data import SelectOptionActionData
from .upload_file_action_data import UploadFileActionData


class RunSdkActionRequestAction_AiAct(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["ai_act"] = "ai_act"
    intention: typing.Optional[str] = None
    data: typing.Optional[ActActionData] = 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 RunSdkActionRequestAction_AiClick(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["ai_click"] = "ai_click"
    selector: typing.Optional[str] = None
    intention: typing.Optional[str] = None
    data: typing.Optional[ClickActionData] = None
    timeout: typing.Optional[float] = 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 RunSdkActionRequestAction_AiInputText(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["ai_input_text"] = "ai_input_text"
    selector: typing.Optional[str] = None
    value: typing.Optional[str] = None
    intention: typing.Optional[str] = None
    data: typing.Optional[InputTextActionData] = None
    totp_identifier: typing.Optional[str] = None
    totp_url: typing.Optional[str] = None
    timeout: typing.Optional[float] = 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 RunSdkActionRequestAction_AiSelectOption(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["ai_select_option"] = "ai_select_option"
    selector: typing.Optional[str] = None
    value: typing.Optional[str] = None
    intention: typing.Optional[str] = None
    data: typing.Optional[SelectOptionActionData] = None
    timeout: typing.Optional[float] = 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 RunSdkActionRequestAction_AiUploadFile(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["ai_upload_file"] = "ai_upload_file"
    selector: typing.Optional[str] = None
    file_url: typing.Optional[str] = None
    intention: typing.Optional[str] = None
    data: typing.Optional[UploadFileActionData] = None
    timeout: typing.Optional[float] = 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 RunSdkActionRequestAction_Extract(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["extract"] = "extract"
    prompt: typing.Optional[str] = None
    extract_schema: typing.Optional[ExtractActionExtractSchema] = None
    error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
    intention: typing.Optional[str] = None
    data: typing.Optional[ExtractActionData] = 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 RunSdkActionRequestAction_LocateElement(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["locate_element"] = "locate_element"
    prompt: 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


class RunSdkActionRequestAction_Prompt(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["prompt"] = "prompt"
    prompt: str
    response_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
    model: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = 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 RunSdkActionRequestAction_Validate(UniversalBaseModel):
    """
    The action to execute with its specific parameters
    """

    type: typing.Literal["validate"] = "validate"
    prompt: str
    model: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = 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


RunSdkActionRequestAction = typing.Union[
    RunSdkActionRequestAction_AiAct,
    RunSdkActionRequestAction_AiClick,
    RunSdkActionRequestAction_AiInputText,
    RunSdkActionRequestAction_AiSelectOption,
    RunSdkActionRequestAction_AiUploadFile,
    RunSdkActionRequestAction_Extract,
    RunSdkActionRequestAction_LocateElement,
    RunSdkActionRequestAction_Prompt,
    RunSdkActionRequestAction_Validate,
]
