#ifndef EDITSCENE_COMPONENTEDITOR_HPP
#define EDITSCENE_COMPONENTEDITOR_HPP
#pragma once
#include <imgui.h>
#include <flecs.h>

// Forward declarations for component editor templates
struct StaticGeometryComponent;
struct StaticGeometryMemberComponent;

/**
 * Base interface for component editors
 */
class IComponentEditor {
public:
	virtual ~IComponentEditor() = default;

	/**
	 * Render the editor UI
	 * @param entity The flecs entity being edited
	 * @param component Pointer to the component data
	 * @return true if the component was modified
	 */
	virtual bool render(flecs::entity entity, void *component) = 0;

	/**
	 * Get the display name for this component type
	 */
	virtual const char *getName() const = 0;
};

/**
 * Template base class for component editors
 * @tparam T The component type to edit
 */
template<typename T>
class ComponentEditor : public IComponentEditor {
public:
	bool render(flecs::entity entity, void *component) override
	{
		return renderComponent(entity, *static_cast<T *>(component));
	}

protected:
	/**
	 * Implement this method to render the editor for your component
	 * @param entity The flecs entity being edited
	 * @param component Reference to the component data
	 * @return true if the component was modified
	 */
	virtual bool renderComponent(flecs::entity entity, T &component) = 0;
};

#endif // EDITSCENE_COMPONENTEDITOR_HPP
