import 'package:test_sa/models/lookup.dart'; class WorkOrderDetail { WorkOrder? data; String? message; String? title; String? innerMessage; int? responseCode; bool? isSuccess; WorkOrderDetail({this.data, this.message, this.title, this.innerMessage, this.responseCode, this.isSuccess}); factory WorkOrderDetail.fromJson(Map json) { return WorkOrderDetail( data: json['data'] == null ? null : WorkOrder.fromJson(json['data']), message: json['message'], title: json['title'], innerMessage: json['innerMessage'], responseCode: json['responseCode'], isSuccess: json['isSuccess'], ); } Map toJson() { return { 'data': data?.toJson(), 'message': message, 'title': title, 'innerMessage': innerMessage, 'responseCode': responseCode, 'isSuccess': isSuccess, }; } } class WorkOrder { String? workOrderNo; WorkOrderCreatedBy? workOrderCreatedBy; DateTime? requestedDate; Asset? asset; Lookup? assetGroup; Lookup? manufacturer; Lookup? model; Lookup? assetNDModel; Site? site; Lookup? building; Lookup? floor; Lookup? department; dynamic room; Lookup? assetType; AssignedEmployee? assignedEmployee; dynamic lastActivityStatus; Lookup? status; Lookup? nextStep; dynamic assetVerificationType; List? workOrderContactPerson; EquipmentStatus? equipmentStatus; Priority? priority; RequestedThrough? requestedThrough; TypeOfRequest? typeofRequest; dynamic loanAvailablity; dynamic assetLoan; dynamic safety; ProblemDescription? problemDescription; String? comments; String? voiceNote; List? workOrderAttachments; dynamic returnToService; dynamic serviceType; dynamic failureReasone; dynamic solution; dynamic totalWorkingHours; List? workOrderHistory; List? activityMaintenances; List? activitySpareParts; List? activityAssetToBeRetireds; WorkOrder({ this.workOrderNo, this.workOrderCreatedBy, this.requestedDate, this.asset, this.assetGroup, this.manufacturer, this.model, this.assetNDModel, this.site, this.building, this.floor, this.department, this.room, this.assetType, this.assignedEmployee, this.lastActivityStatus, this.status, this.nextStep, this.assetVerificationType, this.workOrderContactPerson, this.equipmentStatus, this.priority, this.requestedThrough, this.typeofRequest, this.loanAvailablity, this.assetLoan, this.safety, this.problemDescription, this.comments, this.voiceNote, this.workOrderAttachments, this.returnToService, this.serviceType, this.failureReasone, this.solution, this.totalWorkingHours, this.workOrderHistory, this.activityMaintenances, this.activitySpareParts, this.activityAssetToBeRetireds, }); factory WorkOrder.fromJson(Map json) { return WorkOrder( workOrderNo: json['workOrderNo'], workOrderCreatedBy: WorkOrderCreatedBy.fromJson(json['workOrderCreatedBy']), requestedDate: DateTime.parse(json['requestedDate']), asset: Asset.fromJson(json['asset']), assetGroup: json['assetGroup'] ?? Lookup.fromJson(json['assetGroup']), manufacturer: json['manufacturer'] ?? Lookup.fromJson(json['manufacturer']), model: json['model'] ?? Lookup.fromJson(json['model']), assetNDModel: json['assetNDModel'] ?? Lookup.fromJson(json['assetNDModel']), site: Site.fromJson(json['site']), building: json['building'] ?? Lookup.fromJson(json['building']), floor: json['floor'] ?? Lookup.fromJson(json['floor']), department: json['department'] ?? Lookup.fromJson(json['department']), room: json['room'], assetType: json['assetType'] ?? Lookup.fromJson(json['assetType']), assignedEmployee: AssignedEmployee.fromJson(json['assignedEmployee']), lastActivityStatus: json['lastActivityStatus'], status: json['status'] ?? Lookup.fromJson(json['status']), nextStep: json['nextStep'] ?? Lookup.fromJson(json['nextStep']), assetVerificationType: json['assetVerificationType'], workOrderContactPerson: (json['workOrderContactPerson'] as List).map((i) => WorkOrderContactPerson.fromJson(i)).toList(), equipmentStatus: EquipmentStatus.fromJson(json['equipmentStatus']), priority: Priority.fromJson(json['priority']), requestedThrough: RequestedThrough.fromJson(json['requestedThrough']), typeofRequest: TypeOfRequest.fromJson(json['typeofRequest']), loanAvailablity: json['loanAvailablity'], assetLoan: json['assetLoan'], safety: json['safety'], problemDescription: ProblemDescription.fromJson(json['problemDescription']), comments: json['comments'], voiceNote: json['voiceNote'], workOrderAttachments: json['workOrderAttachments'] as List, returnToService: json['returnToService'], serviceType: json['serviceType'], failureReasone: json['failureReasone'], solution: json['solution'], totalWorkingHours: json['totalWorkingHours'], workOrderHistory: (json['workOrderHistory'] as List).map((i) => WorkOrderHistory.fromJson(i)).toList(), activityMaintenances: json['activityMaintenances'] as List, activitySpareParts: json['activitySpareParts'] as List, activityAssetToBeRetireds: json['activityAssetToBeRetireds'] as List, ); } Map toJson() { return { 'workOrderNo': workOrderNo, 'workOrderCreatedBy': workOrderCreatedBy?.toJson(), 'requestedDate': requestedDate?.toIso8601String(), 'asset': asset?.toJson(), 'assetGroup': assetGroup?.toJson(), 'manufacturer': manufacturer?.toJson(), 'model': model?.toJson(), 'assetNDModel': assetNDModel?.toJson(), 'site': site?.toJson(), 'building': building?.toJson(), 'floor': floor?.toJson(), 'department': department?.toJson(), 'room': room, 'assetType': assetType?.toJson(), 'assignedEmployee': assignedEmployee?.toJson(), 'lastActivityStatus': lastActivityStatus, 'status': status?.toJson(), 'nextStep': nextStep?.toJson(), 'assetVerificationType': assetVerificationType, 'workOrderContactPerson': workOrderContactPerson?.map((i) => i.toJson()).toList(), 'equipmentStatus': equipmentStatus?.toJson(), 'priority': priority?.toJson(), 'requestedThrough': requestedThrough?.toJson(), 'typeofRequest': typeofRequest?.toJson(), 'loanAvailablity': loanAvailablity, 'assetLoan': assetLoan, 'safety': safety, 'problemDescription': problemDescription?.toJson(), 'comments': comments, 'voiceNote': voiceNote, 'workOrderAttachments': workOrderAttachments, 'returnToService': returnToService, 'serviceType': serviceType, 'failureReasone': failureReasone, 'solution': solution, 'totalWorkingHours': totalWorkingHours, 'workOrderHistory': workOrderHistory?.map((i) => i.toJson()).toList(), 'activityMaintenances': activityMaintenances, 'activitySpareParts': activitySpareParts, 'activityAssetToBeRetireds': activityAssetToBeRetireds, }; } } class WorkOrderCreatedBy { String? id; String? userName; WorkOrderCreatedBy({this.id, this.userName}); factory WorkOrderCreatedBy.fromJson(Map json) { return WorkOrderCreatedBy(id: json['id'], userName: json['userName']); } Map toJson() { return {'id': id, 'userName': userName}; } } class Asset { int? id; String? assetNumber; Asset({this.id, this.assetNumber}); factory Asset.fromJson(Map json) { return Asset(id: json['id'], assetNumber: json['assetNumber']); } Map toJson() { return {'id': id, 'assetNumber': assetNumber}; } } class WorkOrderContactPerson { int? id; String? name; String? employeeId; String? position; String? extension; String? email; String? mobilePhone; ContactUser? contactUser; WorkOrderContactPerson({this.id, this.name, this.employeeId, this.position, this.extension, this.email, this.mobilePhone, this.contactUser}); factory WorkOrderContactPerson.fromJson(Map json) { return WorkOrderContactPerson( id: json['id'], name: json['name'], employeeId: json['employeeId'], position: json['position'], extension: json['extension'], email: json['email'], mobilePhone: json['mobilePhone'], contactUser: json['contactUser'] == null ? null : ContactUser.fromJson(json['contactUser']), ); } Map toJson() { return { 'id': id, 'name': name, 'employeeId': employeeId, 'position': position, 'extension': extension, 'email': email, 'mobilePhone': mobilePhone, 'contactUser': contactUser?.toJson(), }; } } class ContactUser { String? id; String? userName; ContactUser({this.id, this.userName}); factory ContactUser.fromJson(Map json) { return ContactUser(id: json['id'], userName: json['userName']); } Map toJson() { return {'id': id, 'userName': userName}; } } class AssignedEmployee { String? id; String? userName; AssignedEmployee({this.id, this.userName}); factory AssignedEmployee.fromJson(Map json) { return AssignedEmployee(id: json['id'], userName: json['userName']); } Map toJson() { return {'id': id, 'userName': userName}; } } class Site { int? id; String? siteName; Site({this.id, this.siteName}); factory Site.fromJson(Map json) { return Site(id: json['id'], siteName: json['siteName']); } Map toJson() { return {'id': id, 'siteName': siteName}; } } /// // class AssetGroup { // int id; // String name; // // AssetGroup({this.id, this.name}); // // factory AssetGroup.fromJson(Map json) { // return AssetGroup( // id: json['id'], // name: json['name'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // }; // } // // } // // class Manufacturer { // int id; // String name; // // Manufacturer({this.id, this.name}); // // factory Manufacturer.fromJson(Map json) { // return Manufacturer( // id: json['id'], // name: json['name'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // }; // } // } // // class Model { // int id; // String name; // // Model({this.id, this.name}); // // factory Model.fromJson(Map json) { // return Model( // id: json['id'], // name: json['name'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // }; // } // } // // class AssetNDModel { // int id; // String name; // // AssetNDModel({this.id, this.name}); // // factory AssetNDModel.fromJson(Map json) { // return AssetNDModel( // id: json['id'], // name: json['name'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // }; // } // } // // class Building { // int id; // String name; // int value; // // Building({this.id, this.name, this.value}); // // factory Building.fromJson(Map json) { // return Building( // id: json['id'], // name: json['name'], // value: json['value'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // 'value': value, // }; // } // } // // class Floor { // int id; // String name; // int value; // // Floor({this.id, this.name, this.value}); // // factory Floor.fromJson(Map json) { // return Floor( // id: json['id'], // name: json['name'], // value: json['value'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // 'value': value, // }; // } // } // // class Department { // int id; // String name; // // Department({this.id, this.name}); // // factory Department.fromJson(Map json) { // return Department( // id: json['id'], // name: json['name'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // }; // } // } // // class AssetType { // int id; // String name; // int value; // // AssetType({this.id, this.name, this.value}); // // factory AssetType.fromJson(Map json) { // return AssetType( // id: json['id'], // name: json['name'], // value: json['value'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // 'value': value, // }; // } // } // // class Status { // int id; // String name; // int value; // // Status({this.id, this.name, this.value}); // // factory Status.fromJson(Map json) { // return Status( // id: json['id'], // name: json['name'], // value: json['value'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // 'value': value, // }; // } // } // // class NextStep { // int id; // String name; // int value; // // NextStep({this.id, this.name, this.value}); // // factory NextStep.fromJson(Map json) { // return NextStep( // id: json['id'], // name: json['name'], // value: json['value'], // ); // } // Map toJson() { // return { // 'id': id, // 'name': name, // 'value': value, // }; // } // } class EquipmentStatus { int? id; String? name; int? value; EquipmentStatus({this.id, this.name, this.value}); factory EquipmentStatus.fromJson(Map json) { return EquipmentStatus(id: json['id'], name: json['name'], value: json['value']); } Map toJson() { return {'id': id, 'name': name, 'value': value}; } } class Priority { int? id; String? name; int? value; Priority({this.id, this.name, this.value}); factory Priority.fromJson(Map json) { return Priority(id: json['id'], name: json['name'], value: json['value']); } Map toJson() { return {'id': id, 'name': name, 'value': value}; } } class RequestedThrough { int? id; String? name; RequestedThrough({this.id, this.name}); factory RequestedThrough.fromJson(Map json) { return RequestedThrough(id: json['id'], name: json['name']); } Map toJson() { return {'id': id, 'name': name}; } } class TypeOfRequest { int? id; String? name; TypeOfRequest({this.id, this.name}); factory TypeOfRequest.fromJson(Map json) { return TypeOfRequest(id: json['id'], name: json['name']); } Map toJson() { return {'id': id, 'name': name}; } } class ProblemDescription { int? id; String? name; ProblemDescription({this.id, this.name}); factory ProblemDescription.fromJson(Map json) { return ProblemDescription(id: json['id'], name: json['name']); } Map toJson() { return {'id': id, 'name': name}; } } class WorkOrderHistory { int? id; Lookup? workOrderStatus; dynamic activityStatus; // Since activityStatus is null, it's dynamic String? date; HistoryUser? user; Lookup? step; dynamic fixRemotelyStartTime; // Since it's null, it's dynamic dynamic fixRemotelyEndTime; // Since it's null, it's dynamic dynamic fixRemotelyWorkingHours; // Since it's null, it's dynamic String? comments; dynamic needAVisitDateTime; // Since it's null, it's dynamic WorkOrderHistory( {this.id, this.workOrderStatus, this.activityStatus, this.date, this.user, this.step, this.fixRemotelyStartTime, this.fixRemotelyEndTime, this.fixRemotelyWorkingHours, this.comments, this.needAVisitDateTime}); factory WorkOrderHistory.fromJson(Map json) { return WorkOrderHistory( id: json['id'], //json['assetType'] != null ? Lookup.fromJson(json['assetType']) : null; workOrderStatus: json['workorderStatus'] ?? Lookup.fromJson(json['workorderStatus']), activityStatus: json['activityStatus'], date: json['date'], user: HistoryUser.fromJson(json['user']), step: json['step'] ?? Lookup.fromJson(json['step']), fixRemotelyStartTime: json['fixRemotlyStartTime'], fixRemotelyEndTime: json['fixRemotlyEndTime'], fixRemotelyWorkingHours: json['fixRemotlyWorkingHours'], comments: json['comments'] ?? "", needAVisitDateTime: json['needAVisitDateTime'], ); } Map toJson() { return { 'id': id, // Lookup.fromJson(json['workorderStatus']) 'workorderStatus': workOrderStatus?.toJson(), 'activityStatus': activityStatus, 'date': date, 'user': user?.toJson(), 'step': step?.toJson(), 'fixRemotelyStartTime': fixRemotelyStartTime, 'fixRemotelyEndTime': fixRemotelyEndTime, 'fixRemotelyWorkingHours': fixRemotelyWorkingHours, 'comments': comments, 'needAVisitDateTime': needAVisitDateTime, }; } } // class WorkOrderStatus { // int id; // String name; // int value; // // WorkOrderStatus({ // this.id, // this.name, // this.value, // }); // // factory WorkOrderStatus.fromJson(Map json) { // return WorkOrderStatus( // id: json['id'], // name: json['name'], // value: json['value'], // ); // } // // Map toJson() { // return { // 'id': id, // 'name': name, // 'value': value, // }; // } // } class HistoryUser { String? id; String? userName; HistoryUser({this.id, this.userName}); factory HistoryUser.fromJson(Map json) { return HistoryUser(id: json['id'], userName: json['userName']); } Map toJson() { return {'id': id, 'userName': userName}; } } // class Step { // int id; // String name; // int value; // // Step({ // this.id, // this.name, // this.value, // }); // // factory Step.fromJson(Map json) { // return Step( // id: json['id'], // name: json['name'], // value: json['value'], // ); // } // // Map toJson() { // return { // 'id': id, // 'name': name, // 'value': value, // }; // } // }