#ifndef EDITSCENE_PHYSICSCOLLIDEREDITOR_HPP
#define EDITSCENE_PHYSICSCOLLIDEREDITOR_HPP
#pragma once

#include "ComponentEditor.hpp"
#include "../components/PhysicsCollider.hpp"
#include <OgreSceneManager.h>
#include <vector>
#include <string>

/**
 * Editor for PhysicsColliderComponent
 */
class PhysicsColliderEditor : public ComponentEditor<PhysicsColliderComponent> {
public:
	PhysicsColliderEditor(Ogre::SceneManager *sceneMgr = nullptr);
	bool renderComponent(flecs::entity entity,
			     PhysicsColliderComponent &collider) override;
	const char *getName() const override { return "Physics Collider"; }

private:
	void scanMeshFiles();
	bool matchesSearch(const std::string &meshName, const std::string &search);
	void renderMeshBrowser(PhysicsColliderComponent &collider);
	void markParentRigidBodiesDirty(flecs::entity entity);

	Ogre::SceneManager *m_sceneMgr;
	std::vector<std::string> m_meshFiles;
	bool m_meshesScanned = false;
	bool m_showMeshBrowser = false;
	char m_searchBuffer[256] = { 0 };
};

#endif // EDITSCENE_PHYSICSCOLLIDEREDITOR_HPP
