#pragma once

namespace xtr {

#pragma warning( push )
#pragma warning( disable : 26440 ) // Don't warn about noexcept in base class

//! Base class for message manager
struct MessageManager {
  virtual ~MessageManager() noexcept = default;

  virtual uint32_t ShowMessage(CString /*text*/, uint32_t /*type*/) { return 0; }
  virtual uint32_t ShowMessage(uint32_t /*messageID*/, uint32_t /*type*/) { return 0; }
};

#pragma warning( pop )

//! Enivroment Exteor configuration - !Global state!
class Global final {
  std::unique_ptr<MessageManager> messager{ std::make_unique<MessageManager>() };

private:
  Global() = default;

public:
  [[nodiscard]] static Global& Instance() noexcept;
  [[nodiscard]] static MessageManager& Msg() noexcept { 
    return *Instance().messager;
  }
  void SetMessageManager(std::unique_ptr<MessageManager> newMessager) noexcept;
};

} // namespace xtr