#ifndef ANGELSCRIPTDEBUGGER_ASVARIABLEFORMATTER_HPP
#define ANGELSCRIPTDEBUGGER_ASVARIABLEFORMATTER_HPP
#include <angelscript.h>
#include "../extern/json.hpp"
#include "AngelscriptDebugger.hpp"
#include "DebugAdapterProtocol/Types.hpp"

class ASVariableFormatter {
public:
    static nlohmann::json GetAsJsonValue(asIScriptEngine* engine, int, void*, int32_t depth = 0);
    static DebugAdapterProtocol::Variable GetAsDAPVariable(asIScriptEngine* engine, asIScriptContext* ctx,
                                                           AngelscriptDebugger* debugger, const std::string& name, int,
                                                           void*);
    template <typename T, int (asIScriptContext::*SetArg)(asUINT, T), T (asIScriptContext::*GetLength)()>
    static void FormatArrayLike(std::vector<DebugAdapterProtocol::Variable>& vars, asIScriptEngine* engine,
                         asIScriptContext* ctx, void* address, AngelscriptDebugger* debugger,
                         asIScriptFunction* indexFunc);
    static void GetChildDAPVariables(std::vector<DebugAdapterProtocol::Variable>&, asIScriptEngine* engine,
                                     asIScriptContext* ctx, AngelscriptDebugger* debugger, int, void*);
};

#endif // ANGELSCRIPTDEBUGGER_ASVARIABLEFORMATTER_HPP
