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

Defines commands and events for browser extensions.
https://chromedevtools.github.io/devtools-protocol/tot/Extensions/

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

from cdpkit.protocol._types import (
    Extensions,
)
from cdpkit.protocol.base import JSON_DICT, CDPMethod, InputModel, OutputModel


class LoadUnpackedInput(InputModel):

    path: str


class LoadUnpackedOutput(OutputModel):

    id: str


class LoadUnpacked(CDPMethod[LoadUnpackedOutput]):
    """ Installs an unpacked extension from the filesystem similar to
    --load-extension CLI flags. Returns extension ID once the extension
    has been installed. Available if the client is connected using the
    --remote-debugging-pipe flag and the --enable-unsafe-extension-debugging
    flag is set. """

    INPUT_VALIDATOR = LoadUnpackedInput
    OUTPUT_VALIDATOR = LoadUnpackedOutput

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


class UninstallInput(InputModel):

    id: str


class Uninstall(CDPMethod[None]):
    """ Uninstalls an unpacked extension (others not supported) from the profile.
    Available if the client is connected using the --remote-debugging-pipe flag
    and the --enable-unsafe-extension-debugging. """

    INPUT_VALIDATOR = UninstallInput
    OUTPUT_VALIDATOR = None

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


class GetStorageItemsInput(InputModel):

    id: str
    storageArea: Extensions.StorageArea
    keys: list[str] | None = None


class GetStorageItemsOutput(OutputModel):

    data: JSON_DICT


class GetStorageItems(CDPMethod[GetStorageItemsOutput]):
    """ Gets data from extension storage in the given `storageArea`. If `keys` is
    specified, these are used to filter the result. """

    INPUT_VALIDATOR = GetStorageItemsInput
    OUTPUT_VALIDATOR = GetStorageItemsOutput

    def __init__(
        self,
        *,
        id_: str,
        storage_area: Extensions.StorageArea,
        keys: list[str] | None = None
    ):
        super().__init__(
            id=id_,
            storageArea=storage_area,
            keys=keys
        )


class RemoveStorageItemsInput(InputModel):

    id: str
    storageArea: Extensions.StorageArea
    keys: list[str]


class RemoveStorageItems(CDPMethod[None]):
    """ Removes `keys` from extension storage in the given `storageArea`. """

    INPUT_VALIDATOR = RemoveStorageItemsInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        id_: str,
        storage_area: Extensions.StorageArea,
        keys: list[str]
    ):
        super().__init__(
            id=id_,
            storageArea=storage_area,
            keys=keys
        )


class ClearStorageItemsInput(InputModel):

    id: str
    storageArea: Extensions.StorageArea


class ClearStorageItems(CDPMethod[None]):
    """ Clears extension storage in the given `storageArea`. """

    INPUT_VALIDATOR = ClearStorageItemsInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        id_: str,
        storage_area: Extensions.StorageArea
    ):
        super().__init__(
            id=id_,
            storageArea=storage_area
        )


class SetStorageItemsInput(InputModel):

    id: str
    storageArea: Extensions.StorageArea
    values: JSON_DICT


class SetStorageItems(CDPMethod[None]):
    """ Sets `values` in extension storage in the given `storageArea`. The provided `values`
    will be merged with existing values in the storage area. """

    INPUT_VALIDATOR = SetStorageItemsInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        id_: str,
        storage_area: Extensions.StorageArea,
        values: JSON_DICT
    ):
        super().__init__(
            id=id_,
            storageArea=storage_area,
            values=values
        )
