// 板端离线登记: 只保存 SDK 特征库，照片无需常驻板端。
#include "infer/face_gallery.h"
#include "common/log.h"

#include <inspireface.h>

#include <cstdlib>
#include <string>

int main(int argc, char** argv) {
    if (argc != 5) {
        HW_LOG("用法: %s <Gundam_RV1106.tar> <照片.jpg> <数据库文件> <person_id>", argv[0]);
        return 1;
    }
    const std::string pack = argv[1], photo = argv[2], db = argv[3];
    const long id = std::strtol(argv[4], nullptr, 10);
    if (id <= 0) return 1;
    const HResult ret = HFLaunchInspireFace(pack.c_str());
    if (ret != HSUCCEED) {
        HW_ERR("enroll_face: 加载模型包失败 (%ld): %s", (long)ret, pack.c_str());
        return 2;
    }
    handwash::FaceGallery gallery;
    if (!gallery.Init(db, 0.48f)) return 3;
    return gallery.EnrollImage(photo, id) ? 0 : 4;
}
