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

/**
 * @route   POST /api/transaction-sync/sync
 * @desc    Sync PhonePe transactions for manager
 * @access  Private (Managers only)
 */
router.post('/sync', authenticateToken, requireManager, transactionSyncController.syncTransactions);

/**
 * @route   GET /api/transaction-sync/review-queue
 * @desc    Get transactions needing manual review
 * @access  Private (Managers only)
 */
router.get('/review-queue', authenticateToken, requireManager, transactionSyncController.getReviewQueue);

/**
 * @route   POST /api/transaction-sync/approve
 * @desc    Approve a suggested payment match
 * @access  Private (Managers only)
 */
router.post('/approve', authenticateToken, requireManager, transactionSyncController.approveSuggestedMatch);

/**
 * @route   POST /api/transaction-sync/reject
 * @desc    Reject a suggested payment match
 * @access  Private (Managers only)
 */
router.post('/reject', authenticateToken, requireManager, transactionSyncController.rejectSuggestedMatch);

/**
 * @route   GET /api/transaction-sync/stats
 * @desc    Get sync statistics
 * @access  Private (Managers only)
 */
router.get('/stats', authenticateToken, requireManager, transactionSyncController.getSyncStats);

module.exports = router;

