import '../lookup.dart';

class PPMCheckList {
  Lookup? status;
  String? title;
  String? comment;
  String? measuredValue;

  PPMCheckList({
    this.title,
    this.status,
    this.comment,
    this.measuredValue,
  });

  Map<String, String> toMap() {
    return {
      if (status != null) 'status': status!.id.toString(),
      if (title != null) 'title': title!,
      if (comment != null) 'comment': comment!,
      if (measuredValue != null) 'measuredValue': measuredValue!,
    };
  }

  factory PPMCheckList.fromMap(Map<String, dynamic> map) {
    return PPMCheckList(
      status: Lookup.fromJson(map['status']),
      title: map['title'] as String?,
      comment: map['comment'] as String?,
      measuredValue: map['measuredValue'] as String?,
    );
  }
}
