# 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.animation
from cdp.animation import (
    Animation,
    AnimationCanceled,
    AnimationCreated,
    AnimationEffect,
    AnimationStarted,
    KeyframeStyle,
    KeyframesRule
)


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


async def enable() -> None:
    '''
    Enables animation domain notifications.
    '''
    session = get_session_context('animation.enable')
    return await session.execute(cdp.animation.enable())


async def get_current_time(
        id_: str
    ) -> float:
    '''
    Returns the current time of the an animation.

    :param id_: Id of animation.
    :returns: Current time of the page.
    '''
    session = get_session_context('animation.get_current_time')
    return await session.execute(cdp.animation.get_current_time(id_))


async def get_playback_rate() -> float:
    '''
    Gets the playback rate of the document timeline.

    :returns: Playback rate for animations on page.
    '''
    session = get_session_context('animation.get_playback_rate')
    return await session.execute(cdp.animation.get_playback_rate())


async def release_animations(
        animations: typing.List[str]
    ) -> None:
    '''
    Releases a set of animations to no longer be manipulated.

    :param animations: List of animation ids to seek.
    '''
    session = get_session_context('animation.release_animations')
    return await session.execute(cdp.animation.release_animations(animations))


async def resolve_animation(
        animation_id: str
    ) -> cdp.runtime.RemoteObject:
    '''
    Gets the remote object of the Animation.

    :param animation_id: Animation id.
    :returns: Corresponding remote object.
    '''
    session = get_session_context('animation.resolve_animation')
    return await session.execute(cdp.animation.resolve_animation(animation_id))


async def seek_animations(
        animations: typing.List[str],
        current_time: float
    ) -> None:
    '''
    Seek a set of animations to a particular time within each animation.

    :param animations: List of animation ids to seek.
    :param current_time: Set the current time of each animation.
    '''
    session = get_session_context('animation.seek_animations')
    return await session.execute(cdp.animation.seek_animations(animations, current_time))


async def set_paused(
        animations: typing.List[str],
        paused: bool
    ) -> None:
    '''
    Sets the paused state of a set of animations.

    :param animations: Animations to set the pause state of.
    :param paused: Paused state to set to.
    '''
    session = get_session_context('animation.set_paused')
    return await session.execute(cdp.animation.set_paused(animations, paused))


async def set_playback_rate(
        playback_rate: float
    ) -> None:
    '''
    Sets the playback rate of the document timeline.

    :param playback_rate: Playback rate for animations on page
    '''
    session = get_session_context('animation.set_playback_rate')
    return await session.execute(cdp.animation.set_playback_rate(playback_rate))


async def set_timing(
        animation_id: str,
        duration: float,
        delay: float
    ) -> None:
    '''
    Sets the timing of an animation node.

    :param animation_id: Animation id.
    :param duration: Duration of the animation.
    :param delay: Delay of the animation.
    '''
    session = get_session_context('animation.set_timing')
    return await session.execute(cdp.animation.set_timing(animation_id, duration, delay))
