// Ini model buat notifikasi
class Notification {
  int? status;
  bool? error;
  Data? data;

  Notification({this.status, this.error, this.data});

  Notification.fromJson(Map<String, dynamic> json) {
    status = json['status'];
    error = json['error'];
    data = json['data'] != null ? new Data.fromJson(json['data']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['status'] = this.status;
    data['error'] = this.error;
    if (this.data != null) {
      data['data'] = this.data!.toJson();
    }
    return data;
  }
}

class Data {
  Users? users;
  Instructur? instructur;

  Data({this.users, this.instructur});

  Data.fromJson(Map<String, dynamic> json) {
    users = json['users'] != null ? new Users.fromJson(json['users']) : null;
    instructur = json['instructur'] != null
        ? new Instructur.fromJson(json['instructur'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.users != null) {
      data['users'] = this.users!.toJson();
    }
    if (this.instructur != null) {
      data['instructur'] = this.instructur!.toJson();
    }
    return data;
  }
}

class Users {
  List<Qna>? qna;
  List<Courses>? courses;
  List<Announcement>? announcement;

  Users({this.qna, this.courses, this.announcement});

  Users.fromJson(Map<String, dynamic> json) {
    if (json['qna'] != null) {
      qna = <Qna>[];
      json['qna'].forEach((v) {
        qna!.add(new Qna.fromJson(v));
      });
    }
    if (json['announcement'] != null) {
      announcement = <Announcement>[];
      json['announcement'].forEach((v) {
        announcement!.add(new Announcement.fromJson(v));
      });
    }
    if (json['courses'] != null) {
      courses = <Courses>[];
      json['courses'].forEach((v) {
        courses!.add(new Courses.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.qna != null) {
      data['qna'] = this.qna!.map((v) => v.toJson()).toList();
    }
    if (this.announcement != null) {
      data['announcement'] = this.announcement!.map((v) => v.toJson()).toList();
    }
    if (this.courses != null) {
      data['courses'] = this.courses!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class NotificationDataAnnouncementUser {
  String? idCourse;
  String? subject;
  String? titleCourse;
  String? messages;
  String? date;
  String? thumbnail;
  String? timestamps;
  String? instructor;
  int? isRead;
  String? idRead;
  String? ket;

  NotificationDataAnnouncementUser(
      {this.idCourse,
      this.subject,
      this.titleCourse,
      this.messages,
      this.date,
      this.thumbnail,
      this.timestamps,
      this.instructor,
      this.isRead,
      this.idRead,
      this.ket});

  NotificationDataAnnouncementUser.announcementFromJson(
      Map<String, dynamic> json) {
    idCourse = json['id_course'];
    subject = json['subject'];
    titleCourse = json['title_course'];
    thumbnail = json['thumbnail'];
    messages = json['messages'];
    date = json['date'];
    timestamps = json['timestamps'];
    instructor = json['name_instructure'];
    isRead = json['is_read'];
    idRead = json['id_read'];
    ket = json['ket'];
  }
}

class NotificationData {
  String? idCourse;
  String? subject;
  String? titleCourse;
  String? messages;
  String? date;
  String? thumbnail;
  String? timestamps;
  String? instructor;
  String? isRead;
  String? idRead;
  String? ket;

  NotificationData(
      {this.idCourse,
      this.subject,
      this.titleCourse,
      this.messages,
      this.date,
      this.thumbnail,
      this.timestamps,
      this.instructor,
      this.isRead,
      this.idRead,
      this.ket});

  NotificationData.qnaFromJson(Map<String, dynamic> json) {
    idCourse = json['id_course'];
    subject = json['subject'];
    titleCourse = json['title_course'];
    thumbnail = json['thumbnail'];
    messages = json['messages'];
    date = json['date'];
    timestamps = json['timestamps'].toString();
    instructor = json['name_instructure'];
    isRead = json['is_read'];
    idRead = json['id_read'];
    ket = json['ket'];
  }

  NotificationData.announcementFromJson(Map<String, dynamic> json) {
    subject = json['subject'];
    titleCourse = json['title_course'];
    messages = json['messages'];
    date = json['date'];
    idCourse = json['id_course'];
    timestamps = json['timestamps'];
    isRead = json['is_read'].toString();
    idRead = json['id_read'];
    ket = json['ket'];
    instructor = json['name_instructure'];
    thumbnail = json['thumbnail'];
  }

  NotificationData.coursesFromJson(Map<String, dynamic> json) {
    idCourse = json['id_course'];
    subject = json['subject'];
    titleCourse = json['title_course'];
    thumbnail = json['thumbnail'];
    messages = json['messages'];
    date = json['date'];
    timestamps = json['timestamps'];
    instructor = json['instructur_name'];
    isRead = json['is_read'];
    idRead = json['id_read'];
    ket = json['ket'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['subject'] = this.subject;
    data['title_course'] = this.titleCourse;
    data['messages'] = this.messages;
    data['date'] = this.date;
    return data;
  }
}

class Qna {
  String? subject;
  String? titleCourse;
  String? messages;
  String? date;

  Qna({this.subject, this.titleCourse, this.messages, this.date});

  Qna.fromJson(Map<String, dynamic> json) {
    subject = json['subject'];
    titleCourse = json['title_course'];
    messages = json['messages'];
    date = json['date'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['subject'] = this.subject;
    data['title_course'] = this.titleCourse;
    data['messages'] = this.messages;
    data['date'] = this.date;
    return data;
  }
}

class Announcement {
  String? subject;
  String? titleCourse;
  String? messages;
  String? date;

  Announcement({this.subject, this.titleCourse, this.messages, this.date});

  Announcement.fromJson(Map<String, dynamic> json) {
    subject = json['subject'];
    titleCourse = json['title_course'];
    messages = json['messages'];
    date = json['date'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['subject'] = this.subject;
    data['title_course'] = this.titleCourse;
    data['messages'] = this.messages;
    data['date'] = this.date;
    return data;
  }
}

class Courses {
  String? subject;
  String? title;
  String? thumbnail;
  String? date;

  Courses({this.subject, this.title, this.thumbnail, this.date});

  Courses.fromJson(Map<String, dynamic> json) {
    subject = json['subject'];
    title = json['title'];
    thumbnail = json['thumbnail'];
    date = json['date'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['subject'] = this.subject;
    data['title'] = this.title;
    data['thumbnail'] = this.thumbnail;
    data['date'] = this.date;
    return data;
  }
}

class Instructur {
  List<Qna>? qna;
  List<Announcement>? announcement;
  List<CoursesAdded>? coursesAdded;
  List<Payout>? payout;

  Instructur({this.qna, this.coursesAdded, this.payout, this.announcement});

  Instructur.fromJson(Map<String, dynamic> json) {
    if (json['qna'] != null) {
      qna = <Qna>[];
      json['qna'].forEach((v) {
        qna!.add(new Qna.fromJson(v));
      });
    }
    if (json['announcement'] != null) {
      announcement = <Announcement>[];
      json['announcement'].forEach((v) {
        announcement!.add(new Announcement.fromJson(v));
      });
    }
    if (json['courses_added'] != null) {
      coursesAdded = <CoursesAdded>[];
      json['courses_added'].forEach((v) {
        coursesAdded!.add(new CoursesAdded.fromJson(v));
      });
    }
    if (json['payout'] != null) {
      payout = <Payout>[];
      json['payout'].forEach((v) {
        payout!.add(new Payout.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.qna != null) {
      data['qna'] = this.qna!.map((v) => v.toJson()).toList();
    }
    if (this.announcement != null) {
      data['announcement'] = this.announcement!.map((v) => v.toJson()).toList();
    }
    if (this.coursesAdded != null) {
      data['courses_added'] =
          this.coursesAdded!.map((v) => v.toJson()).toList();
    }
    if (this.payout != null) {
      data['payout'] = this.payout!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class CoursesAdded {
  String? subject;
  String? title;
  String? time;

  CoursesAdded({this.subject, this.title, this.time});

  CoursesAdded.fromJson(Map<String, dynamic> json) {
    subject = json['subject'];
    title = json['title'];
    time = json['time'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['subject'] = this.subject;
    data['title'] = this.title;
    data['time'] = this.time;
    return data;
  }
}

class Payout {
  String? subject;
  String? message;
  String? date;

  Payout({this.subject, this.message, this.date});

  Payout.fromJson(Map<String, dynamic> json) {
    subject = json['subject'];
    message = json['message'];
    date = json['date'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['subject'] = this.subject;
    data['message'] = this.message;
    data['date'] = this.date;
    return data;
  }
}
