rewards_my_detail_entity.g.dart 6.3 KB

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