#pragma once

#include "DungeonModel.h"
#include <GameKit.h>
#include <lvgl.h>

namespace PocketDungeon {

class DungeonRenderer {
    lv_obj_t* root = nullptr;
    lv_obj_t* board = nullptr;
    lv_obj_t* cells[DUNGEON_ROWS][DUNGEON_COLS] {};
    lv_obj_t* labels[DUNGEON_ROWS][DUNGEON_COLS] {};
    lv_obj_t* status = nullptr;
    lv_obj_t* message = nullptr;
    GameKit::GridSpec grid {};

    static lv_color_t tileColor(Tile tile);
    static const char* tileText(Tile tile);
    static lv_color_t entityColor(EntityType type);
    void clearEntityLabels();

public:
    void create(lv_obj_t* parent);
    void render(const DungeonModel& model, MoveResult lastResult);
};

} // namespace PocketDungeon
