/**
 * ============================================
 * MODULE TYPES
 * ============================================
 * 
 * Types for course modules and topics
 * shared between frontend and backend
 */

import { TopicType, ModuleType } from './exercise';

// ============================================
// MODULE
// ============================================

export interface Module {
  id: string;
  name: string;
  description: string;
  type: ModuleType;
  order: number;
  introduction?: string;
  examples?: ModuleExample[];
  exercises?: ModuleExerciseRef[];
  answers?: ModuleAnswer[];
}

export interface ModuleExample {
  title: string;
  content: string;
  latexFormula?: string;
  explanation: string;
  difficulty?: 'EASY' | 'MEDIUM' | 'HARD';
}

export interface ModuleExerciseRef {
  id: string;
  section: string;
  content: string;
  problems: {
    id: string;
    statement: string;
    type: string;
  }[];
}

export interface ModuleAnswer {
  id: string;
  exerciseId: string;
  content: string;
  steps: string[];
}

// ============================================
// TOPIC
// ============================================

export interface Topic {
  id: string;
  moduleId: string;
  name: string;
  type: TopicType;
  theoryContent?: TheoryContent;
  formulas?: Formula[];
}

export interface TheoryContent {
  title: string;
  description: string;
  sections: TheorySection[];
}

export interface TheorySection {
  title: string;
  content: string;
  formulas?: string[];
}

export interface Formula {
  id: string;
  name: string;
  latex: string;
  description?: string;
}

// ============================================
// THEORY CONTENT (Detailed)
// ============================================

export interface TheoryContentDetailed {
  concept: string;
  explanation: string;
  formulas: LatexFormula[];
  examples: ModuleExample[];
}

export interface LatexFormula {
  name: string;
  latex: string;
  description: string;
  category?: string;
}

export interface KeyPoint {
  title: string;
  explanation: string;
  latex?: string;
}

export interface CommonMistake {
  mistake: string;
  correction: string;
  explanation: string;
}
