import 'package:zhiying_comm/models/base/skip_model.dart';

class WalletHeaderModel extends SkipModel {
  String headerImg;
  String headerAvatar;
  String headerCashOutText;
  String headerCashOutTextColor;
  String headerCashOutKey;
  String headerCashOutBtnText;
  String headerCashOutBtnTextColor;
  String headerCashOutBtnImg;
  String skipIdentifier;
  String requiredLogin;
  String requiredTaobaoAuth;
  List<HeaderBottomList> headerBottomList;

  WalletHeaderModel(
      {this.headerImg,
        this.headerAvatar,
        this.headerCashOutText,
        this.headerCashOutTextColor,
        this.headerCashOutKey,
        this.headerCashOutBtnText,
        this.headerCashOutBtnTextColor,
        this.headerCashOutBtnImg,
        this.skipIdentifier,
        this.requiredLogin,
        this.requiredTaobaoAuth,
        this.headerBottomList});

  WalletHeaderModel.fromJson(Map<String, dynamic> json) {
    headerImg = json['header_img'];
    headerAvatar = json['header_avatar'];
    headerCashOutText = json['header_cash_out_text'];
    headerCashOutTextColor = json['header_cash_out_text_color'];
    headerCashOutKey = json['header_cash_out_key'];
    headerCashOutBtnText = json['header_cash_out_btn_text'];
    headerCashOutBtnTextColor = json['header_cash_out_btn_text_color'];
    headerCashOutBtnImg = json['header_cash_out_btn_img'];
    skipIdentifier = json['skip_identifier'];
    requiredLogin = json['required_login'];
    requiredTaobaoAuth = json['required_taobao_auth'];
    if (json['header_bottom_list'] != null) {
      headerBottomList = new List<HeaderBottomList>();
      json['header_bottom_list'].forEach((v) {
        headerBottomList.add(new HeaderBottomList.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['header_img'] = this.headerImg;
    data['header_avatar'] = this.headerAvatar;
    data['header_cash_out_text'] = this.headerCashOutText;
    data['header_cash_out_text_color'] = this.headerCashOutTextColor;
    data['header_cash_out_key'] = this.headerCashOutKey;
    data['header_cash_out_btn_text'] = this.headerCashOutBtnText;
    data['header_cash_out_btn_text_color'] = this.headerCashOutBtnTextColor;
    data['header_cash_out_btn_img'] = this.headerCashOutBtnImg;
    data['skip_identifier'] = this.skipIdentifier;
    data['required_login'] = this.requiredLogin;
    data['required_taobao_auth'] = this.requiredTaobaoAuth;
    if (this.headerBottomList != null) {
      data['header_bottom_list'] =
          this.headerBottomList.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class HeaderBottomList {
  String text;
  String textColor;
  String valueColor;
  String valueKey;

  HeaderBottomList({this.text, this.textColor, this.valueColor, this.valueKey});

  HeaderBottomList.fromJson(Map<String, dynamic> json) {
    text = json['text'];
    textColor = json['text_color'];
    valueColor = json['value_color'];
    valueKey = json['value_key'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['text'] = this.text;
    data['text_color'] = this.textColor;
    data['value_color'] = this.valueColor;
    data['value_key'] = this.valueKey;
    return data;
  }
}
