#pragma once

#include "nlohmann/json.hpp"

namespace mitech::utils::logging
{
    constexpr auto MAX_FILESIZE_MB    = 1;
    constexpr auto MAX_RUNNING_NUMBER = 99;

    using stLogOption = struct _stLogOption
    {
        bool enable{ false };
        // daily 1:30am
        bool daily_log{ false };
        int  daily_hour{ 1 };
        int  daily_minute{ 30 };
        // rotating 1MB 99 files
        int filesize_mb{ MAX_FILESIZE_MB };
        int rotating_files{ MAX_RUNNING_NUMBER };
        //
        bool debug_console{ false };
        //
        std::string path_file{};

        NLOHMANN_DEFINE_TYPE_INTRUSIVE(_stLogOption, enable, daily_log, daily_hour, daily_minute, filesize_mb, rotating_files, debug_console, path_file)
    };

    class CLogSettings
    {
    public:
        bool Deserialize(const std::string& strFileName, stLogOption& myOption);
        bool Serialize(const std::string& strFilename, const stLogOption& _myOption);
    };
}
