import 'dart:convert'; import 'package:flutter/foundation.dart'; 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.fromJsonCons(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)); }); } } static Future fromJson(Map json) { return compute(AllRequestsAndCount.fromJsonCons, json); } 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? sessionType; String? code; String? date; String? siteTransferFrom; String? siteTransferTo; int? transactionType; int? numberOfAssets; int? numberOfSites; 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.numberOfAssets, this.numberOfSites, this.sessionType, this.gasType, this.site, this.statusReceiver, this.assetTransferFrom, this.assetTransferTo, this.code, this.siteTransferFrom, this.siteTransferTo, this.date, this.transactionType}); 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']; sessionType = json['sessionType']; numberOfAssets = json['numberOfAssets']; numberOfSites = json['numberOfSites']; 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']; transactionType = json['transactionType']; } 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['sessionType'] = sessionType; data['numberOfSites'] = numberOfSites; data['numberOfAssets'] = numberOfAssets; data['code'] = code; data['date'] = date; data['siteTransferFrom'] = siteTransferFrom; data['siteTransferTo'] = siteTransferTo; data['transactionType'] = transactionType; 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 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'] ?? 1, pageSize: json['pageSize'] ?? 10, showLoader: json['showLoader'] ?? true, ); } Map toJson() { return { 'typeTransaction': typeTransaction, 'statusTransaction': statusTransaction, 'priority': priority, 'displayData': displayData, 'pageNumber': pageNumber, 'pageSize': pageSize, 'showLoader': showLoader, }; } String encodeToJson() => json.encode(toJson()); static RequestQueryModel decodeFromJson(String jsonString) => RequestQueryModel.fromJson(json.decode(jsonString)); }