const express = require('express');
const router = express.Router();
const { authenticateToken } = require('../middleware/auth');
const {
  createMonthlyDraw,
  getGroupMonthlyDraws,
  getMonthlyDrawDetails,
  verifyDrawResult,
  getDrawStatistics
} = require('../controllers/monthlyDrawController');

// All routes require authentication
router.use(authenticateToken);

// Create a new monthly draw (manager only)
router.post('/', createMonthlyDraw);

// Get all monthly draws for a group
router.get('/group/:group_id', getGroupMonthlyDraws);

// Get monthly draw details
router.get('/:draw_id', getMonthlyDrawDetails);

// Verify provably fair result
router.post('/:draw_id/verify', verifyDrawResult);

// Get draw statistics for a group
router.get('/group/:group_id/statistics', getDrawStatistics);

module.exports = router;
