import { Router } from "express";
import { approveProduct, createProduct, listProducts } from "../controllers/product.controller.js";
import { requireAuth, requireRole } from "../middleware/auth.js";

export const productRouter = Router();

productRouter.get("/", listProducts);
productRouter.post("/", requireAuth, requireRole("seller", "admin", "super_admin"), createProduct);
productRouter.patch("/:id/approve", requireAuth, requireRole("admin", "super_admin"), approveProduct);
productRouter.post("/bulk-upload", requireAuth, requireRole("seller", "admin", "super_admin"), (_request, response) => {
  response.status(202).json({ message: "Bulk upload queued for validation" });
});
