import 'package:test_sa/models/fault_description.dart';
import 'package:test_sa/models/lookup.dart';

import '../../new_models/work_order_detail_model.dart';

class FixRemotelyHelperModel {
  int? workOrderId;
  DateTime? startDate;
  DateTime? endDate;
  dynamic workingHour;
  String? comment;

  FixRemotelyHelperModel({this.workOrderId, this.startDate, this.endDate, this.workingHour, this.comment});

  Map<String, dynamic> toJson() {
    return {'workOrderId': workOrderId, 'startDate': startDate?.toIso8601String(), 'endDate': endDate?.toIso8601String(), 'workingHour': workingHour, 'comment': comment};
  }
}

class WorkOrderHelperModel {
  num? assetId;
  int? equipmentStatusId;
  int? priorityId;
  int? problemDescriptionId;
  String? comments;
  String? voiceNote;
  List<WorkOrderAttachments>? workOrderAttachments;

  WorkOrderHelperModel({this.assetId, this.equipmentStatusId, this.priorityId, this.problemDescriptionId, this.comments, this.voiceNote, this.workOrderAttachments});

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['assetId'] = assetId;
    data['equipmentStatusId'] = equipmentStatusId;
    data['priorityId'] = priorityId;
    data['problemDescriptionId'] = problemDescriptionId;
    data['comments'] = comments;
    data['voiceNote'] = voiceNote;
    if (workOrderAttachments != null) {
      data['workOrderAttachments'] = workOrderAttachments!.map((v) => v.toJson()).toList();
    }
    return data;
  }
  Map<String, dynamic> toUploadAttachmentJson(int? workOrderId,List<WorkOrderAttachments>? workOrderAttachments) {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['workOrderId'] = workOrderId;
    if (workOrderAttachments != null) {
      data['workOrderAttachments'] = workOrderAttachments!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class WorkOrderAttachments {
  WorkOrderAttachments({this.id, this.name});

  int? id;
  String? name;

  WorkOrderAttachments.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['id'] = id;
    data['name'] = name;
    return data;
  }
}

class EngineerUpdateWorkOrderHelperModel {
  int? workOrderId;
  Lookup? equipmentStatus;
  String? returnToService;
  Lookup? serviceType;
  Lookup? loanAvailability;
  num? loanAssetId;
  WorkOrderAsset? loanAsset;
  Lookup? failureReason;
  FaultDescription? faultDescription;
  String? solution;
  String? callResponse;

  EngineerUpdateWorkOrderHelperModel({
    this.workOrderId,
    this.equipmentStatus,
    this.failureReason,
    this.faultDescription,
    this.loanAvailability,
    this.loanAssetId,
    this.loanAsset,
    this.serviceType,
    this.solution,
    this.returnToService,
    this.callResponse,
  });

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
    data['workOrderId'] = workOrderId;
    data['equipmentStatusId'] = equipmentStatus?.id;
    data['returnToService'] = returnToService;
    data['loanAvailabilityId'] = loanAvailability?.id;
    data['loanAssetId'] = loanAssetId;
    data['failureReasonId'] = failureReason?.id;
    data['faultDescriptionId'] = faultDescription?.id;
    data['callResponse'] = callResponse;
    return data;
  }
}

class NurseActionHelperModel {
  int? workOrderId;
  String? feedback;
  String? signatureNurse;

  NurseActionHelperModel({this.workOrderId, this.feedback, this.signatureNurse});

  Map<String, dynamic> toJson() {
    return {'workOrderId': workOrderId, 'feedback': feedback, 'signatureNurse': signatureNurse};
  }
}

class NeedVisitHelperModel {
  int? workOrderId;
  DateTime? visitDate;
  String? comment;

  NeedVisitHelperModel({this.workOrderId, this.visitDate, this.comment});

  Map<String, dynamic> toJson() {
    return {'workOrderId': workOrderId, 'visitDate': visitDate?.toIso8601String(), 'comment': comment};
  }
}

class EngineerRejectHelperModel {
  int? workOrderId;
  String? feedback;
  Lookup? rejectionReason;

  EngineerRejectHelperModel({this.workOrderId, this.feedback, this.rejectionReason});

  Map<String, dynamic> toJson() {
    return {'workOrderId': workOrderId, 'feedback': feedback, 'rejectReasonId': rejectionReason?.id};
  }
}
