"use strict";

const router = require("express").Router();
const { authenticateAdmin, audit } = require("../../middleware");

const AdminPlansController = require("../../controllers/admin/planController");

// Plans
router.get("/", authenticateAdmin, AdminPlansController.getPlans);
router.get("/:planId", authenticateAdmin, AdminPlansController.getPlanById);

router.post(
  "/",
  authenticateAdmin,
  audit("plans.create", "plan"),
  AdminPlansController.createPlan
);

router.put(
  "/:planId",
  authenticateAdmin,
  audit("plans.update", "plan"),
  AdminPlansController.updatePlan
);

router.delete(
  "/:planId",
  authenticateAdmin,
  audit("plans.delete", "plan"),
  AdminPlansController.deletePlan
);

module.exports = router;