#pragma once

#include "dinkyecs.hpp"
#include "lights.hpp"
#include "map.hpp"
#include <vector>
#include <memory>
#include "spatialmap.hpp"
#include "dinky_components.hpp"

using std::shared_ptr;

struct GameLevel {
  size_t index;
  shared_ptr<Map> map;
  shared_ptr<DinkyECS::World> world;
  shared_ptr<lighting::LightRender> lights;
  shared_ptr<SpatialMap> collision;
};

struct LevelScaling {
  int map_width=20;
  int map_height=20;
};

class LevelManager {
  public:
  components::ComponentMap $components;
  std::vector<GameLevel> $levels;
  size_t $current_level = 0;

  LevelManager();

  size_t create_level(shared_ptr<DinkyECS::World> prev_world = nullptr);
  GameLevel &next();
  GameLevel &previous();
  GameLevel &current();
  size_t current_index() { return $current_level; }
  GameLevel &get(size_t index);
  LevelScaling scale_level();
};
