const express = require('express');
const router = express.Router();
const paymentController = require('../controllers/paymentController');
const { authenticateToken, requireManager } = require('../middleware/auth');

// All routes require authentication
router.use(authenticateToken);

// Payment Management (Manager only)
router.post('/', requireManager, paymentController.recordPayment);
router.put('/:paymentId/status', requireManager, paymentController.updatePaymentStatus);

// Payment Access (Manager and Members)
router.get('/group/:groupId', paymentController.getGroupPayments);
router.get('/group/:groupId/summary', paymentController.getGroupPaymentSummary);
router.get('/group/:groupId/pending', paymentController.getPendingPayments);
router.get('/group/:groupId/member/:memberId', paymentController.getMemberPayments);

module.exports = router;
