#pragma once
#include "components.hpp"
#include "levelmanager.hpp"
#include <SFML/Graphics/RenderTexture.hpp>

namespace System {
  using namespace components;
  using namespace DinkyECS;
  using std::string;

  void lighting(GameLevel &level);
  void motion(GameLevel &level);
  void collision(GameLevel &level);
  void death(GameLevel &level);
  void generate_paths(GameLevel &level);
  void enemy_pathing(GameLevel &level);
  void enemy_ai_initialize(GameLevel &level);

  void device(World &world, Entity actor, Entity item);
  void plan_motion(World& world, Position move_to);
  Entity spawn_item(World& world, const string& name);
  bool drop_item(GameLevel& level, Entity item);

  void enemy_ai(GameLevel &level);
  void combat(GameLevel& level, int attack_id);

  std::shared_ptr<sf::Shader> sprite_effect(GameLevel &level, Entity entity);
  void player_status(GameLevel &level);
  void distribute_loot(GameLevel &level, Position target_pos);

  void pickup(GameLevel &level, Entity entity);

  bool place_in_container(World& world, Entity cont_id, const string& name, Entity world_entity);

  void remove_from_container(World& world, Entity cont_id, const std::string& name);
  void remove_from_world(GameLevel &level, Entity entity);
  Position& player_position(GameLevel& level);
  void inventory_swap(GameLevel &level, Entity container_id, const std::string& a_name, const std::string &b_name);
  bool inventory_occupied(GameLevel& level, Entity container_id, const std::string& name);

  void draw_map(GameLevel& level, Matrix& grid, EntityGrid& entity_map);
  void render_map(Matrix& tiles, EntityGrid& entity_map, sf::RenderTexture& render, int compass_dir, wchar_t player_display);
}
