import 'dart:convert' as Con;

class MessageNoticeDataModel {
  List<MessageNoticeDataItemModel> list;

  MessageNoticeDataModel({this.list});

  MessageNoticeDataModel.fromJson(Map<String, dynamic> json) {
    if (json['list'] != null) {
      list = new List<MessageNoticeDataItemModel>();
      json['list'].forEach((v) {
        list.add(new MessageNoticeDataItemModel.fromJson(v));
      });
    }
  }

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

class MessageNoticeDataItemModel {
  String unreadCount;
  String type;
  int id;
  int receiver;
  String content;
  String skipIdentifier;
  int status;
  String dateTime;
  MessageContent messageContent;

  MessageNoticeDataItemModel({this.unreadCount, this.type, this.id, this.receiver, this.content, this.skipIdentifier, this.status, this.dateTime});

  MessageNoticeDataItemModel.fromJson(Map<String, dynamic> json) {
    unreadCount = json['unread_count'];
    type = json['type'];
    id = json['id'];
    receiver = json['receiver'];
    content = json['content'];
    skipIdentifier = json['skip_identifier'];
    status = json['status'];
    dateTime = json['date_time'];
    if(json['content']!=null){
      messageContent=MessageContent.fromJson(Con.json.decode(json['content']));
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['unread_count'] = this.unreadCount;
    data['type'] = this.type;
    data['id'] = this.id;
    data['receiver'] = this.receiver;
    data['content'] = this.content;
    data['skip_identifier'] = this.skipIdentifier;
    data['status'] = this.status;
    data['date_time'] = this.dateTime;
    return data;
  }
}

class MessageContent {
  String title;
  String content;
  String image;

  MessageContent({this.title, this.content, this.image});

  MessageContent.fromJson(Map<String, dynamic> json) {
    title = json['title'];
    content = json['content'];
    image = json['image'];
  }

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