class PolicyDialogModel {
  String title;
  String titleColor;
  String content;
  String contentColor;
  List<PolicyItemModel> selectedText;
  String selectedColor;
  PolicyDialogModel subDialog;
  String leftBfnText;
  String leftBfnTextColor;
  String leftBfnBgColor;
  String rightBfnText;
  String rightBfnTextColor;
  String rightBfnBgColor;

  PolicyDialogModel(
      {this.title,
      this.titleColor,
      this.content,
      this.contentColor,
      this.selectedText,
      this.selectedColor,
      this.subDialog,
      this.leftBfnText,
      this.leftBfnTextColor,
      this.leftBfnBgColor,
      this.rightBfnText,
      this.rightBfnTextColor,
      this.rightBfnBgColor});

  PolicyDialogModel.fromJson(Map<String, dynamic> json) {
    title = json['title'];
    titleColor = json['title_color'];
    content = json['content'];
    contentColor = json['content_color'];
    if (json['selected_text'] != null) {
      selectedText = new List<PolicyItemModel>();
      json['selected_text'].forEach((v) {
        selectedText.add(new PolicyItemModel.fromJson(v));
      });
    }
    selectedColor = json['selected_color'];
    subDialog = json['sub_dialog'] != null
        ? new PolicyDialogModel.fromJson(json['sub_dialog'])
        : null;
    leftBfnText = json['left_bfn_text'];
    leftBfnTextColor = json['left_bfn_text_color'];
    leftBfnBgColor = json['left_bfn_bg_color'];
    rightBfnText = json['right_bfn_text'];
    rightBfnTextColor = json['right_bfn__text_color'];
    rightBfnBgColor = json['right_bfn_bg_color'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['title'] = this.title;
    data['title_color'] = this.titleColor;
    data['content'] = this.content;
    data['content_color'] = this.contentColor;
    if (this.selectedText != null) {
      data['selected_text'] = this.selectedText.map((v) => v.toJson()).toList();
    }
    data['selected_color'] = this.selectedColor;
    if (this.subDialog != null) {
      data['sub_dialog'] = this.subDialog.toJson();
    }
    data['left_bfn_text'] = this.leftBfnText;
    data['left_bfn_text_color'] = this.leftBfnTextColor;
    data['left_bfn_bg_color'] = this.leftBfnBgColor;
    data['right_bfn_text'] = this.rightBfnText;
    data['right_bfn__text_color'] = this.rightBfnTextColor;
    data['right_bfn_bg_color'] = this.rightBfnBgColor;
    return data;
  }
}

class PolicyItemModel {
  String key;
  String text;
  String url;

  PolicyItemModel({this.key, this.text, this.url});

  PolicyItemModel.fromJson(Map<String, dynamic> json) {
    key = json['key'];
    text = json['text'];
    url = json['url'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['key'] = this.key;
    data['text'] = this.text;
    data['url'] = this.url;
    return data;
  }
}
