/*
 * @Author: XianKaiQun
 * @Date: 2020-09-02 14:36:01
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-09-03 11:44:13
 * @Description: 
 */
import 'package:wisdom_cli/wisdom_ui.dart';

class EnumModel implements WPickerEntity {
  String? code;
  String? name;
  bool? disabled;

  EnumModel({
    this.code,
    this.name,
    this.disabled = false,
  });

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

    code = map['code'];
    name = map['name'];
    disabled = map['disabled'] ?? this.disabled;
  }

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

    json['code'] = this.code;
    json['name'] = this.name;
    json['disabled'] = this.disabled;

    return json;
  }

  @override
  String get selectName => name ?? '';

  @override
  get selectUnique => code!;

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