# 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 .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


class SdkAction_AiClick(UniversalBaseModel):
    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 SdkAction_AiInputText(UniversalBaseModel):
    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 SdkAction_AiSelectOption(UniversalBaseModel):
    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 SdkAction_AiAct(UniversalBaseModel):
    type: typing.Literal["ai_act"] = "ai_act"
    intention: 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 SdkAction_Extract(UniversalBaseModel):
    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


SdkAction = typing.Union[
    SdkAction_AiClick, SdkAction_AiInputText, SdkAction_AiSelectOption, SdkAction_AiAct, SdkAction_Extract
]
