#pragma once
#include <string>

#include "../util/i18n.h"

/**
 * Represents a config value of a module and its imgui representation.
 */
class ConfigValue
{
public:
    virtual ~ConfigValue() = default;

    explicit ConfigValue(const std::string& name)
    {
        this->name_ = name;
    }

    /**
     * Register with the module
     * @param mod module name
     */
    void reg(const std::string& mod)
    {
        this->module_ = mod;
    }

    virtual void draw() = 0;

    virtual void set(const std::string& string) = 0;

    virtual std::string get() = 0;

    virtual std::string get_default() = 0;

    virtual void set_disabled(const bool d) { disabled_ = d; }

    [[nodiscard]] virtual bool is_disabled() const { return disabled_; }

    virtual void set_master_toggle(const bool m) { master_toggle_ = m; }

    [[nodiscard]] std::string get_config_key() const
    {
        return this->name_ + "##" + this->module_;
    }

    std::string get_imgui_title() const
    {
        return i18n::tr(this->name_) + "##" + this->module_;
    }

protected:
    bool disabled_ = false;
    bool master_toggle_ = false;

private:
    std::string name_;
    std::string module_;
};
