#ifndef EDITSCENE_NAVMESH_HPP
#define EDITSCENE_NAVMESH_HPP
#pragma once

#include <Ogre.h>
#include <cstdint>

/**
 * Navigation mesh component.
 *
 * Attached to a single "manager" entity that owns the tiled navmesh
 * for the entire scene. The NavMeshSystem collects geometry from
 * static rigid bodies, StaticGeometry members, and entities with
 * NavMeshGeometrySource to build the mesh.
 */
struct NavMeshComponent {
	// Recast build parameters
	float cellSize = 0.3f;
	float cellHeight = 0.2f;
	float agentHeight = 2.5f;
	float agentRadius = 0.5f;
	float agentMaxClimb = 1.0f;
	float agentMaxSlope = 20.0f;
	float edgeMaxLen = 12.0f;
	float edgeMaxError = 1.3f;
	float regionMinSize = 50.0f;
	float regionMergeSize = 20.0f;
	int tileSize = 48; // cells per tile

	// Runtime flags
	bool enabled = true;
	bool debugDraw = false;
	bool dirty = true;

	// Partial rebuild tracking (not serialized)
	bool needsPartialRebuild = false;
	Ogre::AxisAlignedBox rebuildArea;
};

/**
 * Component that forces an entity's geometry to be included in
 * navmesh generation regardless of physics state.
 */
struct NavMeshGeometrySource {
	bool include = true;
};

/**
 * Component for entities that want pathfinding on this navmesh.
 */
struct NavMeshAgent {
	Ogre::Vector3 targetPos = Ogre::Vector3::ZERO;
	bool hasTarget = false;
	bool pathPending = false;
	std::vector<Ogre::Vector3> currentPath;
	int pathIndex = 0;
};

#endif // EDITSCENE_NAVMESH_HPP
