#pragma once

#include <string>
#include <utility>
#include "module/inspect_props.h"

namespace flexui::devtools {

/**
 * @brief inspect event when you need send data to frontend but not reponse to frontend
 */
struct InspectEvent {
  /**
   * @brief event constructor
   * @param method method name
   * @param params data string
   */
  InspectEvent(const std::string& method, std::string&& params) {
    method_ = method;
    params_ = std::move(params);  // the params will be so large, like sometimes more 1M, then use move to improve performance
  }

  /**
   * @brief change data to cdp event json string
   */
  std::string ToJsonString() const {
    std::string result = "{\"";
    result += kFrontendKeyMethod;
    result += "\":\"";
    result += method_;
    result += "\",\"";
    result += kFrontendKeyParams;
    result += "\":";
    result += params_;
    result += "}";
    return result;
  }

 private:
  std::string method_;
  std::string params_;
};

}  // namespace flexui::devtools