import express from 'express';
const router = express.Router();
import * as assessmentController from './assessment.controller.js';
import { authenticate } from '../../common/middleware/auth.js';
import { checkRole } from '../../common/middleware/roleCheck.js';
import { ROLES } from '../../common/config/constants.js';

router.use(authenticate as any);

// Questionnaires
router.get('/questionnaire', assessmentController.getQuestionnaire);
router.post('/questionnaire/response', assessmentController.submitQuestionnaireResponse);

// Interviews
router.get('/interviews/:applicationId', assessmentController.getInterviews);
router.post('/interviews', assessmentController.scheduleInterview);
router.put('/interviews/:id', assessmentController.updateInterview);
router.post('/interviews/:id/evaluation', assessmentController.submitEvaluation);
router.post('/kt-matrix', assessmentController.submitKTMatrix);
router.post('/level2-feedback', assessmentController.submitLevel2Feedback);
router.post('/recommendation', assessmentController.updateRecommendation);
router.post('/decision', assessmentController.updateInterviewDecision);
router.post('/stage-decision', assessmentController.submitStageDecision);
router.get('/interviews/:interviewId/approval-status', assessmentController.getInterviewApprovalStatus);
router.get('/approval-policies', checkRole([ROLES.SUPER_ADMIN, ROLES.DD_ADMIN]) as any, assessmentController.getStageApprovalPolicies);
router.put('/approval-policies/:stageCode', checkRole([ROLES.SUPER_ADMIN, ROLES.DD_ADMIN]) as any, assessmentController.upsertStageApprovalPolicy);

// AI Summary
router.post('/ai-summary/:applicationId', assessmentController.generateAiSummary);
router.get('/ai-summary/:applicationId', assessmentController.getAiSummary);

export default router;
