/// 阅读练习类型枚举
enum ReadingExerciseType {
  news,        // 新闻
  story,       // 故事
  science,     // 科学
  business,    // 商务
  culture,     // 文化
  technology,  // 科技
  health,      // 健康
  travel,      // 旅游
}

/// 阅读难度枚举
enum ReadingDifficulty {
  elementary,        // 初级 A1-A2
  intermediate,      // 中级 B1
  upperIntermediate, // 中高级 B2
  advanced,          // 高级 C1
  proficient,        // 精通 C2
}

/// 阅读练习分类
class ReadingCategory {
  final String id;
  final String name;
  final String description;
  final String icon;
  final int articleCount;
  final ReadingExerciseType type;

  const ReadingCategory({
    required this.id,
    required this.name,
    required this.description,
    required this.icon,
    required this.articleCount,
    required this.type,
  });
}

/// 阅读练习
class ReadingExercise {
  final String id;
  final String title;
  final String content;
  final String summary;
  final ReadingExerciseType type;
  final ReadingDifficulty difficulty;
  final int wordCount;
  final int estimatedTime; // 预估阅读时间（分钟）
  final List<ReadingQuestion> questions;
  final List<String> tags;
  final String source;
  final DateTime publishDate;
  final String imageUrl;

  const ReadingExercise({
    required this.id,
    required this.title,
    required this.content,
    required this.summary,
    required this.type,
    required this.difficulty,
    required this.wordCount,
    required this.estimatedTime,
    required this.questions,
    required this.tags,
    required this.source,
    required this.publishDate,
    required this.imageUrl,
  });
}

/// 阅读问题
class ReadingQuestion {
  final String id;
  final String question;
  final List<String> options;
  final int correctAnswer; // 正确答案的索引
  final String explanation;
  final String type; // multiple_choice, true_false, fill_blank

  const ReadingQuestion({
    required this.id,
    required this.question,
    required this.options,
    required this.correctAnswer,
    required this.explanation,
    required this.type,
  });
}

/// 阅读结果
class ReadingResult {
  final String exerciseId;
  final int correctAnswers;
  final int totalQuestions;
  final int readingTime; // 实际阅读时间（秒）
  final DateTime completedAt;
  final List<UserAnswer> userAnswers;

  const ReadingResult({
    required this.exerciseId,
    required this.correctAnswers,
    required this.totalQuestions,
    required this.readingTime,
    required this.completedAt,
    required this.userAnswers,
  });

  double get accuracy => correctAnswers / totalQuestions;
}

/// 用户答案
class UserAnswer {
  final String questionId;
  final int selectedAnswer;
  final bool isCorrect;

  const UserAnswer({
    required this.questionId,
    required this.selectedAnswer,
    required this.isCorrect,
  });
}