/***************************************************************************
*                                                                          *
*  Copyright (C) Golaem S.A.  All Rights Reserved.                         *
*                                                                          *
***************************************************************************/

#pragma once

#include "glmSDKAPI.h"
#include "glmPathDefinitions.h"

namespace glm
{
	class IOrientedGraph;
	class RoadmapArc;
	class RoadmapNode;
	class Vector3;

	/** 
	* \brief Abstract class defining the weights of a roadmap.
	*
	* \ingroup PathLib
	*
	* \author Golaem <dev@golaem.com>
	*/
	class GLM_SDK_API IRoadmapCosts
	{
	public:
		GLM_CLASS_STAT_ID(glm::MemoryStatIds::Simulation)

		virtual ~IRoadmapCosts() {}

		/**
		* \brief Computes and retrieves the weight attached to a given arc.
		*
		* \param queryGraph The graph for which cost computations are needed.
		* \param arcId The identifier of the arc in the roadmap attached to this.
		* \return The weight of this arc.
		*
		* \pre arcId must be a valid identifier.
		*/
		virtual float getArcCost(const IOrientedGraph& queryGraph, const RoadmapArcId & arcId) const = 0;

		/**
		* \brief Check if a given arc is usable.
		*
		* \param queryGraph The graph for which cost computations are needed.
		* \param arcId The identifier of the arc in the roadmap attached to this.
		* \return True if the arc is usable.
		*
		* \pre The roadmap must be set, arcId must be a valid identifier.
		*/
		virtual bool isArcUsable(const IOrientedGraph& queryGraph, const RoadmapArcId & arcId) const = 0;

		/**
		* \brief Computes and retrieves the weight attached to a given waypoint.
		*
		* \param queryGraph The graph for which cost computations are needed.
		* \param waypointId The identifier of the waypoint in the roadmap attached to this.
		* \return The weight of this waypoint.
		*
		* \pre The roadmap must be set, waypointId must be a valid identifier.
		*/
		virtual float getNodeCost(const IOrientedGraph& queryGraph, const RoadmapNodeId & waypointId) const = 0;

		/**
		* \brief Check if a given waypoint is usable.
		*
		* \param queryGraph The graph for which cost computations are needed.
		* \param waypointId The identifier of the waypoint in the roadmap attached to this.
		* \return True if the waypoint is usable.
		*
		* \pre The roadmap must be set, waypointId must be a valid identifier.
		*/
		virtual bool isNodeUsable(const IOrientedGraph& queryGraph, const RoadmapNodeId & waypointId) const = 0;

		/**
		* \brief Computes and retrieves a heuristic on the weight of the path between two given waypoints.
		*
		* \param queryGraph The graph for which cost computations are needed.
		* \param widOrigin The identifier of the origin waypoint.
		* \param widDestination The identifier of the destination waypoint.
		*
		* \pre The roadmap must be set, widOrigin and widDestination must be valid identifiers.
		*/
		virtual float getCostHeuristic(const IOrientedGraph& queryGraph, const RoadmapNodeId & widOrigin, const RoadmapNodeId & widDestination) const = 0;

		/**
		* \brief Computes and retrieves a heuristic on the weight of the path between two given waypoints.
		*
		* \param queryGraph The graph for which cost computations are needed.
		* \param widOrigin The identifier of the origin waypoint.
		* \param destination The identifier of the destination as a vector3.
		*
		* \pre The roadmap must be set, widOrigin and widDestination must be valid identifiers.
		*/
		virtual float getCostHeuristic(const IOrientedGraph& queryGraph, const RoadmapNodeId & widOrigin, const glm::Vector3& destination) const = 0;
	};
}
