import 'package:test_sa/models/base.dart'; import 'package:test_sa/models/new_models/room_model.dart'; class MappedSite extends Base { int? id; String? custName; int? languageId; List? translations; int? customerCode; dynamic costOfCustomerId; dynamic costOfCustomerName; dynamic taxId; dynamic taxName; dynamic custCategoryId; dynamic custCategoryName; dynamic custTypeId; dynamic custTypeName; dynamic custGroupId; dynamic custGroupName; dynamic invCollectionRep; dynamic salesRep; int? cityId; String? cityName; dynamic collectionPeriod1Id; dynamic collectionPeriod1Name; dynamic collectionPeriod2Id; dynamic collectionPeriod2Name; dynamic creditLimit; dynamic salesSubRepId; dynamic salesSubRepName; dynamic initialLetterText; dynamic assignedEmployeeId; dynamic assignedEmployeeUserName; dynamic groupLeaderId; dynamic groupLeaderUserName; int? organizationId; String? orgCode; String? orgName; String? orgPostalCode; List? attachments; List? buildings; dynamic operatingUnitNumber; dynamic operatingUnitName; List? custEndPoints; dynamic createdBy; dynamic createdDate; dynamic modifiedBy; dynamic modifiedDate; MappedSite({ this.id, this.custName, this.languageId, this.translations, this.customerCode, this.costOfCustomerId, this.costOfCustomerName, this.taxId, this.taxName, this.custCategoryId, this.custCategoryName, this.custTypeId, this.custTypeName, this.custGroupId, this.custGroupName, this.invCollectionRep, this.salesRep, this.cityId, this.cityName, this.collectionPeriod1Id, this.collectionPeriod1Name, this.collectionPeriod2Id, this.collectionPeriod2Name, this.creditLimit, this.salesSubRepId, this.salesSubRepName, this.initialLetterText, this.assignedEmployeeId, this.assignedEmployeeUserName, this.groupLeaderId, this.groupLeaderUserName, this.organizationId, this.orgCode, this.orgName, this.orgPostalCode, this.attachments, this.buildings, this.operatingUnitNumber, this.operatingUnitName, this.custEndPoints, this.createdBy, this.createdDate, this.modifiedBy, this.modifiedDate, }) : super(identifier: id?.toString() ?? '', name: custName); MappedSite.fromJson(Map json) { id = json['id']; identifier = id?.toString() ?? ''; // Handle potential null id custName = json['custName']; name = custName; languageId = json['languageId']; translations = (json['translations'] as List?)?.map((e) => MappedTranslation.fromJson(e)).toList(); customerCode = json['customerCode']; costOfCustomerId = json['costOfCustomerId']; costOfCustomerName = json['costOfCustomerName']; taxId = json['taxId']; taxName = json['taxName']; custCategoryId = json['custCategoryId']; custCategoryName = json['custCategoryName']; custTypeId = json['custTypeId']; custTypeName = json['custTypeName']; custGroupId = json['custGroupId']; custGroupName = json['custGroupName']; invCollectionRep = json['invCollectionRep']; salesRep = json['salesRep']; cityId = json['cityId']; cityName = json['cityName']; collectionPeriod1Id = json['collectionPeriod_1Id']; collectionPeriod1Name = json['collectionPeriod_1Name']; collectionPeriod2Id = json['collectionPeriod_2Id']; collectionPeriod2Name = json['collectionPeriod_2Name']; creditLimit = json['creditLimit']; salesSubRepId = json['salesSubRepId']; salesSubRepName = json['salesSubRepName']; initialLetterText = json['initialLetterText']; assignedEmployeeId = json['assignedEmployeeId']; assignedEmployeeUserName = json['assignedEmployeeUserName']; groupLeaderId = json['groupLeaderId']; groupLeaderUserName = json['groupLeaderUserName']; organizationId = json['organizationId']; orgCode = json['orgCode']; orgName = json['orgName']; orgPostalCode = json['orgPostalCode']; attachments = json['attachments']; buildings = (json['buildings'] as List?)?.map((e) => MappedBuilding.fromJson(e)).toList(); operatingUnitNumber = json['operatingUnitNumber']; operatingUnitName = json['operatingUnitName']; custEndPoints = json['custEndPoints']; createdBy = json['createdBy']; createdDate = json['createdDate']; modifiedBy = json['modifiedBy']; modifiedDate = json['modifiedDate']; } Map toJson() => { 'id': id, 'custName': custName, 'languageId': languageId, 'translations': translations?.map((e) => e.toJson()).toList(), 'customerCode': customerCode, 'costOfCustomerId': costOfCustomerId, 'costOfCustomerName': costOfCustomerName, 'taxId': taxId, 'taxName': taxName, 'custCategoryId': custCategoryId, 'custCategoryName': custCategoryName, 'custTypeId': custTypeId, 'custTypeName': custTypeName, 'custGroupId': custGroupId, 'custGroupName': custGroupName, 'invCollectionRep': invCollectionRep, 'salesRep': salesRep, 'cityId': cityId, 'cityName': cityName, 'collectionPeriod_1Id': collectionPeriod1Id, 'collectionPeriod_1Name': collectionPeriod1Name, 'collectionPeriod_2Id': collectionPeriod2Id, 'collectionPeriod_2Name': collectionPeriod2Name, 'creditLimit': creditLimit, 'salesSubRepId': salesSubRepId, 'salesSubRepName': salesSubRepName, 'initialLetterText': initialLetterText, 'assignedEmployeeId': assignedEmployeeId, 'assignedEmployeeUserName': assignedEmployeeUserName, 'groupLeaderId': groupLeaderId, 'groupLeaderUserName': groupLeaderUserName, 'organizationId': organizationId, 'orgCode': orgCode, 'orgName': orgName, 'orgPostalCode': orgPostalCode, 'attachments': attachments, 'buildings': buildings?.map((e) => e.toJson()).toList(), 'operatingUnitNumber': operatingUnitNumber, 'operatingUnitName': operatingUnitName, 'custEndPoints': custEndPoints, 'createdBy': createdBy, 'createdDate': createdDate, 'modifiedBy': modifiedBy, 'modifiedDate': modifiedDate, }; } class MappedTranslation { int? id; int? customerId; int? langId; String? langName; String? nameValue; MappedTranslation(); MappedTranslation.fromJson(Map json) { id = json['id']; customerId = json['customerId']; langId = json['langId']; langName = json['langName']; nameValue = json['nameValue']; } Map toJson() => { 'id': id, 'customerId': customerId, 'langId': langId, 'langName': langName, 'nameValue': nameValue, }; } class MappedBuilding extends Base { int? id; int? customerId; int? clientBuildingId; String? clientBuildingName; List? floors; MappedBuilding({ this.id, this.customerId, this.clientBuildingId, this.clientBuildingName, this.floors, }) : super(identifier: id?.toString() ?? '', name: clientBuildingName); MappedBuilding.fromJson(Map json) { id = json['id']; identifier = id?.toString() ?? ''; customerId = json['customerId']; clientBuildingId = json['clientBuildingId']; clientBuildingName = json['clientBuildingName']; name = clientBuildingName??json['name']; floors = (json['floors'] as List?)?.map((e) => MappedFloor.fromJson(e)).toList(); } Map toJson() => { 'id': id, 'customerId': customerId, 'clientBuildingId': clientBuildingId, 'clientBuildingName': clientBuildingName, 'floors': floors?.map((e) => e.toJson()).toList(), }; } class MappedFloor extends Base { int? id; int? buildingId; int? clientFloorId; String? clientFloorName; List? departments; MappedFloor({ this.id, this.buildingId, this.clientFloorId, this.clientFloorName, this.departments, }) : super(identifier: id?.toString() ?? '', name: clientFloorName); MappedFloor.fromJson(Map json) { id = json['id']; identifier = id?.toString() ?? ''; buildingId = json['buildingId']; clientFloorId = json['clientFloorId']; clientFloorName = json['clientFloorName']; name = clientFloorName??json['name']; departments = (json['departments'] as List?)?.map((e) => MappedDepartment.fromJson(e)).toList(); } Map toJson() => { 'id': id, 'buildingId': buildingId, 'clientFloorId': clientFloorId, 'clientFloorName': clientFloorName, 'departments': departments?.map((e) => e.toJson()).toList(), }; } class MappedDepartment extends Base { int? id; int? floorId; int? departmentId; String? departmentName; List? rooms; MappedDepartment({ this.id, this.floorId, this.departmentId, this.departmentName, this.rooms, }) : super(identifier: id?.toString() ?? '', name: departmentName); MappedDepartment.fromJson(Map json) { id = json['id']; identifier = id?.toString() ?? ''; floorId = json['floorId']; departmentId = json['departmentId']; departmentName = json['departmentName']; name = departmentName??json['name']; // rooms = json['rooms']; } Map toJson() => { 'id': id, 'floorId': floorId, 'departmentId': departmentId, 'departmentName': departmentName, 'rooms': rooms, }; }