// GENERATED CODE - DO NOT MODIFY BY HAND

part of 'learning_session_model.dart';

// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************

LearningSession _$LearningSessionFromJson(Map<String, dynamic> json) =>
    LearningSession(
      id: LearningSession._idFromJson(json['id']),
      userId: LearningSession._userIdFromJson(json['user_id']),
      bookId: json['book_id'] as String,
      dailyGoal: (json['daily_goal'] as num).toInt(),
      newWordsCount: (json['new_words_count'] as num?)?.toInt() ?? 0,
      reviewCount: (json['review_count'] as num?)?.toInt() ?? 0,
      masteredCount: (json['mastered_count'] as num?)?.toInt() ?? 0,
      startedAt: DateTime.parse(json['started_at'] as String),
      completedAt: json['completed_at'] == null
          ? null
          : DateTime.parse(json['completed_at'] as String),
    );

Map<String, dynamic> _$LearningSessionToJson(LearningSession instance) =>
    <String, dynamic>{
      'id': instance.id,
      'user_id': instance.userId,
      'book_id': instance.bookId,
      'daily_goal': instance.dailyGoal,
      'new_words_count': instance.newWordsCount,
      'review_count': instance.reviewCount,
      'mastered_count': instance.masteredCount,
      'started_at': instance.startedAt.toIso8601String(),
      'completed_at': instance.completedAt?.toIso8601String(),
    };

DailyLearningTasks _$DailyLearningTasksFromJson(Map<String, dynamic> json) =>
    DailyLearningTasks(
      newWords: (json['newWords'] as List<dynamic>)
          .map((e) => (e as num).toInt())
          .toList(),
      reviewWords: DailyLearningTasks._reviewWordsFromJson(json['reviewWords']),
      masteredCount: (json['masteredCount'] as num).toInt(),
      totalWords: (json['totalWords'] as num).toInt(),
      progress: (json['progress'] as num).toDouble(),
    );

Map<String, dynamic> _$DailyLearningTasksToJson(DailyLearningTasks instance) =>
    <String, dynamic>{
      'newWords': instance.newWords,
      'reviewWords': instance.reviewWords,
      'masteredCount': instance.masteredCount,
      'totalWords': instance.totalWords,
      'progress': instance.progress,
    };

LearningStatistics _$LearningStatisticsFromJson(Map<String, dynamic> json) =>
    LearningStatistics(
      todayNewWords: (json['todayNewWords'] as num).toInt(),
      todayReview: (json['todayReview'] as num).toInt(),
      todayMastered: (json['todayMastered'] as num).toInt(),
      totalLearned: (json['totalLearned'] as num).toInt(),
      totalMastered: (json['totalMastered'] as num).toInt(),
      avgProficiency: (json['avgProficiency'] as num).toDouble(),
      streakDays: (json['streakDays'] as num).toInt(),
    );

Map<String, dynamic> _$LearningStatisticsToJson(LearningStatistics instance) =>
    <String, dynamic>{
      'todayNewWords': instance.todayNewWords,
      'todayReview': instance.todayReview,
      'todayMastered': instance.todayMastered,
      'totalLearned': instance.totalLearned,
      'totalMastered': instance.totalMastered,
      'avgProficiency': instance.avgProficiency,
      'streakDays': instance.streakDays,
    };

StudyResult _$StudyResultFromJson(Map<String, dynamic> json) => StudyResult(
      wordId: json['wordId'] as String,
      difficulty: $enumDecode(_$StudyDifficultyEnumMap, json['difficulty']),
      studyTime: (json['studyTime'] as num).toInt(),
    );

Map<String, dynamic> _$StudyResultToJson(StudyResult instance) =>
    <String, dynamic>{
      'wordId': instance.wordId,
      'difficulty': _$StudyDifficultyEnumMap[instance.difficulty]!,
      'studyTime': instance.studyTime,
    };

const _$StudyDifficultyEnumMap = {
  StudyDifficulty.forgot: 'forgot',
  StudyDifficulty.hard: 'hard',
  StudyDifficulty.good: 'good',
  StudyDifficulty.easy: 'easy',
  StudyDifficulty.perfect: 'perfect',
};
