/// 复习模式
enum ReviewMode {
  adaptive,    // 智能适应
  sequential,  // 顺序复习
  random,      // 随机复习
  difficulty,  // 按难度复习
}

/// 复习结果
class ReviewResult {
  final String wordId;
  final bool isCorrect;
  final DateTime timestamp;
  final Duration reviewTime;

  ReviewResult({
    required this.wordId,
    required this.isCorrect,
    required this.timestamp,
    required this.reviewTime,
  });
}

/// 复习会话
class ReviewSession {
  final String id;
  final DateTime startTime;
  final int targetCount;
  final ReviewMode mode;
  DateTime? endTime;
  Map<String, ReviewResult> results = {};

  ReviewSession({
    required this.id,
    required this.startTime,
    required this.targetCount,
    required this.mode,
    this.endTime,
  });

  double get accuracy {
    if (results.isEmpty) return 0.0;
    final correctCount = results.values.where((r) => r.isCorrect).length;
    return correctCount / results.length;
  }

  Duration get totalTime {
    final end = endTime ?? DateTime.now();
    return end.difference(startTime);
  }

  bool get isCompleted => results.length >= targetCount;
}