/*
 * @Author: XianKaiQun
 * @Date: 2020-08-17 19:17:43
 * @LastEditors: ,: XianKaiQun
 * @LastEditTime: ,: 2020-10-20 11:54:00
 * @Description: 
 */
import 'package:wisdom_cli/wisdom_ui.dart';

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

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

  NameCodeModel.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 => this.name ?? '';

  @override
  Object get selectUnique => this.code ?? '';

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