import 'package:zhiying_base_widget/pages/invited_friends/models/invite_friend_data_model.dart';
import 'package:zhiying_comm/models/base/skip_model.dart';

class InvitedFriendsModel {
  String appBarName;
  String appBarNameColor;
  String appBarBgImg;
  String appBarBgColor;
  String appBarRightBtnIcon;
  String appBarRightBtnText;
  String appBarRightBtnTextColor;
  String bgColor;
  String bgImg;
  List<String> posterList;
  String whiteOutlineImg;
  InvitedWechatTeacherModel wechatTip;
  InvitedFriendsBottomModel bottom;
  InvitedFriendsDataModel dataModel; // 数据

  InvitedFriendsModel(
      {this.appBarName,
      this.appBarNameColor,
      this.appBarBgImg,
      this.appBarBgColor,
      this.appBarRightBtnIcon,
      this.appBarRightBtnText,
      this.appBarRightBtnTextColor,
      this.bgColor,
      this.bgImg,
      this.posterList,
      this.whiteOutlineImg,
      this.wechatTip,
      this.bottom});

  InvitedFriendsModel.fromJson(Map<String, dynamic> json) {
    appBarName = json['app_bar_name'];
    appBarNameColor = json['app_bar_name_color'];
    appBarBgImg = json['app_bar_bg_img'];
    appBarBgColor = json['app_bar_bg_color'];
    appBarRightBtnIcon = json['app_bar_right_btn_icon'];
    appBarRightBtnText = json['app_bar_right_btn_text'];
    appBarRightBtnTextColor = json['app_bar_right_btn_text_color'];
    bgColor = json['bg_color'];
    bgImg = json['bg_img'];
    posterList = json['poster_list'].cast<String>();
    whiteOutlineImg = json['white_outline_img'];
    wechatTip = json['wechat_tip'] != null
        ? new InvitedWechatTeacherModel.fromJson(json['wechat_tip'])
        : null;
    bottom = json['bottom'] != null
        ? new InvitedFriendsBottomModel.fromJson(json['bottom'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['app_bar_name'] = this.appBarName;
    data['app_bar_name_color'] = this.appBarNameColor;
    data['app_bar_bg_img'] = this.appBarBgImg;
    data['app_bar_bg_color'] = this.appBarBgColor;
    data['app_bar_right_btn_icon'] = this.appBarRightBtnIcon;
    data['app_bar_right_btn_text'] = this.appBarRightBtnText;
    data['app_bar_right_btn_text_color'] = this.appBarRightBtnTextColor;
    data['bg_color'] = this.bgColor;
    data['bg_img'] = this.bgImg;
    data['poster_list'] = this.posterList;
    data['white_outline_img'] = this.whiteOutlineImg;
    if (this.wechatTip != null) {
      data['wechat_tip'] = this.wechatTip.toJson();
    }
    if (this.bottom != null) {
      data['bottom'] = this.bottom.toJson();
    }
    return data;
  }
}

class InvitedWechatTeacherModel {
  String icon;
  String bgColor;
  InvitedWechatTeacherSkipModel toWechatTeacher;
  InvitedWechatTeacherSkipModel toInputWechatUsername;
  String btnTextColor;
  String btnBgColor;

  InvitedWechatTeacherModel(
      {this.icon,
      this.bgColor,
      this.toWechatTeacher,
      this.toInputWechatUsername,
      this.btnTextColor,
      this.btnBgColor});

  InvitedWechatTeacherModel.fromJson(Map<String, dynamic> json) {
    icon = json['icon'];
    bgColor = json['bg_color'];
    toWechatTeacher = json['to_wechat_teacher'] != null
        ? new InvitedWechatTeacherSkipModel.fromJson(json['to_wechat_teacher'])
        : null;
    toInputWechatUsername = json['to_input_wechat_username'] != null
        ? new InvitedWechatTeacherSkipModel.fromJson(
            json['to_input_wechat_username'])
        : null;
    btnTextColor = json['btn_text_color'];
    btnBgColor = json['btn_bg_color'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['icon'] = this.icon;
    data['bg_color'] = this.bgColor;
    if (this.toWechatTeacher != null) {
      data['to_wechat_teacher'] = this.toWechatTeacher.toJson();
    }
    if (this.toInputWechatUsername != null) {
      data['to_input_wechat_username'] = this.toInputWechatUsername.toJson();
    }
    data['btn_text_color'] = this.btnTextColor;
    data['btn_bg_color'] = this.btnBgColor;
    return data;
  }
}

class InvitedWechatTeacherSkipModel extends SkipModel {
  String type;
  String btnText;
  String tipText;
  String tipTextColor;

  InvitedWechatTeacherSkipModel({
    this.type,
    this.btnText,
    this.tipText,
    this.tipTextColor,
  });

  InvitedWechatTeacherSkipModel.fromJson(Map<String, dynamic> json) {
    super.fromJson(json);
    type = json['type'];
    btnText = json['btn_text'];
    tipText = json['tip_text'];
    tipTextColor = json['tip_text_color'];
    skipIdentifier = json['skip_identifier'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = super.toJson();
    data['type'] = this.type;
    data['btn_text'] = this.btnText;
    data['tip_text'] = this.tipText;
    data['tip_text_color'] = this.tipTextColor;
    data['skip_identifier'] = this.skipIdentifier;
    return data;
  }
}

class InvitedFriendsBottomModel {
  String bgColor;
  String tipText;
  String tipTextColor;
  List<InvitedFriendsButtonModel> btns;

  InvitedFriendsBottomModel(
      {this.bgColor, this.tipText, this.tipTextColor, this.btns});

  InvitedFriendsBottomModel.fromJson(Map<String, dynamic> json) {
    bgColor = json['bg_color'];
    tipText = json['tip_text'];
    tipTextColor = json['tip_text_color'];
    if (json['btns'] != null) {
      btns = new List<InvitedFriendsButtonModel>();
      json['btns'].forEach((v) {
        btns.add(new InvitedFriendsButtonModel.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['bg_color'] = this.bgColor;
    data['tip_text'] = this.tipText;
    data['tip_text_color'] = this.tipTextColor;
    if (this.btns != null) {
      data['btns'] = this.btns.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class InvitedFriendsButtonModel {
  String type;
  String text;
  String textColor;
  String icon;
  String bgColor;
  String bgColorT;
  String skipIdentifier;

  InvitedFriendsButtonModel(
      {this.type,
      this.text,
      this.textColor,
      this.icon,
      this.bgColor,
      this.bgColorT,
      this.skipIdentifier});

  InvitedFriendsButtonModel.fromJson(Map<String, dynamic> json) {
    type = json['type'];
    text = json['text'];
    textColor = json['text_color'];
    icon = json['icon'];
    bgColor = json['bg_color'];
    bgColorT = json['bg_color_t'];
    skipIdentifier = json['skip_identifier'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['type'] = this.type;
    data['text'] = this.text;
    data['text_color'] = this.textColor;
    data['icon'] = this.icon;
    data['bg_color'] = this.bgColor;
    data['bg_color_t'] = this.bgColorT;
    data['skip_identifier'] = this.skipIdentifier;
    return data;
  }
}
