rewards_home_tes_entity.g.dart 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/rewards_home_tes_entity.dart';
  3. RewardsHomeTesEntity $RewardsHomeTesEntityFromJson(Map<String, dynamic> json) {
  4. final RewardsHomeTesEntity rewardsHomeTesEntity = RewardsHomeTesEntity();
  5. final double? id = jsonConvert.convert<double>(json['id']);
  6. if (id != null) {
  7. rewardsHomeTesEntity.id = id;
  8. }
  9. final String? name = jsonConvert.convert<String>(json['name']);
  10. if (name != null) {
  11. rewardsHomeTesEntity.name = name;
  12. }
  13. final List<RewardsHomeTesRewards>? rewards = (json['rewards'] as List<dynamic>?)?.map(
  14. (e) => jsonConvert.convert<RewardsHomeTesRewards>(e) as RewardsHomeTesRewards).toList();
  15. if (rewards != null) {
  16. rewardsHomeTesEntity.rewards = rewards;
  17. }
  18. return rewardsHomeTesEntity;
  19. }
  20. Map<String, dynamic> $RewardsHomeTesEntityToJson(RewardsHomeTesEntity entity) {
  21. final Map<String, dynamic> data = <String, dynamic>{};
  22. data['id'] = entity.id;
  23. data['name'] = entity.name;
  24. data['rewards'] = entity.rewards.map((v) => v.toJson()).toList();
  25. return data;
  26. }
  27. extension RewardsHomeTesEntityExtension on RewardsHomeTesEntity {
  28. RewardsHomeTesEntity copyWith({
  29. double? id,
  30. String? name,
  31. List<RewardsHomeTesRewards>? rewards,
  32. }) {
  33. return RewardsHomeTesEntity()
  34. ..id = id ?? this.id
  35. ..name = name ?? this.name
  36. ..rewards = rewards ?? this.rewards;
  37. }
  38. }
  39. RewardsHomeTesRewards $RewardsHomeTesRewardsFromJson(Map<String, dynamic> json) {
  40. final RewardsHomeTesRewards rewardsHomeTesRewards = RewardsHomeTesRewards();
  41. final double? id = jsonConvert.convert<double>(json['id']);
  42. if (id != null) {
  43. rewardsHomeTesRewards.id = id;
  44. }
  45. final String? name = jsonConvert.convert<String>(json['name']);
  46. if (name != null) {
  47. rewardsHomeTesRewards.name = name;
  48. }
  49. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  50. (e) => jsonConvert.convert<String>(e) as String).toList();
  51. if (resources != null) {
  52. rewardsHomeTesRewards.resources = resources;
  53. }
  54. final double? originalPoint = jsonConvert.convert<double>(json['original_point']);
  55. if (originalPoint != null) {
  56. rewardsHomeTesRewards.originalPoint = originalPoint;
  57. }
  58. final double? point = jsonConvert.convert<double>(json['point']);
  59. if (point != null) {
  60. rewardsHomeTesRewards.point = point;
  61. }
  62. return rewardsHomeTesRewards;
  63. }
  64. Map<String, dynamic> $RewardsHomeTesRewardsToJson(RewardsHomeTesRewards entity) {
  65. final Map<String, dynamic> data = <String, dynamic>{};
  66. data['id'] = entity.id;
  67. data['name'] = entity.name;
  68. data['resources'] = entity.resources;
  69. data['original_point'] = entity.originalPoint;
  70. data['point'] = entity.point;
  71. return data;
  72. }
  73. extension RewardsHomeTesRewardsExtension on RewardsHomeTesRewards {
  74. RewardsHomeTesRewards copyWith({
  75. double? id,
  76. String? name,
  77. List<String>? resources,
  78. double? originalPoint,
  79. double? point,
  80. }) {
  81. return RewardsHomeTesRewards()
  82. ..id = id ?? this.id
  83. ..name = name ?? this.name
  84. ..resources = resources ?? this.resources
  85. ..originalPoint = originalPoint ?? this.originalPoint
  86. ..point = point ?? this.point;
  87. }
  88. }