import express from "express";
import { getExercises, getExerciseById, getExercisesForAdmin, getExerciseByLevelId, getExerciseByLevelIdForAdmin, createExercises, updateExerciseById, updateExerciseTitle, deleteExerciseById, deleteExerciseFileById } from "../../controllers/contentControllers/exercise.js";
// import { createMultipleChoicesExercise, updateMultipleChoicesExerciseById } from "../../controllers/exerciseTypesControllers/multipleChoices.js";
// import { createMatchingPairsExercise, updateMatchingPairsExerciseById } from "../../controllers/exerciseTypesControllers/matchingPairs.js";
// import { createTrueFalseExercise, updateTrueFalseExerciseById } from "../../controllers/exerciseTypesControllers/trueFalse.js";
import { verifyLoginUser, adminOnly } from "../../middlewares/User/authUser.js";
import handleUpload from '../../middlewares/uploadExercise.js';
// import handleUploadSingleExercise from '../../middlewares/uploadExerciseSingle.js';


const router = express.Router();

router.get("/exercise", verifyLoginUser, getExercises);

router.get("/exercise/level/:idLevel", verifyLoginUser, getExerciseByLevelId);

router.get("/exercise/admin", verifyLoginUser, adminOnly, getExercisesForAdmin);

router.get("/exercise/admin/level/:idLevel", verifyLoginUser, adminOnly, getExerciseByLevelIdForAdmin);

router.get("/exercise/:id", verifyLoginUser, getExerciseById);

router.post("/exercises", verifyLoginUser, adminOnly, handleUpload, createExercises);

// router.post("/exercise/multiple-choices", verifyLoginUser, adminOnly, handleUploadSingleExercise, createMultipleChoicesExercise);

// router.post("/exercise/matching-pairs", verifyLoginUser, adminOnly, handleUploadSingleExercise, createMatchingPairsExercise);

// router.post("/exercise/true-false", verifyLoginUser, adminOnly, handleUploadSingleExercise, createTrueFalseExercise);

router.put("/exercise/title", verifyLoginUser, adminOnly, updateExerciseTitle);

router.put("/exercise/:id", verifyLoginUser, adminOnly, handleUpload, updateExerciseById);

// router.put("/exercise/multiple-choices/:id", verifyLoginUser, adminOnly, handleUploadSingleExercise, updateMultipleChoicesExerciseById);

// router.put("/exercise/matching-pairs/:id", verifyLoginUser, adminOnly, handleUploadSingleExercise, updateMatchingPairsExerciseById);

// router.put("/exercise/true-false/:id", verifyLoginUser, adminOnly, handleUploadSingleExercise, updateTrueFalseExerciseById);

router.delete("/exercise/:id", verifyLoginUser, adminOnly, deleteExerciseById);

router.delete("/exercise/file/:id", verifyLoginUser, adminOnly, deleteExerciseFileById);

export default router