#pragma once

#include <sdi_toolBox/common/utils/hash.h>
#include <sdi_toolBox/desktop/eventBus/bus.h>
#include <sdi_toolBox/desktop/eventBus/message.h>
#include <sdi_toolBox/desktop/eventBus/node.h>
#include <sdi_toolBox/external/nlohmann/json/json.hpp>

namespace eventBus
{
//--------------------------------------------------------------
namespace hash = sdi_toolBox::common::utils::hash;

using sv   = std::string_view;
using Json = nlohmann::ordered_json;

using Bus     = sdi_toolBox::desktop::eventBus::Bus;
using Node    = sdi_toolBox::desktop::eventBus::Node;
using Message = sdi_toolBox::desktop::eventBus::Message;
//--------------------------------------------------------------

//--------------------------------------------------------------
//--- Messages -------------------------------------------------
//--------------------------------------------------------------
class NavBridge_sendMessage : public Message
{
  public:
  static constexpr auto MESSAGE_ID = hash::fnv1a_64(sv{ "NavBridge.sendMessage" });

  public:
  NavBridge_sendMessage() = delete;                // Default constructor
  explicit NavBridge_sendMessage(Json payload)     // Constructor
    : Message(MESSAGE_ID)
    , payload(std::move(payload))
  {
  }
  virtual ~NavBridge_sendMessage() = default;     // Default destructor
  Json payload;                                   // Payload in JSON format
};
//--------------------------------------------------------------
class NavBridge_receiveMessage : public Message
{
  public:
  static constexpr auto MESSAGE_ID = hash::fnv1a_64(sv{ "NavBridge.receiveMessage" });

  public:
  NavBridge_receiveMessage() = delete;                // Default constructor
  explicit NavBridge_receiveMessage(Json payload)     // Constructor
    : Message(MESSAGE_ID)
    , payload(std::move(payload))
  {
  }
  virtual ~NavBridge_receiveMessage() = default;     // Default destructor
  Json payload;                                      // Payload in JSON format
};
//--------------------------------------------------------------
class NavBridge_command : public Message
{
  public:
  NavBridge_command() = delete;                                                  // Default constructor
  explicit NavBridge_command(const std::string_view messageId, Json payload)     // Constructor
    : Message(hash::fnv1a_64(messageId))
    , payload(std::move(payload))
  {
  }
  virtual ~NavBridge_command() = default;     // Default destructor
  Json payload;                               // Payload in JSON format
};
//--------------------------------------------------------------
}     // namespace eventBus
