import express from 'express';
const router = express.Router();
import * as auditController from './audit.controller.js';
import * as systemAuditController from './systemAudit.controller.js';
import { authenticate } from '../../common/middleware/auth.js';

// All audit routes require authentication
router.use(authenticate as any);

// GET /api/audit/logs?entityType=application&entityId=<uuid>&page=1&limit=50
router.get('/logs', auditController.getAuditLogs);

// GET /api/audit/summary?entityType=application&entityId=<uuid>
router.get('/summary', auditController.getAuditSummary);

// --- System / configuration audit (segregated table: system_audit_logs) ---
// GET /api/audit/system-logs?module=&entityType=&entityId=&action=&userId=&search=&dateFrom=&dateTo=&page=1&limit=50
router.get('/system-logs', systemAuditController.getSystemAuditLogs);

// GET /api/audit/system-summary
router.get('/system-summary', systemAuditController.getSystemAuditSummary);

export default router;
