#pragma once

#include "volatileMessages.h"

//--------------------------------------------------------------
class LogMessage : public sdi_toolBox::desktop::eventBus::Message
  , public BasicMessage
{
  using MessageTypeID                = sdi_toolBox::desktop::eventBus::MessageTypeID;
  static constexpr auto LogMessageId = HashMessageType("Log");

  public:
  enum class LogLevel : std::uint8_t
  {
    Info = 0,
    Debug,
    Warning,
    Error
  };

  LogLevel    m_logLevel;
  std::string m_logMessage;

  public:
  LogMessage()          = delete;
  virtual ~LogMessage() = default;
  explicit LogMessage(const LogLevel logLevel, std::string logMessage = "")
    : Message(LogMessageId)
    , m_logLevel(logLevel)
    , m_logMessage(std::move(logMessage))
  {
  }

  // Return a string representation of the message
  [[nodiscard]] std::string debug() const override
  {
    std::ostringstream oss;

    switch (m_logLevel)
    {
      case LogLevel::Info:
        oss << "[INFO]    ";
        break;
      case LogLevel::Debug:
        oss << "[DEBUG]   ";
        break;
      case LogLevel::Warning:
        oss << "[WARNING] ";
        break;
      case LogLevel::Error:
        oss << "[ERROR]   ";
        break;
    }
    oss << m_logMessage;

    return oss.str();
  }
};
//--------------------------------------------------------------
