rewards_buy_entity.g.dart 6.8 KB

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