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

// All mobile routes require authentication
router.use(protect);

// Dashboard - aggregated stats
router.get('/dashboard', mobileController.getDashboard);

// Update push token
router.post('/push-token', mobileController.updatePushToken);

// Triage game - check if completed today
router.get('/triage-status', mobileController.getTriageStatus);

// Triage game - submit results
router.post('/triage-submit', mobileController.submitTriageResults);

// Quiz - get random questions from database
router.get('/quiz-questions', mobileController.getQuizQuestions);

// Micro-learning - get today's lessons
router.get('/lessons', mobileController.getMicroLessons);

// Micro-learning - complete a lesson
router.post('/lessons/:lessonId/complete', mobileController.completeLesson);

// Leaderboard - get global ranking
router.get('/leaderboard', mobileController.getLeaderboard);

// Field Ops - submit action for alert
router.post('/field-ops-submit', mobileController.submitFieldOps);

// Phishing Hunter - get a random scenario
router.get('/phishing-scenario', mobileController.getPhishingScenario);

// Phishing Hunter - submit decision
router.post('/phishing-submit', mobileController.submitPhishingDecision);

// Log Detective - get a random log scenario
router.get('/log-scenario', mobileController.getLogScenario);

// Log Detective - submit answer
router.post('/log-submit', mobileController.submitLogAnswer);

// Specialization - get current paths and available options
router.get('/specialization', mobileController.getSpecialization);

// Specialization - update primary/secondary paths
router.post('/specialization', mobileController.updateSpecialization);

const crisisController = require('../controllers/crisisController');

// ... existing routes ...

// Crisis Mode Routes
// Crisis Mode Routes (Protected by router.use(protect))
router.get('/crisis/check', crisisController.checkCrisisAvailability);
router.post('/crisis/start', crisisController.startCrisis);
router.post('/crisis/resolve', crisisController.submitCrisis);

module.exports = router;
