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