import 'package:zhiying_comm/zhiying_comm.dart';

class SecurityStyleModel {
  String appBarName;
  String appBarNameColor;
  String appBarBgColor;
  String accountDeleteText;
  String accountDeleteTextColor;
  String settingsBgColor;
  List<SecurityStyleItemModel> settings;

  SecurityStyleModel(
      {this.appBarName,
      this.appBarNameColor,
      this.appBarBgColor,
      this.accountDeleteText,
      this.accountDeleteTextColor,
      this.settingsBgColor,
      this.settings});

  SecurityStyleModel.fromJson(Map<String, dynamic> json) {
    appBarName = json['app_bar_name'];
    appBarNameColor = json['app_bar_name_color'];
    appBarBgColor = json['app_bar_bg_color'];
    accountDeleteText = json['account_delete_text'];
    accountDeleteTextColor = json['account_delete_text_color'];
    settingsBgColor = json['settings_bg_color'];
    if (json['settings'] != null) {
      settings = new List<SecurityStyleItemModel>();
      json['settings'].forEach((v) {
        settings.add(new SecurityStyleItemModel.fromJson(v));
      });
    }
  }

  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_color'] = this.appBarBgColor;
    data['account_delete_text'] = this.accountDeleteText;
    data['account_delete_text_color'] = this.accountDeleteTextColor;
    data['settings_bg_color'] = this.settingsBgColor;
    if (this.settings != null) {
      data['settings'] = this.settings.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class SecurityStyleItemModel extends SkipModel {
  List<String> dataKeys;
  String name;
  String nameColor;
  String descColor;

  // 绑定状态，本地标记
  String desc;

  SecurityStyleItemModel(
      {this.dataKeys, this.name, this.nameColor, this.descColor});

  SecurityStyleItemModel.fromJson(Map<String, dynamic> json) {
    super.fromJson(json);
    dataKeys = json['data_keys'].cast<String>();
    name = json['name'];
    nameColor = json['name_color'];
    descColor = json['desc_color'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = super.toJson();
    data['data_keys'] = this.dataKeys;
    data['name'] = this.name;
    data['name_color'] = this.nameColor;
    data['desc_color'] = this.descColor;

    return data;
  }
}
