// ============================================================================
// LUA GAME LOADER - HEADER
// ============================================================================
// Scans SD card for .lua game scripts and registers them with GameLauncher

#ifndef LUA_GAME_LOADER_H
#define LUA_GAME_LOADER_H

#include "../lib/game_launcher.h"

/**
 * @brief Lua Game Loader - discovers and registers Lua games from SD card
 */
class LuaGameLoader {
public:
    /**
     * @brief Scan SD card /games directory and register all .lua files
     * @param launcher GameLauncher to register games with
     * @return Number of Lua games found and registered
     */
    static int register_all_games(GameLauncher* launcher);

private:
    /**
     * @brief Parse metadata from Lua script comments
     * @param script_path Path to .lua file
     * @param name Output: game name (default: filename)
     * @param description Output: game description (default: empty)
     * @return true if file could be read
     */
    static bool parse_metadata(const char* script_path, char* name, char* description);
    
    /**
     * @brief Factory function for creating LuaGame instances
     */
    static Game* create_lua_game(const char* script_path, uint16_t width, uint16_t height,
                                  LowLevelRenderer* renderer, LowLevelGUI* gui, InputManager* input_manager);
};

#endif // LUA_GAME_LOADER_H
