import { Router } from "express";
import {
  createCustomer,
  deleteCustomer,
  getCustomerById,
  getCustomers,
  getCustomerStats,
  updateCustomer
} from "../controllers/customersController.js";
import { requirePermission } from "../middleware/auth.js";

const router = Router();

router.get("/stats/summary", getCustomerStats);
router.get("/", getCustomers);
router.get("/:id", getCustomerById);
router.post("/", requirePermission("customers", "create"), createCustomer);
router.put("/:id", requirePermission("customers", "edit"), updateCustomer);
router.delete("/:id", requirePermission("customers", "delete"), deleteCustomer);

export default router;
