const express = require('express');
const router = express.Router();
const verifyToken = require('../middlewares/verifyToken');
const {
    getAllAudits,
    getAuditById,
    getAuditForms,
    getAuditLogs,
    getAuditLogsJoined,
    getOpeningClosingPairs,
    setAuditStatus,
    createAudit,
    updateAudit,
    deleteAudit,
    addObservationsToAudit
} = require('../controllers/auditsController');

router.get('/', getAllAudits);
router.get('/logs/joined', getAuditLogsJoined);
router.get('/logs', getAuditLogs);
router.get('/:id/forms', getAuditForms);
router.get('/:id/opening-closing-pairs', getOpeningClosingPairs);
router.patch('/:id/status', setAuditStatus);
router.get('/:id', getAuditById);
router.post('/', createAudit);
router.post('/:id/observations', verifyToken, addObservationsToAudit);
router.put('/:id', updateAudit);
router.delete('/:id', deleteAudit);

module.exports = router;

