"""
This file is generated by generator/run.py based on the Chrome DevTools Protocol.


https://chromedevtools.github.io/devtools-protocol/tot/Input/

***************************************************
                    Methods
***************************************************
"""
from __future__ import annotations

from typing import Literal

from cdpkit.protocol._types import (
    Input,
)
from cdpkit.protocol.base import CDPMethod, InputModel


class DispatchDragEventInput(InputModel):

    type: Literal['dragEnter', 'dragOver', 'drop', 'dragCancel']  # deprecated
    x: float  # deprecated
    y: float  # deprecated
    data: Input.DragData
    modifiers: int | None = None  # deprecated


class DispatchDragEvent(CDPMethod[None]):  # experimental deprecated
    """ Dispatches a drag event into the page. """

    INPUT_VALIDATOR = DispatchDragEventInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        type_: Literal['dragEnter', 'dragOver', 'drop', 'dragCancel'],
        x: float,
        y: float,
        data: Input.DragData,
        modifiers: int | None = None
    ):
        super().__init__(
            type=type_,
            x=x,
            y=y,
            data=data,
            modifiers=modifiers
        )


class DispatchKeyEventInput(InputModel):

    type: Literal['keyDown', 'keyUp', 'rawKeyDown', 'char']  # deprecated
    modifiers: int | None = None  # deprecated
    timestamp: Input.TimeSinceEpoch | None = None  # deprecated
    text: str | None = None  # deprecated
    unmodifiedText: str | None = None  # deprecated
    keyIdentifier: str | None = None  # deprecated
    code: str | None = None  # deprecated
    key: str | None = None  # deprecated
    windowsVirtualKeyCode: int | None = None  # deprecated
    nativeVirtualKeyCode: int | None = None  # deprecated
    autoRepeat: bool | None = None  # deprecated
    isKeypad: bool | None = None  # deprecated
    isSystemKey: bool | None = None  # deprecated
    location: int | None = None  # deprecated
    commands: list[str] | None = None  # experimental deprecated


class DispatchKeyEvent(CDPMethod[None]):  # deprecated
    """ Dispatches a key event to the page. """

    INPUT_VALIDATOR = DispatchKeyEventInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        type_: Literal['keyDown', 'keyUp', 'rawKeyDown', 'char'],
        modifiers: int | None = None,
        timestamp: Input.TimeSinceEpoch | None = None,
        text: str | None = None,
        unmodified_text: str | None = None,
        key_identifier: str | None = None,
        code: str | None = None,
        key: str | None = None,
        windows_virtual_key_code: int | None = None,
        native_virtual_key_code: int | None = None,
        auto_repeat: bool | None = None,
        is_keypad: bool | None = None,
        is_system_key: bool | None = None,
        location: int | None = None,
        commands: list[str] | None = None
    ):
        super().__init__(
            type=type_,
            modifiers=modifiers,
            timestamp=timestamp,
            text=text,
            unmodifiedText=unmodified_text,
            keyIdentifier=key_identifier,
            code=code,
            key=key,
            windowsVirtualKeyCode=windows_virtual_key_code,
            nativeVirtualKeyCode=native_virtual_key_code,
            autoRepeat=auto_repeat,
            isKeypad=is_keypad,
            isSystemKey=is_system_key,
            location=location,
            commands=commands
        )


class InsertTextInput(InputModel):

    text: str  # deprecated


class InsertText(CDPMethod[None]):  # experimental deprecated
    """ This method emulates inserting text that doesn't come from a key press,
    for example an emoji keyboard or an IME. """

    INPUT_VALIDATOR = InsertTextInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        text: str
    ):
        super().__init__(
            text=text
        )


class ImeSetCompositionInput(InputModel):

    text: str  # deprecated
    selectionStart: int  # deprecated
    selectionEnd: int  # deprecated
    replacementStart: int | None = None  # deprecated
    replacementEnd: int | None = None  # deprecated


class ImeSetComposition(CDPMethod[None]):  # experimental deprecated
    """ This method sets the current candidate text for IME.
    Use imeCommitComposition to commit the final text.
    Use imeSetComposition with empty string as text to cancel composition. """

    INPUT_VALIDATOR = ImeSetCompositionInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        text: str,
        selection_start: int,
        selection_end: int,
        replacement_start: int | None = None,
        replacement_end: int | None = None
    ):
        super().__init__(
            text=text,
            selectionStart=selection_start,
            selectionEnd=selection_end,
            replacementStart=replacement_start,
            replacementEnd=replacement_end
        )


class DispatchMouseEventInput(InputModel):

    type: Literal['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel']  # deprecated
    x: float  # deprecated
    y: float  # deprecated
    modifiers: int | None = None  # deprecated
    timestamp: Input.TimeSinceEpoch | None = None  # deprecated
    button: Input.MouseButton | None = None  # deprecated
    buttons: int | None = None  # deprecated
    clickCount: int | None = None  # deprecated
    force: float | None = None  # experimental deprecated
    tangentialPressure: float | None = None  # experimental deprecated
    tiltX: float | None = None  # deprecated
    tiltY: float | None = None  # deprecated
    twist: int | None = None  # experimental deprecated
    deltaX: float | None = None  # deprecated
    deltaY: float | None = None  # deprecated
    pointerType: Literal['mouse', 'pen'] | None = None  # deprecated


class DispatchMouseEvent(CDPMethod[None]):  # deprecated
    """ Dispatches a mouse event to the page. """

    INPUT_VALIDATOR = DispatchMouseEventInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        type_: Literal['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel'],
        x: float,
        y: float,
        modifiers: int | None = None,
        timestamp: Input.TimeSinceEpoch | None = None,
        button: Input.MouseButton | None = None,
        buttons: int | None = None,
        click_count: int | None = None,
        force: float | None = None,
        tangential_pressure: float | None = None,
        tilt_x: float | None = None,
        tilt_y: float | None = None,
        twist: int | None = None,
        delta_x: float | None = None,
        delta_y: float | None = None,
        pointer_type: Literal['mouse', 'pen'] | None = None
    ):
        super().__init__(
            type=type_,
            x=x,
            y=y,
            modifiers=modifiers,
            timestamp=timestamp,
            button=button,
            buttons=buttons,
            clickCount=click_count,
            force=force,
            tangentialPressure=tangential_pressure,
            tiltX=tilt_x,
            tiltY=tilt_y,
            twist=twist,
            deltaX=delta_x,
            deltaY=delta_y,
            pointerType=pointer_type
        )


class DispatchTouchEventInput(InputModel):

    type: Literal['touchStart', 'touchEnd', 'touchMove', 'touchCancel']  # deprecated
    touchPoints: list[Input.TouchPoint]  # deprecated
    modifiers: int | None = None  # deprecated
    timestamp: Input.TimeSinceEpoch | None = None  # deprecated


class DispatchTouchEvent(CDPMethod[None]):  # deprecated
    """ Dispatches a touch event to the page. """

    INPUT_VALIDATOR = DispatchTouchEventInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        type_: Literal['touchStart', 'touchEnd', 'touchMove', 'touchCancel'],
        touch_points: list[Input.TouchPoint],
        modifiers: int | None = None,
        timestamp: Input.TimeSinceEpoch | None = None
    ):
        super().__init__(
            type=type_,
            touchPoints=touch_points,
            modifiers=modifiers,
            timestamp=timestamp
        )


class CancelDragging(CDPMethod[None]):  # deprecated
    """ Cancels any active dragging in the page. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class EmulateTouchFromMouseEventInput(InputModel):

    type: Literal['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel']  # deprecated
    x: int  # deprecated
    y: int  # deprecated
    button: Input.MouseButton  # deprecated
    timestamp: Input.TimeSinceEpoch | None = None  # deprecated
    deltaX: float | None = None  # deprecated
    deltaY: float | None = None  # deprecated
    modifiers: int | None = None  # deprecated
    clickCount: int | None = None  # deprecated


class EmulateTouchFromMouseEvent(CDPMethod[None]):  # experimental deprecated
    """ Emulates touch event from the mouse event parameters. """

    INPUT_VALIDATOR = EmulateTouchFromMouseEventInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        type_: Literal['mousePressed', 'mouseReleased', 'mouseMoved', 'mouseWheel'],
        x: int,
        y: int,
        button: Input.MouseButton,
        timestamp: Input.TimeSinceEpoch | None = None,
        delta_x: float | None = None,
        delta_y: float | None = None,
        modifiers: int | None = None,
        click_count: int | None = None
    ):
        super().__init__(
            type=type_,
            x=x,
            y=y,
            button=button,
            timestamp=timestamp,
            deltaX=delta_x,
            deltaY=delta_y,
            modifiers=modifiers,
            clickCount=click_count
        )


class SetIgnoreInputEventsInput(InputModel):

    ignore: bool  # deprecated


class SetIgnoreInputEvents(CDPMethod[None]):  # deprecated
    """ Ignores input events (useful while auditing page). """

    INPUT_VALIDATOR = SetIgnoreInputEventsInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        ignore: bool
    ):
        super().__init__(
            ignore=ignore
        )


class SetInterceptDragsInput(InputModel):

    enabled: bool


class SetInterceptDrags(CDPMethod[None]):  # experimental deprecated
    """ Prevents default drag and drop behavior and instead emits `Input.dragIntercepted` events.
    Drag and drop behavior can be directly controlled via `Input.dispatchDragEvent`. """

    INPUT_VALIDATOR = SetInterceptDragsInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enabled: bool
    ):
        super().__init__(
            enabled=enabled
        )


class SynthesizePinchGestureInput(InputModel):

    x: float  # deprecated
    y: float  # deprecated
    scaleFactor: float  # deprecated
    relativeSpeed: int | None = None  # deprecated
    gestureSourceType: Input.GestureSourceType | None = None  # deprecated


class SynthesizePinchGesture(CDPMethod[None]):  # experimental deprecated
    """ Synthesizes a pinch gesture over a time period by issuing appropriate touch events. """

    INPUT_VALIDATOR = SynthesizePinchGestureInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        x: float,
        y: float,
        scale_factor: float,
        relative_speed: int | None = None,
        gesture_source_type: Input.GestureSourceType | None = None
    ):
        super().__init__(
            x=x,
            y=y,
            scaleFactor=scale_factor,
            relativeSpeed=relative_speed,
            gestureSourceType=gesture_source_type
        )


class SynthesizeScrollGestureInput(InputModel):

    x: float  # deprecated
    y: float  # deprecated
    xDistance: float | None = None  # deprecated
    yDistance: float | None = None  # deprecated
    xOverscroll: float | None = None  # deprecated
    yOverscroll: float | None = None  # deprecated
    preventFling: bool | None = None  # deprecated
    speed: int | None = None  # deprecated
    gestureSourceType: Input.GestureSourceType | None = None  # deprecated
    repeatCount: int | None = None  # deprecated
    repeatDelayMs: int | None = None  # deprecated
    interactionMarkerName: str | None = None  # deprecated


class SynthesizeScrollGesture(CDPMethod[None]):  # experimental deprecated
    """ Synthesizes a scroll gesture over a time period by issuing appropriate touch events. """

    INPUT_VALIDATOR = SynthesizeScrollGestureInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        x: float,
        y: float,
        x_distance: float | None = None,
        y_distance: float | None = None,
        x_overscroll: float | None = None,
        y_overscroll: float | None = None,
        prevent_fling: bool | None = None,
        speed: int | None = None,
        gesture_source_type: Input.GestureSourceType | None = None,
        repeat_count: int | None = None,
        repeat_delay_ms: int | None = None,
        interaction_marker_name: str | None = None
    ):
        super().__init__(
            x=x,
            y=y,
            xDistance=x_distance,
            yDistance=y_distance,
            xOverscroll=x_overscroll,
            yOverscroll=y_overscroll,
            preventFling=prevent_fling,
            speed=speed,
            gestureSourceType=gesture_source_type,
            repeatCount=repeat_count,
            repeatDelayMs=repeat_delay_ms,
            interactionMarkerName=interaction_marker_name
        )


class SynthesizeTapGestureInput(InputModel):

    x: float  # deprecated
    y: float  # deprecated
    duration: int | None = None  # deprecated
    tapCount: int | None = None  # deprecated
    gestureSourceType: Input.GestureSourceType | None = None  # deprecated


class SynthesizeTapGesture(CDPMethod[None]):  # experimental deprecated
    """ Synthesizes a tap gesture over a time period by issuing appropriate touch events. """

    INPUT_VALIDATOR = SynthesizeTapGestureInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        x: float,
        y: float,
        duration: int | None = None,
        tap_count: int | None = None,
        gesture_source_type: Input.GestureSourceType | None = None
    ):
        super().__init__(
            x=x,
            y=y,
            duration=duration,
            tapCount=tap_count,
            gestureSourceType=gesture_source_type
        )
