// This file must only be included from SettingsList.hpp

#ifndef HIDDEN_SETTINGS
#   define HIDDEN_SETTINGS(...)
#endif

HIDDEN_SETTINGS
(
    DECL_COMMON_SETTING
    (
        std::optional<int>, numAsyncThreads, std::nullopt,
        "Number of threads in the async pool",

        "Async threads perform work such as loading and generating chunks.\n"
        "However, too many async threads can cause unnecessary load on the CPU and slow down the game.\n\n"

        "You can set this to 'auto' to make the game automatically decide this number based on your hardware.\n"
        "It is recommended that you leave this as 'auto' unless you have some special requirements.",

        {
            if (numAsyncThreads.has_value()) ofs << *numAsyncThreads;
            else ofs << "auto";
        },

        {
            if (value == "auto")
            {
                numAsyncThreads = std::nullopt;
            }
            else
            {
                numAsyncThreads = std::max(1, std::stoi(value));
            }
            
            return "";
        },

        !
    )

    DECL_CLIENT_ONLY_SETTING
    (
        bool, validationLayers, false,
        "Validation layers",

        "Whether Vulkan validation layers should be enabled.",

        {ofs << (validationLayers ? "on" : "off");},

        PARSE_BOOL("on", "off"),

        !
    )

    DECL_CLIENT_ONLY_SETTING
    (
        KeyActionMap, keyBindings, KeyActionMap(),
        "The map of key bindings",

        "Specifies which action verb is mapped to which SDL scancode.",

        {ofs << keyBindings;},

        {SETTING_VALUE.deserialize(value); return "";},

        !
    )
)

#ifndef NO_PERF_TIMERS
HIDDEN_SETTINGS
(
    DECL_CLIENT_ONLY_SETTING
    (
        std::optional<int>, frameDumpThresholdMS, std::nullopt,
        "The number of milliseconds after which a frame should be dumped",

        "If drawing a frame takes longer than this amount of milliseconds,\n"
        "a timeline of the frame as a PNG will be placed in the 'dumps' folder.\n"
        "If this is set to 'disabled', no dumping will happen. By default it is\n"
        "set to 'disabled'.",

        {
            if (frameDumpThresholdMS.has_value()) ofs << *frameDumpThresholdMS;
            else ofs << "disabled";
        },

        {
            if (value == "disabled")
            {
                frameDumpThresholdMS = std::nullopt;
            }
            else
            {
                frameDumpThresholdMS = std::max(1, std::stoi(value));
            }
            
            return "";
        },

        !
    )
)
#endif