#include <catch2/catch_test_macros.hpp>
#include <fmt/core.h>
#include "map.hpp"
#include "dinkyecs.hpp"
#include "worldbuilder.hpp"
#include "save.hpp"
#include "systems.hpp"
#include "spatialmap.hpp"
#include "levelmanager.hpp"

using namespace fmt;
using std::string;

TEST_CASE("basic level manager test", "[levelmanager]") {
  LevelManager lm;

  // starts off with one already but I need to change that
  size_t level1 = lm.current_index();
  size_t level2 = lm.create_level();

  auto& test1_level = lm.get(level1);
  auto& test2_level = lm.get(level2);

  REQUIRE(test1_level.map->width() > 0);
  REQUIRE(test1_level.map->height() > 0);
  REQUIRE(test1_level.index == 0);

  REQUIRE(test2_level.map->width() > 0);
  REQUIRE(test2_level.map->height() > 0);
  REQUIRE(test2_level.index == 1);

  auto& cur_level = lm.current();
  REQUIRE(cur_level.index == 0);

  auto& next_level = lm.next();
  REQUIRE(next_level.index == 1);

  auto& prev_level = lm.previous();
  REQUIRE(prev_level.index == 0);
}
