// This file is generated by TypeBuilder_h.template.

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef content_protocol_WebAuthn_h
#define content_protocol_WebAuthn_h

#include "content/common/content_export.h"
#include "content/browser/devtools/protocol/protocol.h"
// For each imported domain we generate a ValueConversions struct instead of a full domain definition
// and include Domain::API version from there.

namespace content {
namespace protocol {
namespace WebAuthn {
using AuthenticatorId = String;
using AuthenticatorProtocol = String;
using Ctap2Version = String;
using AuthenticatorTransport = String;
class VirtualAuthenticatorOptions;
class Credential;

// ------------- Forward and enum declarations.

namespace AuthenticatorProtocolEnum {
inline constexpr char U2f[] = "u2f";
inline constexpr char Ctap2[] = "ctap2";
} // namespace AuthenticatorProtocolEnum

namespace Ctap2VersionEnum {
inline constexpr char Ctap2_0[] = "ctap2_0";
inline constexpr char Ctap2_1[] = "ctap2_1";
inline constexpr char Ctap2_2[] = "ctap2_2";
} // namespace Ctap2VersionEnum

namespace AuthenticatorTransportEnum {
inline constexpr char Usb[] = "usb";
inline constexpr char Nfc[] = "nfc";
inline constexpr char Ble[] = "ble";
inline constexpr char Cable[] = "cable";
inline constexpr char Hybrid[] = "hybrid";
inline constexpr char SmartCard[] = "smart-card";
inline constexpr char Internal[] = "internal";
} // namespace AuthenticatorTransportEnum

// ------------- Type and builder declarations.

class CONTENT_EXPORT VirtualAuthenticatorOptions : public ::crdtp::ProtocolObject<VirtualAuthenticatorOptions> {
public:
    ~VirtualAuthenticatorOptions() override;  // Defined below

    String GetProtocol() { return m_protocol; }
    void SetProtocol(const String& value);  // Defined below

    bool HasCtap2Version() { return !!m_ctap2Version; }
    String GetCtap2Version(const String& defaultValue) const {
       return m_ctap2Version.value_or(defaultValue);
    }
    const std::optional<String>& GetCtap2Version() const {
       return m_ctap2Version;
    }
    void SetCtap2Version(const String& value);  // Defined below

    String GetTransport() { return m_transport; }
    void SetTransport(const String& value);  // Defined below

    bool HasHasResidentKey() { return !!m_hasResidentKey; }
    bool GetHasResidentKey(bool defaultValue) const {
       return m_hasResidentKey.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasResidentKey() const {
       return m_hasResidentKey;
    }
    void SetHasResidentKey(bool value);  // Defined below

    bool HasHasUserVerification() { return !!m_hasUserVerification; }
    bool GetHasUserVerification(bool defaultValue) const {
       return m_hasUserVerification.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasUserVerification() const {
       return m_hasUserVerification;
    }
    void SetHasUserVerification(bool value);  // Defined below

    bool HasHasLargeBlob() { return !!m_hasLargeBlob; }
    bool GetHasLargeBlob(bool defaultValue) const {
       return m_hasLargeBlob.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasLargeBlob() const {
       return m_hasLargeBlob;
    }
    void SetHasLargeBlob(bool value);  // Defined below

    bool HasHasCredBlob() { return !!m_hasCredBlob; }
    bool GetHasCredBlob(bool defaultValue) const {
       return m_hasCredBlob.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasCredBlob() const {
       return m_hasCredBlob;
    }
    void SetHasCredBlob(bool value);  // Defined below

    bool HasHasMinPinLength() { return !!m_hasMinPinLength; }
    bool GetHasMinPinLength(bool defaultValue) const {
       return m_hasMinPinLength.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasMinPinLength() const {
       return m_hasMinPinLength;
    }
    void SetHasMinPinLength(bool value);  // Defined below

    bool HasHasPrf() { return !!m_hasPrf; }
    bool GetHasPrf(bool defaultValue) const {
       return m_hasPrf.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasPrf() const {
       return m_hasPrf;
    }
    void SetHasPrf(bool value);  // Defined below

    bool HasHasHmacSecret() { return !!m_hasHmacSecret; }
    bool GetHasHmacSecret(bool defaultValue) const {
       return m_hasHmacSecret.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasHmacSecret() const {
       return m_hasHmacSecret;
    }
    void SetHasHmacSecret(bool value);  // Defined below

    bool HasHasHmacSecretMc() { return !!m_hasHmacSecretMc; }
    bool GetHasHmacSecretMc(bool defaultValue) const {
       return m_hasHmacSecretMc.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasHmacSecretMc() const {
       return m_hasHmacSecretMc;
    }
    void SetHasHmacSecretMc(bool value);  // Defined below

    bool HasHasCmtgKey() { return !!m_hasCmtgKey; }
    bool GetHasCmtgKey(bool defaultValue) const {
       return m_hasCmtgKey.value_or(defaultValue);
    }
    const std::optional<bool>& GetHasCmtgKey() const {
       return m_hasCmtgKey;
    }
    void SetHasCmtgKey(bool value);  // Defined below

    bool HasAutomaticPresenceSimulation() { return !!m_automaticPresenceSimulation; }
    bool GetAutomaticPresenceSimulation(bool defaultValue) const {
       return m_automaticPresenceSimulation.value_or(defaultValue);
    }
    const std::optional<bool>& GetAutomaticPresenceSimulation() const {
       return m_automaticPresenceSimulation;
    }
    void SetAutomaticPresenceSimulation(bool value);  // Defined below

    bool HasIsUserVerified() { return !!m_isUserVerified; }
    bool GetIsUserVerified(bool defaultValue) const {
       return m_isUserVerified.value_or(defaultValue);
    }
    const std::optional<bool>& GetIsUserVerified() const {
       return m_isUserVerified;
    }
    void SetIsUserVerified(bool value);  // Defined below

    bool HasDefaultBackupEligibility() { return !!m_defaultBackupEligibility; }
    bool GetDefaultBackupEligibility(bool defaultValue) const {
       return m_defaultBackupEligibility.value_or(defaultValue);
    }
    const std::optional<bool>& GetDefaultBackupEligibility() const {
       return m_defaultBackupEligibility;
    }
    void SetDefaultBackupEligibility(bool value);  // Defined below

    bool HasDefaultBackupState() { return !!m_defaultBackupState; }
    bool GetDefaultBackupState(bool defaultValue) const {
       return m_defaultBackupState.value_or(defaultValue);
    }
    const std::optional<bool>& GetDefaultBackupState() const {
       return m_defaultBackupState;
    }
    void SetDefaultBackupState(bool value);  // Defined below

    template<int STATE>
    class VirtualAuthenticatorOptionsBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            ProtocolSet = 1 << 1,
            TransportSet = 1 << 2,
            AllFieldsSet = (ProtocolSet | TransportSet | 0)};


        VirtualAuthenticatorOptionsBuilder<STATE | ProtocolSet>& SetProtocol(const String& value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetCtap2Version(const String& value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE | TransportSet>& SetTransport(const String& value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasResidentKey(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasUserVerification(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasLargeBlob(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasCredBlob(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasMinPinLength(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasPrf(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasHmacSecret(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasHmacSecretMc(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetHasCmtgKey(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetAutomaticPresenceSimulation(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetIsUserVerified(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetDefaultBackupEligibility(bool value);  // Defined below

        VirtualAuthenticatorOptionsBuilder<STATE>& SetDefaultBackupState(bool value);  // Defined below

        std::unique_ptr<VirtualAuthenticatorOptions> Build()
        {
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
            return std::move(m_result);
        }

    private:
        friend class VirtualAuthenticatorOptions;
        VirtualAuthenticatorOptionsBuilder() : m_result(new VirtualAuthenticatorOptions()) { }

        template<int STEP> VirtualAuthenticatorOptionsBuilder<STATE | STEP>& castState()
        {
            return *reinterpret_cast<VirtualAuthenticatorOptionsBuilder<STATE | STEP>*>(this);
        }

        std::unique_ptr<protocol::WebAuthn::VirtualAuthenticatorOptions> m_result;
    };

    static VirtualAuthenticatorOptionsBuilder<0> Create()
    {
        return VirtualAuthenticatorOptionsBuilder<0>();
    }

private:
    DECLARE_SERIALIZATION_SUPPORT();

    VirtualAuthenticatorOptions();  // Defined below

    String m_protocol;
    std::optional<String> m_ctap2Version;
    String m_transport;
    std::optional<bool> m_hasResidentKey;
    std::optional<bool> m_hasUserVerification;
    std::optional<bool> m_hasLargeBlob;
    std::optional<bool> m_hasCredBlob;
    std::optional<bool> m_hasMinPinLength;
    std::optional<bool> m_hasPrf;
    std::optional<bool> m_hasHmacSecret;
    std::optional<bool> m_hasHmacSecretMc;
    std::optional<bool> m_hasCmtgKey;
    std::optional<bool> m_automaticPresenceSimulation;
    std::optional<bool> m_isUserVerified;
    std::optional<bool> m_defaultBackupEligibility;
    std::optional<bool> m_defaultBackupState;
};


class CONTENT_EXPORT Credential : public ::crdtp::ProtocolObject<Credential> {
public:
    ~Credential() override;  // Defined below

    Binary GetCredentialId() { return m_credentialId; }
    void SetCredentialId(const Binary& value);  // Defined below

    bool GetIsResidentCredential() { return m_isResidentCredential; }
    void SetIsResidentCredential(bool value);  // Defined below

    bool HasRpId() { return !!m_rpId; }
    String GetRpId(const String& defaultValue) const {
       return m_rpId.value_or(defaultValue);
    }
    const std::optional<String>& GetRpId() const {
       return m_rpId;
    }
    void SetRpId(const String& value);  // Defined below

    Binary GetPrivateKey() { return m_privateKey; }
    void SetPrivateKey(const Binary& value);  // Defined below

    bool HasUserHandle() { return !!m_userHandle; }
    Binary GetUserHandle(const Binary& defaultValue) const {
       return m_userHandle.value_or(defaultValue);
    }
    const std::optional<Binary>& GetUserHandle() const {
       return m_userHandle;
    }
    void SetUserHandle(const Binary& value);  // Defined below

    int GetSignCount() { return m_signCount; }
    void SetSignCount(int value);  // Defined below

    bool HasLargeBlob() { return !!m_largeBlob; }
    Binary GetLargeBlob(const Binary& defaultValue) const {
       return m_largeBlob.value_or(defaultValue);
    }
    const std::optional<Binary>& GetLargeBlob() const {
       return m_largeBlob;
    }
    void SetLargeBlob(const Binary& value);  // Defined below

    bool HasBackupEligibility() { return !!m_backupEligibility; }
    bool GetBackupEligibility(bool defaultValue) const {
       return m_backupEligibility.value_or(defaultValue);
    }
    const std::optional<bool>& GetBackupEligibility() const {
       return m_backupEligibility;
    }
    void SetBackupEligibility(bool value);  // Defined below

    bool HasBackupState() { return !!m_backupState; }
    bool GetBackupState(bool defaultValue) const {
       return m_backupState.value_or(defaultValue);
    }
    const std::optional<bool>& GetBackupState() const {
       return m_backupState;
    }
    void SetBackupState(bool value);  // Defined below

    bool HasUserName() { return !!m_userName; }
    String GetUserName(const String& defaultValue) const {
       return m_userName.value_or(defaultValue);
    }
    const std::optional<String>& GetUserName() const {
       return m_userName;
    }
    void SetUserName(const String& value);  // Defined below

    bool HasUserDisplayName() { return !!m_userDisplayName; }
    String GetUserDisplayName(const String& defaultValue) const {
       return m_userDisplayName.value_or(defaultValue);
    }
    const std::optional<String>& GetUserDisplayName() const {
       return m_userDisplayName;
    }
    void SetUserDisplayName(const String& value);  // Defined below

    bool HasCmtgKeys() { return !!m_cmtgKeys; }
    protocol::Array<Binary>* GetCmtgKeys(protocol::Array<Binary>* defaultValue) {
       return m_cmtgKeys ? m_cmtgKeys.get() : defaultValue;
    }
    const std::unique_ptr<protocol::Array<Binary>>& GetCmtgKeys() const {
       return m_cmtgKeys;
    }
    void SetCmtgKeys(std::unique_ptr<protocol::Array<Binary>> value);  // Defined below

    bool HasActiveCmtgKeyIndex() { return !!m_activeCmtgKeyIndex; }
    int GetActiveCmtgKeyIndex(int defaultValue) const {
       return m_activeCmtgKeyIndex.value_or(defaultValue);
    }
    const std::optional<int>& GetActiveCmtgKeyIndex() const {
       return m_activeCmtgKeyIndex;
    }
    void SetActiveCmtgKeyIndex(int value);  // Defined below

    bool HasGenerateCmtgKeyOnNextOperation() { return !!m_generateCmtgKeyOnNextOperation; }
    bool GetGenerateCmtgKeyOnNextOperation(bool defaultValue) const {
       return m_generateCmtgKeyOnNextOperation.value_or(defaultValue);
    }
    const std::optional<bool>& GetGenerateCmtgKeyOnNextOperation() const {
       return m_generateCmtgKeyOnNextOperation;
    }
    void SetGenerateCmtgKeyOnNextOperation(bool value);  // Defined below

    template<int STATE>
    class CredentialBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            CredentialIdSet = 1 << 1,
            IsResidentCredentialSet = 1 << 2,
            PrivateKeySet = 1 << 3,
            SignCountSet = 1 << 4,
            AllFieldsSet = (CredentialIdSet | IsResidentCredentialSet | PrivateKeySet | SignCountSet | 0)};


        CredentialBuilder<STATE | CredentialIdSet>& SetCredentialId(const Binary& value);  // Defined below

        CredentialBuilder<STATE | IsResidentCredentialSet>& SetIsResidentCredential(bool value);  // Defined below

        CredentialBuilder<STATE>& SetRpId(const String& value);  // Defined below

        CredentialBuilder<STATE | PrivateKeySet>& SetPrivateKey(const Binary& value);  // Defined below

        CredentialBuilder<STATE>& SetUserHandle(const Binary& value);  // Defined below

        CredentialBuilder<STATE | SignCountSet>& SetSignCount(int value);  // Defined below

        CredentialBuilder<STATE>& SetLargeBlob(const Binary& value);  // Defined below

        CredentialBuilder<STATE>& SetBackupEligibility(bool value);  // Defined below

        CredentialBuilder<STATE>& SetBackupState(bool value);  // Defined below

        CredentialBuilder<STATE>& SetUserName(const String& value);  // Defined below

        CredentialBuilder<STATE>& SetUserDisplayName(const String& value);  // Defined below

        CredentialBuilder<STATE>& SetCmtgKeys(std::unique_ptr<protocol::Array<Binary>> value);  // Defined below

        CredentialBuilder<STATE>& SetActiveCmtgKeyIndex(int value);  // Defined below

        CredentialBuilder<STATE>& SetGenerateCmtgKeyOnNextOperation(bool value);  // Defined below

        std::unique_ptr<Credential> Build()
        {
            static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet");
            return std::move(m_result);
        }

    private:
        friend class Credential;
        CredentialBuilder() : m_result(new Credential()) { }

        template<int STEP> CredentialBuilder<STATE | STEP>& castState()
        {
            return *reinterpret_cast<CredentialBuilder<STATE | STEP>*>(this);
        }

        std::unique_ptr<protocol::WebAuthn::Credential> m_result;
    };

    static CredentialBuilder<0> Create()
    {
        return CredentialBuilder<0>();
    }

private:
    DECLARE_SERIALIZATION_SUPPORT();

    Credential();  // Defined below

    Binary m_credentialId;
    bool m_isResidentCredential;
    std::optional<String> m_rpId;
    Binary m_privateKey;
    std::optional<Binary> m_userHandle;
    int m_signCount;
    std::optional<Binary> m_largeBlob;
    std::optional<bool> m_backupEligibility;
    std::optional<bool> m_backupState;
    std::optional<String> m_userName;
    std::optional<String> m_userDisplayName;
    std::unique_ptr<protocol::Array<Binary>> m_cmtgKeys;
    std::optional<int> m_activeCmtgKeyIndex;
    std::optional<bool> m_generateCmtgKeyOnNextOperation;
};


// ------------- Type and builder method definitions.
//
// These methods separate from the type declaration because of
// https://github.com/llvm/llvm-project/issues/59966. The DevTools protocol has
// mutually recursive types, so we cannot simply reorder the types.
inline VirtualAuthenticatorOptions::~VirtualAuthenticatorOptions() = default;
inline void VirtualAuthenticatorOptions::SetProtocol(const String& value) { m_protocol = value; }
inline void VirtualAuthenticatorOptions::SetCtap2Version(const String& value) { m_ctap2Version = value; }
inline void VirtualAuthenticatorOptions::SetTransport(const String& value) { m_transport = value; }
inline void VirtualAuthenticatorOptions::SetHasResidentKey(bool value) { m_hasResidentKey = value; }
inline void VirtualAuthenticatorOptions::SetHasUserVerification(bool value) { m_hasUserVerification = value; }
inline void VirtualAuthenticatorOptions::SetHasLargeBlob(bool value) { m_hasLargeBlob = value; }
inline void VirtualAuthenticatorOptions::SetHasCredBlob(bool value) { m_hasCredBlob = value; }
inline void VirtualAuthenticatorOptions::SetHasMinPinLength(bool value) { m_hasMinPinLength = value; }
inline void VirtualAuthenticatorOptions::SetHasPrf(bool value) { m_hasPrf = value; }
inline void VirtualAuthenticatorOptions::SetHasHmacSecret(bool value) { m_hasHmacSecret = value; }
inline void VirtualAuthenticatorOptions::SetHasHmacSecretMc(bool value) { m_hasHmacSecretMc = value; }
inline void VirtualAuthenticatorOptions::SetHasCmtgKey(bool value) { m_hasCmtgKey = value; }
inline void VirtualAuthenticatorOptions::SetAutomaticPresenceSimulation(bool value) { m_automaticPresenceSimulation = value; }
inline void VirtualAuthenticatorOptions::SetIsUserVerified(bool value) { m_isUserVerified = value; }
inline void VirtualAuthenticatorOptions::SetDefaultBackupEligibility(bool value) { m_defaultBackupEligibility = value; }
inline void VirtualAuthenticatorOptions::SetDefaultBackupState(bool value) { m_defaultBackupState = value; }

template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE | VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::ProtocolSet>&
VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetProtocol(const String& value) {
  static_assert(!(STATE & ProtocolSet), "property protocol should not be set yet");
  m_result->SetProtocol(value);
  return castState<ProtocolSet>();
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetCtap2Version(const String& value) {
  m_result->SetCtap2Version(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE | VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::TransportSet>&
VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetTransport(const String& value) {
  static_assert(!(STATE & TransportSet), "property transport should not be set yet");
  m_result->SetTransport(value);
  return castState<TransportSet>();
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasResidentKey(bool value) {
  m_result->SetHasResidentKey(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasUserVerification(bool value) {
  m_result->SetHasUserVerification(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasLargeBlob(bool value) {
  m_result->SetHasLargeBlob(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasCredBlob(bool value) {
  m_result->SetHasCredBlob(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasMinPinLength(bool value) {
  m_result->SetHasMinPinLength(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasPrf(bool value) {
  m_result->SetHasPrf(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasHmacSecret(bool value) {
  m_result->SetHasHmacSecret(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasHmacSecretMc(bool value) {
  m_result->SetHasHmacSecretMc(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetHasCmtgKey(bool value) {
  m_result->SetHasCmtgKey(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetAutomaticPresenceSimulation(bool value) {
  m_result->SetAutomaticPresenceSimulation(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetIsUserVerified(bool value) {
  m_result->SetIsUserVerified(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetDefaultBackupEligibility(bool value) {
  m_result->SetDefaultBackupEligibility(value);
  return *this;
}
template<int STATE>
inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>& VirtualAuthenticatorOptions::VirtualAuthenticatorOptionsBuilder<STATE>::SetDefaultBackupState(bool value) {
  m_result->SetDefaultBackupState(value);
  return *this;
}

inline VirtualAuthenticatorOptions::VirtualAuthenticatorOptions() {
}
inline Credential::~Credential() = default;
inline void Credential::SetCredentialId(const Binary& value) { m_credentialId = value; }
inline void Credential::SetIsResidentCredential(bool value) { m_isResidentCredential = value; }
inline void Credential::SetRpId(const String& value) { m_rpId = value; }
inline void Credential::SetPrivateKey(const Binary& value) { m_privateKey = value; }
inline void Credential::SetUserHandle(const Binary& value) { m_userHandle = value; }
inline void Credential::SetSignCount(int value) { m_signCount = value; }
inline void Credential::SetLargeBlob(const Binary& value) { m_largeBlob = value; }
inline void Credential::SetBackupEligibility(bool value) { m_backupEligibility = value; }
inline void Credential::SetBackupState(bool value) { m_backupState = value; }
inline void Credential::SetUserName(const String& value) { m_userName = value; }
inline void Credential::SetUserDisplayName(const String& value) { m_userDisplayName = value; }
inline void Credential::SetCmtgKeys(std::unique_ptr<protocol::Array<Binary>> value) { m_cmtgKeys = std::move(value); }
inline void Credential::SetActiveCmtgKeyIndex(int value) { m_activeCmtgKeyIndex = value; }
inline void Credential::SetGenerateCmtgKeyOnNextOperation(bool value) { m_generateCmtgKeyOnNextOperation = value; }

template<int STATE>
inline Credential::CredentialBuilder<STATE | Credential::CredentialBuilder<STATE>::CredentialIdSet>&
Credential::CredentialBuilder<STATE>::SetCredentialId(const Binary& value) {
  static_assert(!(STATE & CredentialIdSet), "property credentialId should not be set yet");
  m_result->SetCredentialId(value);
  return castState<CredentialIdSet>();
}
template<int STATE>
inline Credential::CredentialBuilder<STATE | Credential::CredentialBuilder<STATE>::IsResidentCredentialSet>&
Credential::CredentialBuilder<STATE>::SetIsResidentCredential(bool value) {
  static_assert(!(STATE & IsResidentCredentialSet), "property isResidentCredential should not be set yet");
  m_result->SetIsResidentCredential(value);
  return castState<IsResidentCredentialSet>();
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetRpId(const String& value) {
  m_result->SetRpId(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE | Credential::CredentialBuilder<STATE>::PrivateKeySet>&
Credential::CredentialBuilder<STATE>::SetPrivateKey(const Binary& value) {
  static_assert(!(STATE & PrivateKeySet), "property privateKey should not be set yet");
  m_result->SetPrivateKey(value);
  return castState<PrivateKeySet>();
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetUserHandle(const Binary& value) {
  m_result->SetUserHandle(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE | Credential::CredentialBuilder<STATE>::SignCountSet>&
Credential::CredentialBuilder<STATE>::SetSignCount(int value) {
  static_assert(!(STATE & SignCountSet), "property signCount should not be set yet");
  m_result->SetSignCount(value);
  return castState<SignCountSet>();
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetLargeBlob(const Binary& value) {
  m_result->SetLargeBlob(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetBackupEligibility(bool value) {
  m_result->SetBackupEligibility(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetBackupState(bool value) {
  m_result->SetBackupState(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetUserName(const String& value) {
  m_result->SetUserName(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetUserDisplayName(const String& value) {
  m_result->SetUserDisplayName(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetCmtgKeys(std::unique_ptr<protocol::Array<Binary>> value) {
  m_result->SetCmtgKeys(std::move(value));
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetActiveCmtgKeyIndex(int value) {
  m_result->SetActiveCmtgKeyIndex(value);
  return *this;
}
template<int STATE>
inline Credential::CredentialBuilder<STATE>& Credential::CredentialBuilder<STATE>::SetGenerateCmtgKeyOnNextOperation(bool value) {
  m_result->SetGenerateCmtgKeyOnNextOperation(value);
  return *this;
}

inline Credential::Credential() {
  m_isResidentCredential = false;
  m_signCount = 0;
}

// ------------- Backend interface.

class CONTENT_EXPORT Backend {
public:
    virtual ~Backend() { }

    virtual DispatchResponse Enable(std::optional<bool> in_enableUI) = 0;
    virtual DispatchResponse Disable() = 0;
    virtual DispatchResponse AddVirtualAuthenticator(std::unique_ptr<protocol::WebAuthn::VirtualAuthenticatorOptions> in_options, String* out_authenticatorId) = 0;
    virtual DispatchResponse SetResponseOverrideBits(const String& in_authenticatorId, std::optional<bool> in_isBogusSignature, std::optional<bool> in_isBadUV, std::optional<bool> in_isBadUP) = 0;
    virtual DispatchResponse RemoveVirtualAuthenticator(const String& in_authenticatorId) = 0;
    class CONTENT_EXPORT AddCredentialCallback {
    public:
        virtual void sendSuccess() = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~AddCredentialCallback() { }
    };
    virtual void AddCredential(const String& in_authenticatorId, std::unique_ptr<protocol::WebAuthn::Credential> in_credential, std::unique_ptr<AddCredentialCallback> callback) = 0;
    class CONTENT_EXPORT GetCredentialCallback {
    public:
        virtual void sendSuccess(std::unique_ptr<protocol::WebAuthn::Credential> credential) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~GetCredentialCallback() { }
    };
    virtual void GetCredential(const String& in_authenticatorId, const Binary& in_credentialId, std::unique_ptr<GetCredentialCallback> callback) = 0;
    class CONTENT_EXPORT GetCredentialsCallback {
    public:
        virtual void sendSuccess(std::unique_ptr<protocol::Array<protocol::WebAuthn::Credential>> credentials) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~GetCredentialsCallback() { }
    };
    virtual void GetCredentials(const String& in_authenticatorId, std::unique_ptr<GetCredentialsCallback> callback) = 0;
    virtual DispatchResponse RemoveCredential(const String& in_authenticatorId, const Binary& in_credentialId) = 0;
    virtual DispatchResponse ClearCredentials(const String& in_authenticatorId) = 0;
    virtual DispatchResponse SetUserVerified(const String& in_authenticatorId, bool in_isUserVerified) = 0;
    virtual DispatchResponse SetAutomaticPresenceSimulation(const String& in_authenticatorId, bool in_enabled) = 0;
    virtual DispatchResponse SetCredentialProperties(const String& in_authenticatorId, const Binary& in_credentialId, std::optional<bool> in_backupEligibility, std::optional<bool> in_backupState, std::optional<int> in_activeCmtgKeyIndex, std::optional<bool> in_generateCmtgKeyOnNextOperation, std::optional<int> in_signCount) = 0;

};

// ------------- Frontend interface.

class CONTENT_EXPORT Frontend {
public:
  explicit Frontend(FrontendChannel* frontend_channel) : frontend_channel_(frontend_channel) {}
    void CredentialAdded(const String& authenticatorId, std::unique_ptr<protocol::WebAuthn::Credential> credential);
    void CredentialDeleted(const String& authenticatorId, const Binary& credentialId);
    void CredentialUpdated(const String& authenticatorId, std::unique_ptr<protocol::WebAuthn::Credential> credential);
    void CredentialAsserted(const String& authenticatorId, std::unique_ptr<protocol::WebAuthn::Credential> credential);

  void flush();
  void sendRawNotification(std::unique_ptr<Serializable>);
 private:
  FrontendChannel* frontend_channel_;
};

// ------------- Dispatcher.

class CONTENT_EXPORT Dispatcher {
public:
    static void wire(UberDispatcher*, Backend*);

private:
    Dispatcher() { }
};

// ------------- Metainfo.

class CONTENT_EXPORT Metainfo {
public:
    using BackendClass = Backend;
    using FrontendClass = Frontend;
    using DispatcherClass = Dispatcher;
    static const char domainName[];
    static const char commandPrefix[];
    static const char version[];
};

} // namespace WebAuthn
} // namespace content
} // namespace protocol

#endif // !defined(content_protocol_WebAuthn_h)
