const express = require('express');
const router = express.Router();
const supplierController = require('../controllers/supplierController');

router.post('/', supplierController.createSupplier);
router.get('/', supplierController.getAllSuppliers);
router.get('/:id', supplierController.getSupplierById);
router.put('/:id', supplierController.updateSupplier);
router.delete('/:id', supplierController.deleteSupplier);
router.get('/:id/payment-history', supplierController.getSupplierPaymentHistory);

// Manual trigger for totals update
router.put('/:id/update-totals', supplierController.updateSupplierTotals);

module.exports = router;
