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

This domain allows configuring virtual authenticators to test the WebAuthn
API.
https://chromedevtools.github.io/devtools-protocol/tot/WebAuthn/

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

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


class EnableInput(InputModel):

    enableUI: bool | None = None


class Enable(CDPMethod[None]):
    """ Enable the WebAuthn domain and start intercepting credential storage and
    retrieval with a virtual authenticator. """

    INPUT_VALIDATOR = EnableInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        enable_ui: bool | None = None
    ):
        super().__init__(
            enableUI=enable_ui
        )


class Disable(CDPMethod[None]):
    """ Disable the WebAuthn domain. """

    INPUT_VALIDATOR = None
    OUTPUT_VALIDATOR = None


class AddVirtualAuthenticatorInput(InputModel):

    options: WebAuthn.VirtualAuthenticatorOptions


class AddVirtualAuthenticatorOutput(OutputModel):

    authenticatorId: WebAuthn.AuthenticatorId


class AddVirtualAuthenticator(CDPMethod[AddVirtualAuthenticatorOutput]):
    """ Creates and adds a virtual authenticator. """

    INPUT_VALIDATOR = AddVirtualAuthenticatorInput
    OUTPUT_VALIDATOR = AddVirtualAuthenticatorOutput

    def __init__(
        self,
        *,
        options: WebAuthn.VirtualAuthenticatorOptions
    ):
        super().__init__(
            options=options
        )


class SetResponseOverrideBitsInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId
    isBogusSignature: bool | None = None
    isBadUV: bool | None = None
    isBadUP: bool | None = None


class SetResponseOverrideBits(CDPMethod[None]):
    """ Resets parameters isBogusSignature, isBadUV, isBadUP to false if they are not present. """

    INPUT_VALIDATOR = SetResponseOverrideBitsInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId,
        is_bogus_signature: bool | None = None,
        is_bad_uv: bool | None = None,
        is_bad_up: bool | None = None
    ):
        super().__init__(
            authenticatorId=authenticator_id,
            isBogusSignature=is_bogus_signature,
            isBadUV=is_bad_uv,
            isBadUP=is_bad_up
        )


class RemoveVirtualAuthenticatorInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId


class RemoveVirtualAuthenticator(CDPMethod[None]):
    """ Removes the given authenticator. """

    INPUT_VALIDATOR = RemoveVirtualAuthenticatorInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId
    ):
        super().__init__(
            authenticatorId=authenticator_id
        )


class AddCredentialInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId
    credential: WebAuthn.Credential


class AddCredential(CDPMethod[None]):
    """ Adds the credential to the specified authenticator. """

    INPUT_VALIDATOR = AddCredentialInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId,
        credential: WebAuthn.Credential
    ):
        super().__init__(
            authenticatorId=authenticator_id,
            credential=credential
        )


class GetCredentialInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId
    credentialId: str


class GetCredentialOutput(OutputModel):

    credential: WebAuthn.Credential


class GetCredential(CDPMethod[GetCredentialOutput]):
    """ Returns a single credential stored in the given virtual authenticator that
    matches the credential ID. """

    INPUT_VALIDATOR = GetCredentialInput
    OUTPUT_VALIDATOR = GetCredentialOutput

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId,
        credential_id: str
    ):
        super().__init__(
            authenticatorId=authenticator_id,
            credentialId=credential_id
        )


class GetCredentialsInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId


class GetCredentialsOutput(OutputModel):

    credentials: list[WebAuthn.Credential]


class GetCredentials(CDPMethod[GetCredentialsOutput]):
    """ Returns all the credentials stored in the given virtual authenticator. """

    INPUT_VALIDATOR = GetCredentialsInput
    OUTPUT_VALIDATOR = GetCredentialsOutput

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId
    ):
        super().__init__(
            authenticatorId=authenticator_id
        )


class RemoveCredentialInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId
    credentialId: str


class RemoveCredential(CDPMethod[None]):
    """ Removes a credential from the authenticator. """

    INPUT_VALIDATOR = RemoveCredentialInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId,
        credential_id: str
    ):
        super().__init__(
            authenticatorId=authenticator_id,
            credentialId=credential_id
        )


class ClearCredentialsInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId


class ClearCredentials(CDPMethod[None]):
    """ Clears all the credentials from the specified device. """

    INPUT_VALIDATOR = ClearCredentialsInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId
    ):
        super().__init__(
            authenticatorId=authenticator_id
        )


class SetUserVerifiedInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId
    isUserVerified: bool


class SetUserVerified(CDPMethod[None]):
    """ Sets whether User Verification succeeds or fails for an authenticator.
    The default is true. """

    INPUT_VALIDATOR = SetUserVerifiedInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId,
        is_user_verified: bool
    ):
        super().__init__(
            authenticatorId=authenticator_id,
            isUserVerified=is_user_verified
        )


class SetAutomaticPresenceSimulationInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId
    enabled: bool


class SetAutomaticPresenceSimulation(CDPMethod[None]):
    """ Sets whether tests of user presence will succeed immediately (if true) or fail to resolve (if false) for an authenticator.
    The default is true. """

    INPUT_VALIDATOR = SetAutomaticPresenceSimulationInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId,
        enabled: bool
    ):
        super().__init__(
            authenticatorId=authenticator_id,
            enabled=enabled
        )


class SetCredentialPropertiesInput(InputModel):

    authenticatorId: WebAuthn.AuthenticatorId
    credentialId: str
    backupEligibility: bool | None = None
    backupState: bool | None = None


class SetCredentialProperties(CDPMethod[None]):
    """ Allows setting credential properties.
    https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties """

    INPUT_VALIDATOR = SetCredentialPropertiesInput
    OUTPUT_VALIDATOR = None

    def __init__(
        self,
        *,
        authenticator_id: WebAuthn.AuthenticatorId,
        credential_id: str,
        backup_eligibility: bool | None = None,
        backup_state: bool | None = None
    ):
        super().__init__(
            authenticatorId=authenticator_id,
            credentialId=credential_id,
            backupEligibility=backup_eligibility,
            backupState=backup_state
        )
