const express = require('express');
const router = express.Router();
const ctrl = require('../controllers/settlementController');
const { createRequirePage } = require('../../../shared/middleware/pagePermission');
const { getDb } = require('../dbPool');
const requirePage = createRequirePage(getDb);

router.get('/summary', ctrl.getMonthlySummary);
router.get('/purchases', ctrl.getMonthlyPurchases);
router.get('/price-changes', ctrl.getPriceChanges);
router.post('/complete', requirePage('factory_settlements'), ctrl.complete);
router.post('/cancel', requirePage('factory_settlements'), ctrl.cancel);

module.exports = router;
