export type ProgressionModel = "linear" | "parallel" | "adaptive";

export interface SkillGap {
  skill: string;
  current_level: string;
  current_band?: number;
  target_level: string;
  target_band?: number;
  gap: number;
  priority: "high" | "medium" | "low" | "none";
  estimated_hours: number;
}

export interface QuestionTypeWeakness {
  question_type: string;
  accuracy: number;
  total: number;
  correct: number;
}

export interface TopicWeakness {
  topic: string;
  errors: number;
  total: number;
}

export interface GapAnalysis {
  student_id: number;
  source: "exam" | "placement";
  source_id: number;
  skill_gaps: SkillGap[];
  question_type_weaknesses: Record<string, QuestionTypeWeakness[]>;
  topic_weaknesses: Record<string, TopicWeakness[]>;
}

export interface CourseConfig {
  id: number;
  title: string;
  exam_type?: string;
  target_band?: number;
  target_level?: string;
  duration_weeks: number;
  study_hours_week: number;
  skills: string[];
  skill_weightings: Record<string, number>;
  progression_model: ProgressionModel;
  status: "draft" | "published" | "archived";
  modules: ModuleConfig[];
}

export interface ModuleConfig {
  id: number;
  title: string;
  skill: string;
  estimated_hours: number;
  cefr_target?: string;
  resources: ModuleResource[];
  completion_criteria: "complete_all" | "score_threshold" | "teacher_approval";
  score_threshold?: number;
  prerequisite_module_id?: number;
  status: "locked" | "available" | "in_progress" | "completed" | "skipped";
  progress_percent?: number;
}

export interface ModuleResource {
  id: number;
  title: string;
  type: "pdf" | "video" | "audio" | "exercise" | "ai_generated";
  url?: string;
  completed: boolean;
  time_spent_ms?: number;
}

export interface CourseProgress {
  resource_id: number;
  completion_percent: number;
  time_spent_ms: number;
}

export interface CheckpointResult {
  score: number;
  passed: boolean;
  remedial_added: boolean;
}
