import { Router } from "express";
import {
  adjustInventoryStock,
  createInventoryItem,
  deleteInventoryItem,
  getInventory,
  updateInventoryItem
} from "../controllers/inventoryController.js";
import { requirePermission } from "../middleware/auth.js";

const router = Router();

router.get("/", getInventory);
router.post("/", requirePermission("inventory", "create"), createInventoryItem);
router.put("/:id", requirePermission("inventory", "edit"), updateInventoryItem);
router.patch("/:id/stock", requirePermission("inventory", "edit"), adjustInventoryStock);
router.delete("/:id", requirePermission("inventory", "delete"), deleteInventoryItem);

export default router;
