// 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_Page_h
#define protocol_Page_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 Page {
using FrameId = String;
class InstallabilityErrorArgument;
class InstallabilityError;

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

namespace CaptureScreenshot {
namespace FormatEnum {
inline constexpr char Jpeg[] = "jpeg";
inline constexpr char Png[] = "png";
inline constexpr char Webp[] = "webp";
} // FormatEnum
} // CaptureScreenshot

namespace CaptureSnapshot {
namespace FormatEnum {
inline constexpr char Mhtml[] = "mhtml";
} // FormatEnum
} // CaptureSnapshot

namespace PrintToPDF {
namespace TransferModeEnum {
inline constexpr char ReturnAsBase64[] = "ReturnAsBase64";
inline constexpr char ReturnAsStream[] = "ReturnAsStream";
} // TransferModeEnum
} // PrintToPDF

namespace SetDownloadBehavior {
namespace BehaviorEnum {
inline constexpr char Deny[] = "deny";
inline constexpr char Allow[] = "allow";
inline constexpr char Default[] = "default";
} // BehaviorEnum
} // SetDownloadBehavior

namespace SetTouchEmulationEnabled {
namespace ConfigurationEnum {
inline constexpr char Mobile[] = "mobile";
inline constexpr char Desktop[] = "desktop";
} // ConfigurationEnum
} // SetTouchEmulationEnabled

namespace StartScreencast {
namespace FormatEnum {
inline constexpr char Jpeg[] = "jpeg";
inline constexpr char Png[] = "png";
} // FormatEnum
} // StartScreencast

namespace SetWebLifecycleState {
namespace StateEnum {
inline constexpr char Frozen[] = "frozen";
inline constexpr char Active[] = "active";
} // StateEnum
} // SetWebLifecycleState

namespace SetSPCTransactionMode {
namespace ModeEnum {
inline constexpr char None[] = "none";
inline constexpr char AutoAccept[] = "autoAccept";
inline constexpr char AutoChooseToAuthAnotherWay[] = "autoChooseToAuthAnotherWay";
inline constexpr char AutoReject[] = "autoReject";
inline constexpr char AutoOptOut[] = "autoOptOut";
} // ModeEnum
} // SetSPCTransactionMode

namespace SetRPHRegistrationMode {
namespace ModeEnum {
inline constexpr char None[] = "none";
inline constexpr char AutoAccept[] = "autoAccept";
inline constexpr char AutoReject[] = "autoReject";
} // ModeEnum
} // SetRPHRegistrationMode

namespace FileChooserOpened {
namespace ModeEnum {
inline constexpr char SelectSingle[] = "selectSingle";
inline constexpr char SelectMultiple[] = "selectMultiple";
} // ModeEnum
} // FileChooserOpened

namespace FrameDetached {
namespace ReasonEnum {
inline constexpr char Remove[] = "remove";
inline constexpr char Swap[] = "swap";
} // ReasonEnum
} // FrameDetached

namespace FrameStartedNavigating {
namespace NavigationTypeEnum {
inline constexpr char Reload[] = "reload";
inline constexpr char ReloadBypassingCache[] = "reloadBypassingCache";
inline constexpr char Restore[] = "restore";
inline constexpr char RestoreWithPost[] = "restoreWithPost";
inline constexpr char HistorySameDocument[] = "historySameDocument";
inline constexpr char HistoryDifferentDocument[] = "historyDifferentDocument";
inline constexpr char SameDocument[] = "sameDocument";
inline constexpr char DifferentDocument[] = "differentDocument";
} // NavigationTypeEnum
} // FrameStartedNavigating

namespace DownloadProgress {
namespace StateEnum {
inline constexpr char InProgress[] = "inProgress";
inline constexpr char Completed[] = "completed";
inline constexpr char Canceled[] = "canceled";
} // StateEnum
} // DownloadProgress

namespace NavigatedWithinDocument {
namespace NavigationTypeEnum {
inline constexpr char Fragment[] = "fragment";
inline constexpr char HistoryApi[] = "historyApi";
inline constexpr char Other[] = "other";
} // NavigationTypeEnum
} // NavigatedWithinDocument

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

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

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

    String GetValue() { return m_value; }
    void SetValue(const String& value);  // Defined below

    template<int STATE>
    class InstallabilityErrorArgumentBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            NameSet = 1 << 1,
            ValueSet = 1 << 2,
            AllFieldsSet = (NameSet | ValueSet | 0)};


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

        InstallabilityErrorArgumentBuilder<STATE | ValueSet>& SetValue(const String& value);  // Defined below

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

    private:
        friend class InstallabilityErrorArgument;
        InstallabilityErrorArgumentBuilder() : m_result(new InstallabilityErrorArgument()) { }

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

        std::unique_ptr<protocol::Page::InstallabilityErrorArgument> m_result;
    };

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

private:
    DECLARE_SERIALIZATION_SUPPORT();

    InstallabilityErrorArgument();  // Defined below

    String m_name;
    String m_value;
};


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

    String GetErrorId() { return m_errorId; }
    void SetErrorId(const String& value);  // Defined below

    protocol::Array<protocol::Page::InstallabilityErrorArgument>* GetErrorArguments() { return m_errorArguments.get(); }
    void SetErrorArguments(std::unique_ptr<protocol::Array<protocol::Page::InstallabilityErrorArgument>> value);  // Defined below

    template<int STATE>
    class InstallabilityErrorBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            ErrorIdSet = 1 << 1,
            ErrorArgumentsSet = 1 << 2,
            AllFieldsSet = (ErrorIdSet | ErrorArgumentsSet | 0)};


        InstallabilityErrorBuilder<STATE | ErrorIdSet>& SetErrorId(const String& value);  // Defined below

        InstallabilityErrorBuilder<STATE | ErrorArgumentsSet>& SetErrorArguments(std::unique_ptr<protocol::Array<protocol::Page::InstallabilityErrorArgument>> value);  // Defined below

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

    private:
        friend class InstallabilityError;
        InstallabilityErrorBuilder() : m_result(new InstallabilityError()) { }

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

        std::unique_ptr<protocol::Page::InstallabilityError> m_result;
    };

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

private:
    DECLARE_SERIALIZATION_SUPPORT();

    InstallabilityError();  // Defined below

    String m_errorId;
    std::unique_ptr<protocol::Array<protocol::Page::InstallabilityErrorArgument>> m_errorArguments;
};


// ------------- 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 InstallabilityErrorArgument::~InstallabilityErrorArgument() = default;
inline void InstallabilityErrorArgument::SetName(const String& value) { m_name = value; }
inline void InstallabilityErrorArgument::SetValue(const String& value) { m_value = value; }

template<int STATE>
inline InstallabilityErrorArgument::InstallabilityErrorArgumentBuilder<STATE | InstallabilityErrorArgument::InstallabilityErrorArgumentBuilder<STATE>::NameSet>&
InstallabilityErrorArgument::InstallabilityErrorArgumentBuilder<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 InstallabilityErrorArgument::InstallabilityErrorArgumentBuilder<STATE | InstallabilityErrorArgument::InstallabilityErrorArgumentBuilder<STATE>::ValueSet>&
InstallabilityErrorArgument::InstallabilityErrorArgumentBuilder<STATE>::SetValue(const String& value) {
  static_assert(!(STATE & ValueSet), "property value should not be set yet");
  m_result->SetValue(value);
  return castState<ValueSet>();
}

inline InstallabilityErrorArgument::InstallabilityErrorArgument() {
}
inline InstallabilityError::~InstallabilityError() = default;
inline void InstallabilityError::SetErrorId(const String& value) { m_errorId = value; }
inline void InstallabilityError::SetErrorArguments(std::unique_ptr<protocol::Array<protocol::Page::InstallabilityErrorArgument>> value) { m_errorArguments = std::move(value); }

template<int STATE>
inline InstallabilityError::InstallabilityErrorBuilder<STATE | InstallabilityError::InstallabilityErrorBuilder<STATE>::ErrorIdSet>&
InstallabilityError::InstallabilityErrorBuilder<STATE>::SetErrorId(const String& value) {
  static_assert(!(STATE & ErrorIdSet), "property errorId should not be set yet");
  m_result->SetErrorId(value);
  return castState<ErrorIdSet>();
}
template<int STATE>
inline InstallabilityError::InstallabilityErrorBuilder<STATE | InstallabilityError::InstallabilityErrorBuilder<STATE>::ErrorArgumentsSet>&
InstallabilityError::InstallabilityErrorBuilder<STATE>::SetErrorArguments(std::unique_ptr<protocol::Array<protocol::Page::InstallabilityErrorArgument>> value) {
  static_assert(!(STATE & ErrorArgumentsSet), "property errorArguments should not be set yet");
  m_result->SetErrorArguments(std::move(value));
  return castState<ErrorArgumentsSet>();
}

inline InstallabilityError::InstallabilityError() {
}

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

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

    virtual DispatchResponse Disable() = 0;
    virtual DispatchResponse Enable(std::optional<bool> in_enableFileChooserOpenedEvent) = 0;
    class  GetInstallabilityErrorsCallback {
    public:
        virtual void sendSuccess(std::unique_ptr<protocol::Array<protocol::Page::InstallabilityError>> installabilityErrors) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~GetInstallabilityErrorsCallback() { }
    };
    virtual void GetInstallabilityErrors(std::unique_ptr<GetInstallabilityErrorsCallback> callback) = 0;
    class  GetManifestIconsCallback {
    public:
        virtual void sendSuccess(std::optional<Binary> primaryIcon) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~GetManifestIconsCallback() { }
    };
    virtual void GetManifestIcons(std::unique_ptr<GetManifestIconsCallback> callback) = 0;
    class  GetAppIdCallback {
    public:
        virtual void sendSuccess(std::optional<String> appId, std::optional<String> recommendedId) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~GetAppIdCallback() { }
    };
    virtual void GetAppId(std::unique_ptr<GetAppIdCallback> callback) = 0;
    class  PrintToPDFCallback {
    public:
        virtual void sendSuccess(const Binary& data, std::optional<String> stream) = 0;
        virtual void sendFailure(const DispatchResponse&) = 0;
        virtual void fallThrough() = 0;
        virtual ~PrintToPDFCallback() { }
    };
    virtual void PrintToPDF(std::optional<bool> in_landscape, std::optional<bool> in_displayHeaderFooter, std::optional<bool> in_printBackground, std::optional<double> in_scale, std::optional<double> in_paperWidth, std::optional<double> in_paperHeight, std::optional<double> in_marginTop, std::optional<double> in_marginBottom, std::optional<double> in_marginLeft, std::optional<double> in_marginRight, std::optional<String> in_pageRanges, std::optional<String> in_headerTemplate, std::optional<String> in_footerTemplate, std::optional<bool> in_preferCSSPageSize, std::optional<String> in_transferMode, std::optional<bool> in_generateTaggedPDF, std::optional<bool> in_generateDocumentOutline, std::unique_ptr<PrintToPDFCallback> callback) = 0;
    virtual DispatchResponse SetAdBlockingEnabled(bool in_enabled) = 0;
    virtual DispatchResponse SetSPCTransactionMode(const String& in_mode) = 0;
    virtual DispatchResponse SetRPHRegistrationMode(const String& in_mode) = 0;

};

// ------------- 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 Page
} // namespace protocol

#endif // !defined(protocol_Page_h)
