#include "ANSLIB.h"
#include <ANSOCRBase.h>
#include "ANSOpenCV.h"

//#define FNS_DEBUG
class CUSTOM_API ANSCustomRVA : public IANSCustomClass
{
private:
	using ANSLIBPtr = std::unique_ptr<ANSCENTER::ANSLIB, decltype(&ANSCENTER::ANSLIB::Destroy)>;

	std::recursive_mutex	_mutex;
	int						engineType{ 0 };
	ANSLIBPtr _detector{ nullptr, &ANSCENTER::ANSLIB::Destroy };

	ANSCENTER::ANSOCRBase* ansOCRHandle = nullptr;
	ANSCENTER::ANSOPENCV* ansOpenCVHandle = nullptr;

	// ----- Model config -----
	int _detectorModelType;
	int _detectorDetectionType;

	std::string _classifierLabels;
	bool    _isInitialized{ false };
	bool    _readROIs{ false };
	int     _numberOfScrews;
	int     _numberOfScrewsPCB;
	int     _numberOfPowerCable;
	int     _numberOfBMPRO;
	int     _numberOfLabel;
	int     _numberOfPlasticPackge;
public:
	bool Initialize(const std::string& modelDiretory, float detectionScoreThreshold, std::string& labelMap)override;
	bool OptimizeModel(bool fp16)override;
	bool ConfigureParameters(CustomParams& param)override;
	std::vector<CustomObject> RunInference(const cv::Mat& input)override;
	std::vector<CustomObject> RunInference(const cv::Mat& input, const std::string& camera_id)override;
	bool Destroy()override;
	ANSCustomRVA();
	~ANSCustomRVA();
};
