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

#pragma once

#include "glmSDKAPI.h"
#include "glmNavigationData.h"

namespace glm
{
	class PathContext;

	// Path component for a simulated entity.
	class GLM_SDK_API PathEntityComponent
	{
		friend class PathContext;
		template<class TValue> friend class Array;
			
	public:

		GLM_CLASS_STAT_ID( glm::MemoryStatIds::Simulation)

		PathEntityComponent() ;
		virtual ~PathEntityComponent();
		
		// specialized version does not check group or not, called from pathEntityComponent
		bool isCollisionDetectedForPathEntityComponent(float radius, float precision = GLM_EPSILON) const;

		//GLM_DISALLOW_COPY_AND_ASSIGN(PathEntityComponent);

		/**
		* \name Component method definitions.
		*/
		//@{
        void doInit(PathContext& pathContext, int entityTypeIndex, int64_t entityIndex);
        void doUpdate(PathContext& pathContext, int entityTypeIndex, int64_t entityIndex, Time dt);
        void doFinish();
		void updateGroupMemberLostBehavior(PathContext& pathContext, Entity& entity, bool lost, const NavigationMeshLocation& targetLocation, float distanceThreshold);
		//@}
		NavigationData _navigationData;

	private:
		void doPositionLocationOrientationInit(PathContext& pathContext, Entity& entity);
		void doPositionLocationOrientationUpdate(PathContext& pathContext, Entity& entity, Time dt);

	};
}
