#pragma once
#include <cstdint>
#include <vector>
#include <string>
#include <SFML/Graphics.hpp>
#include <unordered_map>
#include <memory>
#include "matrix.hpp"

namespace textures {

  struct SpriteTexture {
    std::shared_ptr<sf::Sprite> sprite = nullptr;
    std::shared_ptr<sf::Texture> texture = nullptr;
    sf::Vector2i frame_size;
  };

  struct TextureManager {
    std::vector<sf::Image> surfaces;
    std::vector<size_t> ceilings;
    std::vector<wchar_t> map_tile_set;
    std::vector<int> ambient_light;
    std::unordered_map<std::string, SpriteTexture> sprite_textures;
    std::unordered_map<std::string, size_t> name_to_id;
  };

  void init();

  SpriteTexture get(const std::string& name);

  sf::Image load_image(const std::string& filename);

  std::vector<int>& get_ambient_light();

  std::vector<wchar_t>& get_map_tile_set();

  const uint32_t* get_surface(size_t num);

  const uint32_t* get_ceiling(size_t num);

  size_t get_id(const std::string& name);
}
