// ignore_for_file: non_constant_identifier_names // ignore_for_file: camel_case_types // ignore_for_file: prefer_single_quotes // This file is automatically generated. DO NOT EDIT, all your changes would be lost. import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesCategoriesResponseModel.dart'; import 'package:diplomaticquarterapp/generated/json/OfferCategoriesResponseModel_helper.dart'; import 'package:diplomaticquarterapp/core/model/geofencing/responses/LogGeoZoneResponseModel.dart'; import 'package:diplomaticquarterapp/generated/json/log_geo_zone_response_model_entity_helper.dart'; import 'package:diplomaticquarterapp/core/model/packages_offers/responses/PackagesResponseModel.dart'; import 'package:diplomaticquarterapp/generated/json/OfferProductsResponseModel_helper.dart'; import 'package:diplomaticquarterapp/core/model/geofencing/responses/GeoZonesResponseModel.dart'; import 'package:diplomaticquarterapp/generated/json/GeoZonesResponseModel_helper.dart'; class JsonConvert { T fromJson(Map json) { return _getFromJson(runtimeType, this, json); } Map toJson() { return _getToJson(runtimeType, this); } static _getFromJson(Type type, data, json) { switch (type) { case PackagesCategoriesResponseModel: return offerCategoriesResponseModelFromJson(data as PackagesCategoriesResponseModel, json) as T; case OfferCategoriesResponseModelLocalizedName: return offerCategoriesResponseModelLocalizedNameFromJson(data as OfferCategoriesResponseModelLocalizedName, json) as T; case OfferCategoriesResponseModelImage: return offerCategoriesResponseModelImageFromJson(data as OfferCategoriesResponseModelImage, json) as T; case LogGeoZoneResponseModel: return logGeoZoneResponseModelEntityFromJson(data as LogGeoZoneResponseModel, json) as T; case PackagesResponseModel: return offerProductsResponseModelFromJson(data as PackagesResponseModel, json) as T; case OfferProductsResponseModelLocalizedName: return offerProductsResponseModelLocalizedNameFromJson(data as OfferProductsResponseModelLocalizedName, json) as T; case OfferProductsResponseModelImage: return offerProductsResponseModelImageFromJson(data as OfferProductsResponseModelImage, json) as T; case OfferProductsResponseModelSpecification: return offerProductsResponseModelSpecificationFromJson(data as OfferProductsResponseModelSpecification, json) as T; case GeoZonesResponseModel: return geoZonesResponseModelEntityFromJson(data as GeoZonesResponseModel, json) as T; } return data as T; } static _getToJson(Type type, data) { switch (type) { case PackagesCategoriesResponseModel: return offerCategoriesResponseModelToJson(data as PackagesCategoriesResponseModel); case OfferCategoriesResponseModelLocalizedName: return offerCategoriesResponseModelLocalizedNameToJson(data as OfferCategoriesResponseModelLocalizedName); case OfferCategoriesResponseModelImage: return offerCategoriesResponseModelImageToJson(data as OfferCategoriesResponseModelImage); case LogGeoZoneResponseModel: return logGeoZoneResponseModelEntityToJson(data as LogGeoZoneResponseModel); case PackagesResponseModel: return offerProductsResponseModelToJson(data as PackagesResponseModel); case OfferProductsResponseModelLocalizedName: return offerProductsResponseModelLocalizedNameToJson(data as OfferProductsResponseModelLocalizedName); case OfferProductsResponseModelImage: return offerProductsResponseModelImageToJson(data as OfferProductsResponseModelImage); case OfferProductsResponseModelSpecification: return offerProductsResponseModelSpecificationToJson(data as OfferProductsResponseModelSpecification); case GeoZonesResponseModel: return geoZonesResponseModelEntityToJson(data as GeoZonesResponseModel); } return data as T; } //Go back to a single instance by type static _fromJsonSingle(json) { String type = M.toString(); if (type == (PackagesCategoriesResponseModel).toString()) { return PackagesCategoriesResponseModel().fromJson(json); } else if (type == (OfferCategoriesResponseModelLocalizedName).toString()) { return OfferCategoriesResponseModelLocalizedName().fromJson(json); } else if (type == (OfferCategoriesResponseModelImage).toString()) { return OfferCategoriesResponseModelImage().fromJson(json); } else if (type == (LogGeoZoneResponseModel).toString()) { return LogGeoZoneResponseModel().fromJson(json); } else if (type == (PackagesResponseModel).toString()) { return PackagesResponseModel().fromJson(json); } else if (type == (OfferProductsResponseModelLocalizedName).toString()) { return OfferProductsResponseModelLocalizedName().fromJson(json); } else if (type == (OfferProductsResponseModelImage).toString()) { return OfferProductsResponseModelImage().fromJson(json); } else if (type == (OfferProductsResponseModelSpecification).toString()) { return OfferProductsResponseModelSpecification().fromJson(json); } else if (type == (GeoZonesResponseModel).toString()) { return GeoZonesResponseModel().fromJson(json); } return null; } //list is returned by type static M _getListChildType(List data) { if (List() is M) { return data.map((e) => PackagesCategoriesResponseModel().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => OfferCategoriesResponseModelLocalizedName().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => OfferCategoriesResponseModelImage().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => LogGeoZoneResponseModel().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => PackagesResponseModel().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => OfferProductsResponseModelLocalizedName().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => OfferProductsResponseModelImage().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => OfferProductsResponseModelSpecification().fromJson(e)).toList() as M; } else if (List() is M) { return data.map((e) => GeoZonesResponseModel().fromJson(e)).toList() as M; } return null; } static M fromJsonAsT(json) { if (json is List) { return _getListChildType(json); } else { return _fromJsonSingle(json) as M; } } }