const express = require('express');
const router = express.Router();
const authController = require('../controllers/authController');
const passwordRecoveryController = require('../controllers/passwordRecoveryController');
const { authLimiter } = require('../middleware/rateLimiter');
const config = require('../config');

// Login route with rate limiting
router.post('/login', authLimiter, authController.login);

// Debug login route without rate limiting (only in development or for testing)
if (!config.isProduction) {
    router.post('/debug-login', authController.login);
}

// Password recovery route with rate limiting
router.post('/recover-password', authLimiter, passwordRecoveryController.requestPassword);

// Logout route
router.post('/logout', authController.logout);

// Check authentication status
router.get('/check', authController.check);

module.exports = router;