import 'package:zhiying_comm/zhiying_comm.dart';

class CustomSearchModel {
  String name;
  String desc;
  String moduleType;
  String moduleKey;
  String isTopMargin;
  String isLeftRightMargin;
  String isShow;
  String topMargin;
  String leftRightMargin;
  String topLeftRadius;
  String topRightRadius;
  String bottomLeftRadius;
  String bottomRightRadius;
  String bgColor;
  ListStyle listStyle;

  CustomSearchModel({
    this.name,
    this.desc,
    this.moduleType,
    this.moduleKey,
    this.isTopMargin,
    this.isLeftRightMargin,
    this.isShow,
    this.topMargin,
    this.leftRightMargin,
    this.bgColor,
    this.listStyle,
    this.topLeftRadius,
    this.topRightRadius,
    this.bottomLeftRadius,
    this.bottomRightRadius,
  });

  CustomSearchModel.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    desc = json['desc'];
    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'];
    bgColor = json['bg_color'];
    topLeftRadius = json['top_left_radius'];
    topRightRadius = json['top_right_radius'];
    bottomLeftRadius = json['bottom_left_radius'];
    bottomRightRadius = json['bottom_right_radius'];
    listStyle = json['list_style'] != null ? new ListStyle.fromJson(json['list_style']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['desc'] = this.desc;
    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['bg_color'] = this.bgColor;
    data['top_left_radius'] = this.topLeftRadius;
    data['top_right_radius'] = this.topRightRadius;
    data['bottom_left_radius'] = this.bottomLeftRadius;
    data['bottom_right_radius'] = this.bottomRightRadius;
    if (this.listStyle != null) {
      data['list_style'] = this.listStyle.toJson();
    }
    return data;
  }
}

class ListStyle {
  SearchCss searchCss;
  RightCss rightCss;

  ListStyle({this.searchCss, this.rightCss});

  ListStyle.fromJson(Map<String, dynamic> json) {
    searchCss = json['search_css'] != null ? new SearchCss.fromJson(json['search_css']) : null;
    rightCss = json['right_css'] != null ? new RightCss.fromJson(json['right_css']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.searchCss != null) {
      data['search_css'] = this.searchCss.toJson();
    }
    if (this.rightCss != null) {
      data['right_css'] = this.rightCss.toJson();
    }
    return data;
  }
}

class SearchCss extends SkipModel {
  String name;
  String text;
  String image;
  String bgColor;
  String textColor;
  String requiredLogin;
  String requiredTaobaoAuth;
  String skipIdentifier;

  SearchCss({this.name, this.text, this.image, this.bgColor, this.textColor, this.requiredLogin, this.requiredTaobaoAuth, this.skipIdentifier});

  SearchCss.fromJson(Map<String, dynamic> json) {
    super.fromJson(json);
    name = json['name'];
    text = json['text'];
    image = json['image'];
    bgColor = json['bg_color'];
    textColor = json['text_color'];
    requiredLogin = json['required_login'];
    requiredTaobaoAuth = json['required_taobao_auth'];
    skipIdentifier = json['skip_identifier'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = super.toJson();
    data['name'] = this.name;
    data['text'] = this.text;
    data['image'] = this.image;
    data['bg_color'] = this.bgColor;
    data['text_color'] = this.textColor;
    data['required_login'] = this.requiredLogin;
    data['required_taobao_auth'] = this.requiredTaobaoAuth;
    data['skip_identifier'] = this.skipIdentifier;
    return data;
  }
}

class RightCss extends SkipModel {
  String name;
  String text;
  String type;
  String image;
  String requiredLogin;
  String requiredTaobaoAuth;
  String skipIdentifier;

  RightCss({this.name, this.text, this.type, this.image, this.requiredLogin, this.requiredTaobaoAuth, this.skipIdentifier});

  RightCss.fromJson(Map<String, dynamic> json) {
    super.fromJson(json);
    name = json['name'];
    text = json['text'];
    type = json['type'];
    image = json['image'];
    requiredLogin = json['required_login'];
    requiredTaobaoAuth = json['required_taobao_auth'];
    skipIdentifier = json['skip_identifier'];
  }

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