const express = require('express');
const router = express.Router();
const accountController = require('../controllers/accountController');
// ✅ Make sure this line exists:
const auth = require('../middlewares/auth');
const { allowRoles } = require('../middlewares/roleMiddleware');

// router.get('/', accountController.getAllTransactions);
router.get('/type/:type', accountController.getTransactionsByType); // e.g. /type/sale
// router.get('/profit-loss', accountController.getProfitLoss);
router.get('/', accountController.getAllTransactions);
router.get('/profit-loss', auth, allowRoles('admin'), accountController.getProfitLoss);
router.get('/summary/bank/:bankId', accountController.getBankSummary);
router.get('/ledger/:accountId', accountController.getLedgerByAccount);
router.get('/summary/customer/:customerId', accountController.getCustomerSummary);


module.exports = router;
