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

A domain for letting clients substitute browser's network layer with client code.
https://chromedevtools.github.io/devtools-protocol/tot/Fetch/

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

from cdpkit.protocol._types import (
    Fetch,
    Network,
    Page,
)
from cdpkit.protocol.base import CDPEvent


class RequestPaused(CDPEvent):
    """ Issued when the domain is enabled and the request URL matches the
    specified filter. The request is paused until the client responds
    with one of continueRequest, failRequest or fulfillRequest.
    The stage of the request can be determined by presence of responseErrorReason
    and responseStatusCode -- the request is at the response stage if either
    of these fields is present and in the request stage otherwise.
    Redirect responses and subsequent requests are reported similarly to regular
    responses and requests. Redirect responses may be distinguished by the value
    of `responseStatusCode` (which is one of 301, 302, 303, 307, 308) along with
    presence of the `location` header. Requests resulting from a redirect will
    have `redirectedRequestId` field set. """

    requestId: Fetch.RequestId  # deprecated
    request: Network.Request  # deprecated
    frameId: Page.FrameId  # deprecated
    resourceType: Network.ResourceType  # deprecated
    responseErrorReason: Network.ErrorReason | None = None  # deprecated
    responseStatusCode: int | None = None  # deprecated
    responseStatusText: str | None = None  # deprecated
    responseHeaders: list[Fetch.HeaderEntry] | None = None  # deprecated
    networkId: Network.RequestId | None = None  # deprecated
    redirectedRequestId: Fetch.RequestId | None = None  # experimental deprecated


class AuthRequired(CDPEvent):
    """ Issued when the domain is enabled with handleAuthRequests set to true.
    The request is paused until client responds with continueWithAuth. """

    requestId: Fetch.RequestId  # deprecated
    request: Network.Request  # deprecated
    frameId: Page.FrameId  # deprecated
    resourceType: Network.ResourceType  # deprecated
    authChallenge: Fetch.AuthChallenge  # deprecated
