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

Actions and events related to the inspected page belong to the page domain.
https://chromedevtools.github.io/devtools-protocol/tot/Page/

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

from typing import Literal

from cdpkit.protocol._types import (
    DOM,
    IO,
    Debugger,
    Emulation,
    Network,
    Page,
    Runtime,
)
from cdpkit.protocol.base import CDPMethod, InputModel, OutputModel


class AddScriptToEvaluateOnLoadInput(InputModel):

    scriptSource: str


class AddScriptToEvaluateOnLoadOutput(OutputModel):

    identifier: Page.ScriptIdentifier


class AddScriptToEvaluateOnLoad(CDPMethod[AddScriptToEvaluateOnLoadOutput]):  # experimental deprecated
    """ Deprecated, please use addScriptToEvaluateOnNewDocument instead. """

    INPUT_VALIDATOR = AddScriptToEvaluateOnLoadInput
    OUTPUT_VALIDATOR = AddScriptToEvaluateOnLoadOutput

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


class AddScriptToEvaluateOnNewDocumentInput(InputModel):

    source: str
    worldName: str | None = None  # experimental
    includeCommandLineAPI: bool | None = None  # experimental
    runImmediately: bool | None = None  # experimental


class AddScriptToEvaluateOnNewDocumentOutput(OutputModel):

    identifier: Page.ScriptIdentifier


class AddScriptToEvaluateOnNewDocument(CDPMethod[AddScriptToEvaluateOnNewDocumentOutput]):
    """ Evaluates given script in every frame upon creation (before loading frame's scripts). """

    INPUT_VALIDATOR = AddScriptToEvaluateOnNewDocumentInput
    OUTPUT_VALIDATOR = AddScriptToEvaluateOnNewDocumentOutput

    def __init__(
        self,
        *,
        source: str,
        world_name: str | None = None,
        include_command_line_api: bool | None = None,
        run_immediately: bool | None = None
    ):
        super().__init__(
            source=source,
            worldName=world_name,
            includeCommandLineAPI=include_command_line_api,
            runImmediately=run_immediately
        )


class BringToFront(CDPMethod[None]):
    """ Brings page to front (activates tab). """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class CaptureScreenshotInput(InputModel):

    format: Literal['jpeg', 'png', 'webp'] | None = None
    quality: int | None = None
    clip: Page.Viewport | None = None
    fromSurface: bool | None = None  # experimental
    captureBeyondViewport: bool | None = None  # experimental
    optimizeForSpeed: bool | None = None  # experimental


class CaptureScreenshotOutput(OutputModel):

    data: str


class CaptureScreenshot(CDPMethod[CaptureScreenshotOutput]):
    """ Capture page screenshot. """

    INPUT_VALIDATOR = CaptureScreenshotInput
    OUTPUT_VALIDATOR = CaptureScreenshotOutput

    def __init__(
        self,
        *,
        format_: Literal['jpeg', 'png', 'webp'] | None = None,
        quality: int | None = None,
        clip: Page.Viewport | None = None,
        from_surface: bool | None = None,
        capture_beyond_viewport: bool | None = None,
        optimize_for_speed: bool | None = None
    ):
        super().__init__(
            format=format_,
            quality=quality,
            clip=clip,
            fromSurface=from_surface,
            captureBeyondViewport=capture_beyond_viewport,
            optimizeForSpeed=optimize_for_speed
        )


class CaptureSnapshotInput(InputModel):

    format: Literal['mhtml'] | None = None


class CaptureSnapshotOutput(OutputModel):

    data: str


class CaptureSnapshot(CDPMethod[CaptureSnapshotOutput]):  # experimental
    """ Returns a snapshot of the page as a string. For MHTML format, the serialization includes
    iframes, shadow DOM, external resources, and element-inline styles. """

    INPUT_VALIDATOR = CaptureSnapshotInput
    OUTPUT_VALIDATOR = CaptureSnapshotOutput

    def __init__(
        self,
        *,
        format_: Literal['mhtml'] | None = None
    ):
        super().__init__(
            format=format_
        )


class ClearDeviceMetricsOverride(CDPMethod[None]):  # experimental deprecated
    """ Clears the overridden device metrics. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class ClearDeviceOrientationOverride(CDPMethod[None]):  # experimental deprecated
    """ Clears the overridden Device Orientation. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class ClearGeolocationOverride(CDPMethod[None]):  # deprecated
    """ Clears the overridden Geolocation Position and Error. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class CreateIsolatedWorldInput(InputModel):

    frameId: Page.FrameId
    worldName: str | None = None
    grantUniveralAccess: bool | None = None


class CreateIsolatedWorldOutput(OutputModel):

    executionContextId: Runtime.ExecutionContextId


class CreateIsolatedWorld(CDPMethod[CreateIsolatedWorldOutput]):
    """ Creates an isolated world for the given frame. """

    INPUT_VALIDATOR = CreateIsolatedWorldInput
    OUTPUT_VALIDATOR = CreateIsolatedWorldOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId,
        world_name: str | None = None,
        grant_univeral_access: bool | None = None
    ):
        super().__init__(
            frameId=frame_id,
            worldName=world_name,
            grantUniveralAccess=grant_univeral_access
        )


class DeleteCookieInput(InputModel):

    cookieName: str
    url: str


class DeleteCookie(CDPMethod[None]):  # experimental deprecated
    """ Deletes browser cookie with given name, domain and path. """

    INPUT_VALIDATOR = DeleteCookieInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        cookie_name: str,
        url: str
    ):
        super().__init__(
            cookieName=cookie_name,
            url=url
        )


class Disable(CDPMethod[None]):
    """ Disables page domain notifications. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class EnableInput(InputModel):

    enableFileChooserOpenedEvent: bool | None = None  # experimental


class Enable(CDPMethod[None]):
    """ Enables page domain notifications. """

    INPUT_VALIDATOR = EnableInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enable_file_chooser_opened_event: bool | None = None
    ):
        super().__init__(
            enableFileChooserOpenedEvent=enable_file_chooser_opened_event
        )


class GetAppManifestInput(InputModel):

    manifestId: str | None = None


class GetAppManifestOutput(OutputModel):

    url: str
    errors: list[Page.AppManifestError]
    data: str | None = None
    parsed: Page.AppManifestParsedProperties | None = None  # experimental deprecated
    manifest: Page.WebAppManifest | None = None  # experimental


class GetAppManifest(CDPMethod[GetAppManifestOutput]):
    """ Gets the processed manifest for this current document.
      This API always waits for the manifest to be loaded.
      If manifestId is provided, and it does not match the manifest of the
        current document, this API errors out.
      If there is not a loaded page, this API errors out immediately. """

    INPUT_VALIDATOR = GetAppManifestInput
    OUTPUT_VALIDATOR = GetAppManifestOutput

    def __init__(
        self,
        *,
        manifest_id: str | None = None
    ):
        super().__init__(
            manifestId=manifest_id
        )


class GetInstallabilityErrorsOutput(OutputModel):

    installabilityErrors: list[Page.InstallabilityError]


class GetInstallabilityErrors(CDPMethod[GetInstallabilityErrorsOutput]):  # experimental

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetInstallabilityErrorsOutput


class GetManifestIconsOutput(OutputModel):

    primaryIcon: str | None = None


class GetManifestIcons(CDPMethod[GetManifestIconsOutput]):  # experimental deprecated
    """ Deprecated because it's not guaranteed that the returned icon is in fact the one used for PWA installation. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetManifestIconsOutput


class GetAppIdOutput(OutputModel):

    appId: str | None = None
    recommendedId: str | None = None


class GetAppId(CDPMethod[GetAppIdOutput]):  # experimental
    """ Returns the unique (PWA) app id.
    Only returns values if the feature flag 'WebAppEnableManifestId' is enabled """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetAppIdOutput


class GetAdScriptAncestryInput(InputModel):

    frameId: Page.FrameId


class GetAdScriptAncestryOutput(OutputModel):

    adScriptAncestry: Page.AdScriptAncestry | None = None


class GetAdScriptAncestry(CDPMethod[GetAdScriptAncestryOutput]):  # experimental

    INPUT_VALIDATOR = GetAdScriptAncestryInput
    OUTPUT_VALIDATOR = GetAdScriptAncestryOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId
    ):
        super().__init__(
            frameId=frame_id
        )


class GetFrameTreeOutput(OutputModel):

    frameTree: Page.FrameTree


class GetFrameTree(CDPMethod[GetFrameTreeOutput]):
    """ Returns present frame tree structure. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetFrameTreeOutput


class GetLayoutMetricsOutput(OutputModel):

    layoutViewport: Page.LayoutViewport  # deprecated
    visualViewport: Page.VisualViewport  # deprecated
    contentSize: DOM.Rect  # deprecated
    cssLayoutViewport: Page.LayoutViewport
    cssVisualViewport: Page.VisualViewport
    cssContentSize: DOM.Rect


class GetLayoutMetrics(CDPMethod[GetLayoutMetricsOutput]):
    """ Returns metrics relating to the layouting of the page, such as viewport bounds/scale. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetLayoutMetricsOutput


class GetNavigationHistoryOutput(OutputModel):

    currentIndex: int
    entries: list[Page.NavigationEntry]


class GetNavigationHistory(CDPMethod[GetNavigationHistoryOutput]):
    """ Returns navigation history for the current page. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetNavigationHistoryOutput


class ResetNavigationHistory(CDPMethod[None]):
    """ Resets navigation history for the current page. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class GetResourceContentInput(InputModel):

    frameId: Page.FrameId
    url: str


class GetResourceContentOutput(OutputModel):

    content: str
    base64Encoded: bool


class GetResourceContent(CDPMethod[GetResourceContentOutput]):  # experimental
    """ Returns content of the given resource. """

    INPUT_VALIDATOR = GetResourceContentInput
    OUTPUT_VALIDATOR = GetResourceContentOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId,
        url: str
    ):
        super().__init__(
            frameId=frame_id,
            url=url
        )


class GetResourceTreeOutput(OutputModel):

    frameTree: Page.FrameResourceTree


class GetResourceTree(CDPMethod[GetResourceTreeOutput]):  # experimental
    """ Returns present frame / resource tree structure. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetResourceTreeOutput


class HandleJavaScriptDialogInput(InputModel):

    accept: bool
    promptText: str | None = None


class HandleJavaScriptDialog(CDPMethod[None]):
    """ Accepts or dismisses a JavaScript initiated dialog (alert, confirm, prompt, or onbeforeunload). """

    INPUT_VALIDATOR = HandleJavaScriptDialogInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        accept: bool,
        prompt_text: str | None = None
    ):
        super().__init__(
            accept=accept,
            promptText=prompt_text
        )


class NavigateInput(InputModel):

    url: str
    referrer: str | None = None
    transitionType: Page.TransitionType | None = None
    frameId: Page.FrameId | None = None
    referrerPolicy: Page.ReferrerPolicy | None = None  # experimental


class NavigateOutput(OutputModel):

    frameId: Page.FrameId
    loaderId: Network.LoaderId | None = None
    errorText: str | None = None
    isDownload: bool | None = None  # experimental


class Navigate(CDPMethod[NavigateOutput]):
    """ Navigates current page to the given URL. """

    INPUT_VALIDATOR = NavigateInput
    OUTPUT_VALIDATOR = NavigateOutput

    def __init__(
        self,
        *,
        url: str,
        referrer: str | None = None,
        transition_type: Page.TransitionType | None = None,
        frame_id: Page.FrameId | None = None,
        referrer_policy: Page.ReferrerPolicy | None = None
    ):
        super().__init__(
            url=url,
            referrer=referrer,
            transitionType=transition_type,
            frameId=frame_id,
            referrerPolicy=referrer_policy
        )


class NavigateToHistoryEntryInput(InputModel):

    entryId: int


class NavigateToHistoryEntry(CDPMethod[None]):
    """ Navigates current page to the given history entry. """

    INPUT_VALIDATOR = NavigateToHistoryEntryInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        entry_id: int
    ):
        super().__init__(
            entryId=entry_id
        )


class PrintToPDFInput(InputModel):

    landscape: bool | None = None
    displayHeaderFooter: bool | None = None
    printBackground: bool | None = None
    scale: float | None = None
    paperWidth: float | None = None
    paperHeight: float | None = None
    marginTop: float | None = None
    marginBottom: float | None = None
    marginLeft: float | None = None
    marginRight: float | None = None
    pageRanges: str | None = None
    headerTemplate: str | None = None
    footerTemplate: str | None = None
    preferCSSPageSize: bool | None = None
    transferMode: Literal['ReturnAsBase64', 'ReturnAsStream'] | None = None  # experimental
    generateTaggedPDF: bool | None = None  # experimental
    generateDocumentOutline: bool | None = None  # experimental


class PrintToPDFOutput(OutputModel):

    data: str
    stream: IO.StreamHandle | None = None  # experimental


class PrintToPDF(CDPMethod[PrintToPDFOutput]):
    """ Print page as PDF. """

    INPUT_VALIDATOR = PrintToPDFInput
    OUTPUT_VALIDATOR = PrintToPDFOutput

    def __init__(
        self,
        *,
        landscape: bool | None = None,
        display_header_footer: bool | None = None,
        print_background: bool | None = None,
        scale: float | None = None,
        paper_width: float | None = None,
        paper_height: float | None = None,
        margin_top: float | None = None,
        margin_bottom: float | None = None,
        margin_left: float | None = None,
        margin_right: float | None = None,
        page_ranges: str | None = None,
        header_template: str | None = None,
        footer_template: str | None = None,
        prefer_css_page_size: bool | None = None,
        transfer_mode: Literal['ReturnAsBase64', 'ReturnAsStream'] | None = None,
        generate_tagged_pdf: bool | None = None,
        generate_document_outline: bool | None = None
    ):
        super().__init__(
            landscape=landscape,
            displayHeaderFooter=display_header_footer,
            printBackground=print_background,
            scale=scale,
            paperWidth=paper_width,
            paperHeight=paper_height,
            marginTop=margin_top,
            marginBottom=margin_bottom,
            marginLeft=margin_left,
            marginRight=margin_right,
            pageRanges=page_ranges,
            headerTemplate=header_template,
            footerTemplate=footer_template,
            preferCSSPageSize=prefer_css_page_size,
            transferMode=transfer_mode,
            generateTaggedPDF=generate_tagged_pdf,
            generateDocumentOutline=generate_document_outline
        )


class ReloadInput(InputModel):

    ignoreCache: bool | None = None
    scriptToEvaluateOnLoad: str | None = None
    loaderId: Network.LoaderId | None = None  # experimental


class Reload(CDPMethod[None]):
    """ Reloads given page optionally ignoring the cache. """

    INPUT_VALIDATOR = ReloadInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        ignore_cache: bool | None = None,
        script_to_evaluate_on_load: str | None = None,
        loader_id: Network.LoaderId | None = None
    ):
        super().__init__(
            ignoreCache=ignore_cache,
            scriptToEvaluateOnLoad=script_to_evaluate_on_load,
            loaderId=loader_id
        )


class RemoveScriptToEvaluateOnLoadInput(InputModel):

    identifier: Page.ScriptIdentifier


class RemoveScriptToEvaluateOnLoad(CDPMethod[None]):  # experimental deprecated
    """ Deprecated, please use removeScriptToEvaluateOnNewDocument instead. """

    INPUT_VALIDATOR = RemoveScriptToEvaluateOnLoadInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        identifier: Page.ScriptIdentifier
    ):
        super().__init__(
            identifier=identifier
        )


class RemoveScriptToEvaluateOnNewDocumentInput(InputModel):

    identifier: Page.ScriptIdentifier


class RemoveScriptToEvaluateOnNewDocument(CDPMethod[None]):
    """ Removes given script from the list. """

    INPUT_VALIDATOR = RemoveScriptToEvaluateOnNewDocumentInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        identifier: Page.ScriptIdentifier
    ):
        super().__init__(
            identifier=identifier
        )


class ScreencastFrameAckInput(InputModel):

    sessionId: int


class ScreencastFrameAck(CDPMethod[None]):  # experimental
    """ Acknowledges that a screencast frame has been received by the frontend. """

    INPUT_VALIDATOR = ScreencastFrameAckInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        session_id: int
    ):
        super().__init__(
            sessionId=session_id
        )


class SearchInResourceInput(InputModel):

    frameId: Page.FrameId
    url: str
    query: str
    caseSensitive: bool | None = None
    isRegex: bool | None = None


class SearchInResourceOutput(OutputModel):

    result: list[Debugger.SearchMatch]


class SearchInResource(CDPMethod[SearchInResourceOutput]):  # experimental
    """ Searches for given string in resource content. """

    INPUT_VALIDATOR = SearchInResourceInput
    OUTPUT_VALIDATOR = SearchInResourceOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId,
        url: str,
        query: str,
        case_sensitive: bool | None = None,
        is_regex: bool | None = None
    ):
        super().__init__(
            frameId=frame_id,
            url=url,
            query=query,
            caseSensitive=case_sensitive,
            isRegex=is_regex
        )


class SetAdBlockingEnabledInput(InputModel):

    enabled: bool


class SetAdBlockingEnabled(CDPMethod[None]):  # experimental
    """ Enable Chrome's experimental ad filter on all sites. """

    INPUT_VALIDATOR = SetAdBlockingEnabledInput
    OUTPUT_VALIDATOR = None

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


class SetBypassCSPInput(InputModel):

    enabled: bool


class SetBypassCSP(CDPMethod[None]):
    """ Enable page Content Security Policy by-passing. """

    INPUT_VALIDATOR = SetBypassCSPInput
    OUTPUT_VALIDATOR = None

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


class GetPermissionsPolicyStateInput(InputModel):

    frameId: Page.FrameId


class GetPermissionsPolicyStateOutput(OutputModel):

    states: list[Page.PermissionsPolicyFeatureState]


class GetPermissionsPolicyState(CDPMethod[GetPermissionsPolicyStateOutput]):  # experimental
    """ Get Permissions Policy state on given frame. """

    INPUT_VALIDATOR = GetPermissionsPolicyStateInput
    OUTPUT_VALIDATOR = GetPermissionsPolicyStateOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId
    ):
        super().__init__(
            frameId=frame_id
        )


class GetOriginTrialsInput(InputModel):

    frameId: Page.FrameId


class GetOriginTrialsOutput(OutputModel):

    originTrials: list[Page.OriginTrial]


class GetOriginTrials(CDPMethod[GetOriginTrialsOutput]):  # experimental
    """ Get Origin Trials on given frame. """

    INPUT_VALIDATOR = GetOriginTrialsInput
    OUTPUT_VALIDATOR = GetOriginTrialsOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId
    ):
        super().__init__(
            frameId=frame_id
        )


class SetDeviceMetricsOverrideInput(InputModel):

    width: int
    height: int
    deviceScaleFactor: float
    mobile: bool
    scale: float | None = None
    screenWidth: int | None = None
    screenHeight: int | None = None
    positionX: int | None = None
    positionY: int | None = None
    dontSetVisibleSize: bool | None = None
    screenOrientation: Emulation.ScreenOrientation | None = None
    viewport: Page.Viewport | None = None


class SetDeviceMetricsOverride(CDPMethod[None]):  # experimental deprecated
    """ Overrides the values of device screen dimensions (window.screen.width, window.screen.height,
    window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media
    query results). """

    INPUT_VALIDATOR = SetDeviceMetricsOverrideInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        width: int,
        height: int,
        device_scale_factor: float,
        mobile: bool,
        scale: float | None = None,
        screen_width: int | None = None,
        screen_height: int | None = None,
        position_x: int | None = None,
        position_y: int | None = None,
        dont_set_visible_size: bool | None = None,
        screen_orientation: Emulation.ScreenOrientation | None = None,
        viewport: Page.Viewport | None = None
    ):
        super().__init__(
            width=width,
            height=height,
            deviceScaleFactor=device_scale_factor,
            mobile=mobile,
            scale=scale,
            screenWidth=screen_width,
            screenHeight=screen_height,
            positionX=position_x,
            positionY=position_y,
            dontSetVisibleSize=dont_set_visible_size,
            screenOrientation=screen_orientation,
            viewport=viewport
        )


class SetDeviceOrientationOverrideInput(InputModel):

    alpha: float
    beta: float
    gamma: float


class SetDeviceOrientationOverride(CDPMethod[None]):  # experimental deprecated
    """ Overrides the Device Orientation. """

    INPUT_VALIDATOR = SetDeviceOrientationOverrideInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        alpha: float,
        beta: float,
        gamma: float
    ):
        super().__init__(
            alpha=alpha,
            beta=beta,
            gamma=gamma
        )


class SetFontFamiliesInput(InputModel):

    fontFamilies: Page.FontFamilies
    forScripts: list[Page.ScriptFontFamilies] | None = None


class SetFontFamilies(CDPMethod[None]):  # experimental
    """ Set generic font families. """

    INPUT_VALIDATOR = SetFontFamiliesInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        font_families: Page.FontFamilies,
        for_scripts: list[Page.ScriptFontFamilies] | None = None
    ):
        super().__init__(
            fontFamilies=font_families,
            forScripts=for_scripts
        )


class SetFontSizesInput(InputModel):

    fontSizes: Page.FontSizes


class SetFontSizes(CDPMethod[None]):  # experimental
    """ Set default font sizes. """

    INPUT_VALIDATOR = SetFontSizesInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        font_sizes: Page.FontSizes
    ):
        super().__init__(
            fontSizes=font_sizes
        )


class SetDocumentContentInput(InputModel):

    frameId: Page.FrameId
    html: str


class SetDocumentContent(CDPMethod[None]):
    """ Sets given markup as the document's HTML. """

    INPUT_VALIDATOR = SetDocumentContentInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        frame_id: Page.FrameId,
        html: str
    ):
        super().__init__(
            frameId=frame_id,
            html=html
        )


class SetDownloadBehaviorInput(InputModel):

    behavior: Literal['deny', 'allow', 'default']
    downloadPath: str | None = None


class SetDownloadBehavior(CDPMethod[None]):  # experimental deprecated
    """ Set the behavior when downloading a file. """

    INPUT_VALIDATOR = SetDownloadBehaviorInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        behavior: Literal['deny', 'allow', 'default'],
        download_path: str | None = None
    ):
        super().__init__(
            behavior=behavior,
            downloadPath=download_path
        )


class SetGeolocationOverrideInput(InputModel):

    latitude: float | None = None
    longitude: float | None = None
    accuracy: float | None = None


class SetGeolocationOverride(CDPMethod[None]):  # deprecated
    """ Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position
    unavailable. """

    INPUT_VALIDATOR = SetGeolocationOverrideInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        latitude: float | None = None,
        longitude: float | None = None,
        accuracy: float | None = None
    ):
        super().__init__(
            latitude=latitude,
            longitude=longitude,
            accuracy=accuracy
        )


class SetLifecycleEventsEnabledInput(InputModel):

    enabled: bool


class SetLifecycleEventsEnabled(CDPMethod[None]):
    """ Controls whether page will emit lifecycle events. """

    INPUT_VALIDATOR = SetLifecycleEventsEnabledInput
    OUTPUT_VALIDATOR = None

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


class SetTouchEmulationEnabledInput(InputModel):

    enabled: bool
    configuration: Literal['mobile', 'desktop'] | None = None


class SetTouchEmulationEnabled(CDPMethod[None]):  # experimental deprecated
    """ Toggles mouse event-based touch event emulation. """

    INPUT_VALIDATOR = SetTouchEmulationEnabledInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enabled: bool,
        configuration: Literal['mobile', 'desktop'] | None = None
    ):
        super().__init__(
            enabled=enabled,
            configuration=configuration
        )


class StartScreencastInput(InputModel):

    format: Literal['jpeg', 'png'] | None = None
    quality: int | None = None
    maxWidth: int | None = None
    maxHeight: int | None = None
    everyNthFrame: int | None = None


class StartScreencast(CDPMethod[None]):  # experimental
    """ Starts sending each frame using the `screencastFrame` event. """

    INPUT_VALIDATOR = StartScreencastInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        format_: Literal['jpeg', 'png'] | None = None,
        quality: int | None = None,
        max_width: int | None = None,
        max_height: int | None = None,
        every_nth_frame: int | None = None
    ):
        super().__init__(
            format=format_,
            quality=quality,
            maxWidth=max_width,
            maxHeight=max_height,
            everyNthFrame=every_nth_frame
        )


class StopLoading(CDPMethod[None]):
    """ Force the page stop all navigations and pending resource fetches. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class Crash(CDPMethod[None]):  # experimental
    """ Crashes renderer on the IO thread, generates minidumps. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class Close(CDPMethod[None]):
    """ Tries to close page, running its beforeunload hooks, if any. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class SetWebLifecycleStateInput(InputModel):

    state: Literal['frozen', 'active']


class SetWebLifecycleState(CDPMethod[None]):  # experimental
    """ Tries to update the web lifecycle state of the page.
    It will transition the page to the given state according to:
    https://github.com/WICG/web-lifecycle/ """

    INPUT_VALIDATOR = SetWebLifecycleStateInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        state: Literal['frozen', 'active']
    ):
        super().__init__(
            state=state
        )


class StopScreencast(CDPMethod[None]):  # experimental
    """ Stops sending each frame in the `screencastFrame`. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class ProduceCompilationCacheInput(InputModel):

    scripts: list[Page.CompilationCacheParams]


class ProduceCompilationCache(CDPMethod[None]):  # experimental
    """ Requests backend to produce compilation cache for the specified scripts.
    `scripts` are appended to the list of scripts for which the cache
    would be produced. The list may be reset during page navigation.
    When script with a matching URL is encountered, the cache is optionally
    produced upon backend discretion, based on internal heuristics.
    See also: `Page.compilationCacheProduced`. """

    INPUT_VALIDATOR = ProduceCompilationCacheInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        scripts: list[Page.CompilationCacheParams]
    ):
        super().__init__(
            scripts=scripts
        )


class AddCompilationCacheInput(InputModel):

    url: str
    data: str


class AddCompilationCache(CDPMethod[None]):  # experimental
    """ Seeds compilation cache for given url. Compilation cache does not survive
    cross-process navigation. """

    INPUT_VALIDATOR = AddCompilationCacheInput
    OUTPUT_VALIDATOR = None

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


class ClearCompilationCache(CDPMethod[None]):  # experimental
    """ Clears seeded compilation cache. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class SetSPCTransactionModeInput(InputModel):

    mode: Literal['none', 'autoAccept', 'autoChooseToAuthAnotherWay', 'autoReject', 'autoOptOut']


class SetSPCTransactionMode(CDPMethod[None]):  # experimental
    """ Sets the Secure Payment Confirmation transaction mode.
    https://w3c.github.io/secure-payment-confirmation/#sctn-automation-set-spc-transaction-mode """

    INPUT_VALIDATOR = SetSPCTransactionModeInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        mode: Literal['none', 'autoAccept', 'autoChooseToAuthAnotherWay', 'autoReject', 'autoOptOut']
    ):
        super().__init__(
            mode=mode
        )


class SetRPHRegistrationModeInput(InputModel):

    mode: Literal['none', 'autoAccept', 'autoReject']


class SetRPHRegistrationMode(CDPMethod[None]):  # experimental
    """ Extensions for Custom Handlers API:
    https://html.spec.whatwg.org/multipage/system-state.html#rph-automation """

    INPUT_VALIDATOR = SetRPHRegistrationModeInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        mode: Literal['none', 'autoAccept', 'autoReject']
    ):
        super().__init__(
            mode=mode
        )


class GenerateTestReportInput(InputModel):

    message: str
    group: str | None = None


class GenerateTestReport(CDPMethod[None]):  # experimental
    """ Generates a report for testing. """

    INPUT_VALIDATOR = GenerateTestReportInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        message: str,
        group: str | None = None
    ):
        super().__init__(
            message=message,
            group=group
        )


class WaitForDebugger(CDPMethod[None]):  # experimental
    """ Pauses page execution. Can be resumed using generic Runtime.runIfWaitingForDebugger. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class SetInterceptFileChooserDialogInput(InputModel):

    enabled: bool
    cancel: bool | None = None  # experimental


class SetInterceptFileChooserDialog(CDPMethod[None]):
    """ Intercept file chooser requests and transfer control to protocol clients.
    When file chooser interception is enabled, native file chooser dialog is not shown.
    Instead, a protocol event `Page.fileChooserOpened` is emitted. """

    INPUT_VALIDATOR = SetInterceptFileChooserDialogInput
    OUTPUT_VALIDATOR = None

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


class SetPrerenderingAllowedInput(InputModel):

    isAllowed: bool


class SetPrerenderingAllowed(CDPMethod[None]):  # experimental
    """ Enable/disable prerendering manually.

    This command is a short-term solution for https://crbug.com/1440085.
    See https://docs.google.com/document/d/12HVmFxYj5Jc-eJr5OmWsa2bqTJsbgGLKI6ZIyx0_wpA
    for more details.

    TODO(https://crbug.com/1440085): Remove this once Puppeteer supports tab targets. """

    INPUT_VALIDATOR = SetPrerenderingAllowedInput
    OUTPUT_VALIDATOR = None

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


class GetAnnotatedPageContentInput(InputModel):

    includeActionableInformation: bool | None = None


class GetAnnotatedPageContentOutput(OutputModel):

    content: str


class GetAnnotatedPageContent(CDPMethod[GetAnnotatedPageContentOutput]):  # experimental
    """ Get the annotated page content for the main frame.
    This is an experimental command that is subject to change. """

    INPUT_VALIDATOR = GetAnnotatedPageContentInput
    OUTPUT_VALIDATOR = GetAnnotatedPageContentOutput

    def __init__(
        self,
        *,
        include_actionable_information: bool | None = None
    ):
        super().__init__(
            includeActionableInformation=include_actionable_information
        )
