#pragma once
#include "types.hpp"

#include <memory>
#include <vector>

// ── IFaceDetector ─────────────────────────────────────────────────────────────
// Backend-agnostic face detector interface. The core application detects faces
// through this interface without knowing whether the implementation is ONNX
// Runtime (SCRFD via ORT) or raw TensorRT (a pre-built SCRFD engine).
//
// The concrete implementation is selected at compile time by CMake
// (SAE_INFERENCE_BACKEND): exactly one of backends/ort_backend.cpp or
// backends/trt_backend.cpp is compiled and provides make_face_detector().

struct Config;

struct IFaceDetector {
    virtual ~IFaceDetector() = default;
    // Detect all faces in a BGR image. Thread-safety is backend-defined; callers
    // in this project drive a detector from a single pipeline thread.
    virtual std::vector<DetectedFace> detect(const cv::Mat& img) = 0;
};

// Construct the detector for the compiled-in backend. Reads cfg.detector_model,
// cfg.detector_engine, cfg.detector_conf, cfg.detector_nms and cfg.trt.
std::unique_ptr<IFaceDetector> make_face_detector(const Config& cfg);
