import 'package:initial_folder/models/reply_announcement_model.dart'; class AnnouncementModel { AnnouncementModel({ this.status, this.error, required this.data, }); final int? status; final bool? error; final List> data; factory AnnouncementModel.fromJson(Map json) => AnnouncementModel( status: json["status"], error: json["error"], data: List>.from(json["data"].map((x) => List.from( x.map((x) => AnnouncementDataModel.fromJson(x))))), ); Map toJson() => { "status": status, "error": error, "data": List.from( data.map((x) => List.from(x.map((x) => x.toJson())))), }; } class AnnouncementDataModel { AnnouncementDataModel({ this.idAnnouncement, this.tokenAnnouncement, this.instructorName, this.fotoProfile, this.bodyContent, this.countLike, this.likes, this.isLike, this.comment, this.date, required this.replies, }); final String? idAnnouncement; final String? tokenAnnouncement; final String? instructorName; final String? fotoProfile; final String? bodyContent; final String? countLike; final bool? likes; final int? isLike; final int? comment; final String? date; final List replies; factory AnnouncementDataModel.fromJson(Map json) => AnnouncementDataModel( idAnnouncement: json["id_announcement"], tokenAnnouncement: json["token_announcement"], instructorName: json["instructor_name"], bodyContent: json["body"], fotoProfile: json["foto_profile"], likes: json["likes"].length > 0, isLike: json["is_like"], countLike: json["count_likes"], comment: json["comment"], date: json["date"], replies: List.from( json["replies"].map((x) => ReplyModel.fromJson(x))).toList(), ); Map toJson() => { "id_announcement": idAnnouncement, "token_announcement": tokenAnnouncement, "instructor_name": instructorName, "body": bodyContent, "foto_profile": fotoProfile, "likes": likes, "is_like": isLike, "comment": comment, "date": date, "replies": List.from(replies.map((x) => x)), }; } class AnnouncementPostModel { AnnouncementPostModel({ this.status, this.error, required this.data, }); final int? status; final bool? error; final DataPostAnnouncement data; factory AnnouncementPostModel.fromJson(Map json) => AnnouncementPostModel( status: json["status"], error: json["error"], data: DataPostAnnouncement.fromJson(json["data"]), ); Map toJson() => { "status": status, "error": error, "data": data.toJson(), }; } class DataPostAnnouncement { DataPostAnnouncement({this.idUser, this.idCourse, this.body}); final String? idUser; final String? idCourse; final String? body; factory DataPostAnnouncement.fromJson(Map json) => DataPostAnnouncement( idUser: json["id_user"], idCourse: json["course_id"], body: json["body"], ); Map toJson() => { "id_user": idUser, "id_course": idCourse, "body": body, }; } class AnnouncementLikeModel { AnnouncementLikeModel({ this.userLikes, }); final String? userLikes; factory AnnouncementLikeModel.fromJson(Map json) => AnnouncementLikeModel( userLikes: json["user_likes"], ); Map toJson() => { "user_likes": userLikes, }; } class SectionModel { SectionModel({ this.status, this.error, this.progress, required this.data, }); int? status; bool? error; int? progress; List> data; factory SectionModel.fromJson(Map json) => SectionModel( status: json["status"], error: json["error"], progress: json["progress"], data: List>.from(json["data"].map((x) => Map.from(x) .map((k, v) => MapEntry(k, Datum.fromJson(v))))), ); Map toJson() => { "status": status, "error": error, "progress": progress, "data": List.from(data.map((x) => Map.from(x) .map((k, v) => MapEntry(k, v.toJson())))), }; } class Datum { Datum({ this.sectionTitle, this.dataLesson, }); String? sectionTitle; List? dataLesson; factory Datum.fromJson(Map json) => Datum( sectionTitle: json["section_title"], dataLesson: List.from( json["data_lesson"].map((x) => DataLesson.fromJson(x))), ); Map toJson() => { "section_title": sectionTitle, "data_lesson": List.from(dataLesson!.map((x) => x.toJson())), }; } class DataLesson { DataLesson({ this.lessonId, this.title, this.duration, this.attachmentType, this.videoType, this.videoUrl, this.lessonType, this.attachment, this.isSkip, this.isFinished, this.summary, }); String? lessonId; String? title; String? duration; String? attachmentType; String? videoType; String? videoUrl; String? lessonType; dynamic attachment; String? isSkip; String? summary; int? isFinished; factory DataLesson.fromJson(Map json) => DataLesson( lessonId: json["lesson_id"], title: json["title"], duration: json["duration"], attachmentType: json["attachment_type"], videoType: json["video_type"], videoUrl: json["video_url"], lessonType: json["lesson_type"], attachment: json["attachment"], isSkip: json["is_skip"], isFinished: json["is_finished"], summary: json["summary"], ); get courseId => null; Map toJson() => { "lesson_id": lessonId, "title": title, "duration": duration, "attachment_type": attachmentType, "video_type": videoType, "video_url": videoUrl, "lesson_type": lessonType, "attachment": attachment, "is_skip": isSkip, "is_finished": isFinished, "summary": summary, }; } class NewMap { NewMap({ required this.title, }); final List title; factory NewMap.fromMap(Map<String, dynamic> json) => NewMap( title: List<Title>.from(json["Title"].map((x) => Title.fromMap(x))), ); Map<String, dynamic> toMap() => { "Title": List<dynamic>.from(title.map((x) => x.toMap())), }; } class Title { Title({ this.courseId, this.lessonId, this.sectionTitle, this.lessonTitle, this.duration, this.attachmentType, this.videoType, this.videoUrl, this.lessonType, this.attachment, this.isSkip, this.isFinished, this.summary, }); final String? courseId; final String? lessonId; final String? sectionTitle; final String? lessonTitle; final String? duration; final String? attachmentType; final String? videoType; final String? videoUrl; final String? lessonType; final dynamic attachment; final String? isSkip; final String? summary; final int? isFinished; factory Title.fromMap(Map<String, dynamic> json) => Title( courseId: json["course_id"], lessonId: json["lesson_id"], sectionTitle: json["section_title"], lessonTitle: json["lesson_title"], duration: json["duration"], attachmentType: json["attachment_type"], videoType: json["video_type"], videoUrl: json["video_url"] == '' ? 'a' : json["video_url"], lessonType: json["lesson_type"], attachment: json["attachment"], isSkip: json["is_skip"], isFinished: json["is_finished"], summary: json["summary"], ); Map<String, dynamic> toMap() => { "course_id": courseId, "lesson_id": lessonId, "section_title": sectionTitle, "lesson_title": lessonTitle, "duration": duration, "attachment_type": attachmentType, "video_type": videoType, "video_url": videoUrl, "lesson_type": lessonType, "attachment": attachment, "is_skip": isSkip, "is_finished": isFinished, "summary": summary, }; }