import type { Question } from "./sheet";
import type { ExamMode } from "./test";

type Answer = {
  id: string;
  question_id: string;
  answer_text: string;
  is_correct: boolean;
  marked_for_review: false;
};

/**
 * SessionRequest interface
 * `/sessions/`
 */

export interface SessionRequest {
  sheet_id?: string;
  mode: ExamMode;
  time_limit_minutes: number;
  topic_ids?: string[];
  difficulty?: string;
  question_count?: number;
  section?: string;
}

// export interface TargetedSessionResponse {
//   id: string;
//   practice_sheet_id: null;
//   status: string;
//   current_module_index: number;
//   current_model_id: null;
//   current_module_title: null;
//   answers: Answer[];
//   started_at: string;
//   score: number;
// }

export interface SessionResponse {
  id: string;
  practice_sheet_id: string;
  status: string;
  current_module_index: number;
  current_model_id: string;
  current_module_title: string;
  answers: Answer[];
  started_at: Date;
  score: number;
}

export type SubmitAnswer = {
  question_id: string;
  answer_text: string;
  time_spent_seconds: number;
};

export interface SessionAnswerResponse {
  status: string;
  feedback: {
    is_correct: boolean;
    correct_answer: string;
    explanation: string;
  };
}

export interface SessionQuestionsResponse {
  session_id: string;
  module_id: string;
  module_title: string;
  time_limit_minutes: number;
  questions: Question[];
}

export interface SessionModuleQuestions {
  session_id?: string;
  module_id: string;
  module_title: string;
  time_limit_minutes: number;
  questions: Question[];
}
