/*
 * @Author: WuXiangNan
 * @Date: 2021-05-31 14:17:03
 * @LastEditors: WuXiangNan
 * @LastEditTime: 2021-06-01 10:06:00
 * @Description: 公司项目下的小区
 */

import 'package:business_package/src/models/community/communities.dart';

class CommunityData {
  String? companyName;
  String? companyId;
  bool? isSelected = false;
  List<Communities>? communities;

  CommunityData(
      {this.communities,
      this.companyId,
      this.companyName,
      this.isSelected = false});

  CommunityData.fromJson(json) {
    Map<String, dynamic> map = Map.from(json ?? {});
    companyName = map['companyName'];
    companyId = map['companyId'];
    communities = List<Communities>.from(
        (map['communities'] ?? []).map((x) => Communities.fromJson(x)));
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = Map<String, dynamic>();
    json['companyName'] = this.companyName;
    json['companyId'] = this.companyId;
    json['communities'] =
        List<Communities>.from(this.communities ?? []).map((x) => x.toJson());
    json['isSelected'] = this.isSelected;

    return json;
  }
}
