//! Navigation mesh pathfinding.
//!
//! Provides AI navigation using pre-computed walkable surfaces:
//!
//! - [`NavMeshAgent`]: Component for entities that navigate via navmesh
//! - [`NavMeshAgentState`]: Agent state machine (Idle, Moving, Arrived, etc.)
//! - [`PathRequest`]: Async pathfinding request
//! - [`find_path_with_algorithm`]: Compute a path between two points
//! - `generate_navmesh_recast`: Generate navmesh from geometry (requires `navmesh` feature)
//!
//! Navigation meshes are triangle meshes representing walkable areas. Pathfinding
//! uses A* with funnel smoothing for natural-looking paths.
//!
//! # Generating a NavMesh (Recast)
//!
//! Generate a navmesh from terrain or level geometry (requires `navmesh` feature):
//!
//! ```ignore
//! let config = RecastNavMeshConfig {
//!     cell_size: 0.3,           // XZ voxel size (smaller = more precise)
//!     cell_height: 0.2,         // Y voxel size
//!     agent_height: 2.0,        // Character height
//!     agent_radius: 0.5,        // Character radius
//!     agent_max_climb: 0.5,     // Max step height
//!     agent_max_slope: 45.0,    // Max walkable slope (degrees)
//!     ..Default::default()
//! };
//!
//! generate_navmesh_recast(world, terrain_entity, config);
//! ```
//!
//! # Spawning NavMesh Agents
//!
//! ```ignore
//! let agent = spawn_navmesh_agent(world, Vec3::new(0.0, 0.0, 0.0), "Enemy".to_string());
//! set_agent_speed(world, agent, 3.0);  // Units per second
//! ```
//!
//! # Setting Destinations
//!
//! ```ignore
//! // Move agent to target position
//! set_agent_destination(world, agent, Vec3::new(10.0, 0.0, 5.0));
//!
//! // Stop agent
//! stop_agent(world, agent);
//! ```
//!
//! # Checking Agent State
//!
//! ```ignore
//! match get_agent_state(world, agent) {
//!     NavMeshAgentState::Idle => { /* Standing still */ }
//!     NavMeshAgentState::Moving => { /* Walking to destination */ }
//!     NavMeshAgentState::Arrived => { /* Reached destination */ }
//!     NavMeshAgentState::NoPath => { /* No valid path found */ }
//! }
//! ```
//!
//! # Running the System
//!
//! Call each frame to update agent movement:
//!
//! ```ignore
//! fn run_systems(&mut self, world: &mut World) {
//!     run_navmesh_systems(world);
//! }
//! ```
//!
//! # Debug Visualization
//!
//! ```ignore
//! set_navmesh_debug_draw(world, true);  // Show navmesh triangles and agent paths
//! ```
//!
//! # Sampling Navmesh Height
//!
//! Get the walkable height at a world position:
//!
//! ```ignore
//! if let Some(height) = sample_navmesh_height(world, x, z) {
//!     let ground_pos = Vec3::new(x, height, z);
//! }
//! ```
//!
//! # RecastNavMeshConfig Parameters
//!
//! | Parameter | Description |
//! |-----------|-------------|
//! | `cell_size` | XZ resolution (0.1-0.5, smaller = more accurate) |
//! | `cell_height` | Y resolution (0.1-0.3) |
//! | `agent_height` | Character height for clearance |
//! | `agent_radius` | Character radius for obstacle avoidance |
//! | `agent_max_climb` | Maximum step height |
//! | `agent_max_slope` | Maximum walkable slope in degrees |
//! | `region_min_size` | Minimum region area (filters noise) |
//! | `region_merge_size` | Region merge threshold |
//!
//! [`NavMeshAgent`]: components::NavMeshAgent
//! [`NavMeshAgentState`]: components::NavMeshAgentState
//! [`PathRequest`]: pathfinding::PathRequest
//! [`find_path_with_algorithm`]: pathfinding::find_path_with_algorithm

pub mod commands;
pub mod components;
pub mod debug;
pub mod funnel;
#[cfg(feature = "navmesh")]
pub mod generation;
pub mod pathfinding;
pub mod resources;
pub mod systems;

pub use commands::*;
pub use components::*;
#[cfg(feature = "navmesh")]
pub use generation::{RecastNavMeshConfig, generate_navmesh_recast};
pub use pathfinding::{
    PathRequest, PathResult, PathStatus, PathfindingAlgorithm, find_closest_point_on_navmesh,
    find_path_with_algorithm, sample_navmesh_height,
};
pub use resources::*;
pub use systems::run_navmesh_systems;
