You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/models/course/education_journey_model.dart

625 lines
18 KiB
Dart

import 'dart:async';
import 'dart:convert';
import 'package:video_player/video_player.dart';
class PatientEducationJourneyModel {
dynamic date;
int? languageId;
int? serviceName;
dynamic time;
dynamic androidLink;
dynamic authenticationTokenId;
dynamic data;
bool? dataw;
int? dietType;
int? dietTypeId;
dynamic errorCode;
dynamic errorEndUserMessage;
dynamic errorEndUserMessageN;
dynamic errorMessage;
int? errorStatusCode;
int? errorType;
int? foodCategory;
dynamic iosLink;
bool? isAuthenticated;
int? mealOrderStatus;
int? mealType;
int? messageStatus;
int? numberOfResultRecords;
dynamic patientBlodType;
dynamic successMsg;
dynamic successMsgN;
dynamic vidaUpdatedResponse;
NabedJourneyByIdResponseResult? nabedJourneyByIdResponseResult;
dynamic nabedJourneyResponseResult;
dynamic nabedPatientList;
dynamic nabedResponse;
PatientEducationJourneyModel({
this.date,
this.languageId,
this.serviceName,
this.time,
this.androidLink,
this.authenticationTokenId,
this.data,
this.dataw,
this.dietType,
this.dietTypeId,
this.errorCode,
this.errorEndUserMessage,
this.errorEndUserMessageN,
this.errorMessage,
this.errorStatusCode,
this.errorType,
this.foodCategory,
this.iosLink,
this.isAuthenticated,
this.mealOrderStatus,
this.mealType,
this.messageStatus,
this.numberOfResultRecords,
this.patientBlodType,
this.successMsg,
this.successMsgN,
this.vidaUpdatedResponse,
this.nabedJourneyByIdResponseResult,
this.nabedJourneyResponseResult,
this.nabedPatientList,
this.nabedResponse,
});
factory PatientEducationJourneyModel.fromRawJson(String str) => PatientEducationJourneyModel.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory PatientEducationJourneyModel.fromJson(Map<String, dynamic> json) => PatientEducationJourneyModel(
date: json["Date"],
languageId: json["LanguageID"],
serviceName: json["ServiceName"],
time: json["Time"],
androidLink: json["AndroidLink"],
authenticationTokenId: json["AuthenticationTokenID"],
data: json["Data"],
dataw: json["Dataw"],
dietType: json["DietType"],
dietTypeId: json["DietTypeID"],
errorCode: json["ErrorCode"],
errorEndUserMessage: json["ErrorEndUserMessage"],
errorEndUserMessageN: json["ErrorEndUserMessageN"],
errorMessage: json["ErrorMessage"],
errorStatusCode: json["ErrorStatusCode"],
errorType: json["ErrorType"],
foodCategory: json["FoodCategory"],
iosLink: json["IOSLink"],
isAuthenticated: json["IsAuthenticated"],
mealOrderStatus: json["MealOrderStatus"],
mealType: json["MealType"],
messageStatus: json["MessageStatus"],
numberOfResultRecords: json["NumberOfResultRecords"],
patientBlodType: json["PatientBlodType"],
successMsg: json["SuccessMsg"],
successMsgN: json["SuccessMsgN"],
vidaUpdatedResponse: json["VidaUpdatedResponse"],
nabedJourneyByIdResponseResult: json["NabedJourneyByIdResponseResult"] == null ? null : NabedJourneyByIdResponseResult.fromJson(json["NabedJourneyByIdResponseResult"]),
nabedJourneyResponseResult: json["NabedJourneyResponseResult"],
nabedPatientList: json["NabedPatientList"],
nabedResponse: json["NabedResponse"],
);
Map<String, dynamic> toJson() => {
"Date": date,
"LanguageID": languageId,
"ServiceName": serviceName,
"Time": time,
"AndroidLink": androidLink,
"AuthenticationTokenID": authenticationTokenId,
"Data": data,
"Dataw": dataw,
"DietType": dietType,
"DietTypeID": dietTypeId,
"ErrorCode": errorCode,
"ErrorEndUserMessage": errorEndUserMessage,
"ErrorEndUserMessageN": errorEndUserMessageN,
"ErrorMessage": errorMessage,
"ErrorStatusCode": errorStatusCode,
"ErrorType": errorType,
"FoodCategory": foodCategory,
"IOSLink": iosLink,
"IsAuthenticated": isAuthenticated,
"MealOrderStatus": mealOrderStatus,
"MealType": mealType,
"MessageStatus": messageStatus,
"NumberOfResultRecords": numberOfResultRecords,
"PatientBlodType": patientBlodType,
"SuccessMsg": successMsg,
"SuccessMsgN": successMsgN,
"VidaUpdatedResponse": vidaUpdatedResponse,
"NabedJourneyByIdResponseResult": nabedJourneyByIdResponseResult?.toJson(),
"NabedJourneyResponseResult": nabedJourneyResponseResult,
"NabedPatientList": nabedPatientList,
"NabedResponse": nabedResponse,
};
}
class NabedJourneyByIdResponseResult {
Consultation? consultation;
List<ContentClass>? contentClasses;
NabedJourneyByIdResponseResult({
this.consultation,
this.contentClasses,
});
factory NabedJourneyByIdResponseResult.fromRawJson(String str) => NabedJourneyByIdResponseResult.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory NabedJourneyByIdResponseResult.fromJson(Map<String, dynamic> json) => NabedJourneyByIdResponseResult(
consultation: json["consultation"] == null ? null : Consultation.fromJson(json["consultation"]),
contentClasses: json["content_classes"] == null ? [] : List<ContentClass>.from(json["content_classes"]!.map((x) => ContentClass.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"consultation": consultation?.toJson(),
"content_classes": contentClasses == null ? [] : List<dynamic>.from(contentClasses!.map((x) => x.toJson())),
};
}
class Consultation {
DateTime? date;
DefaultPocData? defaultPocData;
int? id;
String? integrationApproach;
bool? isNew;
String? openedAt;
String? sourceType;
Stats? stats;
TagValues? tagValues;
Consultation({
this.date,
this.defaultPocData,
this.id,
this.integrationApproach,
this.isNew,
this.openedAt,
this.sourceType,
this.stats,
this.tagValues,
});
factory Consultation.fromRawJson(String str) => Consultation.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Consultation.fromJson(Map<String, dynamic> json) => Consultation(
date: json["date"] == null ? null : DateTime.parse(json["date"]),
defaultPocData: json["default_poc_data"] == null ? null : DefaultPocData.fromJson(json["default_poc_data"]),
id: json["id"],
integrationApproach: json["integration_approach"],
isNew: json["is_new"],
openedAt: json["opened_at"],
sourceType: json["source_type"],
stats: json["stats"] == null ? null : Stats.fromJson(json["stats"]),
tagValues: json["tag_values"] == null ? null : TagValues.fromJson(json["tag_values"]),
);
Map<String, dynamic> toJson() => {
"date": "${date!.year.toString().padLeft(4, '0')}-${date!.month.toString().padLeft(2, '0')}-${date!.day.toString().padLeft(2, '0')}",
"default_poc_data": defaultPocData?.toJson(),
"id": id,
"integration_approach": integrationApproach,
"is_new": isNew,
"opened_at": openedAt,
"source_type": sourceType,
"stats": stats?.toJson(),
"tag_values": tagValues?.toJson(),
};
}
class DefaultPocData {
Image? image;
String? title;
DefaultPocData({
this.image,
this.title,
});
factory DefaultPocData.fromRawJson(String str) => DefaultPocData.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory DefaultPocData.fromJson(Map<String, dynamic> json) => DefaultPocData(
image: json["image"] == null ? null : Image.fromJson(json["image"]),
title: json["title"],
);
Map<String, dynamic> toJson() => {
"image": image?.toJson(),
"title": title,
};
}
class Image {
String? thumbUrl;
String? url;
Image({
this.thumbUrl,
this.url,
});
factory Image.fromRawJson(String str) => Image.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Image.fromJson(Map<String, dynamic> json) => Image(
thumbUrl: json["thumb_url"],
url: json["url"],
);
Map<String, dynamic> toJson() => {
"thumb_url": thumbUrl,
"url": url,
};
}
class Stats {
int? attachmentsCount;
int? contentCount;
int? contentReadCount;
int? educationalContentCount;
int? educationalContentReadCount;
int? educationalReadPercentage;
bool? isCompleted;
int? readPercentage;
int? readRemainingPercentage;
int? screenshotsCount;
int? topicCount;
int? videosCount;
int? videosReadCount;
Stats({
this.attachmentsCount,
this.contentCount,
this.contentReadCount,
this.educationalContentCount,
this.educationalContentReadCount,
this.educationalReadPercentage,
this.isCompleted,
this.readPercentage,
this.readRemainingPercentage,
this.screenshotsCount,
this.topicCount,
this.videosCount,
this.videosReadCount,
});
factory Stats.fromRawJson(String str) => Stats.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Stats.fromJson(Map<String, dynamic> json) => Stats(
attachmentsCount: json["attachments_count"],
contentCount: json["content_count"],
contentReadCount: json["content_read_count"],
educationalContentCount: json["educational_content_count"],
educationalContentReadCount: json["educational_content_read_count"],
educationalReadPercentage: json["educational_read_percentage"],
isCompleted: json["is_completed"],
readPercentage: json["read_percentage"],
readRemainingPercentage: json["read_remaining_percentage"],
screenshotsCount: json["screenshots_count"],
topicCount: json["topic_count"],
videosCount: json["videos_count"],
videosReadCount: json["videos_read_count"],
);
Map<String, dynamic> toJson() => {
"attachments_count": attachmentsCount,
"content_count": contentCount,
"content_read_count": contentReadCount,
"educational_content_count": educationalContentCount,
"educational_content_read_count": educationalContentReadCount,
"educational_read_percentage": educationalReadPercentage,
"is_completed": isCompleted,
"read_percentage": readPercentage,
"read_remaining_percentage": readRemainingPercentage,
"screenshots_count": screenshotsCount,
"topic_count": topicCount,
"videos_count": videosCount,
"videos_read_count": videosReadCount,
};
}
class TagValues {
String? consultationCode;
String? title;
String? titleAr;
TagValues({
this.consultationCode,
this.title,
this.titleAr,
});
factory TagValues.fromRawJson(String str) => TagValues.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory TagValues.fromJson(Map<String, dynamic> json) => TagValues(
consultationCode: json["consultation_code"],
title: json["title"],
titleAr: json["title_ar"],
);
Map<String, dynamic> toJson() => {
"consultation_code": consultationCode,
"title": title,
"title_ar": titleAr,
};
}
class ContentClass {
int? id;
Image? image;
int? readPercentage;
String? title;
List<Topic>? topics;
String? type;
ContentClass({
this.id,
this.image,
this.readPercentage,
this.title,
this.topics,
this.type,
});
factory ContentClass.fromRawJson(String str) => ContentClass.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory ContentClass.fromJson(Map<String, dynamic> json) => ContentClass(
id: json["id"],
image: json["image"] == null ? null : Image.fromJson(json["image"]),
readPercentage: json["read_percentage"],
title: json["title"],
topics: json["topics"] == null ? [] : List<Topic>.from(json["topics"]!.map((x) => Topic.fromJson(x))),
type: json["type"],
);
Map<String, dynamic> toJson() => {
"id": id,
"image": image?.toJson(),
"read_percentage": readPercentage,
"title": title,
"topics": topics == null ? [] : List<dynamic>.from(topics!.map((x) => x.toJson())),
"type": type,
};
}
class Topic {
List<Content>? contents;
int? contentsCount;
int? id;
Image? image;
int? readContentsCount;
int? readPercentage;
String? subjectId;
String? title;
Topic({
this.contents,
this.contentsCount,
this.id,
this.image,
this.readContentsCount,
this.readPercentage,
this.subjectId,
this.title,
});
factory Topic.fromRawJson(String str) => Topic.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Topic.fromJson(Map<String, dynamic> json) => Topic(
contents: json["contents"] == null ? [] : List<Content>.from(json["contents"]!.map((x) => Content.fromJson(x))),
contentsCount: json["contents_count"],
id: json["id"],
image: json["image"] == null ? null : Image.fromJson(json["image"]),
readContentsCount: json["read_contents_count"],
readPercentage: json["read_percentage"],
subjectId: json["subject_id"],
title: json["title"],
);
Map<String, dynamic> toJson() => {
"contents": contents == null ? [] : List<dynamic>.from(contents!.map((x) => x.toJson())),
"contents_count": contentsCount,
"id": id,
"image": image?.toJson(),
"read_contents_count": readContentsCount,
"read_percentage": readPercentage,
"subject_id": subjectId,
"title": title,
};
}
enum VideoPlayerState { playing, paused, completed, loading }
class Content {
String? body;
int? id;
Question? question;
dynamic read;
String? subjectId;
String? title;
Video? video;
VideoPlayerController? controller;
VideoPlayerState? videoState;
double? viewedPercentage;
Content({this.body, this.id, this.question, this.read, this.subjectId, this.title, this.video, this.controller, this.videoState, this.viewedPercentage});
factory Content.fromRawJson(String str) => Content.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Content.fromJson(Map<String, dynamic> json) => Content(
body: json["body"],
id: json["id"],
question: json["question"] == null ? null : Question.fromJson(json["question"]),
read: json["read"],
subjectId: json["subject_id"],
title: json["title"],
video: json["video"] == null ? null : Video.fromJson(json["video"]),
controller: null,
videoState: VideoPlayerState.paused,
viewedPercentage: 0.0,
);
Map<String, dynamic> toJson() => {
"body": body,
"id": id,
"question": question?.toJson(),
"read": read,
"subject_id": subjectId,
"title": title,
"video": video?.toJson(),
};
}
class Question {
List<Answer>? answers;
int? id;
bool? shouldAnswer;
String? subjectId;
String? text;
int? triggerAt;
Question({
this.answers,
this.id,
this.shouldAnswer,
this.subjectId,
this.text,
this.triggerAt,
});
factory Question.fromRawJson(String str) => Question.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Question.fromJson(Map<String, dynamic> json) => Question(
answers: json["answers"] == null ? [] : List<Answer>.from(json["answers"]!.map((x) => Answer.fromJson(x))),
id: json["id"],
shouldAnswer: json["should_answer"],
subjectId: json["subject_id"],
text: json["text"],
triggerAt: json["trigger_at"],
);
Map<String, dynamic> toJson() => {
"answers": answers == null ? [] : List<dynamic>.from(answers!.map((x) => x.toJson())),
"id": id,
"should_answer": shouldAnswer,
"subject_id": subjectId,
"text": text,
"trigger_at": triggerAt,
};
}
class Answer {
String? description;
int? id;
bool? isCorrect;
String? text;
Answer({
this.description,
this.id,
this.isCorrect,
this.text,
});
factory Answer.fromRawJson(String str) => Answer.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Answer.fromJson(Map<String, dynamic> json) => Answer(
description: json["description"],
id: json["id"],
isCorrect: json["is_correct"],
text: json["text"],
);
Map<String, dynamic> toJson() => {
"description": description,
"id": id,
"is_correct": isCorrect,
"text": text,
};
}
class Video {
Flavor? flavor;
Video({
this.flavor,
});
factory Video.fromRawJson(String str) => Video.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Video.fromJson(Map<String, dynamic> json) => Video(
flavor: json["flavor"] == null ? null : Flavor.fromJson(json["flavor"]),
);
Map<String, dynamic> toJson() => {
"flavor": flavor?.toJson(),
};
}
class Flavor {
String? downloadable;
int? duration;
int? flavorId;
String? hls;
String? picture;
Flavor({
this.downloadable,
this.duration,
this.flavorId,
this.hls,
this.picture,
});
factory Flavor.fromRawJson(String str) => Flavor.fromJson(json.decode(str));
String toRawJson() => json.encode(toJson());
factory Flavor.fromJson(Map<String, dynamic> json) => Flavor(
downloadable: json["downloadable"],
duration: json["duration"],
flavorId: json["flavor_id"],
hls: json["hls"],
picture: json["picture"],
);
Map<String, dynamic> toJson() => {
"downloadable": downloadable,
"duration": duration,
"flavor_id": flavorId,
"hls": hls,
"picture": picture,
};
}