const express = require('express');
const router = express.Router();
const depositController = require('../controller/deposit.controller');
const { authUser, authAdmin, asyncHandler } = require('../auth/checkAuth');

// Public
router.get('/card-types', asyncHandler(depositController.getCardTypes));

// User (Protected)
router.get('/history', authUser, asyncHandler(depositController.getUserHistory));
router.post('/create', authUser, asyncHandler(depositController.createDeposit));
router.post('/create-qr-bank', authUser, asyncHandler(depositController.createQRBank));
router.post('/check-bank-qr', asyncHandler(depositController.checkBankQR)); // Fix: Yêu cầu đăng nhập
router.get('/check-tsr', authUser, asyncHandler(depositController.checkTsr)); // Fix: Yêu cầu đăng nhập

// Admin (Protected)
// Admin (Protected)
router.get('/card-configs', authAdmin, asyncHandler(depositController.getAllCardConfigs));
router.post('/card-configs', authAdmin, asyncHandler(depositController.updateCardConfig));
router.put('/:id/status', authAdmin, asyncHandler(depositController.updateDepositStatus));
router.get('/all', authAdmin, asyncHandler(depositController.getAllDeposits));

module.exports = router;
