#ifndef EDITSCENE_GOAP_PLANNER_EDITOR_HPP
#define EDITSCENE_GOAP_PLANNER_EDITOR_HPP
#pragma once

#include "ComponentEditor.hpp"
#include "../components/GoapPlanner.hpp"
#include "../components/ActionDatabase.hpp"

/**
 * Editor for GoapPlannerComponent.
 *
 * Allows selecting actions from an ActionDatabase,
 * configuring smart-object distance, and referencing
 * an external ActionDatabase entity.
 */
class GoapPlannerEditor : public ComponentEditor<GoapPlannerComponent> {
public:
	const char *getName() const override
	{
		return "GOAP Planner";
	}

protected:
	bool renderComponent(flecs::entity entity,
			     GoapPlannerComponent &planner) override;

private:
	ActionDatabase *findDatabase(flecs::entity entity,
				     GoapPlannerComponent &planner);
	void renderActionSelector(GoapPlannerComponent &planner,
				  ActionDatabase *db);
	void renderGoalSelector(GoapPlannerComponent &planner,
				ActionDatabase *db);
	void renderPreconditionMaskEditor(GoapAction &action);
};

#endif // EDITSCENE_GOAP_PLANNER_EDITOR_HPP
