// 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_Browser_h
#define protocol_Browser_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 Browser {
using BrowserContextID = String;
using WindowID = int;
using WindowState = String;
class Bounds;
using BrowserCommandId = String;

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

namespace WindowStateEnum {
inline constexpr char Normal[] = "normal";
inline constexpr char Minimized[] = "minimized";
inline constexpr char Maximized[] = "maximized";
inline constexpr char Fullscreen[] = "fullscreen";
} // namespace WindowStateEnum

namespace BrowserCommandIdEnum {
inline constexpr char OpenTabSearch[] = "openTabSearch";
inline constexpr char CloseTabSearch[] = "closeTabSearch";
inline constexpr char OpenGlic[] = "openGlic";
} // namespace BrowserCommandIdEnum

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

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

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

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

    bool HasLeft() { return !!m_left; }
    int GetLeft(int defaultValue) const {
       return m_left.value_or(defaultValue);
    }
    const std::optional<int>& GetLeft() const {
       return m_left;
    }
    void SetLeft(int value);  // Defined below

    bool HasTop() { return !!m_top; }
    int GetTop(int defaultValue) const {
       return m_top.value_or(defaultValue);
    }
    const std::optional<int>& GetTop() const {
       return m_top;
    }
    void SetTop(int value);  // Defined below

    bool HasWidth() { return !!m_width; }
    int GetWidth(int defaultValue) const {
       return m_width.value_or(defaultValue);
    }
    const std::optional<int>& GetWidth() const {
       return m_width;
    }
    void SetWidth(int value);  // Defined below

    bool HasHeight() { return !!m_height; }
    int GetHeight(int defaultValue) const {
       return m_height.value_or(defaultValue);
    }
    const std::optional<int>& GetHeight() const {
       return m_height;
    }
    void SetHeight(int value);  // Defined below

    bool HasWindowState() { return !!m_windowState; }
    String GetWindowState(const String& defaultValue) const {
       return m_windowState.value_or(defaultValue);
    }
    const std::optional<String>& GetWindowState() const {
       return m_windowState;
    }
    void SetWindowState(const String& value);  // Defined below

    template<int STATE>
    class BoundsBuilder {
    public:
        enum {
            NoFieldsSet = 0,
            AllFieldsSet = (0)};


        BoundsBuilder<STATE>& SetLeft(int value);  // Defined below

        BoundsBuilder<STATE>& SetTop(int value);  // Defined below

        BoundsBuilder<STATE>& SetWidth(int value);  // Defined below

        BoundsBuilder<STATE>& SetHeight(int value);  // Defined below

        BoundsBuilder<STATE>& SetWindowState(const String& value);  // Defined below

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

    private:
        friend class Bounds;
        BoundsBuilder() : m_result(new Bounds()) { }

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

        std::unique_ptr<protocol::Browser::Bounds> m_result;
    };

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

private:
    DECLARE_SERIALIZATION_SUPPORT();

    Bounds();  // Defined below

    std::optional<int> m_left;
    std::optional<int> m_top;
    std::optional<int> m_width;
    std::optional<int> m_height;
    std::optional<String> m_windowState;
};


// ------------- 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 Bounds::~Bounds() = default;
inline void Bounds::SetLeft(int value) { m_left = value; }
inline void Bounds::SetTop(int value) { m_top = value; }
inline void Bounds::SetWidth(int value) { m_width = value; }
inline void Bounds::SetHeight(int value) { m_height = value; }
inline void Bounds::SetWindowState(const String& value) { m_windowState = value; }

template<int STATE>
inline Bounds::BoundsBuilder<STATE>& Bounds::BoundsBuilder<STATE>::SetLeft(int value) {
  m_result->SetLeft(value);
  return *this;
}
template<int STATE>
inline Bounds::BoundsBuilder<STATE>& Bounds::BoundsBuilder<STATE>::SetTop(int value) {
  m_result->SetTop(value);
  return *this;
}
template<int STATE>
inline Bounds::BoundsBuilder<STATE>& Bounds::BoundsBuilder<STATE>::SetWidth(int value) {
  m_result->SetWidth(value);
  return *this;
}
template<int STATE>
inline Bounds::BoundsBuilder<STATE>& Bounds::BoundsBuilder<STATE>::SetHeight(int value) {
  m_result->SetHeight(value);
  return *this;
}
template<int STATE>
inline Bounds::BoundsBuilder<STATE>& Bounds::BoundsBuilder<STATE>::SetWindowState(const String& value) {
  m_result->SetWindowState(value);
  return *this;
}

inline Bounds::Bounds() {
}

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

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

    virtual DispatchResponse Close() = 0;
    virtual DispatchResponse GetWindowBounds(int in_windowId, std::unique_ptr<protocol::Browser::Bounds>* out_bounds) = 0;
    virtual DispatchResponse GetWindowForTarget(std::optional<String> in_targetId, int* out_windowId, std::unique_ptr<protocol::Browser::Bounds>* out_bounds) = 0;
    virtual DispatchResponse SetWindowBounds(int in_windowId, std::unique_ptr<protocol::Browser::Bounds> in_bounds) = 0;
    virtual DispatchResponse SetContentsSize(int in_windowId, std::optional<int> in_width, std::optional<int> in_height) = 0;
    virtual DispatchResponse SetDockTile(std::optional<String> in_badgeLabel, std::optional<Binary> in_image) = 0;
    virtual DispatchResponse ExecuteBrowserCommand(const String& in_commandId) = 0;
    virtual DispatchResponse AddPrivacySandboxEnrollmentOverride(const String& in_url) = 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 Browser
} // namespace protocol

#endif // !defined(protocol_Browser_h)
