import { Router } from 'express';
import {
  startAttempt,
  submitAnswer,
  finishAttempt,
  getResult,
  listMyAttempts,
} from '../controllers/attempt.controller.js';
import { authenticate } from '../middleware/auth.middleware.js';

const router = Router();

router.use(authenticate);

router.get('/', listMyAttempts);
router.post('/start', startAttempt);
router.post('/:id/answer', submitAnswer);
router.post('/:id/finish', finishAttempt);
router.get('/:id/result', getResult);

export default router;
