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

This domain allows inspection of Web Audio API.
https://webaudio.github.io/web-audio-api/
https://chromedevtools.github.io/devtools-protocol/tot/WebAudio/

***************************************************
                    Events
***************************************************
"""
from __future__ import annotations

from cdpkit.protocol._types import (
    WebAudio,
)
from cdpkit.protocol.base import CDPEvent


class ContextCreated(CDPEvent):
    """ Notifies that a new BaseAudioContext has been created. """

    context: WebAudio.BaseAudioContext


class ContextWillBeDestroyed(CDPEvent):
    """ Notifies that an existing BaseAudioContext will be destroyed. """

    contextId: WebAudio.GraphObjectId


class ContextChanged(CDPEvent):
    """ Notifies that existing BaseAudioContext has changed some properties (id stays the same).. """

    context: WebAudio.BaseAudioContext


class AudioListenerCreated(CDPEvent):
    """ Notifies that the construction of an AudioListener has finished. """

    listener: WebAudio.AudioListener


class AudioListenerWillBeDestroyed(CDPEvent):
    """ Notifies that a new AudioListener has been created. """

    contextId: WebAudio.GraphObjectId
    listenerId: WebAudio.GraphObjectId


class AudioNodeCreated(CDPEvent):
    """ Notifies that a new AudioNode has been created. """

    node: WebAudio.AudioNode


class AudioNodeWillBeDestroyed(CDPEvent):
    """ Notifies that an existing AudioNode has been destroyed. """

    contextId: WebAudio.GraphObjectId
    nodeId: WebAudio.GraphObjectId


class AudioParamCreated(CDPEvent):
    """ Notifies that a new AudioParam has been created. """

    param: WebAudio.AudioParam


class AudioParamWillBeDestroyed(CDPEvent):
    """ Notifies that an existing AudioParam has been destroyed. """

    contextId: WebAudio.GraphObjectId
    nodeId: WebAudio.GraphObjectId
    paramId: WebAudio.GraphObjectId


class NodesConnected(CDPEvent):
    """ Notifies that two AudioNodes are connected. """

    contextId: WebAudio.GraphObjectId
    sourceId: WebAudio.GraphObjectId
    destinationId: WebAudio.GraphObjectId
    sourceOutputIndex: float | None = None
    destinationInputIndex: float | None = None


class NodesDisconnected(CDPEvent):
    """ Notifies that AudioNodes are disconnected. The destination can be null, and it means all the outgoing connections from the source are disconnected. """

    contextId: WebAudio.GraphObjectId
    sourceId: WebAudio.GraphObjectId
    destinationId: WebAudio.GraphObjectId
    sourceOutputIndex: float | None = None
    destinationInputIndex: float | None = None


class NodeParamConnected(CDPEvent):
    """ Notifies that an AudioNode is connected to an AudioParam. """

    contextId: WebAudio.GraphObjectId
    sourceId: WebAudio.GraphObjectId
    destinationId: WebAudio.GraphObjectId
    sourceOutputIndex: float | None = None


class NodeParamDisconnected(CDPEvent):
    """ Notifies that an AudioNode is disconnected to an AudioParam. """

    contextId: WebAudio.GraphObjectId
    sourceId: WebAudio.GraphObjectId
    destinationId: WebAudio.GraphObjectId
    sourceOutputIndex: float | None = None
