import 'package:zhiying_comm/zhiying_comm.dart';

class UpgradeTipModel {

  String url;

  String name;
  String desc;
  String icon;
  String moduleType;
  String moduleKey;
  String isTopMargin;
  String isLeftRightMargin;
  String isShow;
  String topMargin;
  String leftRightMargin;
  String topLeftRadius;
  String topRightRadius;
  String bottomLeftRadius;
  String bottomRightRadius;
  String bgColor;
  String bulletinText;
  String bulletinBgColor;
  String bulletinTextColor;
  String goText;
  GoSkip goSkip;

  UpgradeTipModel({
    this.name,
    this.desc,
    this.icon,
    this.moduleType,
    this.moduleKey,
    this.isTopMargin,
    this.isLeftRightMargin,
    this.isShow,
    this.topMargin,
    this.leftRightMargin,
    this.topLeftRadius,
    this.topRightRadius,
    this.bottomLeftRadius,
    this.bottomRightRadius,
    this.bgColor,
    this.bulletinText,
    this.bulletinBgColor,
    this.bulletinTextColor,
    this.goText,
    this.goSkip,
    this.url,
  });

  UpgradeTipModel.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    desc = json['desc'];
    icon = json['icon'];
    moduleType = json['module_type'];
    moduleKey = json['module_key'];
    isTopMargin = json['is_top_margin'];
    isLeftRightMargin = json['is_left_right_margin'];
    isShow = json['is_show'];
    topMargin = json['top_margin'];
    leftRightMargin = json['left_right_margin'];
    topLeftRadius = json['top_left_radius'];
    topRightRadius = json['top_right_radius'];
    bottomLeftRadius = json['bottom_left_radius'];
    bottomRightRadius = json['bottom_right_radius'];
    bgColor = json['bg_color'];
    bulletinText = json['bulletin_text'];
    bulletinBgColor = json ['bulletin_bg_color'];
    bulletinTextColor = json['bulletin_text_color'];
    goText = json['go_text'];
    goSkip =
    json['go_skip'] != null ? new GoSkip.fromJson(json['go_skip']) : null;

    url = json['url'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['desc'] = this.desc;
    data['icon'] = this.icon;
    data['module_type'] = this.moduleType;
    data['module_key'] = this.moduleKey;
    data['is_top_margin'] = this.isTopMargin;
    data['is_left_right_margin'] = this.isLeftRightMargin;
    data['is_show'] = this.isShow;
    data['top_margin'] = this.topMargin;
    data['left_right_margin'] = this.leftRightMargin;
    data['top_left_radius'] = this.topLeftRadius;
    data['top_right_radius'] = this.topRightRadius;
    data['bottom_left_radius'] = this.bottomLeftRadius;
    data['bottom_right_radius'] = this.bottomRightRadius;
    data['bg_color'] = this.bgColor;
    data['bulletin_text'] = this.bulletinText;
    data['bulletin_bg_color'] = this.bulletinBgColor;
    data['bulletin_text_color'] = this.bulletinTextColor;
    data['go_text'] = this.goText;
    if (this.goSkip != null) {
      data['go_skip'] = this.goSkip.toJson();
    }

    data['url'] = this.url;
    return data;
  }

}

class GoSkip extends SkipModel {
  String requiredLogin;
  String requiredTaobaoAuth;
  String isJump;
  String skipIdentifier;

  GoSkip({this.requiredLogin,
    this.requiredTaobaoAuth,
    this.isJump,
    this.skipIdentifier});

  GoSkip.fromJson(Map<String, dynamic> json) {
    super.fromJson(json);
    requiredLogin = json['required_login'];
    requiredTaobaoAuth = json['required_taobao_auth'];
    isJump = json['is_jump'];
    skipIdentifier = json['skip_identifier'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = super.toJson();
    data['required_login'] = this.requiredLogin;
    data['required_taobao_auth'] = this.requiredTaobaoAuth;
    data['is_jump'] = this.isJump;
    data['skip_identifier'] = this.skipIdentifier;
    return data;
  }
}
