# DO NOT EDIT THIS FILE!
#
# This code is generated off of PyCDP modules. If you need to make
# changes, edit the generator and regenerate all of the modules.

from __future__ import annotations
import typing

from ..context import get_connection_context, get_session_context

import cdp.accessibility
from cdp.accessibility import (
    AXNode,
    AXNodeId,
    AXProperty,
    AXPropertyName,
    AXRelatedNode,
    AXValue,
    AXValueNativeSourceType,
    AXValueSource,
    AXValueSourceType,
    AXValueType
)


async def disable() -> None:
    '''
    Disables the accessibility domain.
    '''
    session = get_session_context('accessibility.disable')
    return await session.execute(cdp.accessibility.disable())


async def enable() -> None:
    '''
    Enables the accessibility domain which causes ``AXNodeId``'s to remain consistent between method calls.
    This turns on accessibility for the page, which can impact performance until accessibility is disabled.
    '''
    session = get_session_context('accessibility.enable')
    return await session.execute(cdp.accessibility.enable())


async def get_full_ax_tree() -> typing.List[AXNode]:
    '''
    Fetches the entire accessibility tree

    **EXPERIMENTAL**

    :returns: 
    '''
    session = get_session_context('accessibility.get_full_ax_tree')
    return await session.execute(cdp.accessibility.get_full_ax_tree())


async def get_partial_ax_tree(
        node_id: typing.Optional[cdp.dom.NodeId] = None,
        backend_node_id: typing.Optional[cdp.dom.BackendNodeId] = None,
        object_id: typing.Optional[cdp.runtime.RemoteObjectId] = None,
        fetch_relatives: typing.Optional[bool] = None
    ) -> typing.List[AXNode]:
    '''
    Fetches the accessibility node and partial accessibility tree for this DOM node, if it exists.

    **EXPERIMENTAL**

    :param node_id: *(Optional)* Identifier of the node to get the partial accessibility tree for.
    :param backend_node_id: *(Optional)* Identifier of the backend node to get the partial accessibility tree for.
    :param object_id: *(Optional)* JavaScript object id of the node wrapper to get the partial accessibility tree for.
    :param fetch_relatives: *(Optional)* Whether to fetch this nodes ancestors, siblings and children. Defaults to true.
    :returns: The ``Accessibility.AXNode`` for this DOM node, if it exists, plus its ancestors, siblings and children, if requested.
    '''
    session = get_session_context('accessibility.get_partial_ax_tree')
    return await session.execute(cdp.accessibility.get_partial_ax_tree(node_id, backend_node_id, object_id, fetch_relatives))
