import 'package:test_sa/models/device/technical_guidance_book.dart'; import 'package:test_sa/models/lookup.dart'; class AssetByIdModel { List multiAssets; int id; ModelDefinition modelDefinition; Suppliers supplier; String ipAddress; String macAddress; String portNumber; AssetReplace assetReplace; AssetInfo oldAsset; AssetReplace isParent; AssetInfo parentAsset; AssetReplace assetType; String demoRequest; String missionCritical; Site site; AssetReplace building; AssetReplace floor; Department department; String room; int testsDay; num purchasingPrice; String nbv; String currency; String poDate; String poNo; String invoiceNumber; String invoiceDate; String replacementDate; num budgetYear; num lastPOPrice; Lookup commissioningStatus; Department originDepartment; Site originSite; String productionDate; String edd; String technicalInspectionDate; String deliveryInspectionDate; String endUserAcceptanceDate; String technicalAcceptanceDate; String finalAcceptanceDate; String installationDate; int siteWarrantyMonthNo; num extendedWarrantyMonthNo; num remainderWarrantyMonthNo; num eomWarrantyMonthsNo; num warrantyValue; String warrantyEndDate; String warrantyContractConditions; List technicalGuidanceBooks; String comment; bool isEnabled; String tagCode; List assetAttachments; String retirementTypeName; String retirementStatusName; String retirementDate; AssetGroup assetGroup; String assetPhoto; String nextPMDate; String lastPMDate; AssetByIdModel( {this.multiAssets, this.id, this.modelDefinition, this.supplier, this.ipAddress, this.macAddress, this.portNumber, this.assetReplace, this.oldAsset, this.isParent, this.parentAsset, this.assetType, this.demoRequest, this.missionCritical, this.site, this.building, this.floor, this.department, this.room, this.testsDay, this.purchasingPrice, this.nbv, this.currency, this.poDate, this.poNo, this.invoiceNumber, this.invoiceDate, this.replacementDate, this.budgetYear, this.lastPOPrice, this.commissioningStatus, this.originDepartment, this.originSite, this.productionDate, this.edd, this.technicalInspectionDate, this.deliveryInspectionDate, this.endUserAcceptanceDate, this.technicalAcceptanceDate, this.finalAcceptanceDate, this.installationDate, this.siteWarrantyMonthNo, this.extendedWarrantyMonthNo, this.remainderWarrantyMonthNo, this.eomWarrantyMonthsNo, this.warrantyValue, this.warrantyEndDate, this.warrantyContractConditions, this.technicalGuidanceBooks, this.comment, this.isEnabled, this.tagCode, this.assetAttachments, this.retirementTypeName, this.retirementStatusName, this.retirementDate, this.assetGroup, this.assetPhoto, this.nextPMDate, this.lastPMDate}); AssetByIdModel.fromJson(Map json) { if (json['multiAssets'] != null) { multiAssets = []; json['multiAssets'].forEach((v) { multiAssets.add(new MultiAssets.fromJson(v)); }); } id = json['id']; print("supplier:${json['supplier']}"); modelDefinition = json['modelDefinition'] != null ? new ModelDefinition.fromJson(json['modelDefinition']) : null; supplier = json['supplier'] != null ? Suppliers.fromJson(json['supplier']) : null; ipAddress = json['ipAddress']; macAddress = json['macAddress']; portNumber = json['portNumber']; assetReplace = json['assetReplace'] != null ? new AssetReplace.fromJson(json['assetReplace']) : null; oldAsset = json['oldAsset'] != null ? AssetInfo.fromJson(json['oldAsset']) : null; isParent = json['isParent'] != null ? new AssetReplace.fromJson(json['isParent']) : null; parentAsset = json['parentAsset'] != null ? AssetInfo.fromJson(json['parentAsset']) : null; assetType = json['assetType'] != null ? new AssetReplace.fromJson(json['assetType']) : null; demoRequest = json['demoRequest']; missionCritical = json['missionCritical']; site = json['site'] != null ? new Site.fromJson(json['site']) : null; building = json['building'] != null ? new AssetReplace.fromJson(json['building']) : null; floor = json['floor'] != null ? new AssetReplace.fromJson(json['floor']) : null; department = json['department'] != null ? new Department.fromJson(json['department']) : null; room = json['room']; testsDay = json['testsDay']; purchasingPrice = json['purchasingPrice']; nbv = json['nbv']; currency = json['currency']; poDate = json['poDate']; poNo = json['poNo']; invoiceNumber = json['invoiceNumber']; invoiceDate = json['invoiceDate']; replacementDate = json['replacementDate']; budgetYear = json['budgetYear']; lastPOPrice = json['lastPOPrice']; commissioningStatus = json['commissioningStatus'] != null ? new Lookup.fromJson(json['commissioningStatus']) : null; originDepartment = json['originDepartment'] != null ? new Department.fromJson(json['originDepartment']) : null; originSite = json['originSite'] != null ? new Site.fromJson(json['originSite']) : null; productionDate = json['productionDate']; edd = json['edd']; technicalInspectionDate = json['technicalInspectionDate']; deliveryInspectionDate = json['deliveryInspectionDate']; endUserAcceptanceDate = json['endUserAcceptanceDate']; technicalAcceptanceDate = json['technicalAcceptanceDate']; finalAcceptanceDate = json['finalAcceptanceDate']; installationDate = json['installationDate']; siteWarrantyMonthNo = json['siteWarrantyMonthNo']; extendedWarrantyMonthNo = json['extendedWarrantyMonthNo']; remainderWarrantyMonthNo = json['remainderWarrantyMonthNo']; eomWarrantyMonthsNo = json['eomWarrantyMonthsNo']; warrantyValue = json['warrantyValue']; warrantyEndDate = json['warrantyEndDate']; warrantyContractConditions = json['warrantyContractConditions']; if (json['technicalGuidanceBooks'] != null) { technicalGuidanceBooks = []; json['technicalGuidanceBooks'].forEach((v) { technicalGuidanceBooks.add(TechnicalGuidanceBook.fromJson(v)); }); } comment = json['comment']; isEnabled = json['isEnabled']; tagCode = json['tagCode']; if (json['assetAttachments'] != null) { assetAttachments = []; json['assetAttachments'].forEach((v) { assetAttachments.add(v); }); } retirementTypeName = json['retirementTypeName']; retirementStatusName = json['retirementStatusName']; retirementDate = json['retirementDate']; assetGroup = json['assetGroup'] != null ? new AssetGroup.fromJson(json['assetGroup']) : null; assetPhoto = json['assetPhoto']; nextPMDate = json['nextPMDate']; lastPMDate = json['lastPMDate']; } Map toJson() { final Map data = new Map(); if (this.multiAssets != null) { data['multiAssets'] = this.multiAssets.map((v) => v.toJson()).toList(); } data['id'] = this.id; if (this.modelDefinition != null) { data['modelDefinition'] = this.modelDefinition.toJson(); } if (this.supplier != null) { data['supplier'] = this.supplier.toJson(); } data['ipAddress'] = this.ipAddress; data['macAddress'] = this.macAddress; data['portNumber'] = this.portNumber; if (this.assetReplace != null) { data['assetReplace'] = this.assetReplace.toJson(); } data['oldAsset'] = this.oldAsset?.toJson(); if (this.isParent != null) { data['isParent'] = this.isParent.toJson(); } data['parentAsset'] = this.parentAsset?.toJson(); if (this.assetType != null) { data['assetType'] = this.assetType.toJson(); } data['demoRequest'] = this.demoRequest; data['missionCritical'] = this.missionCritical; if (this.site != null) { data['site'] = this.site.toJson(); } if (this.building != null) { data['building'] = this.building.toJson(); } if (this.floor != null) { data['floor'] = this.floor.toJson(); } if (this.department != null) { data['department'] = this.department.toJson(); } data['room'] = this.room; data['testsDay'] = this.testsDay; data['purchasingPrice'] = this.purchasingPrice; data['nbv'] = this.nbv; data['currency'] = this.currency; data['poDate'] = this.poDate; data['poNo'] = this.poNo; data['invoiceNumber'] = this.invoiceNumber; data['invoiceDate'] = this.invoiceDate; data['replacementDate'] = this.replacementDate; data['budgetYear'] = this.budgetYear; data['lastPOPrice'] = this.lastPOPrice; data['commissioningStatus'] = this.commissioningStatus?.toJson(); if (this.originDepartment != null) { data['originDepartment'] = this.originDepartment.toJson(); } if (this.originSite != null) { data['originSite'] = this.originSite.toJson(); } data['productionDate'] = this.productionDate; data['edd'] = this.edd; data['technicalInspectionDate'] = this.technicalInspectionDate; data['deliveryInspectionDate'] = this.deliveryInspectionDate; data['endUserAcceptanceDate'] = this.endUserAcceptanceDate; data['technicalAcceptanceDate'] = this.technicalAcceptanceDate; data['finalAcceptanceDate'] = this.finalAcceptanceDate; data['installationDate'] = this.installationDate; data['siteWarrantyMonthNo'] = this.siteWarrantyMonthNo; data['extendedWarrantyMonthNo'] = this.extendedWarrantyMonthNo; data['remainderWarrantyMonthNo'] = this.remainderWarrantyMonthNo; data['eomWarrantyMonthsNo'] = this.eomWarrantyMonthsNo; data['warrantyValue'] = this.warrantyValue; data['warrantyEndDate'] = this.warrantyEndDate; data['warrantyContractConditions'] = this.warrantyContractConditions; if (this.technicalGuidanceBooks != null) { data['technicalGuidanceBooks'] = this.technicalGuidanceBooks.map((v) => v).toList(); } data['comment'] = this.comment; data['isEnabled'] = this.isEnabled; data['tagCode'] = this.tagCode; if (this.assetAttachments != null) { data['assetAttachments'] = this.assetAttachments.map((v) => v).toList(); } data['retirementTypeName'] = this.retirementTypeName; data['retirementStatusName'] = this.retirementStatusName; data['retirementDate'] = this.retirementDate; if (this.assetGroup != null) { data['assetGroup'] = this.assetGroup.toJson(); } data['assetPhoto'] = this.assetPhoto; data['nextPMDate'] = this.nextPMDate; data['lastPMDate'] = this.lastPMDate; return data; } } class MultiAssets { String assetSerialNo; String systemID; String assetNumber; MultiAssets({this.assetSerialNo, this.systemID, this.assetNumber}); MultiAssets.fromJson(Map json) { assetSerialNo = json['assetSerialNo']; systemID = json['systemID']; assetNumber = json['assetNumber']; } Map toJson() { final Map data = new Map(); data['assetSerialNo'] = this.assetSerialNo; data['systemID'] = this.systemID; data['assetNumber'] = this.assetNumber; return data; } } class ModelDefinition { int id; String assetName; String assetDescription; String modelDefCode; String modelName; int manufacturerId; String manufacturerName; String supplierName; String replacementDate; String essentialEquipement; String businessCritical; int lifeSpan; List modelDefRelatedDefects; List suppliers; ModelDefinition( {this.id, this.assetName, this.assetDescription, this.modelDefCode, this.modelName, this.manufacturerId, this.manufacturerName, this.supplierName, this.replacementDate, this.essentialEquipement, this.businessCritical, this.lifeSpan, this.modelDefRelatedDefects, this.suppliers}); ModelDefinition.fromJson(Map json) { id = json['id']; assetName = json['assetName']; assetDescription = json['assetDescription']; modelDefCode = json['modelDefCode']; modelName = json['modelName']; manufacturerId = json['manufacturerId']; manufacturerName = json['manufacturerName']; supplierName = json['supplierName']; replacementDate = json['replacementDate']; essentialEquipement = json['essentialEquipement']; businessCritical = json['businessCritical']; lifeSpan = json['lifeSpan']; if (json['modelDefRelatedDefects'] != null) { modelDefRelatedDefects = []; json['modelDefRelatedDefects'].forEach((v) { modelDefRelatedDefects.add(ModelDefRelatedDefects.fromJson(v)); }); } if (json['suppliers'] != null) { suppliers = []; json['suppliers'].forEach((v) { suppliers.add(new Suppliers.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['assetName'] = this.assetName; data['assetDescription'] = this.assetDescription; data['modelDefCode'] = this.modelDefCode; data['modelName'] = this.modelName; data['manufacturerId'] = this.manufacturerId; data['manufacturerName'] = this.manufacturerName; data['supplierName'] = this.supplierName; data['replacementDate'] = this.replacementDate; data['essentialEquipement'] = this.essentialEquipement; data['businessCritical'] = this.businessCritical; data['lifeSpan'] = this.lifeSpan; if (this.modelDefRelatedDefects != null) { data['modelDefRelatedDefects'] = this.modelDefRelatedDefects.map((v) => v.toJson()).toList(); } if (this.suppliers != null) { data['suppliers'] = this.suppliers.map((v) => v.toJson()).toList(); } return data; } } class Suppliers { int id; String suppliername; Suppliers({this.id, this.suppliername}); Suppliers.fromJson(Map json) { id = json['id']; suppliername = json['suppliername']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['suppliername'] = this.suppliername; return data; } } class AssetReplace { int id; String name; int value; AssetReplace({this.id, this.name, this.value}); AssetReplace.fromJson(Map json) { id = json['id']; name = json['name']; value = json['value']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['value'] = this.value; 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'].forEach((v) { buildings.add(new Buildings.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['customerCode'] = this.customerCode; data['custName'] = this.custName; if (this.buildings != null) { data['buildings'] = this.buildings.map((v) => v.toJson()).toList(); } return data; } } class Buildings { int id; String name; int value; List floors; Buildings({this.id, this.name, this.value, this.floors}); Buildings.fromJson(Map json) { id = json['id']; name = json['name']; value = json['value']; if (json['floors'] != null) { floors = []; json['floors'].forEach((v) { floors.add(new Floors.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['value'] = this.value; if (this.floors != null) { data['floors'] = this.floors.map((v) => v.toJson()).toList(); } return data; } } class Floors { int id; String name; int value; List departments; Floors({this.id, this.name, this.value, this.departments}); Floors.fromJson(Map json) { id = json['id']; name = json['name']; value = json['value']; if (json['departments'] != null) { departments = []; json['departments'].forEach((v) { departments.add(new Departments.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['value'] = this.value; if (this.departments != null) { data['departments'] = this.departments.map((v) => v.toJson()).toList(); } return data; } } class Departments { int id; String name; Departments({this.id, this.name}); Departments.fromJson(Map json) { id = json['id']; name = json['name']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; return data; } } class Department { int id; String departmentName; String departmentCode; String ntCode; Department({this.id, this.departmentName, this.departmentCode, this.ntCode}); Department.fromJson(Map json) { id = json['id']; departmentName = json['departmentName']; departmentCode = json['departmentCode']; ntCode = json['ntCode']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['departmentName'] = this.departmentName; data['departmentCode'] = this.departmentCode; data['ntCode'] = this.ntCode; return data; } } class AssetGroup { int id; String name; String code; AssetGroup({this.id, this.name, this.code}); AssetGroup.fromJson(Map json) { id = json['id']; name = json['name']; code = json['code']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; data['code'] = this.code; return data; } } class ModelDefRelatedDefects { ModelDefRelatedDefects({ this.id, this.defectName, this.workPerformed, this.estimatedTime, }); ModelDefRelatedDefects.fromJson(dynamic json) { id = json['id']; defectName = json['defectName']; workPerformed = json['workPerformed']; estimatedTime = json['estimatedTime']; } num id; String defectName; String workPerformed; String estimatedTime; ModelDefRelatedDefects copyWith({ num id, String defectName, String workPerformed, String estimatedTime, }) => ModelDefRelatedDefects( id: id ?? this.id ?? 0, defectName: defectName ?? this.defectName, workPerformed: workPerformed ?? this.workPerformed, estimatedTime: estimatedTime ?? this.estimatedTime, ); Map toJson() { final map = {}; map['id'] = id; map['defectName'] = defectName; map['workPerformed'] = workPerformed; map['estimatedTime'] = estimatedTime; return map; } } class AssetInfo { AssetInfo({ this.id, this.assetSerialNo, this.assetNumber, this.tagCode, this.systemId, this.assetName, }); AssetInfo.fromJson(dynamic json) { id = json['id']; assetSerialNo = json['assetSerialNo']; assetNumber = json['assetNumber']; tagCode = json['tagCode']; systemId = json['systemId']; assetName = json['assetName']; } num id; String assetSerialNo; String assetNumber; String tagCode; String systemId; String assetName; AssetInfo copyWith({ num id, String assetSerialNo, String assetNumber, String tagCode, String systemId, String assetName, }) => AssetInfo( id: id ?? this.id, assetSerialNo: assetSerialNo ?? this.assetSerialNo, assetNumber: assetNumber ?? this.assetNumber, tagCode: tagCode ?? this.tagCode, systemId: systemId ?? this.systemId, assetName: assetName ?? this.assetName, ); Map toJson() { final map = {}; map['id'] = id; map['assetSerialNo'] = assetSerialNo; map['assetNumber'] = assetNumber; map['tagCode'] = tagCode; map['systemId'] = systemId; map['assetName'] = assetName; return map; } }