import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_header_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_list_style_model.dart';

class HomeGoodsStyleModel {
  String topMargin;
  String leftRighMargin;
  String subtitle;
  String tilteTextColor;
  String subtitleTextColor;
  String tilteTextSelectedColor;
  String subtitleTextSelectedColor;
  String subtitleBgColor;
  String sourceType;
  List<HomeGoodsHeaderModel> recommendList;
  String listColumn;
  HomeGoodsListStyleModel listStyle;

  String title;
  String titleColor;
  String recIcon;

  HomeGoodsStyleModel({
    this.topMargin,
    this.leftRighMargin,
    this.subtitle,
    this.tilteTextColor,
    this.subtitleTextColor,
    this.tilteTextSelectedColor,
    this.subtitleTextSelectedColor,
    this.subtitleBgColor,
    this.sourceType,
    this.recommendList,
    this.listColumn,
    this.listStyle,
    this.title,
    this.titleColor,
    this.recIcon,
  });

  HomeGoodsStyleModel.fromJson(Map<String, dynamic> json) {
    topMargin = json['top_margin'];
    leftRighMargin = json['left_righ_margin'];
    subtitle = json['subtitle'];
    tilteTextColor = json['tilte_text_color'];
    subtitleTextColor = json['subtitle_text_color'];
    tilteTextSelectedColor = json['tilte_text_selected_color'];
    subtitleTextSelectedColor = json['subtitle_text_selected_color'];
    subtitleBgColor = json['subtitle_bg_color'];
    sourceType = json['source_type'];
    if (json['recommend_list'] != null) {
      recommendList = new List<HomeGoodsHeaderModel>();
      json['recommend_list'].forEach((v) {
        recommendList.add(new HomeGoodsHeaderModel.fromJson(v));
      });
    }
    listColumn = json['list_column'];
    listStyle = json['list_style'] != null ? new HomeGoodsListStyleModel.fromJson(json['list_style']) : null;
    title = json['title'];
    titleColor = json['title_color'];
    recIcon = json['rec_icon'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['top_margin'] = this.topMargin;
    data['left_righ_margin'] = this.leftRighMargin;
    data['subtitle'] = this.subtitle;
    data['tilte_text_color'] = this.tilteTextColor;
    data['subtitle_text_color'] = this.subtitleTextColor;
    data['tilte_text_selected_color'] = this.tilteTextSelectedColor;
    data['subtitle_text_selected_color'] = this.subtitleTextSelectedColor;
    data['subtitle_bg_color'] = this.subtitleBgColor;
    data['source_type'] = this.sourceType;
    if (this.recommendList != null) {
      data['recommend_list'] = this.recommendList.map((v) => v.toJson()).toList();
    }
    data['list_column'] = this.listColumn;
    if (this.listStyle != null) {
      data['list_style'] = this.listStyle.toJson();
    }
    data['title'] = this.title;
    data['title_color'] = this.titleColor;
    data['rec_icon'] = this.recIcon;
    return data;
  }
}
