// 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 protocol_Extensions_h
#define protocol_Extensions_h

#include "chrome/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 protocol {
namespace Extensions {
using StorageArea = String;
class ExtensionInfo;

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

namespace StorageAreaEnum {
inline constexpr char Session[] = "session";
inline constexpr char Local[] = "local";
inline constexpr char Sync[] = "sync";
inline constexpr char Managed[] = "managed";
} // namespace StorageAreaEnum

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

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

    String GetId() { return m_id; }
    void SetId(const String& value);  // Defined below

    String GetName() { return m_name; }
    void SetName(const String& value);  // Defined below

    String GetVersion() { return m_version; }
    void SetVersion(const String& value);  // Defined below

    String GetPath() { return m_path; }
    void SetPath(const String& value);  // Defined below

    bool GetEnabled() { return m_enabled; }
    void SetEnabled(bool value);  // Defined below

    template<int STATE>
    class ExtensionInfoBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            IdSet = 1 << 1,
            NameSet = 1 << 2,
            VersionSet = 1 << 3,
            PathSet = 1 << 4,
            EnabledSet = 1 << 5,
            AllFieldsSet = (IdSet | NameSet | VersionSet | PathSet | EnabledSet | 0)};


        ExtensionInfoBuilder<STATE | IdSet>& SetId(const String& value);  // Defined below

        ExtensionInfoBuilder<STATE | NameSet>& SetName(const String& value);  // Defined below

        ExtensionInfoBuilder<STATE | VersionSet>& SetVersion(const String& value);  // Defined below

        ExtensionInfoBuilder<STATE | PathSet>& SetPath(const String& value);  // Defined below

        ExtensionInfoBuilder<STATE | EnabledSet>& SetEnabled(bool value);  // Defined below

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

    private:
        friend class ExtensionInfo;
        ExtensionInfoBuilder() : m_result(new ExtensionInfo()) { }

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

        std::unique_ptr<protocol::Extensions::ExtensionInfo> m_result;
    };

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

private:
    DECLARE_SERIALIZATION_SUPPORT();

    ExtensionInfo();  // Defined below

    String m_id;
    String m_name;
    String m_version;
    String m_path;
    bool m_enabled;
};


// ------------- 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 ExtensionInfo::~ExtensionInfo() = default;
inline void ExtensionInfo::SetId(const String& value) { m_id = value; }
inline void ExtensionInfo::SetName(const String& value) { m_name = value; }
inline void ExtensionInfo::SetVersion(const String& value) { m_version = value; }
inline void ExtensionInfo::SetPath(const String& value) { m_path = value; }
inline void ExtensionInfo::SetEnabled(bool value) { m_enabled = value; }

template<int STATE>
inline ExtensionInfo::ExtensionInfoBuilder<STATE | ExtensionInfo::ExtensionInfoBuilder<STATE>::IdSet>&
ExtensionInfo::ExtensionInfoBuilder<STATE>::SetId(const String& value) {
  static_assert(!(STATE & IdSet), "property id should not be set yet");
  m_result->SetId(value);
  return castState<IdSet>();
}
template<int STATE>
inline ExtensionInfo::ExtensionInfoBuilder<STATE | ExtensionInfo::ExtensionInfoBuilder<STATE>::NameSet>&
ExtensionInfo::ExtensionInfoBuilder<STATE>::SetName(const String& value) {
  static_assert(!(STATE & NameSet), "property name should not be set yet");
  m_result->SetName(value);
  return castState<NameSet>();
}
template<int STATE>
inline ExtensionInfo::ExtensionInfoBuilder<STATE | ExtensionInfo::ExtensionInfoBuilder<STATE>::VersionSet>&
ExtensionInfo::ExtensionInfoBuilder<STATE>::SetVersion(const String& value) {
  static_assert(!(STATE & VersionSet), "property version should not be set yet");
  m_result->SetVersion(value);
  return castState<VersionSet>();
}
template<int STATE>
inline ExtensionInfo::ExtensionInfoBuilder<STATE | ExtensionInfo::ExtensionInfoBuilder<STATE>::PathSet>&
ExtensionInfo::ExtensionInfoBuilder<STATE>::SetPath(const String& value) {
  static_assert(!(STATE & PathSet), "property path should not be set yet");
  m_result->SetPath(value);
  return castState<PathSet>();
}
template<int STATE>
inline ExtensionInfo::ExtensionInfoBuilder<STATE | ExtensionInfo::ExtensionInfoBuilder<STATE>::EnabledSet>&
ExtensionInfo::ExtensionInfoBuilder<STATE>::SetEnabled(bool value) {
  static_assert(!(STATE & EnabledSet), "property enabled should not be set yet");
  m_result->SetEnabled(value);
  return castState<EnabledSet>();
}

inline ExtensionInfo::ExtensionInfo() {
  m_enabled = false;
}

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

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

    virtual DispatchResponse TriggerAction(const String& in_id, const String& in_targetId) = 0;
    class  LoadUnpackedCallback {
    public:
        virtual void sendSuccess(const String& id) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~LoadUnpackedCallback() { }
    };
    virtual void LoadUnpacked(const String& in_path, std::optional<bool> in_enableInIncognito, std::unique_ptr<LoadUnpackedCallback> callback) = 0;
    virtual DispatchResponse GetExtensions(std::unique_ptr<protocol::Array<protocol::Extensions::ExtensionInfo>>* out_extensions) = 0;
    class  UninstallCallback {
    public:
        virtual void sendSuccess() = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~UninstallCallback() { }
    };
    virtual void Uninstall(const String& in_id, std::unique_ptr<UninstallCallback> callback) = 0;
    class  GetStorageItemsCallback {
    public:
        virtual void sendSuccess(std::unique_ptr<protocol::DictionaryValue> data) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~GetStorageItemsCallback() { }
    };
    virtual void GetStorageItems(const String& in_id, const String& in_storageArea, std::unique_ptr<protocol::Array<String>> in_keys, std::unique_ptr<GetStorageItemsCallback> callback) = 0;
    class  RemoveStorageItemsCallback {
    public:
        virtual void sendSuccess() = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~RemoveStorageItemsCallback() { }
    };
    virtual void RemoveStorageItems(const String& in_id, const String& in_storageArea, std::unique_ptr<protocol::Array<String>> in_keys, std::unique_ptr<RemoveStorageItemsCallback> callback) = 0;
    class  ClearStorageItemsCallback {
    public:
        virtual void sendSuccess() = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~ClearStorageItemsCallback() { }
    };
    virtual void ClearStorageItems(const String& in_id, const String& in_storageArea, std::unique_ptr<ClearStorageItemsCallback> callback) = 0;
    class  SetStorageItemsCallback {
    public:
        virtual void sendSuccess() = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~SetStorageItemsCallback() { }
    };
    virtual void SetStorageItems(const String& in_id, const String& in_storageArea, std::unique_ptr<protocol::DictionaryValue> in_values, std::unique_ptr<SetStorageItemsCallback> callback) = 0;

    virtual DispatchResponse Disable()
    {
        return DispatchResponse::Success();
    }
};

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

class  Frontend {
public:
  explicit Frontend(FrontendChannel* frontend_channel) : frontend_channel_(frontend_channel) {}

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

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

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

private:
    Dispatcher() { }
};

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

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

} // namespace Extensions
} // namespace protocol

#endif // !defined(protocol_Extensions_h)
