import { Router } from "express";
import { login, forgotPassword, resetPassword, validateResetToken, testEmail } from "../controllers/authController.js";
import { requireAuth, requireAdmin } from "../middleware/auth.js";

const router = Router();

router.post("/login", login);
router.post("/forgot-password", forgotPassword);
router.post("/reset-password", resetPassword);
router.get("/validate-reset-token/:token", validateResetToken);

// Test email — admin only (requires valid session token)
router.post("/test-email", requireAuth, requireAdmin, testEmail);

export default router;
