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


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

***************************************************
                    Methods
***************************************************
"""
from __future__ import annotations

from cdpkit.protocol._types import (
    Browser,
    Network,
    Page,
    Storage,
)
from cdpkit.protocol.base import JSON_DICT, CDPMethod, InputModel, OutputModel


class GetStorageKeyForFrameInput(InputModel):

    frameId: Page.FrameId


class GetStorageKeyForFrameOutput(OutputModel):

    storageKey: Storage.SerializedStorageKey


class GetStorageKeyForFrame(CDPMethod[GetStorageKeyForFrameOutput]):  # deprecated
    """ Returns a storage key given a frame id.
    Deprecated. Please use Storage.getStorageKey instead. """

    INPUT_VALIDATOR = GetStorageKeyForFrameInput
    OUTPUT_VALIDATOR = GetStorageKeyForFrameOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId
    ):
        super().__init__(
            frameId=frame_id
        )


class GetStorageKeyInput(InputModel):

    frameId: Page.FrameId | None = None


class GetStorageKeyOutput(OutputModel):

    storageKey: Storage.SerializedStorageKey


class GetStorageKey(CDPMethod[GetStorageKeyOutput]):  # experimental
    """ Returns storage key for the given frame. If no frame ID is provided,
    the storage key of the target executing this command is returned. """

    INPUT_VALIDATOR = GetStorageKeyInput
    OUTPUT_VALIDATOR = GetStorageKeyOutput

    def __init__(
        self,
        *,
        frame_id: Page.FrameId | None = None
    ):
        super().__init__(
            frameId=frame_id
        )


class ClearDataForOriginInput(InputModel):

    origin: str
    storageTypes: str


class ClearDataForOrigin(CDPMethod[None]):
    """ Clears storage for origin. """

    INPUT_VALIDATOR = ClearDataForOriginInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        origin: str,
        storage_types: str
    ):
        super().__init__(
            origin=origin,
            storageTypes=storage_types
        )


class ClearDataForStorageKeyInput(InputModel):

    storageKey: str
    storageTypes: str


class ClearDataForStorageKey(CDPMethod[None]):
    """ Clears storage for storage key. """

    INPUT_VALIDATOR = ClearDataForStorageKeyInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        storage_key: str,
        storage_types: str
    ):
        super().__init__(
            storageKey=storage_key,
            storageTypes=storage_types
        )


class GetCookiesInput(InputModel):

    browserContextId: Browser.BrowserContextID | None = None


class GetCookiesOutput(OutputModel):

    cookies: list[Network.Cookie]


class GetCookies(CDPMethod[GetCookiesOutput]):
    """ Returns all browser cookies. """

    INPUT_VALIDATOR = GetCookiesInput
    OUTPUT_VALIDATOR = GetCookiesOutput

    def __init__(
        self,
        *,
        browser_context_id: Browser.BrowserContextID | None = None
    ):
        super().__init__(
            browserContextId=browser_context_id
        )


class SetCookiesInput(InputModel):

    cookies: list[Network.CookieParam]
    browserContextId: Browser.BrowserContextID | None = None


class SetCookies(CDPMethod[None]):
    """ Sets given cookies. """

    INPUT_VALIDATOR = SetCookiesInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        cookies: list[Network.CookieParam],
        browser_context_id: Browser.BrowserContextID | None = None
    ):
        super().__init__(
            cookies=cookies,
            browserContextId=browser_context_id
        )


class ClearCookiesInput(InputModel):

    browserContextId: Browser.BrowserContextID | None = None


class ClearCookies(CDPMethod[None]):
    """ Clears cookies. """

    INPUT_VALIDATOR = ClearCookiesInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        browser_context_id: Browser.BrowserContextID | None = None
    ):
        super().__init__(
            browserContextId=browser_context_id
        )


class GetUsageAndQuotaInput(InputModel):

    origin: str


class GetUsageAndQuotaOutput(OutputModel):

    usage: float
    quota: float
    overrideActive: bool
    usageBreakdown: list[Storage.UsageForType]


class GetUsageAndQuota(CDPMethod[GetUsageAndQuotaOutput]):
    """ Returns usage and quota in bytes. """

    INPUT_VALIDATOR = GetUsageAndQuotaInput
    OUTPUT_VALIDATOR = GetUsageAndQuotaOutput

    def __init__(
        self,
        *,
        origin: str
    ):
        super().__init__(
            origin=origin
        )


class OverrideQuotaForOriginInput(InputModel):

    origin: str
    quotaSize: float | None = None


class OverrideQuotaForOrigin(CDPMethod[None]):  # experimental
    """ Override quota for the specified origin """

    INPUT_VALIDATOR = OverrideQuotaForOriginInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        origin: str,
        quota_size: float | None = None
    ):
        super().__init__(
            origin=origin,
            quotaSize=quota_size
        )


class TrackCacheStorageForOriginInput(InputModel):

    origin: str


class TrackCacheStorageForOrigin(CDPMethod[None]):
    """ Registers origin to be notified when an update occurs to its cache storage list. """

    INPUT_VALIDATOR = TrackCacheStorageForOriginInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        origin: str
    ):
        super().__init__(
            origin=origin
        )


class TrackCacheStorageForStorageKeyInput(InputModel):

    storageKey: str


class TrackCacheStorageForStorageKey(CDPMethod[None]):
    """ Registers storage key to be notified when an update occurs to its cache storage list. """

    INPUT_VALIDATOR = TrackCacheStorageForStorageKeyInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        storage_key: str
    ):
        super().__init__(
            storageKey=storage_key
        )


class TrackIndexedDBForOriginInput(InputModel):

    origin: str


class TrackIndexedDBForOrigin(CDPMethod[None]):
    """ Registers origin to be notified when an update occurs to its IndexedDB. """

    INPUT_VALIDATOR = TrackIndexedDBForOriginInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        origin: str
    ):
        super().__init__(
            origin=origin
        )


class TrackIndexedDBForStorageKeyInput(InputModel):

    storageKey: str


class TrackIndexedDBForStorageKey(CDPMethod[None]):
    """ Registers storage key to be notified when an update occurs to its IndexedDB. """

    INPUT_VALIDATOR = TrackIndexedDBForStorageKeyInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        storage_key: str
    ):
        super().__init__(
            storageKey=storage_key
        )


class UntrackCacheStorageForOriginInput(InputModel):

    origin: str


class UntrackCacheStorageForOrigin(CDPMethod[None]):
    """ Unregisters origin from receiving notifications for cache storage. """

    INPUT_VALIDATOR = UntrackCacheStorageForOriginInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        origin: str
    ):
        super().__init__(
            origin=origin
        )


class UntrackCacheStorageForStorageKeyInput(InputModel):

    storageKey: str


class UntrackCacheStorageForStorageKey(CDPMethod[None]):
    """ Unregisters storage key from receiving notifications for cache storage. """

    INPUT_VALIDATOR = UntrackCacheStorageForStorageKeyInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        storage_key: str
    ):
        super().__init__(
            storageKey=storage_key
        )


class UntrackIndexedDBForOriginInput(InputModel):

    origin: str


class UntrackIndexedDBForOrigin(CDPMethod[None]):
    """ Unregisters origin from receiving notifications for IndexedDB. """

    INPUT_VALIDATOR = UntrackIndexedDBForOriginInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        origin: str
    ):
        super().__init__(
            origin=origin
        )


class UntrackIndexedDBForStorageKeyInput(InputModel):

    storageKey: str


class UntrackIndexedDBForStorageKey(CDPMethod[None]):
    """ Unregisters storage key from receiving notifications for IndexedDB. """

    INPUT_VALIDATOR = UntrackIndexedDBForStorageKeyInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        storage_key: str
    ):
        super().__init__(
            storageKey=storage_key
        )


class GetTrustTokensOutput(OutputModel):

    tokens: list[Storage.TrustTokens]


class GetTrustTokens(CDPMethod[GetTrustTokensOutput]):  # experimental
    """ Returns the number of stored Trust Tokens per issuer for the
    current browsing context. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetTrustTokensOutput


class ClearTrustTokensInput(InputModel):

    issuerOrigin: str


class ClearTrustTokensOutput(OutputModel):

    didDeleteTokens: bool


class ClearTrustTokens(CDPMethod[ClearTrustTokensOutput]):  # experimental
    """ Removes all Trust Tokens issued by the provided issuerOrigin.
    Leaves other stored data, including the issuer's Redemption Records, intact. """

    INPUT_VALIDATOR = ClearTrustTokensInput
    OUTPUT_VALIDATOR = ClearTrustTokensOutput

    def __init__(
        self,
        *,
        issuer_origin: str
    ):
        super().__init__(
            issuerOrigin=issuer_origin
        )


class GetInterestGroupDetailsInput(InputModel):

    ownerOrigin: str
    name: str


class GetInterestGroupDetailsOutput(OutputModel):

    details: JSON_DICT


class GetInterestGroupDetails(CDPMethod[GetInterestGroupDetailsOutput]):  # experimental
    """ Gets details for a named interest group. """

    INPUT_VALIDATOR = GetInterestGroupDetailsInput
    OUTPUT_VALIDATOR = GetInterestGroupDetailsOutput

    def __init__(
        self,
        *,
        owner_origin: str,
        name: str
    ):
        super().__init__(
            ownerOrigin=owner_origin,
            name=name
        )


class SetInterestGroupTrackingInput(InputModel):

    enable: bool


class SetInterestGroupTracking(CDPMethod[None]):  # experimental
    """ Enables/Disables issuing of interestGroupAccessed events. """

    INPUT_VALIDATOR = SetInterestGroupTrackingInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enable: bool
    ):
        super().__init__(
            enable=enable
        )


class SetInterestGroupAuctionTrackingInput(InputModel):

    enable: bool


class SetInterestGroupAuctionTracking(CDPMethod[None]):  # experimental
    """ Enables/Disables issuing of interestGroupAuctionEventOccurred and
    interestGroupAuctionNetworkRequestCreated. """

    INPUT_VALIDATOR = SetInterestGroupAuctionTrackingInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enable: bool
    ):
        super().__init__(
            enable=enable
        )


class GetSharedStorageMetadataInput(InputModel):

    ownerOrigin: str


class GetSharedStorageMetadataOutput(OutputModel):

    metadata: Storage.SharedStorageMetadata


class GetSharedStorageMetadata(CDPMethod[GetSharedStorageMetadataOutput]):  # experimental
    """ Gets metadata for an origin's shared storage. """

    INPUT_VALIDATOR = GetSharedStorageMetadataInput
    OUTPUT_VALIDATOR = GetSharedStorageMetadataOutput

    def __init__(
        self,
        *,
        owner_origin: str
    ):
        super().__init__(
            ownerOrigin=owner_origin
        )


class GetSharedStorageEntriesInput(InputModel):

    ownerOrigin: str


class GetSharedStorageEntriesOutput(OutputModel):

    entries: list[Storage.SharedStorageEntry]


class GetSharedStorageEntries(CDPMethod[GetSharedStorageEntriesOutput]):  # experimental
    """ Gets the entries in an given origin's shared storage. """

    INPUT_VALIDATOR = GetSharedStorageEntriesInput
    OUTPUT_VALIDATOR = GetSharedStorageEntriesOutput

    def __init__(
        self,
        *,
        owner_origin: str
    ):
        super().__init__(
            ownerOrigin=owner_origin
        )


class SetSharedStorageEntryInput(InputModel):

    ownerOrigin: str
    key: str
    value: str
    ignoreIfPresent: bool | None = None


class SetSharedStorageEntry(CDPMethod[None]):  # experimental
    """ Sets entry with `key` and `value` for a given origin's shared storage. """

    INPUT_VALIDATOR = SetSharedStorageEntryInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        owner_origin: str,
        key: str,
        value: str,
        ignore_if_present: bool | None = None
    ):
        super().__init__(
            ownerOrigin=owner_origin,
            key=key,
            value=value,
            ignoreIfPresent=ignore_if_present
        )


class DeleteSharedStorageEntryInput(InputModel):

    ownerOrigin: str
    key: str


class DeleteSharedStorageEntry(CDPMethod[None]):  # experimental
    """ Deletes entry for `key` (if it exists) for a given origin's shared storage. """

    INPUT_VALIDATOR = DeleteSharedStorageEntryInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        owner_origin: str,
        key: str
    ):
        super().__init__(
            ownerOrigin=owner_origin,
            key=key
        )


class ClearSharedStorageEntriesInput(InputModel):

    ownerOrigin: str


class ClearSharedStorageEntries(CDPMethod[None]):  # experimental
    """ Clears all entries for a given origin's shared storage. """

    INPUT_VALIDATOR = ClearSharedStorageEntriesInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        owner_origin: str
    ):
        super().__init__(
            ownerOrigin=owner_origin
        )


class ResetSharedStorageBudgetInput(InputModel):

    ownerOrigin: str


class ResetSharedStorageBudget(CDPMethod[None]):  # experimental
    """ Resets the budget for `ownerOrigin` by clearing all budget withdrawals. """

    INPUT_VALIDATOR = ResetSharedStorageBudgetInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        owner_origin: str
    ):
        super().__init__(
            ownerOrigin=owner_origin
        )


class SetSharedStorageTrackingInput(InputModel):

    enable: bool


class SetSharedStorageTracking(CDPMethod[None]):  # experimental
    """ Enables/disables issuing of sharedStorageAccessed events. """

    INPUT_VALIDATOR = SetSharedStorageTrackingInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enable: bool
    ):
        super().__init__(
            enable=enable
        )


class SetStorageBucketTrackingInput(InputModel):

    storageKey: str
    enable: bool


class SetStorageBucketTracking(CDPMethod[None]):  # experimental
    """ Set tracking for a storage key's buckets. """

    INPUT_VALIDATOR = SetStorageBucketTrackingInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        storage_key: str,
        enable: bool
    ):
        super().__init__(
            storageKey=storage_key,
            enable=enable
        )


class DeleteStorageBucketInput(InputModel):

    bucket: Storage.StorageBucket


class DeleteStorageBucket(CDPMethod[None]):  # experimental
    """ Deletes the Storage Bucket with the given storage key and bucket name. """

    INPUT_VALIDATOR = DeleteStorageBucketInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        bucket: Storage.StorageBucket
    ):
        super().__init__(
            bucket=bucket
        )


class RunBounceTrackingMitigationsOutput(OutputModel):

    deletedSites: list[str]


class RunBounceTrackingMitigations(CDPMethod[RunBounceTrackingMitigationsOutput]):  # experimental
    """ Deletes state for sites identified as potential bounce trackers, immediately. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = RunBounceTrackingMitigationsOutput


class SetAttributionReportingLocalTestingModeInput(InputModel):

    enabled: bool


class SetAttributionReportingLocalTestingMode(CDPMethod[None]):  # experimental
    """ https://wicg.github.io/attribution-reporting-api/ """

    INPUT_VALIDATOR = SetAttributionReportingLocalTestingModeInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enabled: bool
    ):
        super().__init__(
            enabled=enabled
        )


class SetAttributionReportingTrackingInput(InputModel):

    enable: bool


class SetAttributionReportingTracking(CDPMethod[None]):  # experimental
    """ Enables/disables issuing of Attribution Reporting events. """

    INPUT_VALIDATOR = SetAttributionReportingTrackingInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enable: bool
    ):
        super().__init__(
            enable=enable
        )


class SendPendingAttributionReportsOutput(OutputModel):

    numSent: int


class SendPendingAttributionReports(CDPMethod[SendPendingAttributionReportsOutput]):  # experimental
    """ Sends all pending Attribution Reports immediately, regardless of their
    scheduled report time. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = SendPendingAttributionReportsOutput


class GetRelatedWebsiteSetsOutput(OutputModel):

    sets: list[Storage.RelatedWebsiteSet]


class GetRelatedWebsiteSets(CDPMethod[GetRelatedWebsiteSetsOutput]):  # experimental
    """ Returns the effective Related Website Sets in use by this profile for the browser
    session. The effective Related Website Sets will not change during a browser session. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = GetRelatedWebsiteSetsOutput


class GetAffectedUrlsForThirdPartyCookieMetadataInput(InputModel):

    firstPartyUrl: str
    thirdPartyUrls: list[str]


class GetAffectedUrlsForThirdPartyCookieMetadataOutput(OutputModel):

    matchedUrls: list[str]


class GetAffectedUrlsForThirdPartyCookieMetadata(CDPMethod[GetAffectedUrlsForThirdPartyCookieMetadataOutput]):  # experimental
    """ Returns the list of URLs from a page and its embedded resources that match
    existing grace period URL pattern rules.
    https://developers.google.com/privacy-sandbox/cookies/temporary-exceptions/grace-period """

    INPUT_VALIDATOR = GetAffectedUrlsForThirdPartyCookieMetadataInput
    OUTPUT_VALIDATOR = GetAffectedUrlsForThirdPartyCookieMetadataOutput

    def __init__(
        self,
        *,
        first_party_url: str,
        third_party_urls: list[str]
    ):
        super().__init__(
            firstPartyUrl=first_party_url,
            thirdPartyUrls=third_party_urls
        )


class SetProtectedAudienceKAnonymityInput(InputModel):

    owner: str
    name: str
    hashes: list[str]


class SetProtectedAudienceKAnonymity(CDPMethod[None]):

    INPUT_VALIDATOR = SetProtectedAudienceKAnonymityInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        owner: str,
        name: str,
        hashes: list[str]
    ):
        super().__init__(
            owner=owner,
            name=name,
            hashes=hashes
        )
