const express = require('express');
const router = express.Router();
const { authenticateToken } = require('../middleware/auth');
const {
  getAuditLogs,
  getResourceAuditLogs,
  getAdminActivity,
  getAuditStats,
  exportAuditLogs
} = require('../controllers/auditController');

// All audit routes require authentication
// Static routes MUST come before parameterized routes
router.get('/audit-logs/stats',  authenticateToken, getAuditStats);
router.get('/audit-logs/export', authenticateToken, exportAuditLogs);
router.get('/audit-logs',        authenticateToken, getAuditLogs);
router.get('/audit-logs/admin/:adminId',             authenticateToken, getAdminActivity);
router.get('/audit-logs/:resource/:resourceId',      authenticateToken, getResourceAuditLogs);

module.exports = router;
