import 'package:test_sa/models/lookup.dart'; class SearchWorkOrders { int id; String parentWOId; String workOrderNo; int workOrderYear; int workOrderSequennce; CallRequest callRequest; String assetType; AssignedEmployee assignedEmployee; String visitDate; String startDate; String endDate; List assistantEmployees; String supplier; String vendorTicketNumber; List contactPersonWorkOrders; Lookup calllastSituation; Lookup currentSituation; String repairLocation; String reason; String startofWorkTime; String endofWorkTime; double workingHours; num travelingHours; num travelingExpenses; ModelDefRelatedDefects faultDescription; List sparePartsWorkOrders; String reviewComment; String comment; String attachmentsWorkOrder; String equipmentStatus; List suppEngineerWorkOrders; String engSignature; String nurseSignature; String woParentDto; SearchWorkOrders( {this.id, this.parentWOId, this.workOrderNo, this.workOrderYear, this.workOrderSequennce, this.callRequest, this.assetType, this.assignedEmployee, this.visitDate, this.startDate, this.endDate, this.assistantEmployees, this.supplier, this.vendorTicketNumber, this.contactPersonWorkOrders, this.calllastSituation, this.currentSituation, this.repairLocation, this.reason, this.startofWorkTime, this.endofWorkTime, this.workingHours, this.travelingHours, this.travelingExpenses, this.faultDescription, this.sparePartsWorkOrders, this.reviewComment, this.comment, this.attachmentsWorkOrder, this.equipmentStatus, this.suppEngineerWorkOrders, this.engSignature, this.nurseSignature, this.woParentDto}); SearchWorkOrders.fromJson(Map json) { print(json['callRequest']); id = json['id']; parentWOId = json['parentWOId']; workOrderNo = json['workOrderNo']; workOrderYear = json['workOrderYear']; workOrderSequennce = json['workOrderSequennce']; callRequest = json['callRequest'] != null ? CallRequest.fromJson(json['callRequest']) : CallRequest(); assetType = json['assetType']; assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : AssignedEmployee(); visitDate = json['visitDate']; startDate = json['startDate']; endDate = json['endDate']; if (json['assistantEmployees'] != null) { assistantEmployees = json['assistantEmployees']; } supplier = json['supplier']; vendorTicketNumber = json['vendorTicketNumber']; if (json['contactPersonWorkOrders'] != null) { contactPersonWorkOrders = json['contactPersonWorkOrders']; } calllastSituation = json['calllastSituation'] != null ? Lookup.fromJson(json['calllastSituation']) : const Lookup(); currentSituation = json['currentSituation'] != null ? Lookup.fromJson(json['currentSituation']) : const Lookup(); repairLocation = json['repairLocation']; reason = json['reason']; startofWorkTime = json['startofWorkTime']; endofWorkTime = json['endofWorkTime']; workingHours = json['workingHours']; travelingHours = json['travelingHours']; travelingExpenses = json['travelingExpenses']; faultDescription = json['faultDescription'] != null ? ModelDefRelatedDefects.fromJson(json['faultDescription']) : ModelDefRelatedDefects(); if (json['sparePartsWorkOrders'] != null) { sparePartsWorkOrders = []; json['sparePartsWorkOrders'].forEach((v) { sparePartsWorkOrders.add(SparePartWorkOrder.fromJson(v)); }); } reviewComment = json['reviewComment']; comment = json['comment']; attachmentsWorkOrder = json['attachmentsWorkOrder']; equipmentStatus = json['equipmentStatus']; if (json['suppEngineerWorkOrders'] != null) { suppEngineerWorkOrders = json['suppEngineerWorkOrders']; } engSignature = json['engSignature']; nurseSignature = json['nurseSignature']; woParentDto = json['woParentDto']; } Map toJson() { final Map data = {}; data['id'] = id; data['parentWOId'] = parentWOId; data['workOrderNo'] = workOrderNo; data['workOrderYear'] = workOrderYear; data['workOrderSequennce'] = workOrderSequennce; if (callRequest != null) { data['callRequest'] = callRequest.toJson(); } if (assetType != null) data['assetType'] = assetType; if (assignedEmployee != null) { data['assignedEmployee'] = assignedEmployee.toJson(); } if (data['visitDate'] != null) data['visitDate'] = visitDate; if (data['startDate'] != null) data['startDate'] = startDate; if (data['endDate'] != null) data['endDate'] = endDate; if (assistantEmployees != null) { data['assistantEmployees'] = assistantEmployees.map((v) => v.toJson()).toList(); } if (supplier != null) data['supplier'] = supplier; data['vendorTicketNumber'] = vendorTicketNumber; if (contactPersonWorkOrders != null) { data['contactPersonWorkOrders'] = contactPersonWorkOrders.map((v) => v.toJson()).toList(); } if (calllastSituation != null) { data['calllastSituation'] = calllastSituation.toMap(); } if (currentSituation != null) { data['currentSituation'] = currentSituation.toMap(); } if (repairLocation != null) data['repairLocation'] = repairLocation; if (reason != null) data['reason'] = reason; if (startofWorkTime != null) data['startofWorkTime'] = startofWorkTime; if (endofWorkTime != null) data['endofWorkTime'] = endofWorkTime; if (workingHours != null) data['workingHours'] = workingHours; if (travelingHours != null) data['travelingHours'] = travelingHours; if (travelingExpenses != null) data['travelingExpenses'] = travelingExpenses; if (faultDescription != null) { data['faultDescription'] = faultDescription.toJson(); } if (sparePartsWorkOrders != null) { data['sparePartsWorkOrders'] = sparePartsWorkOrders.map((v) => v.toJson()).toList(); } data['reviewComment'] = reviewComment; data['comment'] = comment; data['attachmentsWorkOrder'] = attachmentsWorkOrder; data['equipmentStatus'] = equipmentStatus; if (suppEngineerWorkOrders != null) { data['suppEngineerWorkOrders'] = suppEngineerWorkOrders.map((v) => v.toJson()).toList(); } data['engSignature'] = engSignature; data['nurseSignature'] = nurseSignature; data['woParentDto'] = woParentDto; return data; } } class SparePart { int id; String partNo; String partName; SparePart({ this.id, this.partNo, this.partName, }); SparePart.fromJson(Map json) { id = json['id']; partNo = json['partNo']; partName = json['partName']; } SparePart copyWith({ int id, String partNo, String partName, }) => SparePart( id: id ?? this.id, partNo: partNo ?? this.partNo, partName: partName ?? this.partName, ); Map toJson() { final map = {}; map['id'] = id ?? 0; map['partNo'] = partNo; map['partName'] = partName; return map; } } class SparePartWorkOrder { int id; SparePart sparePart; double qty; double returnQty; double installQty; SparePartWorkOrder({ this.id, this.sparePart, this.qty, this.returnQty, this.installQty, }); SparePartWorkOrder.fromJson(Map json) { id = json['id']; sparePart = SparePart.fromJson(json['sparePart'] ?? {}); qty = json['qty']; returnQty = json['returnQty']; installQty = json['installQty']; } SparePartWorkOrder copyWith({ int id, SparePart sparePart, double qty, double returnQty, double installQty, }) => SparePartWorkOrder( id: id ?? this.id, sparePart: sparePart ?? this.sparePart, qty: qty ?? this.qty, returnQty: returnQty ?? this.returnQty, installQty: installQty ?? this.installQty, ); Map toJson() { final map = {}; map['id'] = id ?? 0; map['sparePart'] = sparePart?.toJson(); map['qty'] = qty; map['returnQty'] = returnQty; map['installQty'] = installQty; return map; } } class CallRequest { int id; String callNo; Asset asset; AssignedEmployee assignedEmployee; List callSiteContactPerson; Lookup status; Lookup callLastSituation; String defectType; String firstAction; String assetType; CallRequest({this.id, this.callNo, this.asset, this.assignedEmployee, this.callSiteContactPerson, this.status, this.callLastSituation, this.defectType, this.firstAction, this.assetType}); CallRequest.fromJson(Map json) { id = json['id']; callNo = json['callNo']; asset = json['asset'] != null ? Asset.fromJson(json['asset']) : Asset(); assignedEmployee = json['assignedEmployee'] != null ? AssignedEmployee.fromJson(json['assignedEmployee']) : AssignedEmployee(); if (json['callSiteContactPerson'] != null) { callSiteContactPerson = json['callSiteContactPerson']; } status = json['status'] != null ? Lookup.fromJson(json['status']) : const Lookup(); callLastSituation = json['callLastSituation'] != null ? Lookup.fromJson(json['callLastSituation']) : const Lookup(); defectType = json['defectType']; firstAction = json['firstAction']; assetType = json['assetType']; } Map toJson() { final Map data = {}; data['id'] = id; data['callNo'] = callNo; if (asset != null) { data['asset'] = asset.toJson(); } if (assignedEmployee != null) { data['assignedEmployee'] = assignedEmployee.toJson(); } if (callSiteContactPerson != null) { data['callSiteContactPerson'] = callSiteContactPerson.map((v) => v.toJson()).toList(); } if (status != null) { data['status'] = status.toMap(); } if (callLastSituation != null) { data['callLastSituation'] = callLastSituation.toMap(); } data['defectType'] = defectType; data['firstAction'] = firstAction; data['assetType'] = assetType; return data; } } class Asset { int id; String assetSerialNo; String systemID; String assetNumber; ModelDefinition modelDefinition; String supplier; String ipAddress; String macAddress; String portNumber; String assetReplace; String oldAsset; String isParent; String parentAsset; int assetType; Site site; String building; String floor; String department; String room; String testsDay; String purchasingPrice; String nbv; String currency; String poNo; String invoiceNumber; String invoiceDate; String replacementDate; String originDepartment; Site originSite; String budgetYear; String lastPOPrice; String commissioningStatus; String productionDate; String edd; String technicalInspectionDate; String deliveryInspectionDate; String endUserAcceptanceDate; String receivingCommittee; String siteWarrantyMonths; String extendedWarrantyMonths; String remainderWarrantyMonths; String eomWarrantyMonthsNo; String warrantyValue; String warrantyEndDate; String warrantyContractConditions; List technicalGuidanceBooks; String comment; String tagCode; Asset( {this.id, this.assetSerialNo, this.systemID, this.assetNumber, this.modelDefinition, this.supplier, this.ipAddress, this.macAddress, this.portNumber, this.assetReplace, this.oldAsset, this.isParent, this.parentAsset, this.assetType, this.site, this.building, this.floor, this.department, this.room, this.testsDay, this.purchasingPrice, this.nbv, this.currency, this.poNo, this.invoiceNumber, this.invoiceDate, this.replacementDate, this.originDepartment, this.originSite, this.budgetYear, this.lastPOPrice, this.commissioningStatus, this.productionDate, this.edd, this.technicalInspectionDate, this.deliveryInspectionDate, this.endUserAcceptanceDate, this.receivingCommittee, this.siteWarrantyMonths, this.extendedWarrantyMonths, this.remainderWarrantyMonths, this.eomWarrantyMonthsNo, this.warrantyValue, this.warrantyEndDate, this.warrantyContractConditions, this.technicalGuidanceBooks, this.comment, this.tagCode}); Asset.fromJson(Map json) { id = json['id']; assetSerialNo = json['assetSerialNo']; systemID = json['systemID']; assetNumber = json['assetNumber']; modelDefinition = json['modelDefinition'] != null ? ModelDefinition.fromJson(json['modelDefinition']) : ModelDefinition(); supplier = json['supplier']; ipAddress = json['ipAddress']; macAddress = json['macAddress']; portNumber = json['portNumber']; assetReplace = json['assetReplace']; oldAsset = json['oldAsset']; isParent = json['isParent']; parentAsset = json['parentAsset']; assetType = json['assetType']; site = json['site'] != null ? Site.fromJson(json['site']) : Site(); building = json['building']; floor = json['floor']; department = json['department']; } Map toJson() { final Map data = {}; data['id'] = id; data['assetSerialNo'] = assetSerialNo; data['systemID'] = systemID; data['assetNumber'] = assetNumber; if (modelDefinition != null) { data['modelDefinition'] = modelDefinition.toJson(); } data['supplier'] = supplier; data['ipAddress'] = ipAddress; data['macAddress'] = macAddress; data['portNumber'] = portNumber; data['assetReplace'] = assetReplace; data['oldAsset'] = oldAsset; data['isParent'] = isParent; data['parentAsset'] = parentAsset; data['assetType'] = assetType; if (site != null) { data['site'] = site.toJson(); } data['building'] = building; data['floor'] = floor; data['department'] = department; data['room'] = room; data['testsDay'] = testsDay; data['purchasingPrice'] = purchasingPrice; data['nbv'] = nbv; data['currency'] = currency; data['poNo'] = poNo; data['invoiceNumber'] = invoiceNumber; data['invoiceDate'] = invoiceDate; data['replacementDate'] = replacementDate; data['originDepartment'] = originDepartment; if (originSite != null) { data['originSite'] = originSite.toJson(); } data['budgetYear'] = budgetYear; data['lastPOPrice'] = lastPOPrice; data['commissioningStatus'] = commissioningStatus; data['productionDate'] = productionDate; if (edd != null) data['edd'] = edd; data['technicalInspectionDate'] = technicalInspectionDate; data['deliveryInspectionDate'] = deliveryInspectionDate; data['endUserAcceptanceDate'] = endUserAcceptanceDate; data['receivingCommittee'] = receivingCommittee; data['siteWarrantyMonths'] = siteWarrantyMonths; data['extendedWarrantyMonths'] = extendedWarrantyMonths; data['remainderWarrantyMonths'] = remainderWarrantyMonths; data['eomWarrantyMonthsNo'] = eomWarrantyMonthsNo; data['warrantyValue'] = warrantyValue; data['warrantyEndDate'] = warrantyEndDate; data['warrantyContractConditions'] = warrantyContractConditions; if (technicalGuidanceBooks != null) { data['technicalGuidanceBooks'] = technicalGuidanceBooks.map((v) => v.toJson()).toList(); } data['comment'] = comment; data['tagCode'] = tagCode; return data; } } class ModelDefinition { int id; String assetName; String modelDefCode; String modelName; int manufacturerId; String manufacturerName; String supplierName; String replacementDate; int lifeSpan; List modelDefRelatedDefects; List suppliers; ModelDefinition( {this.id, this.assetName, this.modelDefCode, this.modelName, this.manufacturerId, this.manufacturerName, this.supplierName, this.replacementDate, this.lifeSpan, this.modelDefRelatedDefects, this.suppliers}); ModelDefinition.fromJson(Map json) { id = json['id']; assetName = json['assetName']; modelDefCode = json['modelDefCode']; modelName = json['modelName']; manufacturerId = json['manufacturerId']; manufacturerName = json['manufacturerName']; supplierName = json['supplierName']; replacementDate = json['replacementDate']; lifeSpan = json['lifeSpan']; if (json['modelDefRelatedDefects'] != null) { modelDefRelatedDefects = []; json['modelDefRelatedDefects'].forEach((v) { modelDefRelatedDefects.add(ModelDefRelatedDefects.fromJson(v)); }); } if (json['suppliers'] != null) { suppliers = json['suppliers']; } } Map toJson() { final Map data = {}; data['id'] = id; data['assetName'] = assetName; data['modelDefCode'] = modelDefCode; data['modelName'] = modelName; data['manufacturerId'] = manufacturerId; data['manufacturerName'] = manufacturerName; data['supplierName'] = supplierName; data['replacementDate'] = replacementDate; data['lifeSpan'] = lifeSpan; if (modelDefRelatedDefects != null) { data['modelDefRelatedDefects'] = modelDefRelatedDefects.map((v) => v.toJson()).toList(); } if (suppliers != null) { data['suppliers'] = suppliers.map((v) => v.toJson()).toList(); } return data; } } class ModelDefRelatedDefects { int id; String defectName; String workPerformed; String estimatedTime; ModelDefRelatedDefects({this.id, this.defectName, this.workPerformed, this.estimatedTime}); ModelDefRelatedDefects.fromJson(Map json) { id = json['id']; defectName = json['defectName']; workPerformed = json['workPerformed']; estimatedTime = json['estimatedTime']; } Map toJson() { final Map data = {}; data['id'] = id; data['defectName'] = defectName; data['workPerformed'] = workPerformed; data['estimatedTime'] = estimatedTime; return data; } } class Site { int id; int customerCode; String custName; List buildings; Site({this.id, this.customerCode, this.custName, this.buildings}); Site.fromJson(Map json) { id = json['id']; customerCode = json['customerCode']; custName = json['custName']; if (json['buildings'] != null) { buildings = json['buildings']; } } Map toJson() { final Map data = {}; data['id'] = id; data['customerCode'] = customerCode; data['custName'] = custName; if (buildings != null) { data['buildings'] = buildings.map((v) => v.toJson()).toList(); } return data; } } class AssignedEmployee { String id; String name; AssignedEmployee({this.id, this.name}); AssignedEmployee.fromJson(Map json) { id = json['id']; name = json['name']; } Map toJson() { final Map data = {}; data['id'] = id; data['name'] = name; return data; } }