const express = require('express');
const router = express.Router();
const withdrawalController = require('../controllers/withdrawalController');
const { authenticateUser } = require('../middleware/auth');

/**
 * Withdrawal Routes
 * All routes require authentication
 */

// Apply authentication middleware to all routes
router.use(authenticateUser);

/**
 * @route   POST /api/v1/withdrawals
 * @desc    Create withdrawal request
 * @access  Private
 */
router.post('/', withdrawalController.createWithdrawal);

/**
 * @route   GET /api/v1/withdrawals
 * @desc    Get withdrawal records
 * @access  Private
 */
router.get('/', withdrawalController.getWithdrawals);

/**
 * @route   GET /api/v1/withdrawals/:id
 * @desc    Get withdrawal details
 * @access  Private
 */
router.get('/:id', withdrawalController.getWithdrawalById);

module.exports = router;
