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

This domain facilitates obtaining document snapshots with DOM, layout, and style information.
https://chromedevtools.github.io/devtools-protocol/tot/DOMSnapshot/

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

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


class Disable(CDPMethod[None]):
    """ Disables DOM snapshot agent for the given page. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class Enable(CDPMethod[None]):
    """ Enables DOM snapshot agent for the given page. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class GetSnapshotInput(InputModel):

    computedStyleWhitelist: list[str]
    includeEventListeners: bool | None = None
    includePaintOrder: bool | None = None
    includeUserAgentShadowTree: bool | None = None


class GetSnapshotOutput(OutputModel):

    domNodes: list[DOMSnapshot.DOMNode]
    layoutTreeNodes: list[DOMSnapshot.LayoutTreeNode]
    computedStyles: list[DOMSnapshot.ComputedStyle]


class GetSnapshot(CDPMethod[GetSnapshotOutput]):  # deprecated
    """ Returns a document snapshot, including the full DOM tree of the root node (including iframes,
    template contents, and imported documents) in a flattened array, as well as layout and
    white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
    flattened. """

    INPUT_VALIDATOR = GetSnapshotInput
    OUTPUT_VALIDATOR = GetSnapshotOutput

    def __init__(
        self,
        *,
        computed_style_whitelist: list[str],
        include_event_listeners: bool | None = None,
        include_paint_order: bool | None = None,
        include_user_agent_shadow_tree: bool | None = None
    ):
        super().__init__(
            computedStyleWhitelist=computed_style_whitelist,
            includeEventListeners=include_event_listeners,
            includePaintOrder=include_paint_order,
            includeUserAgentShadowTree=include_user_agent_shadow_tree
        )


class CaptureSnapshotInput(InputModel):

    computedStyles: list[str]
    includePaintOrder: bool | None = None
    includeDOMRects: bool | None = None
    includeBlendedBackgroundColors: bool | None = None  # experimental
    includeTextColorOpacities: bool | None = None  # experimental


class CaptureSnapshotOutput(OutputModel):

    documents: list[DOMSnapshot.DocumentSnapshot]
    strings: list[str]


class CaptureSnapshot(CDPMethod[CaptureSnapshotOutput]):
    """ Returns a document snapshot, including the full DOM tree of the root node (including iframes,
    template contents, and imported documents) in a flattened array, as well as layout and
    white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
    flattened. """

    INPUT_VALIDATOR = CaptureSnapshotInput
    OUTPUT_VALIDATOR = CaptureSnapshotOutput

    def __init__(
        self,
        *,
        computed_styles: list[str],
        include_paint_order: bool | None = None,
        include_dom_rects: bool | None = None,
        include_blended_background_colors: bool | None = None,
        include_text_color_opacities: bool | None = None
    ):
        super().__init__(
            computedStyles=computed_styles,
            includePaintOrder=include_paint_order,
            includeDOMRects=include_dom_rects,
            includeBlendedBackgroundColors=include_blended_background_colors,
            includeTextColorOpacities=include_text_color_opacities
        )
