facility_book_entity.g.dart 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/facility_book_entity.dart';
  3. FacilityBookEntity $FacilityBookEntityFromJson(Map<String, dynamic> json) {
  4. final FacilityBookEntity facilityBookEntity = FacilityBookEntity();
  5. final int? remainQuota = jsonConvert.convert<int>(json['remain_quota']);
  6. if (remainQuota != null) {
  7. facilityBookEntity.remainQuota = remainQuota;
  8. }
  9. final String? quotaResetOn = jsonConvert.convert<String>(json['quota_reset_on']);
  10. if (quotaResetOn != null) {
  11. facilityBookEntity.quotaResetOn = quotaResetOn;
  12. }
  13. final FacilityBookFacilityType? facilityType = jsonConvert.convert<FacilityBookFacilityType>(json['facility_type']);
  14. if (facilityType != null) {
  15. facilityBookEntity.facilityType = facilityType;
  16. }
  17. final List<FacilityBookFacilities>? facilities = (json['facilities'] as List<dynamic>?)?.map(
  18. (e) => jsonConvert.convert<FacilityBookFacilities>(e) as FacilityBookFacilities).toList();
  19. if (facilities != null) {
  20. facilityBookEntity.facilities = facilities;
  21. }
  22. return facilityBookEntity;
  23. }
  24. Map<String, dynamic> $FacilityBookEntityToJson(FacilityBookEntity entity) {
  25. final Map<String, dynamic> data = <String, dynamic>{};
  26. data['remain_quota'] = entity.remainQuota;
  27. data['quota_reset_on'] = entity.quotaResetOn;
  28. data['facility_type'] = entity.facilityType?.toJson();
  29. data['facilities'] = entity.facilities?.map((v) => v.toJson()).toList();
  30. return data;
  31. }
  32. extension FacilityBookEntityExtension on FacilityBookEntity {
  33. FacilityBookEntity copyWith({
  34. int? remainQuota,
  35. String? quotaResetOn,
  36. FacilityBookFacilityType? facilityType,
  37. List<FacilityBookFacilities>? facilities,
  38. }) {
  39. return FacilityBookEntity()
  40. ..remainQuota = remainQuota ?? this.remainQuota
  41. ..quotaResetOn = quotaResetOn ?? this.quotaResetOn
  42. ..facilityType = facilityType ?? this.facilityType
  43. ..facilities = facilities ?? this.facilities;
  44. }
  45. }
  46. FacilityBookFacilityType $FacilityBookFacilityTypeFromJson(Map<String, dynamic> json) {
  47. final FacilityBookFacilityType facilityBookFacilityType = FacilityBookFacilityType();
  48. final int? bookAdvanceDays = jsonConvert.convert<int>(json['book_advance_days']);
  49. if (bookAdvanceDays != null) {
  50. facilityBookFacilityType.bookAdvanceDays = bookAdvanceDays;
  51. }
  52. final int? quota = jsonConvert.convert<int>(json['quota']);
  53. if (quota != null) {
  54. facilityBookFacilityType.quota = quota;
  55. }
  56. final String? quotaResetType = jsonConvert.convert<String>(json['quota_reset_type']);
  57. if (quotaResetType != null) {
  58. facilityBookFacilityType.quotaResetType = quotaResetType;
  59. }
  60. return facilityBookFacilityType;
  61. }
  62. Map<String, dynamic> $FacilityBookFacilityTypeToJson(FacilityBookFacilityType entity) {
  63. final Map<String, dynamic> data = <String, dynamic>{};
  64. data['book_advance_days'] = entity.bookAdvanceDays;
  65. data['quota'] = entity.quota;
  66. data['quota_reset_type'] = entity.quotaResetType;
  67. return data;
  68. }
  69. extension FacilityBookFacilityTypeExtension on FacilityBookFacilityType {
  70. FacilityBookFacilityType copyWith({
  71. int? bookAdvanceDays,
  72. int? quota,
  73. String? quotaResetType,
  74. }) {
  75. return FacilityBookFacilityType()
  76. ..bookAdvanceDays = bookAdvanceDays ?? this.bookAdvanceDays
  77. ..quota = quota ?? this.quota
  78. ..quotaResetType = quotaResetType ?? this.quotaResetType;
  79. }
  80. }
  81. FacilityBookFacilities $FacilityBookFacilitiesFromJson(Map<String, dynamic> json) {
  82. final FacilityBookFacilities facilityBookFacilities = FacilityBookFacilities();
  83. final String? id = jsonConvert.convert<String>(json['id']);
  84. if (id != null) {
  85. facilityBookFacilities.id = id;
  86. }
  87. final String? name = jsonConvert.convert<String>(json['name']);
  88. if (name != null) {
  89. facilityBookFacilities.name = name;
  90. }
  91. final List<FacilityBookFacilitiesPeriods>? periods = (json['periods'] as List<dynamic>?)?.map(
  92. (e) => jsonConvert.convert<FacilityBookFacilitiesPeriods>(e) as FacilityBookFacilitiesPeriods).toList();
  93. if (periods != null) {
  94. facilityBookFacilities.periods = periods;
  95. }
  96. return facilityBookFacilities;
  97. }
  98. Map<String, dynamic> $FacilityBookFacilitiesToJson(FacilityBookFacilities entity) {
  99. final Map<String, dynamic> data = <String, dynamic>{};
  100. data['id'] = entity.id;
  101. data['name'] = entity.name;
  102. data['periods'] = entity.periods?.map((v) => v.toJson()).toList();
  103. return data;
  104. }
  105. extension FacilityBookFacilitiesExtension on FacilityBookFacilities {
  106. FacilityBookFacilities copyWith({
  107. String? id,
  108. String? name,
  109. List<FacilityBookFacilitiesPeriods>? periods,
  110. }) {
  111. return FacilityBookFacilities()
  112. ..id = id ?? this.id
  113. ..name = name ?? this.name
  114. ..periods = periods ?? this.periods;
  115. }
  116. }
  117. FacilityBookFacilitiesPeriods $FacilityBookFacilitiesPeriodsFromJson(Map<String, dynamic> json) {
  118. final FacilityBookFacilitiesPeriods facilityBookFacilitiesPeriods = FacilityBookFacilitiesPeriods();
  119. final String? id = jsonConvert.convert<String>(json['id']);
  120. if (id != null) {
  121. facilityBookFacilitiesPeriods.id = id;
  122. }
  123. final String? start = jsonConvert.convert<String>(json['start']);
  124. if (start != null) {
  125. facilityBookFacilitiesPeriods.start = start;
  126. }
  127. final String? end = jsonConvert.convert<String>(json['end']);
  128. if (end != null) {
  129. facilityBookFacilitiesPeriods.end = end;
  130. }
  131. final String? price = jsonConvert.convert<String>(json['price']);
  132. if (price != null) {
  133. facilityBookFacilitiesPeriods.price = price;
  134. }
  135. final String? deposit = jsonConvert.convert<String>(json['deposit']);
  136. if (deposit != null) {
  137. facilityBookFacilitiesPeriods.deposit = deposit;
  138. }
  139. final bool? enable = jsonConvert.convert<bool>(json['enable']);
  140. if (enable != null) {
  141. facilityBookFacilitiesPeriods.enable = enable;
  142. }
  143. final bool? selected = jsonConvert.convert<bool>(json['selected']);
  144. if (selected != null) {
  145. facilityBookFacilitiesPeriods.selected = selected;
  146. }
  147. return facilityBookFacilitiesPeriods;
  148. }
  149. Map<String, dynamic> $FacilityBookFacilitiesPeriodsToJson(FacilityBookFacilitiesPeriods entity) {
  150. final Map<String, dynamic> data = <String, dynamic>{};
  151. data['id'] = entity.id;
  152. data['start'] = entity.start;
  153. data['end'] = entity.end;
  154. data['price'] = entity.price;
  155. data['deposit'] = entity.deposit;
  156. data['enable'] = entity.enable;
  157. data['selected'] = entity.selected;
  158. return data;
  159. }
  160. extension FacilityBookFacilitiesPeriodsExtension on FacilityBookFacilitiesPeriods {
  161. FacilityBookFacilitiesPeriods copyWith({
  162. String? id,
  163. String? start,
  164. String? end,
  165. String? price,
  166. String? deposit,
  167. bool? enable,
  168. bool? selected,
  169. }) {
  170. return FacilityBookFacilitiesPeriods()
  171. ..id = id ?? this.id
  172. ..start = start ?? this.start
  173. ..end = end ?? this.end
  174. ..price = price ?? this.price
  175. ..deposit = deposit ?? this.deposit
  176. ..enable = enable ?? this.enable
  177. ..selected = selected ?? this.selected;
  178. }
  179. }