rewards_active_detail_entity.g.dart 7.5 KB

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