rewards_home_entity.dart 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:domain/generated/json/base/json_field.dart';
  2. import 'package:domain/generated/json/rewards_home_entity.g.dart';
  3. import 'dart:convert';
  4. export 'package:domain/generated/json/rewards_home_entity.g.dart';
  5. @JsonSerializable()
  6. class RewardsHomeEntity {
  7. late List<RewardsHomeData> data = [];
  8. late String message = '';
  9. late int code = 0;
  10. RewardsHomeEntity();
  11. factory RewardsHomeEntity.fromJson(Map<String, dynamic> json) => $RewardsHomeEntityFromJson(json);
  12. Map<String, dynamic> toJson() => $RewardsHomeEntityToJson(this);
  13. @override
  14. String toString() {
  15. return jsonEncode(this);
  16. }
  17. }
  18. @JsonSerializable()
  19. class RewardsHomeData {
  20. late int id = 0;
  21. late String name = '';
  22. late List<RewardsHomeDataRewards> rewards = [];
  23. RewardsHomeData();
  24. factory RewardsHomeData.fromJson(Map<String, dynamic> json) => $RewardsHomeDataFromJson(json);
  25. Map<String, dynamic> toJson() => $RewardsHomeDataToJson(this);
  26. @override
  27. String toString() {
  28. return jsonEncode(this);
  29. }
  30. }
  31. @JsonSerializable()
  32. class RewardsHomeDataRewards {
  33. late int id = 0;
  34. late String name = '';
  35. late List<String> resources = [];
  36. @JSONField(name: "original_point")
  37. late int originalPoint = 0;
  38. late int point = 0;
  39. RewardsHomeDataRewards();
  40. factory RewardsHomeDataRewards.fromJson(Map<String, dynamic> json) => $RewardsHomeDataRewardsFromJson(json);
  41. Map<String, dynamic> toJson() => $RewardsHomeDataRewardsToJson(this);
  42. @override
  43. String toString() {
  44. return jsonEncode(this);
  45. }
  46. }