feedback_detail_entity.g.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/feedback_detail_entity.dart';
  3. import 'package:domain/entity/id_name_entity.dart';
  4. FeedbackDetailEntity $FeedbackDetailEntityFromJson(Map<String, dynamic> json) {
  5. final FeedbackDetailEntity feedbackDetailEntity = FeedbackDetailEntity();
  6. final String? id = jsonConvert.convert<String>(json['id']);
  7. if (id != null) {
  8. feedbackDetailEntity.id = id;
  9. }
  10. final String? title = jsonConvert.convert<String>(json['title']);
  11. if (title != null) {
  12. feedbackDetailEntity.title = title;
  13. }
  14. final String? content = jsonConvert.convert<String>(json['content']);
  15. if (content != null) {
  16. feedbackDetailEntity.content = content;
  17. }
  18. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  19. (e) => jsonConvert.convert<String>(e) as String).toList();
  20. if (resources != null) {
  21. feedbackDetailEntity.resources = resources;
  22. }
  23. final int? status = jsonConvert.convert<int>(json['status']);
  24. if (status != null) {
  25. feedbackDetailEntity.status = status;
  26. }
  27. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  28. if (createdAt != null) {
  29. feedbackDetailEntity.createdAt = createdAt;
  30. }
  31. final IdNameEntity? category = jsonConvert.convert<IdNameEntity>(json['category']);
  32. if (category != null) {
  33. feedbackDetailEntity.category = category;
  34. }
  35. final List<FeedbackDetailReplies>? replies = (json['replies'] as List<dynamic>?)?.map(
  36. (e) => jsonConvert.convert<FeedbackDetailReplies>(e) as FeedbackDetailReplies).toList();
  37. if (replies != null) {
  38. feedbackDetailEntity.replies = replies;
  39. }
  40. return feedbackDetailEntity;
  41. }
  42. Map<String, dynamic> $FeedbackDetailEntityToJson(FeedbackDetailEntity entity) {
  43. final Map<String, dynamic> data = <String, dynamic>{};
  44. data['id'] = entity.id;
  45. data['title'] = entity.title;
  46. data['content'] = entity.content;
  47. data['resources'] = entity.resources;
  48. data['status'] = entity.status;
  49. data['created_at'] = entity.createdAt;
  50. data['category'] = entity.category?.toJson();
  51. data['replies'] = entity.replies?.map((v) => v.toJson()).toList();
  52. return data;
  53. }
  54. extension FeedbackDetailEntityExtension on FeedbackDetailEntity {
  55. FeedbackDetailEntity copyWith({
  56. String? id,
  57. String? title,
  58. String? content,
  59. List<String>? resources,
  60. int? status,
  61. String? createdAt,
  62. IdNameEntity? category,
  63. List<FeedbackDetailReplies>? replies,
  64. }) {
  65. return FeedbackDetailEntity()
  66. ..id = id ?? this.id
  67. ..title = title ?? this.title
  68. ..content = content ?? this.content
  69. ..resources = resources ?? this.resources
  70. ..status = status ?? this.status
  71. ..createdAt = createdAt ?? this.createdAt
  72. ..category = category ?? this.category
  73. ..replies = replies ?? this.replies;
  74. }
  75. }
  76. FeedbackDetailReplies $FeedbackDetailRepliesFromJson(Map<String, dynamic> json) {
  77. final FeedbackDetailReplies feedbackDetailReplies = FeedbackDetailReplies();
  78. final String? id = jsonConvert.convert<String>(json['id']);
  79. if (id != null) {
  80. feedbackDetailReplies.id = id;
  81. }
  82. final String? content = jsonConvert.convert<String>(json['content']);
  83. if (content != null) {
  84. feedbackDetailReplies.content = content;
  85. }
  86. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  87. (e) => jsonConvert.convert<String>(e) as String).toList();
  88. if (resources != null) {
  89. feedbackDetailReplies.resources = resources;
  90. }
  91. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  92. if (createdAt != null) {
  93. feedbackDetailReplies.createdAt = createdAt;
  94. }
  95. final IdNameEntity? accountable = jsonConvert.convert<IdNameEntity>(json['accountable']);
  96. if (accountable != null) {
  97. feedbackDetailReplies.accountable = accountable;
  98. }
  99. return feedbackDetailReplies;
  100. }
  101. Map<String, dynamic> $FeedbackDetailRepliesToJson(FeedbackDetailReplies entity) {
  102. final Map<String, dynamic> data = <String, dynamic>{};
  103. data['id'] = entity.id;
  104. data['content'] = entity.content;
  105. data['resources'] = entity.resources;
  106. data['created_at'] = entity.createdAt;
  107. data['accountable'] = entity.accountable?.toJson();
  108. return data;
  109. }
  110. extension FeedbackDetailRepliesExtension on FeedbackDetailReplies {
  111. FeedbackDetailReplies copyWith({
  112. String? id,
  113. String? content,
  114. List<String>? resources,
  115. String? createdAt,
  116. IdNameEntity? accountable,
  117. }) {
  118. return FeedbackDetailReplies()
  119. ..id = id ?? this.id
  120. ..content = content ?? this.content
  121. ..resources = resources ?? this.resources
  122. ..createdAt = createdAt ?? this.createdAt
  123. ..accountable = accountable ?? this.accountable;
  124. }
  125. }