import 'package:zhiying_comm/zhiying_comm.dart';

class HomeNoticeModel {
  String logo_img;
  String jump_img;
  String bg_color;
  String text_color;
  String duration_time;

  List<HomeNoticeNoticesModel> notices;

  HomeNoticeModel({this.notices, this.logo_img, this.jump_img, this.bg_color, this.text_color, this.duration_time});

  factory HomeNoticeModel.fromJson(Map<String, dynamic> json) {
    return HomeNoticeModel(
      logo_img: json['logo_img']?.toString(),
      jump_img: json['jump_img']?.toString(),
      bg_color: json['bg_color']?.toString(),
      text_color: json['text_color']?.toString(),
      duration_time: json['duration_time']?.toString(),
      notices: json['notices'] != null ? (json['notices'] as List).map((i) => HomeNoticeNoticesModel.fromJson(i)).toList() : null,
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();

    data['duration_time'] = this.duration_time;
    data['text_color'] = this.text_color;
    data['bg_color'] = this.bg_color;
    data['jump_img'] = this.jump_img;
    data['logo_img'] = this.logo_img;

    if (this.notices != null) {
      data['notices'] = this.notices.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class HomeNoticeNoticesModel{
  String notice_text;
  String skip_identifier;

  HomeNoticeNoticesModel({this.notice_text, this.skip_identifier});

  factory HomeNoticeNoticesModel.fromJson(Map<String, dynamic> json) {
    return HomeNoticeNoticesModel(
      notice_text: json['notice_text']?.toString(),
      skip_identifier: json['skip_identifier']?.toString(),
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['img'] = this.notice_text;
    data['skip_identifier'] = this.skip_identifier;
    return data;
  }
}
