class Level {
  final String idLevel;
  final String idTopic;
  final String idSection;
  final String nameSection;
  final String nameTopic;
  final String nameLevel;
  final String content;
  final String? audio;
  final String? image;
  final String? video;
  final int isPretest;
  final String? timeLevel;
  final String? idStudentLearning;
  final int? score;

  const Level({
    required this.idLevel,
    required this.idTopic,
    required this.idSection,
    required this.nameSection,
    required this.nameTopic,
    required this.nameLevel,
    required this.content,
    this.audio,
    this.image,
    this.video,
    required this.isPretest,
    required this.timeLevel,
    this.idStudentLearning,
    this.score,
  });

  factory Level.fromJson(Map<String, dynamic> json) {
    return Level(
      idLevel: json['ID_LEVEL'] ?? '',
      idTopic: json['ID_TOPIC'] ?? '',
      idSection: json['ID_SECTION'] ?? '',
      nameSection: json['NAME_SECTION'] ?? '',
      nameTopic: json['NAME_TOPIC'] ?? '',
      nameLevel: json['NAME_LEVEL'] ?? '',
      content: json['CONTENT'] ?? '',
      audio: json['AUDIO'],
      image: json['IMAGE'],
      video: json['VIDEO'],
      isPretest: json['IS_PRETEST'] ?? 0,
      timeLevel: json['TIME_LEVEL'],
      idStudentLearning: json['ID_STUDENT_LEARNING'],
      score: json['SCORE'],
    );
  }
}
