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

#pragma once

#include "glmSDKAPI.h"
#include "glmSmartPointer.h"
#include "glmBehaviorGraph.h"

namespace glm
{
    class GLM_SDK_API TargetData
    {
    public:
        Vector3 _targetPos;
        Vector3 _targetUpVector;
        int _targetHeuristic; /// Heuristic to find the target faster

        TargetData();
    };

    class GLM_SDK_API AbstractTargetProvider : public ReferenceCounter
    {
    public:
		GLM_CLASS_STAT_ID(glm::MemoryStatIds::Simulation)

        AbstractBehavior* _userBehavior = NULL; // to get behaviorGraph

        typedef SmartPointer<AbstractTargetProvider> SP;

        AbstractTargetProvider(AbstractBehavior* userBehavior = NULL);
        virtual ~AbstractTargetProvider();

        virtual void resize(size_t newSize);

        virtual void computeTargets(int64_t index, BehaviorGraph& graph, const Vector3& entityPosition, glm::Array<TargetData>& outTargets, bool force = false) = 0;
		virtual void resetTargets(int64_t index, BehaviorGraph& graph);

        // Tell if this is the final target to reach (in case of multiple targets like in waypoints)
        virtual bool isUltimateTarget(int64_t index) const;
    };
} // namespace glm
