import 'dart:convert'; class AllRequestsAndCount { CountServiceRequest countServiceRequest; CountServiceRequest countGasRefill; CountServiceRequest countAssetTransfer; CountServiceRequest countPPM; DetailsStatusTotal detailsStatusTotal; CountServiceRequest total; List requestsDetails; AllRequestsAndCount({this.countServiceRequest, this.countGasRefill, this.countAssetTransfer, this.countPPM, this.detailsStatusTotal, this.total, this.requestsDetails}); AllRequestsAndCount.fromJson(Map json) { countServiceRequest = json['countServiceRequest'] != null ? CountServiceRequest.fromJson(json['countServiceRequest']) : null; countGasRefill = json['countGasRefill'] != null ? CountServiceRequest.fromJson(json['countGasRefill']) : null; countAssetTransfer = json['countAssetTransfer'] != null ? CountServiceRequest.fromJson(json['countAssetTransfer']) : null; countPPM = json['countPPM'] != null ? CountServiceRequest.fromJson(json['countPPM']) : null; detailsStatusTotal = json['detailsStatusTotal'] != null ? DetailsStatusTotal.fromJson(json['detailsStatusTotal']) : null; total = json['total'] != null ? CountServiceRequest.fromJson(json['total']) : null; if (json['requestsDetails'] != null) { requestsDetails = []; json['requestsDetails'].forEach((v) { requestsDetails.add(RequestsDetails.fromJson(v)); }); } } Map toJson() { final Map data = {}; if (countServiceRequest != null) { data['countServiceRequest'] = countServiceRequest.toJson(); } if (countGasRefill != null) { data['countGasRefill'] = countGasRefill.toJson(); } if (countAssetTransfer != null) { data['countAssetTransfer'] = countAssetTransfer.toJson(); } if (countPPM != null) { data['countPPM'] = countPPM.toJson(); } if (detailsStatusTotal != null) { data['detailsStatusTotal'] = detailsStatusTotal.toJson(); } if (total != null) { data['total'] = total.toJson(); } if (requestsDetails != null) { data['requestsDetails'] = requestsDetails.map((v) => v.toJson()).toList(); } return data; } } class CountServiceRequest { int count; CountServiceRequest({this.count}); CountServiceRequest.fromJson(Map json) { count = json['count']; } Map toJson() { final Map data = {}; data['count'] = count; return data; } } class DetailsStatusTotal { int open; int inProgress; int closed; DetailsStatusTotal({this.open, this.inProgress, this.closed}); DetailsStatusTotal.fromJson(Map json) { open = json['open']; inProgress = json['inProgress']; closed = json['closed']; } Map toJson() { final Map data = {}; data['open'] = open; data['inProgress'] = inProgress; data['closed'] = closed; return data; } } class RequestsDetails { int id; String nameOfType; String priority; String status; String assetName; String assetNo; String assetSN; String model; String supplier; String manufacturer; String requestType; String requestNo; String gasType; String site; String statusReceiver; String assetTransferFrom; String assetTransferTo; String code; String date; String siteTransferFrom; String siteTransferTo; RequestsDetails( {this.id, this.nameOfType, this.priority, this.status, this.assetName, this.assetNo, this.assetSN, this.model, this.supplier, this.manufacturer, this.requestType, this.requestNo, this.gasType, this.site, this.statusReceiver, this.assetTransferFrom, this.assetTransferTo, this.code, this.siteTransferFrom, this.siteTransferTo, this.date}); RequestsDetails.fromJson(Map json) { id = json['id']; nameOfType = json['nameOfType']; priority = json['priority']; status = json['status']; assetName = json['assetName']; assetNo = json['assetNo']; assetSN = json['assetSN']; model = json['model']; supplier = json['supplier']; manufacturer = json['manufacturer']; requestType = json['requestType']; requestNo = json['requestNo']; gasType = json['gasType']; site = json['site']; statusReceiver = json['statusReceiver']; assetTransferFrom = json['assetTransferFrom']; assetTransferTo = json['assetTransferTo']; code = json['code']; date = json['date']; siteTransferFrom = json['siteTransferFrom']; siteTransferTo = json['siteTransferTo']; } Map toJson() { final Map data = {}; data['id'] = id; data['nameOfType'] = nameOfType; data['priority'] = priority; data['status'] = status; data['assetName'] = assetName; data['assetNo'] = assetNo; data['assetSN'] = assetSN; data['model'] = model; data['supplier'] = supplier; data['manufacturer'] = manufacturer; data['requestType'] = requestType; data['requestNo'] = requestNo; data['gasType'] = gasType; data['site'] = site; data['statusReceiver'] = statusReceiver; data['assetTransferFrom'] = assetTransferFrom; data['assetTransferTo'] = assetTransferTo; data['code'] = code; data['date'] = date; data['siteTransferFrom'] = siteTransferFrom; data['siteTransferTo'] = siteTransferTo; return data; } } class RequestQueryModel { List typeTransaction; List statusTransaction; List priority; List displayData; int pageNumber; int pageSize; bool showLoader; RequestQueryModel({ this.typeTransaction, this.statusTransaction, this.priority, this.displayData, this.pageNumber=1, this.pageSize=10, this.showLoader = true, }); // Factory method to create an instance from a JSON map factory RequestQueryModel.fromJson(Map json) { return RequestQueryModel( typeTransaction: List.from(json['typeTransaction']), statusTransaction: List.from(json['statusTransaction']), priority: List.from(json['priority']), displayData: List.from(json['displayData']), pageNumber: json['pageNumber'], pageSize: json['pageSize'], ); } // Method to convert an instance to a JSON map Map toJson() { return { 'typeTransaction': typeTransaction, 'statusTransaction': statusTransaction, 'priority': priority, 'displayData': displayData, 'pageNumber': pageNumber, 'pageSize': pageSize, }; } // Method to encode the model to a JSON string String encodeToJson() => json.encode(toJson()); // Method to decode the model from a JSON string static RequestQueryModel decodeFromJson(String jsonString) => RequestQueryModel.fromJson(json.decode(jsonString)); }