# 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 ...types.button import Button


class Action_MoveTo(UniversalBaseModel):
    action_type: typing.Literal["MOVE_TO"] = "MOVE_TO"
    x: float
    y: 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


class Action_MoveRel(UniversalBaseModel):
    action_type: typing.Literal["MOVE_REL"] = "MOVE_REL"
    x_offset: float
    y_offset: 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


class Action_Click(UniversalBaseModel):
    action_type: typing.Literal["CLICK"] = "CLICK"
    x: typing.Optional[float] = None
    y: typing.Optional[float] = None
    button: typing.Optional[Button] = None
    num_clicks: typing.Optional[int] = 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 Action_MouseDown(UniversalBaseModel):
    action_type: typing.Literal["MOUSE_DOWN"] = "MOUSE_DOWN"
    button: typing.Optional[Button] = 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 Action_MouseUp(UniversalBaseModel):
    action_type: typing.Literal["MOUSE_UP"] = "MOUSE_UP"
    button: typing.Optional[Button] = 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 Action_RightClick(UniversalBaseModel):
    action_type: typing.Literal["RIGHT_CLICK"] = "RIGHT_CLICK"
    x: typing.Optional[float] = None
    y: 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 Action_DoubleClick(UniversalBaseModel):
    action_type: typing.Literal["DOUBLE_CLICK"] = "DOUBLE_CLICK"
    x: typing.Optional[float] = None
    y: 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 Action_DragTo(UniversalBaseModel):
    action_type: typing.Literal["DRAG_TO"] = "DRAG_TO"
    x: float
    y: 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


class Action_DragRel(UniversalBaseModel):
    action_type: typing.Literal["DRAG_REL"] = "DRAG_REL"
    x_offset: float
    y_offset: 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


class Action_Scroll(UniversalBaseModel):
    action_type: typing.Literal["SCROLL"] = "SCROLL"
    dx: typing.Optional[int] = None
    dy: typing.Optional[int] = 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 Action_Typing(UniversalBaseModel):
    action_type: typing.Literal["TYPING"] = "TYPING"
    text: str
    use_clipboard: 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 Action_Press(UniversalBaseModel):
    action_type: typing.Literal["PRESS"] = "PRESS"
    key: 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 Action_KeyDown(UniversalBaseModel):
    action_type: typing.Literal["KEY_DOWN"] = "KEY_DOWN"
    key: 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 Action_KeyUp(UniversalBaseModel):
    action_type: typing.Literal["KEY_UP"] = "KEY_UP"
    key: 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 Action_Hotkey(UniversalBaseModel):
    action_type: typing.Literal["HOTKEY"] = "HOTKEY"
    keys: typing.List[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 Action_Wait(UniversalBaseModel):
    action_type: typing.Literal["WAIT"] = "WAIT"
    duration: 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


Action = typing.Union[
    Action_MoveTo,
    Action_MoveRel,
    Action_Click,
    Action_MouseDown,
    Action_MouseUp,
    Action_RightClick,
    Action_DoubleClick,
    Action_DragTo,
    Action_DragRel,
    Action_Scroll,
    Action_Typing,
    Action_Press,
    Action_KeyDown,
    Action_KeyUp,
    Action_Hotkey,
    Action_Wait,
]
