|
|
@ -1,13 +1,34 @@ |
|
|
|
import 'package:hadi_hoda_flutter/features/question/data/model/answer_model.dart'; |
|
|
|
import 'package:hadi_hoda_flutter/features/question/data/model/file_model.dart'; |
|
|
|
import 'package:hadi_hoda_flutter/features/question/domain/entity/answer_entity.dart'; |
|
|
|
import 'package:hadi_hoda_flutter/features/question/domain/entity/question_entity.dart'; |
|
|
|
|
|
|
|
class QuestionModel extends QuestionEntity { |
|
|
|
QuestionModel({ |
|
|
|
super.id, |
|
|
|
super.title, |
|
|
|
super.audioId, |
|
|
|
super.audioInfo, |
|
|
|
super.order, |
|
|
|
super.correctAnswer, |
|
|
|
super.isActive, |
|
|
|
super.answers, |
|
|
|
}); |
|
|
|
|
|
|
|
factory QuestionModel.fromJson(Map<String, dynamic> json) { |
|
|
|
return QuestionModel( |
|
|
|
id: json['id'], |
|
|
|
title: json['title'], |
|
|
|
audioId: json['audio_id'], |
|
|
|
audioInfo: json['audio_info'] == null |
|
|
|
? null |
|
|
|
: FileModel.fromJson(json['audio_info']), |
|
|
|
order: json['order'], |
|
|
|
correctAnswer: json['correct_answer'], |
|
|
|
isActive: json['is_active'], |
|
|
|
answers: json['answers'] |
|
|
|
?.map<AnswerEntity>((e) => AnswerModel.fromJson(e)) |
|
|
|
.toList(), |
|
|
|
); |
|
|
|
} |
|
|
|
} |