#include "Terrain.hpp"
#include "Transform.hpp"
#include "EditorMarker.hpp"
#include "EntityName.hpp"
#include "../ui/ComponentRegistration.hpp"
#include "../ui/TerrainEditor.hpp"
#include <chrono>

REGISTER_COMPONENT_GROUP("Terrain", "Environment", TerrainComponent,
			 TerrainEditor)
{
	registry.registerComponent<TerrainComponent>(
		"Terrain", "Environment",
		std::make_unique<TerrainEditor>(),
		/* Adder */
		[](flecs::entity e) {
			if (!e.has<TerrainComponent>()) {
				TerrainComponent tc;
				tc.terrainId = (uint64_t)std::chrono::
					system_clock::now()
						.time_since_epoch()
						.count();
				e.set<TerrainComponent>(tc);
			}
		},
		/* Remover */
		[](flecs::entity e) {
			if (e.has<TerrainComponent>())
				e.remove<TerrainComponent>();
		});
}
