#include <algorithm>  // Required for std::max
#include <fstream>
#include <iostream>

#include "gstnvdsmeta.h"
#include "nvdsmeta.h"
#include "nvdsmeta_schema.h"

class FaceCandidTrace {
   private:
    int maxlen;
    // int interval_frame_log;
    float face_detection_threshold;
    int face_surface_threshold;
    float termostat_threshold;
    struct FaceBody {
        int object_id = 0;
        int source_id = 0;
        int num_frames = 0;
        float face_score = -1;
    };
    std::vector<FaceBody> queue;

   public:
    struct FaceCandidate {
        float w = 0;
        float h = 0;
        float face_score;
        gint frame_number;
        int object_id;
        int source_id;
    };
    FaceCandidTrace();
    ~FaceCandidTrace();
    bool filter(FaceCandidate *);
    float metric(FaceCandidate *face_candidate);
    bool add(FaceCandidate *);
    float check_existence(int, int);
};