/**
 *  选取最优结果Engine
 * */

#ifndef SELECTBESTENGINE_H
#define SELECTBESTENGINE_H

#include "AppCommon.h"
#include "EngineBase.h"
#include "EngineFactory.h"

class SelectBestEngine : public ai_matrix::EngineBase
{
public:
    SelectBestEngine();
    ~SelectBestEngine();

    APP_ERROR Init() override;
    APP_ERROR DeInit() override;
    APP_ERROR Process() override;

private:
    //初始化参数信息
    void initParam();

    void selectBest();
    void selectBestFailInfo(DetectResultData &detectResultData, int i);
    void sendWSServer(DetectResultData &detectResultData);
    void sendMinioServer(DetectResultData &detectResultData);
    void sendSaveCSV(DetectResultData &detectResultData);

    std::string strPort0_;
    std::string strPort1_;
    std::string strPort2_;

    ai_matrix::BaseConfig baseConfig_;
    ai_matrix::MinioConfig minioConfig_;
    std::vector<ai_matrix::DataSourceConfig> vecDataSourceConfig_;

    std::string strImagePath_;
    std::string strDetectDate_;
    std::string strDetectTime_;

    uint16_t iEndCount_;

    std::map<int, std::vector<VSelectBestData>> mapIndex_Containers_; // 每个集装箱，各个数据源识别的结果
    std::map<int, std::map<int, std::vector<VSelectBestData>>> mapDataSource_FrameInfo_Fail_; // 每个集装箱，各个数据源识别的结果

};

ENGINE_REGIST(SelectBestEngine)

#endif
