rewards_detail_entity.g.dart 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_detail_entity.dart';
  3. RewardsDetailEntity $RewardsDetailEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsDetailEntity rewardsDetailEntity = RewardsDetailEntity();
  5. final int? id = jsonConvert.convert<int>(json['id']);
  6. if (id != null) {
  7. rewardsDetailEntity.id = id;
  8. }
  9. final String? title = jsonConvert.convert<String>(json['title']);
  10. if (title != null) {
  11. rewardsDetailEntity.title = title;
  12. }
  13. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  14. (e) => jsonConvert.convert<String>(e) as String).toList();
  15. if (resources != null) {
  16. rewardsDetailEntity.resources = resources;
  17. }
  18. final int? originalPoint = jsonConvert.convert<int>(json['original_point']);
  19. if (originalPoint != null) {
  20. rewardsDetailEntity.originalPoint = originalPoint;
  21. }
  22. final int? point = jsonConvert.convert<int>(json['point']);
  23. if (point != null) {
  24. rewardsDetailEntity.point = point;
  25. }
  26. final String? description = jsonConvert.convert<String>(json['description']);
  27. if (description != null) {
  28. rewardsDetailEntity.description = description;
  29. }
  30. final bool? reservation = jsonConvert.convert<bool>(json['reservation']);
  31. if (reservation != null) {
  32. rewardsDetailEntity.reservation = reservation;
  33. }
  34. final String? start = jsonConvert.convert<String>(json['start']);
  35. if (start != null) {
  36. rewardsDetailEntity.start = start;
  37. }
  38. final String? end = jsonConvert.convert<String>(json['end']);
  39. if (end != null) {
  40. rewardsDetailEntity.end = end;
  41. }
  42. final String? redeemedStart = jsonConvert.convert<String>(json['redeemed_start']);
  43. if (redeemedStart != null) {
  44. rewardsDetailEntity.redeemedStart = redeemedStart;
  45. }
  46. final String? redeemedEnd = jsonConvert.convert<String>(json['redeemed_end']);
  47. if (redeemedEnd != null) {
  48. rewardsDetailEntity.redeemedEnd = redeemedEnd;
  49. }
  50. final String? package = jsonConvert.convert<String>(json['package']);
  51. if (package != null) {
  52. rewardsDetailEntity.package = package;
  53. }
  54. final String? notice = jsonConvert.convert<String>(json['notice']);
  55. if (notice != null) {
  56. rewardsDetailEntity.notice = notice;
  57. }
  58. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  59. if (createdAt != null) {
  60. rewardsDetailEntity.createdAt = createdAt;
  61. }
  62. final List<RewardsDetailRedeemable>? redeemable = (json['redeemable'] as List<dynamic>?)?.map(
  63. (e) => jsonConvert.convert<RewardsDetailRedeemable>(e) as RewardsDetailRedeemable).toList();
  64. if (redeemable != null) {
  65. rewardsDetailEntity.redeemable = redeemable;
  66. }
  67. return rewardsDetailEntity;
  68. }
  69. Map<String, dynamic> $RewardsDetailEntityToJson(RewardsDetailEntity entity) {
  70. final Map<String, dynamic> data = <String, dynamic>{};
  71. data['id'] = entity.id;
  72. data['title'] = entity.title;
  73. data['resources'] = entity.resources;
  74. data['original_point'] = entity.originalPoint;
  75. data['point'] = entity.point;
  76. data['description'] = entity.description;
  77. data['reservation'] = entity.reservation;
  78. data['start'] = entity.start;
  79. data['end'] = entity.end;
  80. data['redeemed_start'] = entity.redeemedStart;
  81. data['redeemed_end'] = entity.redeemedEnd;
  82. data['package'] = entity.package;
  83. data['notice'] = entity.notice;
  84. data['created_at'] = entity.createdAt;
  85. data['redeemable'] = entity.redeemable.map((v) => v.toJson()).toList();
  86. return data;
  87. }
  88. extension RewardsDetailEntityExtension on RewardsDetailEntity {
  89. RewardsDetailEntity copyWith({
  90. int? id,
  91. String? title,
  92. List<String>? resources,
  93. int? originalPoint,
  94. int? point,
  95. String? description,
  96. bool? reservation,
  97. String? start,
  98. String? end,
  99. String? redeemedStart,
  100. String? redeemedEnd,
  101. String? package,
  102. String? notice,
  103. String? createdAt,
  104. List<RewardsDetailRedeemable>? redeemable,
  105. }) {
  106. return RewardsDetailEntity()
  107. ..id = id ?? this.id
  108. ..title = title ?? this.title
  109. ..resources = resources ?? this.resources
  110. ..originalPoint = originalPoint ?? this.originalPoint
  111. ..point = point ?? this.point
  112. ..description = description ?? this.description
  113. ..reservation = reservation ?? this.reservation
  114. ..start = start ?? this.start
  115. ..end = end ?? this.end
  116. ..redeemedStart = redeemedStart ?? this.redeemedStart
  117. ..redeemedEnd = redeemedEnd ?? this.redeemedEnd
  118. ..package = package ?? this.package
  119. ..notice = notice ?? this.notice
  120. ..createdAt = createdAt ?? this.createdAt
  121. ..redeemable = redeemable ?? this.redeemable;
  122. }
  123. }
  124. RewardsDetailRedeemable $RewardsDetailRedeemableFromJson(Map<String, dynamic> json) {
  125. final RewardsDetailRedeemable rewardsDetailRedeemable = RewardsDetailRedeemable();
  126. final String? day = jsonConvert.convert<String>(json['day']);
  127. if (day != null) {
  128. rewardsDetailRedeemable.day = day;
  129. }
  130. final String? time = jsonConvert.convert<String>(json['time']);
  131. if (time != null) {
  132. rewardsDetailRedeemable.time = time;
  133. }
  134. return rewardsDetailRedeemable;
  135. }
  136. Map<String, dynamic> $RewardsDetailRedeemableToJson(RewardsDetailRedeemable entity) {
  137. final Map<String, dynamic> data = <String, dynamic>{};
  138. data['day'] = entity.day;
  139. data['time'] = entity.time;
  140. return data;
  141. }
  142. extension RewardsDetailRedeemableExtension on RewardsDetailRedeemable {
  143. RewardsDetailRedeemable copyWith({
  144. String? day,
  145. String? time,
  146. }) {
  147. return RewardsDetailRedeemable()
  148. ..day = day ?? this.day
  149. ..time = time ?? this.time;
  150. }
  151. }