/*
 * @Author: XianKaiQun
 * @Date: 2020-09-02 11:10:32
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-09-02 12:50:56
 * @Description: 
 */

import 'package:wisdom_cli/wisdom_ui.dart';

///小区-楼栋-单元-楼层-房屋通用
class CascadeHouseModel implements WPickerEntity {
  String? id;
  String? name;
  String? status;
  num? unitAboveLayerNum;
  num? unitUnderLayerNum;
  bool? disabled;

  CascadeHouseModel({
    this.id,
    this.name,
    this.status,
    this.unitAboveLayerNum,
    this.unitUnderLayerNum,
    this.disabled = false,
  });

  CascadeHouseModel.fromJson(json) {
    Map<String, dynamic> map = Map.from(json ?? {});

    id = map['id'].toString();
    name = map['name'];
    status = map['status'];
    unitAboveLayerNum = map['unitAboveLayerNum'];
    unitUnderLayerNum = map['unitUnderLayerNum'];
    disabled = map['disabled'] ?? this.disabled;
  }

  Map<String, dynamic> toJson() {
    Map<String, dynamic> json = Map<String, dynamic>();

    json['id'] = this.id;
    json['name'] = this.name;
    json['status'] = this.status;
    json['unitAboveLayerNum'] = this.unitAboveLayerNum;
    json['unitUnderLayerNum'] = this.unitUnderLayerNum;
    json['disabled'] = this.disabled;

    return json;
  }

  @override
  String get selectName => this.name!;

  @override
  get selectUnique => this.id!;

  @override
  bool get selectDisabled => this.disabled ?? false;
}
