#ifndef ANSANSMOT_H
#define ANSANSMOT_H
#define ANSMOT_API __declspec(dllexport)

#include <vector>
#include <random>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <exception>
#include <fstream>
#include <algorithm>
#include "ANSLicense.h"
#include "LabVIEWHeader/extcode.h"

namespace ANSCENTER {
    struct TrackerObject
    {
        std::string object_id;                // Use to check if this object belongs to any camera
        int class_id;
		int track_id;
        float prob;
        float x;
        float y;
        float width;
        float height;
        float left;
        float top;
        float right;
        float bottom;
    };
    //enum MOTType {
    //    BYTETRACKNCNN = 0,
    //    BYTETRACK = 1,
    //    BYTETRACKEIGEN=2,
    //    UCMC = 3,
    //    OCSORT=4
    //};

    class ANSMOT_API ANSMOT
    {
    protected:
        bool            _licenseValid{ false };
        std::string     _licenseKey;
        SPDLogger&      _logger = SPDLogger::GetInstance("ANSMOT", false);
        void            CheckLicense();
    public:
        [[nodiscard]] virtual bool UpdateParameters(const std::string& trackerParameters);
        [[nodiscard]] virtual std::string Update(int modelId, const std::string& detectionData);
		[[nodiscard]] virtual std::vector<TrackerObject> UpdateTracker(int modelId, const std::vector<TrackerObject> &detectionObjects);
        virtual ~ANSMOT();
        [[nodiscard]] virtual bool Destroy() = 0;
    };
}

extern "C" __declspec(dllexport) int            __cdecl CreateANSMOTHandle(ANSCENTER::ANSMOT **Handle, int motType);
extern "C" __declspec(dllexport) int            __cdecl ReleaseANSMOTHandle(ANSCENTER::ANSMOT **Handle);
extern "C" __declspec(dllexport) int            __cdecl UpdateANSMOTParameters(ANSCENTER::ANSMOT **Handle, const char* );
extern "C" __declspec(dllexport) int            __cdecl UpdateANSMOT(ANSCENTER::ANSMOT **Handle, int modelId, const char* detectionData, std::string &result);
extern "C" __declspec(dllexport) int            __cdecl UpdateANSMOT_LV(ANSCENTER::ANSMOT * *Handle, int modelId, const char* detectionData, LStrHandle trackerResult);
extern "C" __declspec(dllexport) int            __cdecl UpdateANSMOTTracker(ANSCENTER::ANSMOT** Handle, int modelId, const std::vector<ANSCENTER::TrackerObject>& detectionObjects, std::vector<ANSCENTER::TrackerObject>& trackedObjects);
#endif // ANSMOT