#include "Primitive.hpp"
#include "../ui/ComponentRegistration.hpp"
#include "../ui/PrimitiveEditor.hpp"

// Register Primitive component
REGISTER_COMPONENT("Primitive", PrimitiveComponent, PrimitiveEditor)
{
    registry.registerComponent<PrimitiveComponent>(
        "Primitive",
        std::make_unique<PrimitiveEditor>(),
        // Adder
        [sceneMgr](flecs::entity e) {
            if (!e.has<PrimitiveComponent>()) {
                e.set<PrimitiveComponent>({});
            }
        },
        // Remover
        [sceneMgr](flecs::entity e) {
            if (e.has<PrimitiveComponent>()) {
                e.remove<PrimitiveComponent>();
            }
        }
    );
}
