/*
 * @Author: ChenYaJin
 * @Date: 2021-11-09 10:57:56
 * @LastEditors: ChenYaJin
 * @LastEditTime: 2021-11-24 15:56:10
 * @Description:  服务项目模型
 */
import 'package:wisdom_cli/wisdom_ui.dart';

class ServiceProject implements WPickerEntity {
  String? id;
  String? name;
  double? price; //单价
  String? unit;
  bool? disabled;

  ServiceProject(
      {this.id, this.name, this.price, this.unit, this.disabled = false});

  ServiceProject.fromJson(json) {
    Map<String, dynamic> map = Map.from(json ?? {});
    id = map['id'];
    name = map['name'];
    price = map['price'];
    unit = map['unit'];
    disabled = map['disbaled'] ?? this.disabled;
  }

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

    json['id'] = this.id;
    json['name'] = this.name;
    json['price'] = this.price;
    json['unit'] = this.unit;
    json['disabled'] = this.disabled;

    return json;
  }

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

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

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