import '../lookup.dart';

class PMKit {
  Lookup? itemCode;
  String? itemName;
  String? preparationTimeFrame;
  String? kitFrequencyDemand;
  String? availability;
  String? quantityNeeded;
  String? quantityReserved;

  PMKit({this.itemCode, this.itemName, this.preparationTimeFrame, this.kitFrequencyDemand, this.availability, this.quantityNeeded, this.quantityReserved});

  Map<String, String> toMap() {
    return {
      if (itemCode != null) 'itemCode': (itemCode?.id).toString(),
      if (itemName != null) 'itemName': itemName!,
      if (preparationTimeFrame != null) 'preparationTimeFrame': preparationTimeFrame!,
      if (kitFrequencyDemand != null) 'kitFrequencyDemand': kitFrequencyDemand!,
      if (availability != null) 'availability': availability!,
      if (quantityNeeded != null) 'quantityNeeded': quantityNeeded!,
      if (quantityReserved != null) 'quantityReserved': quantityReserved!,
    };
  }

  factory PMKit.fromMap(Map<String, dynamic> map) {
    return PMKit(
      itemCode: Lookup.fromJson(map['itemCode']),
      itemName: map['itemName'] as String?,
      preparationTimeFrame: map['preparationTimeFrame'] as String?,
      kitFrequencyDemand: map['kitFrequencyDemand'] as String?,
      availability: map['availability'] as String?,
      quantityNeeded: map['quantityNeeded'] as String?,
      quantityReserved: map['quantityReserved'] as String?,
    );
  }
}
