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


https://chromedevtools.github.io/devtools-protocol/tot/Storage/

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

from cdpkit.protocol._types import (
    Network,
    Page,
    Storage,
    Target,
)
from cdpkit.protocol.base import JSON_DICT, CDPEvent


class CacheStorageContentUpdated(CDPEvent):
    """ A cache's contents have been modified. """

    origin: str
    storageKey: str
    bucketId: str
    cacheName: str


class CacheStorageListUpdated(CDPEvent):
    """ A cache has been added/deleted. """

    origin: str
    storageKey: str
    bucketId: str


class IndexedDBContentUpdated(CDPEvent):
    """ The origin's IndexedDB object store has been modified. """

    origin: str
    storageKey: str
    bucketId: str
    databaseName: str
    objectStoreName: str


class IndexedDBListUpdated(CDPEvent):
    """ The origin's IndexedDB database list has been modified. """

    origin: str
    storageKey: str
    bucketId: str


class InterestGroupAccessed(CDPEvent):
    """ One of the interest groups was accessed. Note that these events are global
    to all targets sharing an interest group store. """

    accessTime: Network.TimeSinceEpoch
    type: Storage.InterestGroupAccessType
    ownerOrigin: str
    name: str
    componentSellerOrigin: str | None = None
    bid: float | None = None
    bidCurrency: str | None = None
    uniqueAuctionId: Storage.InterestGroupAuctionId | None = None


class InterestGroupAuctionEventOccurred(CDPEvent):
    """ An auction involving interest groups is taking place. These events are
    target-specific. """

    eventTime: Network.TimeSinceEpoch
    type: Storage.InterestGroupAuctionEventType
    uniqueAuctionId: Storage.InterestGroupAuctionId
    parentAuctionId: Storage.InterestGroupAuctionId | None = None
    auctionConfig: JSON_DICT | None = None


class InterestGroupAuctionNetworkRequestCreated(CDPEvent):
    """ Specifies which auctions a particular network fetch may be related to, and
    in what role. Note that it is not ordered with respect to
    Network.requestWillBeSent (but will happen before loadingFinished
    loadingFailed). """

    type: Storage.InterestGroupAuctionFetchType
    requestId: Network.RequestId
    auctions: list[Storage.InterestGroupAuctionId]


class SharedStorageAccessed(CDPEvent):
    """ Shared storage was accessed by the associated page.
    The following parameters are included in all events. """

    accessTime: Network.TimeSinceEpoch
    scope: Storage.SharedStorageAccessScope
    method: Storage.SharedStorageAccessMethod
    mainFrameId: Page.FrameId
    ownerOrigin: str
    ownerSite: str
    params: Storage.SharedStorageAccessParams


class SharedStorageWorkletOperationExecutionFinished(CDPEvent):
    """ A shared storage run or selectURL operation finished its execution.
    The following parameters are included in all events. """

    finishedTime: Network.TimeSinceEpoch
    executionTime: int
    method: Storage.SharedStorageAccessMethod
    operationId: str
    workletTargetId: Target.TargetID
    mainFrameId: Page.FrameId
    ownerOrigin: str


class StorageBucketCreatedOrUpdated(CDPEvent):

    bucketInfo: Storage.StorageBucketInfo


class StorageBucketDeleted(CDPEvent):

    bucketId: str


class AttributionReportingSourceRegistered(CDPEvent):

    registration: Storage.AttributionReportingSourceRegistration
    result: Storage.AttributionReportingSourceRegistrationResult


class AttributionReportingTriggerRegistered(CDPEvent):

    registration: Storage.AttributionReportingTriggerRegistration
    eventLevel: Storage.AttributionReportingEventLevelResult
    aggregatable: Storage.AttributionReportingAggregatableResult


class AttributionReportingReportSent(CDPEvent):

    url: str
    body: JSON_DICT
    result: Storage.AttributionReportingReportResult
    netError: int | None = None
    netErrorName: str | None = None
    httpStatusCode: int | None = None


class AttributionReportingVerboseDebugReportSent(CDPEvent):

    url: str
    body: list[JSON_DICT] | None = None
    netError: int | None = None
    netErrorName: str | None = None
    httpStatusCode: int | None = None
