import express from 'express';
import {
  getWalletBalance,
  getTransactionHistory,
  requestWithdrawal,
  getWithdrawalHistory,
  approveWithdrawal,
  rejectWithdrawal
} from '../controllers/walletController.js';
import { authenticateToken, authenticateAdmin } from '../middleware/auth.js';

const router = express.Router();

router.get('/balance', authenticateToken, getWalletBalance);
router.get('/transactions', authenticateToken, getTransactionHistory);
router.post('/withdraw', authenticateToken, requestWithdrawal);
router.get('/withdrawals', authenticateToken, getWithdrawalHistory);
router.put('/withdrawals/:id/approve', authenticateAdmin, approveWithdrawal);
router.put('/withdrawals/:id/reject', authenticateAdmin, rejectWithdrawal);

export default router;
