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

Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing
breakpoints, stepping through execution, exploring stack traces, etc.
https://chromedevtools.github.io/devtools-protocol/tot/Debugger/

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

from typing import Literal

from cdpkit.protocol._types import (
    Debugger,
    Runtime,
)
from cdpkit.protocol.base import JSON_DICT, CDPEvent


class BreakpointResolved(CDPEvent):
    """ Fired when breakpoint is resolved to an actual script and location.
    Deprecated in favor of `resolvedBreakpoints` in the `scriptParsed` event. """

    breakpointId: Debugger.BreakpointId
    location: Debugger.Location


class Paused(CDPEvent):
    """ Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. """

    callFrames: list[Debugger.CallFrame]
    reason: Literal['ambiguous', 'assert', 'CSPViolation', 'debugCommand', 'DOM', 'EventListener', 'exception', 'instrumentation', 'OOM', 'other', 'promiseRejection', 'XHR', 'step']
    data: JSON_DICT | None = None
    hitBreakpoints: list[str] | None = None
    asyncStackTrace: Runtime.StackTrace | None = None
    asyncStackTraceId: Runtime.StackTraceId | None = None  # experimental
    asyncCallStackTraceId: Runtime.StackTraceId | None = None  # experimental deprecated


class Resumed(CDPEvent):
    """ Fired when the virtual machine resumed execution. """

    ...


class ScriptFailedToParse(CDPEvent):
    """ Fired when virtual machine fails to parse the script. """

    scriptId: Runtime.ScriptId
    url: str
    startLine: int
    startColumn: int
    endLine: int
    endColumn: int
    executionContextId: Runtime.ExecutionContextId
    hash: str
    buildId: str
    executionContextAuxData: JSON_DICT | None = None
    sourceMapURL: str | None = None
    hasSourceURL: bool | None = None
    isModule: bool | None = None
    length: int | None = None
    stackTrace: Runtime.StackTrace | None = None  # experimental
    codeOffset: int | None = None  # experimental
    scriptLanguage: Debugger.ScriptLanguage | None = None  # experimental
    embedderName: str | None = None  # experimental


class ScriptParsed(CDPEvent):
    """ Fired when virtual machine parses script. This event is also fired for all known and uncollected
    scripts upon enabling debugger. """

    scriptId: Runtime.ScriptId
    url: str
    startLine: int
    startColumn: int
    endLine: int
    endColumn: int
    executionContextId: Runtime.ExecutionContextId
    hash: str
    buildId: str
    executionContextAuxData: JSON_DICT | None = None
    isLiveEdit: bool | None = None  # experimental
    sourceMapURL: str | None = None
    hasSourceURL: bool | None = None
    isModule: bool | None = None
    length: int | None = None
    stackTrace: Runtime.StackTrace | None = None  # experimental
    codeOffset: int | None = None  # experimental
    scriptLanguage: Debugger.ScriptLanguage | None = None  # experimental
    debugSymbols: list[Debugger.DebugSymbols] | None = None  # experimental
    embedderName: str | None = None  # experimental
    resolvedBreakpoints: list[Debugger.ResolvedBreakpoint] | None = None  # experimental
