const router = require('express').Router();
const { authMiddleware } = require('../middleware/auth');
const { requireFeature } = require('../middleware/features');
const c = require('../controllers/gamesController');

const hangman   = requireFeature('hangman');
const crossword = requireFeature('crossword');

router.get('/hangman/word',         hangman,   authMiddleware, c.hangmanWord);
router.post('/hangman/complete',    hangman,   authMiddleware, c.hangmanComplete);
router.get('/crossword/generate',   crossword, authMiddleware, c.crosswordGenerate);
router.post('/crossword/complete',  crossword, authMiddleware, c.crosswordComplete);

module.exports = router;
