rewards_active_detail_entity.g.dart 7.6 KB

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