#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include <nlohmann/json.hpp>
#include <fstream>
#include "game/map.hpp"
#include "game/level.hpp"
#include "graphics/lights.hpp"
#include "algos/point.hpp"

using namespace lighting;

TEST_CASE("lighting a map works", "[lighting]") {
  GameDB::init();
  auto& level = GameDB::current_level();
  auto& map = *level.map;

  Point light1, light2;

  REQUIRE(map.place_entity(0, light1));
  REQUIRE(map.place_entity(0, light1));

  LightSource source1{6, 1.0};
  LightSource source2{4,3};

  LightRender lr(map.walls());

  lr.reset_light();

  lr.set_light_target(light1);
  lr.set_light_target(light2);

  lr.path_light(map.walls());

  lr.render_light(source1, light1);
  lr.render_light(source2, light2);

  lr.clear_light_target(light1);
  lr.clear_light_target(light2);

  Matrix &lighting = lr.lighting();
  (void)lighting;
}
