export type ChapterUnlockMode = "auto_date" | "manual" | "prerequisite";
export type ChapterProgressStatus = "not_started" | "in_progress" | "completed";
export type MaterialType = "pdf" | "document" | "video" | "audio" | "image" | "link" | "article";

export interface CourseChapter {
  id: number;
  name: string;
  course_id: number;
  course_name: string;
  sequence: number;
  description: string;
  start_date?: string;
  end_date?: string;
  unlock_mode: ChapterUnlockMode;
  is_unlocked: boolean;
  topic_id?: number;
  topic_name?: string;
  domain_id?: number | null;
  domain_name?: string | null;
  learning_objective_ids?: number[];
  learning_objective_names?: string[];
  material_count: number;
  assignment_ids: number[];
  exam_ids: number[];
}

export interface ChapterMaterial {
  id: number;
  name: string;
  chapter_id: number;
  type: MaterialType;
  file_url?: string;
  url?: string;
  description?: string;
  sequence: number;
  allow_download: boolean;
  is_book: boolean;
  book_chapters?: string;
}

export interface ChapterProgress {
  id: number;
  student_id: number;
  student_name: string;
  chapter_id: number;
  status: ChapterProgressStatus;
  started_at?: string;
  completed_at?: string;
  materials_completed: number;
  materials_total: number;
}

export interface ChapterCreateRequest {
  name: string;
  course_id: number;
  sequence?: number;
  description?: string;
  start_date?: string;
  end_date?: string;
  unlock_mode: ChapterUnlockMode;
  topic_id?: number;
  learning_objective_ids?: number[];
}

export interface MaterialUploadRequest {
  name: string;
  chapter_id: number;
  type: MaterialType;
  url?: string;
  description?: string;
  allow_download?: boolean;
  is_book?: boolean;
}

export interface WorkbenchGenerateRequest {
  course_id: number;
  topic: string;
  objectives: string;
  complexity: "beginner" | "intermediate" | "advanced";
  target_audience?: string;
}

export interface WorkbenchGeneratedOutline {
  chapters: { name: string; description: string; learning_outcomes: string[]; estimated_duration_hours: number }[];
  suggested_rubric?: string;
}

export interface WorkbenchGeneratedChapter {
  content: string;
  exercises: { question: string; answer: string; type: string }[];
  multimedia_suggestions: { type: string; description: string }[];
}
