const express = require('express');
const router = express.Router();
const {
  getDashboardStats,
  getCriticalFindingsAudits,
  getAuditTrends,
  getHarmDistributions,
  getRpnAuditCounts,
  getAuditsByRpnValue,
  getObservationOpenClosedCounts,
  getObservationOpenClosedList,
  getSioOioCaStats,
  getSioOioCaList,
  getAuditsBySeverityOfHarm,
  getAuditsByLikelihoodOfHarm,
} = require('../controllers/dashboardController');

router.get('/stats', getDashboardStats);
router.get('/audits-rpn-critical', getCriticalFindingsAudits);
router.get('/audit-trends', getAuditTrends);
router.get('/harm-distributions', getHarmDistributions);
router.get('/rpn-audit-counts', getRpnAuditCounts);
router.get('/rpn-sat_audits/:rpnValue', getAuditsByRpnValue);
// Backward-compatible alias used by frontend/docs
router.get('/rpn-audits/:rpnValue', getAuditsByRpnValue);
router.get('/observations-open-closed', getObservationOpenClosedCounts);
router.get('/observations-open-closed-list', getObservationOpenClosedList);
router.get('/sio-oio-ca-stats', getSioOioCaStats);
router.get('/sio-oio-ca-list', getSioOioCaList);
router.get('/harm-severity-audits', getAuditsBySeverityOfHarm);
router.get('/harm-likelihood-audits', getAuditsByLikelihoodOfHarm);

module.exports = router;
