import express from "express";
import { getUsers, getAdmins, getTeachers, getStudents, getUserById, getUserByName, updateUserById, updateUserPasswordById, deleteUserById, getMe } from "../../controllers/usersControllers/user.js";
import { verifyLoginUser, adminOnly, adminOrTeacherOnly } from "../../middlewares/User/authUser.js";
import handleUpload from "../../middlewares/User/uploadUser.js";


const router = express.Router();

router.get("/user", verifyLoginUser, adminOnly, getUsers);

router.get("/user/admin", verifyLoginUser, adminOnly, getAdmins);

router.get("/user/teacher", verifyLoginUser, adminOnly, getTeachers);

router.get("/user/student", verifyLoginUser, adminOrTeacherOnly, getStudents);

router.get("/user/:id", verifyLoginUser, getUserById);

router.get("/user/name/:name", verifyLoginUser, adminOrTeacherOnly, getUserByName);

router.get("/getMe", verifyLoginUser, getMe);

router.put("/user/update/:id", verifyLoginUser, handleUpload, updateUserById);

router.put("/user/update/password/:id", verifyLoginUser, updateUserPasswordById);

router.delete("/user/delete/:id", verifyLoginUser, adminOnly, deleteUserById);

export default router
