#include <catch2/catch_test_macros.hpp>
#include "components.hpp"
#include "dinkyecs.hpp"
#include "config.hpp"
#include <iostream>

using namespace components;
using namespace DinkyECS;

TEST_CASE("confirm component loading works", "[components]") {
  std::vector<std::string> test_list{
    "assets/enemies.json", "assets/items.json", "assets/devices.json"};

  components::ComponentMap comp_map;
  components::configure(comp_map);
  DinkyECS::World world;

  for(auto test_data : test_list) {
    Config config(test_data);
    auto data_list = config.json();

    for(auto& [key, data] : data_list.items()) {
      auto& components = data["components"];
      fmt::println("TEST COMPONENT: {} from file {}", key, test_data);
      auto ent = world.entity();
      components::configure_entity(comp_map, world, ent, components);
    }
  }
}
