rewards_buy_entity.g.dart 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_buy_entity.dart';
  3. RewardsBuyEntity $RewardsBuyEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsBuyEntity rewardsBuyEntity = RewardsBuyEntity();
  5. final int? id = jsonConvert.convert<int>(json['id']);
  6. if (id != null) {
  7. rewardsBuyEntity.id = id;
  8. }
  9. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  10. if (createdAt != null) {
  11. rewardsBuyEntity.createdAt = createdAt;
  12. }
  13. final RewardsBuyReward? reward = jsonConvert.convert<RewardsBuyReward>(
  14. json['reward']);
  15. if (reward != null) {
  16. rewardsBuyEntity.reward = reward;
  17. }
  18. return rewardsBuyEntity;
  19. }
  20. Map<String, dynamic> $RewardsBuyEntityToJson(RewardsBuyEntity entity) {
  21. final Map<String, dynamic> data = <String, dynamic>{};
  22. data['id'] = entity.id;
  23. data['created_at'] = entity.createdAt;
  24. data['reward'] = entity.reward.toJson();
  25. return data;
  26. }
  27. extension RewardsBuyEntityExtension on RewardsBuyEntity {
  28. RewardsBuyEntity copyWith({
  29. int? id,
  30. String? createdAt,
  31. RewardsBuyReward? reward,
  32. }) {
  33. return RewardsBuyEntity()
  34. ..id = id ?? this.id
  35. ..createdAt = createdAt ?? this.createdAt
  36. ..reward = reward ?? this.reward;
  37. }
  38. }
  39. RewardsBuyReward $RewardsBuyRewardFromJson(Map<String, dynamic> json) {
  40. final RewardsBuyReward rewardsBuyReward = RewardsBuyReward();
  41. final int? id = jsonConvert.convert<int>(json['id']);
  42. if (id != null) {
  43. rewardsBuyReward.id = id;
  44. }
  45. final String? title = jsonConvert.convert<String>(json['title']);
  46. if (title != null) {
  47. rewardsBuyReward.title = title;
  48. }
  49. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  50. (e) => jsonConvert.convert<String>(e) as String).toList();
  51. if (resources != null) {
  52. rewardsBuyReward.resources = resources;
  53. }
  54. final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
  55. if (originalPoint != null) {
  56. rewardsBuyReward.originalPoint = originalPoint;
  57. }
  58. final int? point = jsonConvert.convert<int>(json['point']);
  59. if (point != null) {
  60. rewardsBuyReward.point = point;
  61. }
  62. final String? description = jsonConvert.convert<String>(json['description']);
  63. if (description != null) {
  64. rewardsBuyReward.description = description;
  65. }
  66. final bool? reservation = jsonConvert.convert<bool>(json['reservation']);
  67. if (reservation != null) {
  68. rewardsBuyReward.reservation = reservation;
  69. }
  70. final String? start = jsonConvert.convert<String>(json['start']);
  71. if (start != null) {
  72. rewardsBuyReward.start = start;
  73. }
  74. final String? end = jsonConvert.convert<String>(json['end']);
  75. if (end != null) {
  76. rewardsBuyReward.end = end;
  77. }
  78. final String? redeemedStart = jsonConvert.convert<String>(
  79. json['redeemed_start']);
  80. if (redeemedStart != null) {
  81. rewardsBuyReward.redeemedStart = redeemedStart;
  82. }
  83. final String? redeemedEnd = jsonConvert.convert<String>(json['redeemed_end']);
  84. if (redeemedEnd != null) {
  85. rewardsBuyReward.redeemedEnd = redeemedEnd;
  86. }
  87. final String? package = jsonConvert.convert<String>(json['package']);
  88. if (package != null) {
  89. rewardsBuyReward.package = package;
  90. }
  91. final String? notice = jsonConvert.convert<String>(json['notice']);
  92. if (notice != null) {
  93. rewardsBuyReward.notice = notice;
  94. }
  95. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  96. if (createdAt != null) {
  97. rewardsBuyReward.createdAt = createdAt;
  98. }
  99. final List<
  100. RewardsBuyRewardRedeemable>? redeemable = (json['redeemable'] as List<
  101. dynamic>?)?.map(
  102. (e) =>
  103. jsonConvert.convert<RewardsBuyRewardRedeemable>(
  104. e) as RewardsBuyRewardRedeemable).toList();
  105. if (redeemable != null) {
  106. rewardsBuyReward.redeemable = redeemable;
  107. }
  108. return rewardsBuyReward;
  109. }
  110. Map<String, dynamic> $RewardsBuyRewardToJson(RewardsBuyReward entity) {
  111. final Map<String, dynamic> data = <String, dynamic>{};
  112. data['id'] = entity.id;
  113. data['title'] = entity.title;
  114. data['resources'] = entity.resources;
  115. data['original_point'] = entity.originalPoint;
  116. data['point'] = entity.point;
  117. data['description'] = entity.description;
  118. data['reservation'] = entity.reservation;
  119. data['start'] = entity.start;
  120. data['end'] = entity.end;
  121. data['redeemed_start'] = entity.redeemedStart;
  122. data['redeemed_end'] = entity.redeemedEnd;
  123. data['package'] = entity.package;
  124. data['notice'] = entity.notice;
  125. data['created_at'] = entity.createdAt;
  126. data['redeemable'] = entity.redeemable.map((v) => v.toJson()).toList();
  127. return data;
  128. }
  129. extension RewardsBuyRewardExtension on RewardsBuyReward {
  130. RewardsBuyReward copyWith({
  131. int? id,
  132. String? title,
  133. List<String>? resources,
  134. int? originalPoint,
  135. int? point,
  136. String? description,
  137. bool? reservation,
  138. String? start,
  139. String? end,
  140. String? redeemedStart,
  141. String? redeemedEnd,
  142. String? package,
  143. String? notice,
  144. String? createdAt,
  145. List<RewardsBuyRewardRedeemable>? redeemable,
  146. }) {
  147. return RewardsBuyReward()
  148. ..id = id ?? this.id
  149. ..title = title ?? this.title
  150. ..resources = resources ?? this.resources
  151. ..originalPoint = originalPoint ?? this.originalPoint
  152. ..point = point ?? this.point
  153. ..description = description ?? this.description
  154. ..reservation = reservation ?? this.reservation
  155. ..start = start ?? this.start
  156. ..end = end ?? this.end
  157. ..redeemedStart = redeemedStart ?? this.redeemedStart
  158. ..redeemedEnd = redeemedEnd ?? this.redeemedEnd
  159. ..package = package ?? this.package
  160. ..notice = notice ?? this.notice
  161. ..createdAt = createdAt ?? this.createdAt
  162. ..redeemable = redeemable ?? this.redeemable;
  163. }
  164. }
  165. RewardsBuyRewardRedeemable $RewardsBuyRewardRedeemableFromJson(
  166. Map<String, dynamic> json) {
  167. final RewardsBuyRewardRedeemable rewardsBuyRewardRedeemable = RewardsBuyRewardRedeemable();
  168. final String? day = jsonConvert.convert<String>(json['day']);
  169. if (day != null) {
  170. rewardsBuyRewardRedeemable.day = day;
  171. }
  172. final String? time = jsonConvert.convert<String>(json['time']);
  173. if (time != null) {
  174. rewardsBuyRewardRedeemable.time = time;
  175. }
  176. return rewardsBuyRewardRedeemable;
  177. }
  178. Map<String, dynamic> $RewardsBuyRewardRedeemableToJson(
  179. RewardsBuyRewardRedeemable entity) {
  180. final Map<String, dynamic> data = <String, dynamic>{};
  181. data['day'] = entity.day;
  182. data['time'] = entity.time;
  183. return data;
  184. }
  185. extension RewardsBuyRewardRedeemableExtension on RewardsBuyRewardRedeemable {
  186. RewardsBuyRewardRedeemable copyWith({
  187. String? day,
  188. String? time,
  189. }) {
  190. return RewardsBuyRewardRedeemable()
  191. ..day = day ?? this.day
  192. ..time = time ?? this.time;
  193. }
  194. }