import { Router } from "express";
import {
  createApplication,
  listApplications,
  reviewApplication
} from "../controllers/application.controller.js";
import { authenticate, requireRole } from "../middleware/auth.middleware.js";
import { roles } from "../utils/constants.js";

const router = Router();

router.post("/", createApplication);
router.get("/", authenticate, requireRole(roles.SUPER_ADMIN, roles.MINISTRY_JUSTICE), listApplications);
router.patch(
  "/:id/review",
  authenticate,
  requireRole(roles.SUPER_ADMIN, roles.MINISTRY_JUSTICE),
  reviewApplication
);

export default router;
