class SearchResultSortModel {
  String coupin_icon;
  String coupin_icon_with_color;
  String layout_icon_1;
  String layout_icon_2;
  List<SearchResultItemSort> sort_list;
  String text_no_select_color;
  String text_select_color;

  /// 是否展示1列
  bool isShowOneColumn;
  String keywords;

  SearchResultSortModel({
    this.coupin_icon,
    this.coupin_icon_with_color,
    this.layout_icon_1,
    this.layout_icon_2,
    this.sort_list,
    this.text_no_select_color,
    this.text_select_color,
    this.isShowOneColumn,
    this.keywords,
  });

  factory SearchResultSortModel.fromJson(Map<String, dynamic> json) {
    return SearchResultSortModel(
      coupin_icon: json['coupin_icon'],
      coupin_icon_with_color: json['coupin_icon_with_color'],
      layout_icon_1: json['layout_icon_1'],
      layout_icon_2: json['layout_icon_2'],
      sort_list: json['sort_list'] != null ? (json['sort_list'] as List).map((i) => SearchResultItemSort.fromJson(i)).toList() : null,
      text_no_select_color: json['text_no_select_color'],
      text_select_color: json['text_select_color'],
      isShowOneColumn: json['isShowOneColumn'] ?? false,
      keywords: json['keywords'],
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['coupin_icon'] = this.coupin_icon;
    data['coupin_icon_with_color'] = this.coupin_icon_with_color;
    data['layout_icon_1'] = this.layout_icon_1;
    data['layout_icon_2'] = this.layout_icon_2;
    data['text_no_select_color'] = this.text_no_select_color;
    data['text_select_color'] = this.text_select_color;
    if (this.sort_list != null) {
      data['sort_list'] = this.sort_list.map((v) => v.toJson()).toList();
    }
    data['isShowOneColumn'] = this.isShowOneColumn;
    data['keywords'] = this.keywords;
    return data;
  }
}

class SearchResultItemSort {
  String name;
  bool isSelect;
  List<SearchResultSortSelect> select_list;
  String type;
  String icon_1;
  String icon_2;
  String icon_3;
  String state;

  SearchResultItemSort({
    this.name,
    this.select_list,
    this.isSelect,
    this.type,
    this.icon_1,
    this.icon_2,
    this.icon_3,
    this.state,
  });

  factory SearchResultItemSort.fromJson(Map<String, dynamic> json) {
    return SearchResultItemSort(
      name: json['name'],
      isSelect: json['isSelect'] ?? false,
      select_list: json['select_list'] != null ? (json['select_list'] as List).map((i) => SearchResultSortSelect.fromJson(i)).toList() : null,
      type: json['type']?.toString(),
      icon_1: json['icon_1']?.toString(),
      icon_2: json['icon_2']?.toString(),
      icon_3: json['icon_3']?.toString(),
        state: json['state'] ?? '0',
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['isSelect'] = this.isSelect;
    if (this.select_list != null) {
      data['select_list'] = this.select_list.map((v) => v.toJson()).toList();
    }
    data['type'] = this.type;
    data['icon_1'] = this.icon_1;
    data['icon_2'] = this.icon_2;
    data['icon_3'] = this.icon_3;
    data['state'] = this.state;
    return data;
  }
}

class SearchResultSortSelect {
  String id;
  String name;
  String query_args;
  bool isSelect;

  SearchResultSortSelect({this.name, this.query_args, this.id, this.isSelect});

  factory SearchResultSortSelect.fromJson(Map<String, dynamic> json) {
    return SearchResultSortSelect(
      name: json['name'],
      query_args: json['query_args'],
      id: json['id'],
      isSelect: json['isSelect'] ?? false,
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['query_args'] = this.query_args;
    data['id'] = this.id;
    data['isSelect'] = this.isSelect;
    return data;
  }
}
