import { Router } from 'express';
import * as auditController from '../controllers/auditController';
import { authenticate, authorize } from '../middleware/auth';

const router = Router();

router.use(authenticate);

// Audit logs (admin only)
router.get('/logs', authorize('Admin', 'Super Admin'), auditController.getAuditLogs);

// Lead status management
router.put('/leads/:leadId/close', auditController.closeLead);
router.put('/leads/:leadId/reopen', auditController.reopenLead);

// Pendings
router.get('/pendings', auditController.getPendings);
router.post('/pendings', auditController.createPending);
router.put('/pendings/:id', auditController.updatePending);
router.put('/pendings/:id/escalate', auditController.escalatePending);
router.get('/pendings/breached', auditController.getBreachedPendings);

export default router;
