#ifndef _CHARACTER_MANAGER_MODULE_
#define _CHARACTER_MANAGER_MODULE_
#include <flecs.h>
#include <nlohmann/json.hpp>
#include "PlayerActionModule.h"
namespace ECS
{
struct TownCharacterHolder{int index;};
struct TownNPCs {
    struct NPCData {
        flecs::entity e;
        nlohmann::json props;
        Ogre::Vector3 position;
        Ogre::Quaternion orientation;
        Ogre::String modelFace;
        Ogre::String modelHair;
        Ogre::String modelTop;
        Ogre::String modelBottom;
        Ogre::String modelFeet;
        std::vector<ActionNodeList::ActionNode> actionNodes;
    };

    std::map<int, NPCData> npcs;
};
struct LivesIn {};
struct CharacterManagerModule {
	std::set<flecs::entity> characters;
    flecs::entity player;
	CharacterManagerModule(flecs::world &ecs);
	flecs::entity createPlayer(const Ogre::Vector3 &position,
				   const Ogre::Quaternion &rotation);
    flecs::entity createCharacterData(const Ogre::String &modelFace,
                      const Ogre::String &modelHair,
                      const Ogre::String &modelTop,
                      const Ogre::String &modelBottom,
                      const Ogre::String &modelFeet,
                      const Ogre::Vector3 &position,
					  const Ogre::Quaternion &rotation);
	void removeCharacterData(int id);
    flecs::entity getPlayer() const
    {
        return player;
    }
    void registerTownCharacters(flecs::entity town);
    void setTownCharacter(flecs::entity town, int index, bool enable);
    CharacterManagerModule(CharacterManagerModule &&) = delete;
    CharacterManagerModule &operator=(CharacterManagerModule&&) = delete;
};
}
#endif
