import 'package:test_sa/models/generic_attachment_model.dart';

class EngineerData {
  int? id;
  String? debrief;
  String? startTime;
  String? endTime;
  double? totalHours;
  bool? isComplete;
  int? statusId;
  int? requestId;
  List<GenericAttachmentModel>? attachments;

  EngineerData({
    this.id,
    this.debrief,
    this.startTime,
    this.endTime,
    this.totalHours,
    this.isComplete,
    this.statusId,
    this.requestId,
    this.attachments,
  });

  EngineerData.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    debrief = json['debrief'];
    startTime = json['startTime'];
    endTime = json['endTime'];
    totalHours = (json['totalHours'] as num?)?.toDouble();
    isComplete = json['isComplete'];
    statusId = json['statusId'];
    requestId = json['requestId'];
    attachments = json['attachments'] != null ? (json['attachments'] as List).map((e) => GenericAttachmentModel.fromInternalAuditJson(e)).toList() : [];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = {};
    data['id'] = id;
    data['debrief'] = debrief;
    data['startTime'] = startTime;
    data['endTime'] = endTime;
    data['totalHours'] = totalHours;
    data['isComplete'] = isComplete;
    data['statusId'] = statusId;
    data['requestId'] = requestId;
    if (attachments != null) {
      data['attachments'] = attachments!.whereType<GenericAttachmentModel>().map((e) => e.toInternalAuditJson()).toList();
    }
    return data;
  }
}