import express from "express";
import {
  createProductManual,
  getAllProductManuals,
  getSingleProductManual,
  updateProductManual,
  deleteProductManual,
} from "./ProductManualController.js";
import { isAuthenticatedUser, authorizeRoles } from "../../middlewares/auth.js";
import { isAuthenticated_SC_TM } from "../../middlewares/generalAuth.js";

const router = express.Router();

// Route for creating a product manual (Only Admin can create)
router
  .route("/create")
  .post(isAuthenticatedUser, authorizeRoles("admin"), createProductManual);
router
  .route("/")
  .get(isAuthenticatedUser, authorizeRoles("admin"), getAllProductManuals);

router.route("/getall").get(isAuthenticatedUser, getAllProductManuals);

router
  .route("/:id")
  .get(isAuthenticatedUser, authorizeRoles("admin"), getSingleProductManual);

router.route("/getone/:id").get(isAuthenticatedUser, getSingleProductManual);
// Route to update a product manual by ID
router
  .route("/update/:id")
  .put(isAuthenticatedUser, authorizeRoles("admin"), updateProductManual);

// Route to delete a product manual by ID
router
  .route("/delete/:id")
  .delete(isAuthenticatedUser, authorizeRoles("admin"), deleteProductManual);
export default router;
// /api/productmanual/update
