import 'package:test_sa/models/lookup.dart'; import 'package:test_sa/models/new_models/building.dart'; import 'package:test_sa/models/new_models/department.dart'; import 'package:test_sa/models/new_models/floor.dart'; import 'package:test_sa/models/new_models/site.dart'; import 'package:test_sa/modules/loan_module/models/medical_department_model.dart'; class LoanFormModel { String? docName; String? docNumber; String? docEmail; String? itemDescription; String? requestDescription; String? model; String? manufacturer; Lookup? loanProvided; String? vendorName; String? vendorRepresentativeName; String? vendorNumber; String? vendorEmail; Site? site; MedicalDepartmentModel? department; List? loanAttachment; LoanFormModel({ this.docName, this.docNumber, this.docEmail, this.itemDescription, this.requestDescription, this.model, this.manufacturer, this.loanProvided, this.vendorName, this.vendorRepresentativeName, this.vendorNumber, this.vendorEmail, this.loanAttachment, this.site, this.department, }); //{ // "id": 0, // "employeeId": "fa29a9de-1337-4729-b823-68c6ecffdd33", // "requestorUserID": "fa29a9de-1337-4729-b823-68c6ecffdd33", // "employeeName": "engineer-dev", // "employeeEmail": "Engineer_Dev@yahoo.com", // "positionName": "High", // "requesterExtensionNumber": "7726", // "requesterContactNumber": "72132197", // "siteId": 1, // "departmentId": 5, // "loanTypeId": 6448, // "doctorName": "Doctor A", // "doctorContact": "0561432451", // "doctorEmail": "doctor@test.com", // "itemDescription": "Test item", // "requestDescription": "Test request", // "loanPeriodId": 6453, // "assetId": null, // "assetNumber": "", // "assetName": "", // "assetSerialNumber": "", // "model": "Model A", // "manufacturer": "Siemens", // "vendorName": "Vendor A", // "vendorRepName": "Vendor Rep A", // "vendorContact": "0561432455", // "vendorEmail": "vendor@test.com", // "loanStatusId": 1, // "loanAttachments": [], // "submittedAt": "2025-11-13T12:11:12.673Z", // "updatedAt": null, // "cMWOItemId": null // } Map toJson() { return { "doctorName": docName, "doctorContact": docNumber, "doctorEmail": docEmail, "itemDescription": itemDescription, "requestDescription": requestDescription, "model": model, "manufacturer": manufacturer, "loanPeriodId": loanProvided?.id, "vendorName": vendorName, "vendorRepresentativeName": vendorRepresentativeName, "vendorRepName": vendorRepresentativeName, "vendorNumber": vendorNumber, "vendorContact": vendorNumber, "vendorEmail": vendorEmail, 'siteId': site?.id, 'departmentId': department?.id, "loanAttachments": loanAttachment != null ? loanAttachment!.map((v) => v.toJson()).toList() : [], }; } } class LoanAttachments { num? id; num? loanAttachmentTypeId; num? loanId; String? attachmentName; String? attachmentDescription; LoanAttachments({this.id, this.loanAttachmentTypeId, this.attachmentName, this.loanId, this.attachmentDescription}); LoanAttachments.fromJson(dynamic json) { id = json['id']; loanAttachmentTypeId = json['loanAttachmentTypeId']; loanId = json['loanId']; attachmentName = json['attachmentName']; attachmentDescription = json['attachmentDescription']; } // LoanAttachments copyWith({ // num? id, // Parameter is now nullable // String? name, // Parameter is now nullable // String? originalName, // Parameter is now nullable // }) => // LoanAttachments( // id: id ?? this.id, // name: name ?? this.name, // originalName: originalName ?? this.originalName, // ); Map toJson() { final map = {}; map['id'] = id; map['loanAttachmentTypeId'] = loanAttachmentTypeId; map['attachmentName'] = attachmentName; map['loanId'] = loanId; map['attachmentDescription'] = attachmentDescription; return map; } }