/*
 * Author:          Patrick-Christopher Mattulat
 * Co-Author:       Claude Sonnet 4.6 (LLM)
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2020-08-20
 * Changed:         2026-06-23
 *
 * */

#ifndef LS_STD_LOG_LEVEL_HPP
#define LS_STD_LOG_LEVEL_HPP

#include "LogLevelValue.hpp"
#include <ls-std/core/Class.hpp>
#include <ls-std/os/dynamic-goal.hpp>
#include <string_view>
#include <unordered_map>

/*
 * @doc: class(name: 'LogLevel', package: 'io')
 * @doc: io.LogLevel.description('This class represents the log level controlling how noisy a log should be.')
 * */

namespace ls::standard::io
{
  class LS_STD_DYNAMIC_GOAL LogLevel : public ls::standard::core::Class
  {
    public:

      explicit LogLevel(const ls::standard::io::LogLevelValue &_value);
      LogLevel();
      ~LogLevel() noexcept override;

      ls::standard::io::LogLevel &operator=(const ls::standard::io::LogLevelValue &_value);
      bool operator<(const ls::standard::io::LogLevelValue &_value) const;
      bool operator<=(const ls::standard::io::LogLevelValue &_value) const;
      bool operator>(const ls::standard::io::LogLevelValue &_value) const;
      bool operator>=(const ls::standard::io::LogLevelValue &_value) const;
      bool operator==(const ls::standard::io::LogLevelValue &_value) const;

      [[nodiscard]] ls::standard::io::LogLevelValue getValue() const;
      void setLogLevel(const ls::standard::io::LogLevelValue &_value);
      void setLogLevel(const ::std::string &_value);
      [[nodiscard]] ::std::string toString() const;

    private:

      ::std::unordered_map<ls::standard::io::LogLevelValue, ::std::string> level{};
      ls::standard::io::LogLevelValue value{};

      [[nodiscard]] ls::standard::io::LogLevelValue _getValueFromString(const ::std::string &_value);
      void _init();
      [[nodiscard]] bool _isValidLogLevelString(::std::string_view _value) const;
  };
}

#endif
