const express = require("express");

const router = express.Router();

const FaceController = require("./controller");
const createUpload = require("../../middleware/upload/index");

const faceUpload = createUpload({

    destination: "temp",

    maxFileSize: 10 * 1024 * 1024 // 10MB for face images

});

// ===========================================
// Upload Face
// ===========================================

router.post(
    "/upload/:studentId",
    faceUpload.single("face"),
    FaceController.uploadFace
);

// ===========================================
// Student Faces
// ===========================================

router.get(

    "/student/:studentId",

    FaceController.getStudentFaces

);

// ===========================================
// Delete Face
// ===========================================

router.delete(

    "/:faceId",

    FaceController.deleteFace

);

// ===========================================
// Set Primary Face
// ===========================================

router.put(

    "/primary/:studentId/:faceId",

    FaceController.setPrimaryFace

);

module.exports = router;