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

// Public routes
router.get('/config', asyncHandler(luckyWheelController.getConfig));

// User routes (need login)
router.post('/spin', authUser, asyncHandler(luckyWheelController.spin));
router.get('/history', authUser, asyncHandler(luckyWheelController.getHistory));

// Admin routes
router.put('/config', authAdmin, asyncHandler(luckyWheelController.updateConfig));
router.get('/history/all', authAdmin, asyncHandler(luckyWheelController.getAllHistory));

module.exports = router;
