facility_book_entity.g.dart 6.9 KB

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