/*
 * @Author: XianKaiQun
 * @Date: 2020-08-18 16:54:31
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-11-16 09:30:10
 * @Description: 
 */
import 'package:wisdom_cli/wisdom_ui.dart';

class AdvanceModel extends WPickerEntity {
  String? assetId;
  String? chargeSubject;
  String? assetName;
  String? assetFullName;
  String? identification;
  String? feeName;
  num? price;
  String? unit;
  num? prePayFee;
  num? receivableFee;
  String? type;
  bool? disabled;

  AdvanceModel({
    this.assetId,
    this.chargeSubject,
    this.assetName,
    this.assetFullName,
    this.identification,
    this.feeName,
    this.price,
    this.unit,
    this.prePayFee,
    this.receivableFee,
    this.type,
    this.disabled = false,
  });

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

    assetId = map['assetId'];
    chargeSubject = map['chargeSubject'];
    assetName = map['assetName'];
    assetFullName = map['assetFullName'];
    identification = map['identification'];
    feeName = map['feeName'];
    price = map['price'];
    unit = map['unit'];
    prePayFee = map['prePayFee'];
    receivableFee = map['receivableFee'];
    type = map['type'];
    disabled = map['disabled'] ?? this.disabled;
  }

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

    json['assetId'] = this.assetId;
    json['chargeSubject'] = this.chargeSubject;
    json['assetName'] = this.assetName;
    json['assetFullName'] = this.assetFullName;
    json['identification'] = this.identification;
    json['feeName'] = this.feeName;
    json['price'] = this.price;
    json['unit'] = this.unit;
    json['prePayFee'] = this.prePayFee;
    json['receivableFee'] = this.receivableFee;
    json['type'] = this.type;
    json['disabled'] = this.disabled;

    return json;
  }

  @override
  String get selectName => this.assetFullName ?? this.feeName!;

  @override
  Object get selectUnique =>
      '${this.assetFullName}${this.assetId}${this.feeName}';

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