#include "CharacterSpawner.hpp"
#include "../ui/ComponentRegistration.hpp"
#include "../ui/CharacterSpawnerEditor.hpp"

REGISTER_COMPONENT_GROUP("Character Spawner", "Character",
				 CharacterSpawnerComponent, CharacterSpawnerEditor)
{
	registry.registerComponent<CharacterSpawnerComponent>(
		"Character Spawner",
		std::make_unique<CharacterSpawnerEditor>(sceneMgr),
		/* Adder */
		[sceneMgr](flecs::entity e) {
			(void)sceneMgr;
			if (!e.has<CharacterSpawnerComponent>()) {
				e.set<CharacterSpawnerComponent>(
					CharacterSpawnerComponent{});
			}
		},
		/* Remover */
		[sceneMgr](flecs::entity e) {
			(void)sceneMgr;
			if (e.has<CharacterSpawnerComponent>()) {
				e.remove<CharacterSpawnerComponent>();
			}
		});
}
