import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/facility_book_entity.dart'; FacilityBookEntity $FacilityBookEntityFromJson(Map json) { final FacilityBookEntity facilityBookEntity = FacilityBookEntity(); final int? remainQuota = jsonConvert.convert(json['remain_quota']); if (remainQuota != null) { facilityBookEntity.remainQuota = remainQuota; } final String? quotaResetOn = jsonConvert.convert( json['quota_reset_on']); if (quotaResetOn != null) { facilityBookEntity.quotaResetOn = quotaResetOn; } final FacilityBookFacilityType? facilityType = jsonConvert.convert< FacilityBookFacilityType>(json['facility_type']); if (facilityType != null) { facilityBookEntity.facilityType = facilityType; } final List? facilities = (json['facilities'] as List< dynamic>?) ?.map( (e) => jsonConvert.convert(e) as FacilityBookFacilities) .toList(); if (facilities != null) { facilityBookEntity.facilities = facilities; } return facilityBookEntity; } Map $FacilityBookEntityToJson(FacilityBookEntity entity) { final Map data = {}; data['remain_quota'] = entity.remainQuota; data['quota_reset_on'] = entity.quotaResetOn; data['facility_type'] = entity.facilityType?.toJson(); data['facilities'] = entity.facilities?.map((v) => v.toJson()).toList(); return data; } extension FacilityBookEntityExtension on FacilityBookEntity { FacilityBookEntity copyWith({ int? remainQuota, String? quotaResetOn, FacilityBookFacilityType? facilityType, List? facilities, }) { return FacilityBookEntity() ..remainQuota = remainQuota ?? this.remainQuota ..quotaResetOn = quotaResetOn ?? this.quotaResetOn ..facilityType = facilityType ?? this.facilityType ..facilities = facilities ?? this.facilities; } } FacilityBookFacilityType $FacilityBookFacilityTypeFromJson( Map json) { final FacilityBookFacilityType facilityBookFacilityType = FacilityBookFacilityType(); final int? bookAdvanceDays = jsonConvert.convert( json['book_advance_days']); if (bookAdvanceDays != null) { facilityBookFacilityType.bookAdvanceDays = bookAdvanceDays; } final int? quota = jsonConvert.convert(json['quota']); if (quota != null) { facilityBookFacilityType.quota = quota; } final String? quotaResetType = jsonConvert.convert( json['quota_reset_type']); if (quotaResetType != null) { facilityBookFacilityType.quotaResetType = quotaResetType; } return facilityBookFacilityType; } Map $FacilityBookFacilityTypeToJson( FacilityBookFacilityType entity) { final Map data = {}; data['book_advance_days'] = entity.bookAdvanceDays; data['quota'] = entity.quota; data['quota_reset_type'] = entity.quotaResetType; return data; } extension FacilityBookFacilityTypeExtension on FacilityBookFacilityType { FacilityBookFacilityType copyWith({ int? bookAdvanceDays, int? quota, String? quotaResetType, }) { return FacilityBookFacilityType() ..bookAdvanceDays = bookAdvanceDays ?? this.bookAdvanceDays ..quota = quota ?? this.quota ..quotaResetType = quotaResetType ?? this.quotaResetType; } } FacilityBookFacilities $FacilityBookFacilitiesFromJson( Map json) { final FacilityBookFacilities facilityBookFacilities = FacilityBookFacilities(); final String? id = jsonConvert.convert(json['id']); if (id != null) { facilityBookFacilities.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { facilityBookFacilities.name = name; } final List? periods = (json['periods'] as List< dynamic>?)?.map( (e) => jsonConvert.convert( e) as FacilityBookFacilitiesPeriods).toList(); if (periods != null) { facilityBookFacilities.periods = periods; } return facilityBookFacilities; } Map $FacilityBookFacilitiesToJson( FacilityBookFacilities entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['periods'] = entity.periods?.map((v) => v.toJson()).toList(); return data; } extension FacilityBookFacilitiesExtension on FacilityBookFacilities { FacilityBookFacilities copyWith({ String? id, String? name, List? periods, }) { return FacilityBookFacilities() ..id = id ?? this.id ..name = name ?? this.name ..periods = periods ?? this.periods; } } FacilityBookFacilitiesPeriods $FacilityBookFacilitiesPeriodsFromJson( Map json) { final FacilityBookFacilitiesPeriods facilityBookFacilitiesPeriods = FacilityBookFacilitiesPeriods(); final String? id = jsonConvert.convert(json['id']); if (id != null) { facilityBookFacilitiesPeriods.id = id; } final String? start = jsonConvert.convert(json['start']); if (start != null) { facilityBookFacilitiesPeriods.start = start; } final String? end = jsonConvert.convert(json['end']); if (end != null) { facilityBookFacilitiesPeriods.end = end; } final String? price = jsonConvert.convert(json['price']); if (price != null) { facilityBookFacilitiesPeriods.price = price; } final String? deposit = jsonConvert.convert(json['deposit']); if (deposit != null) { facilityBookFacilitiesPeriods.deposit = deposit; } final bool? enable = jsonConvert.convert(json['enable']); if (enable != null) { facilityBookFacilitiesPeriods.enable = enable; } final bool? selected = jsonConvert.convert(json['selected']); if (selected != null) { facilityBookFacilitiesPeriods.selected = selected; } return facilityBookFacilitiesPeriods; } Map $FacilityBookFacilitiesPeriodsToJson( FacilityBookFacilitiesPeriods entity) { final Map data = {}; data['id'] = entity.id; data['start'] = entity.start; data['end'] = entity.end; data['price'] = entity.price; data['deposit'] = entity.deposit; data['enable'] = entity.enable; data['selected'] = entity.selected; return data; } extension FacilityBookFacilitiesPeriodsExtension on FacilityBookFacilitiesPeriods { FacilityBookFacilitiesPeriods copyWith({ String? id, String? start, String? end, String? price, String? deposit, bool? enable, bool? selected, }) { return FacilityBookFacilitiesPeriods() ..id = id ?? this.id ..start = start ?? this.start ..end = end ?? this.end ..price = price ?? this.price ..deposit = deposit ?? this.deposit ..enable = enable ?? this.enable ..selected = selected ?? this.selected; } }