/**
 * Assignment Routes
 * API routes for specialization paths and daily assignments
 */

const express = require('express');
const router = express.Router();
const assignmentController = require('../controllers/assignmentController');
const { protect } = require('../middleware/authMiddleware');

// PUBLIC ROUTES (no authentication required)
// Get all available specialization paths (static config data for dropdowns)
router.get('/paths', assignmentController.getSpecializationPaths);

// PROTECTED ROUTES (authentication required)
router.use(protect);

// Get all active assignments for current user
router.get('/my', assignmentController.getMyAssignments);

// Get current user's path selections and stats
router.get('/user-paths', assignmentController.getUserPaths);

// Update user's specialization paths
router.put('/user-paths', assignmentController.updateUserPaths);

// Get/generate today's daily queue
router.get('/daily-queue', assignmentController.getDailyQueue);

// Force regenerate today's daily queue
router.post('/generate-queue', assignmentController.generateQueue);

// Mark an assignment as completed
router.post('/:alertId/complete', assignmentController.completeAssignment);

// Get user's specialization statistics
router.get('/stats', assignmentController.getSpecializationStats);

// Get available alerts filtered by level and path
router.get('/available-alerts', assignmentController.getAvailableAlerts);

module.exports = router;
