#pragma once

#include <string>
#include <vector>
#include <cstdarg>
#include <types/color.h>

namespace OX
{
    enum class MessageType
    {
        Info,
        Warning,
        Error,
        Debug,
        Verbose,
        Ok
    };

    struct Message
    {
        std::string timestamp;
        std::string text;
        MessageType type;
        float r, g, b;
    };

    class Logger
    {
    public:
        static void SetSection(const std::string &sectionName) { m_sectionName = sectionName; }

        static void Logf(MessageType type, const char *format, ...);

        static void LogInfo(const char *format, ...);

        static void LogWarning(const char *format, ...);

        static void LogError(const char *format, ...);

        static void LogDebug(const char *format, ...);

        static void LogVerbose(const char *format, ...);

        static void LogOk(const char *format, ...);

        static void Clear() { m_messages.clear(); }

        static std::string MessageTypeToString(MessageType type);

        static Color GetRGBColor(MessageType type);


        static const std::vector<Message> &GetMessages();

    private:
        static void LogInternal(const std::string &text, MessageType type);

        static std::vector<Message> m_messages;
        static std::string m_sectionName;
    };
}
