/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2023-05-09 16:34:28
 * @LastEditTime : 2023-05-10 14:46:25
 * @Description  : Do not edit
 */
import 'package:wisdom_cli/wisdom_ui.dart';

class DepartmentModel implements WPickerEntity {
  String? id;
  num? type;
  String? label;
  String? shortName;
  List<DepartmentModel>? children;
  bool? disable;

  DepartmentModel(
      {this.id, this.label, this.shortName, this.children, this.disable});

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

    id = map['id'];
    label = map['label'];
    shortName = map['shortName'];
    disable = map['disable'];
    children = List<DepartmentModel>.from(
        (map["children"] ?? []).map((x) => DepartmentModel.fromJson(x)));
  }

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

    json['id'] = this.id;
    json['label'] = this.label;
    json['shortName'] = this.shortName;
    json['disable'] = this.disable;
    json['children'] =
        List<dynamic>.from((children ?? []).map((x) => x.toJson()));

    return json;
  }

  @override
  String get selectName => label!;

  @override
  get selectUnique => id ?? '';

  @override
  bool get selectDisabled => false;
}
