import 'package:zhiying_comm/zhiying_comm.dart';

class CustomSlideBannerModel {
  String name;
  String desc;
  String pagination;
  String moduleType;
  String moduleKey;
  String isTopMargin;
  String isLeftRightMargin;
  String isShow;
  String carouselType;
  String paginationSelectColor;
  String paginationUnselectColor;
  String barWidthHeightRatio;
  String bgWidthHeightRatio;
  String carouselTime;
  String topMargin;
  String leftRightMargin;
  String bgColor;
  String bgColor2;
  List<IndexCarouselList> indexCarouselList;
  int moduleKeyId;
  String topLeftRadius;
  String topRightRadius;
  String bottomLeftRadius;
  String bottomRightRadius;


  CustomSlideBannerModel({
    this.name,
    this.desc,
    this.pagination,
    this.moduleType,
    this.moduleKey,
    this.isTopMargin,
    this.isLeftRightMargin,
    this.isShow,
    this.carouselType,
    this.paginationSelectColor,
    this.paginationUnselectColor,
    this.barWidthHeightRatio,
    this.bgWidthHeightRatio,
    this.carouselTime,
    this.topMargin,
    this.leftRightMargin,
    this.indexCarouselList,
    this.moduleKeyId,
    this.bgColor,
    this.bgColor2
  });

  CustomSlideBannerModel.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    desc = json['desc'];
    pagination = json['pagination'];
    moduleType = json['module_type'];
    moduleKey = json['module_key'];
    isTopMargin = json['is_top_margin'];
    isLeftRightMargin = json['is_left_right_margin'];
    isShow = json['is_show'];
    carouselType = json['carousel_type'];
    paginationSelectColor = json['pagination_select_color'];
    paginationUnselectColor = json['pagination_unselect_color'];
    barWidthHeightRatio = json['bar_width_height_ratio'];
    bgWidthHeightRatio = json['bg_width_height_ratio'];
    carouselTime = json['carousel_time'];
    topMargin = json['top_margin'];
    leftRightMargin = json['left_right_margin'];
    bgColor=json['bg_color'];
    bgColor2=json['bg_color2'];
    topLeftRadius=json['top_left_radius'];
    topRightRadius=json['top_right_radius'];
    bottomRightRadius=json['bottom_right_radius'];
    bottomLeftRadius=json['bottom_left_radius'];
    if (json['index_carousel_list'] != null) {
      indexCarouselList = new List<IndexCarouselList>();
      json['index_carousel_list'].forEach((v) {
        indexCarouselList.add(new IndexCarouselList.fromJson(v));
      });
    }
    moduleKeyId = json['module_key_id'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['desc'] = this.desc;
    data['pagination'] = this.pagination;
    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['carousel_type'] = this.carouselType;
    data['pagination_select_color'] = this.paginationSelectColor;
    data['pagination_unselect_color'] = this.paginationUnselectColor;
    data['bar_width_height_ratio'] = this.barWidthHeightRatio;
    data['bg_width_height_ratio'] = this.bgWidthHeightRatio;
    data['carousel_time'] = this.carouselTime;
    data['top_margin'] = this.topMargin;
    data['left_right_margin'] = this.leftRightMargin;
    if (this.indexCarouselList != null) {
      data['index_carousel_list'] = this.indexCarouselList.map((v) => v.toJson()).toList();
    }
    data['module_key_id'] = this.moduleKeyId;
    return data;
  }
}

class IndexCarouselList extends SkipModel {
  String name;
  String img;
  String bgColor;
  String requiredLogin;
  String requiredTaobaoAuth;
  String skipIdentifier;

  IndexCarouselList({this.name, this.img, this.bgColor, this.requiredLogin, this.requiredTaobaoAuth, this.skipIdentifier});

  IndexCarouselList.fromJson(Map<String, dynamic> json) {
    super.fromJson(json);
    name = json['name'];
    img = json['img'];
    bgColor = json['bg_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['img'] = this.img;
    data['bg_color'] = this.bgColor;
    data['required_login'] = this.requiredLogin;
    data['required_taobao_auth'] = this.requiredTaobaoAuth;
    data['skip_identifier'] = this.skipIdentifier;
    return data;
  }
}
