feedback_detail_entity.g.dart 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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>(
  32. json['category']);
  33. if (category != null) {
  34. feedbackDetailEntity.category = category;
  35. }
  36. final List<FeedbackDetailReplies>? replies = (json['replies'] as List<
  37. dynamic>?)
  38. ?.map(
  39. (e) =>
  40. jsonConvert.convert<FeedbackDetailReplies>(e) as FeedbackDetailReplies)
  41. .toList();
  42. if (replies != null) {
  43. feedbackDetailEntity.replies = replies;
  44. }
  45. return feedbackDetailEntity;
  46. }
  47. Map<String, dynamic> $FeedbackDetailEntityToJson(FeedbackDetailEntity entity) {
  48. final Map<String, dynamic> data = <String, dynamic>{};
  49. data['id'] = entity.id;
  50. data['title'] = entity.title;
  51. data['content'] = entity.content;
  52. data['resources'] = entity.resources;
  53. data['status'] = entity.status;
  54. data['created_at'] = entity.createdAt;
  55. data['category'] = entity.category?.toJson();
  56. data['replies'] = entity.replies?.map((v) => v.toJson()).toList();
  57. return data;
  58. }
  59. extension FeedbackDetailEntityExtension on FeedbackDetailEntity {
  60. FeedbackDetailEntity copyWith({
  61. String? id,
  62. String? title,
  63. String? content,
  64. List<String>? resources,
  65. int? status,
  66. String? createdAt,
  67. IdNameEntity? category,
  68. List<FeedbackDetailReplies>? replies,
  69. }) {
  70. return FeedbackDetailEntity()
  71. ..id = id ?? this.id
  72. ..title = title ?? this.title
  73. ..content = content ?? this.content
  74. ..resources = resources ?? this.resources
  75. ..status = status ?? this.status
  76. ..createdAt = createdAt ?? this.createdAt
  77. ..category = category ?? this.category
  78. ..replies = replies ?? this.replies;
  79. }
  80. }
  81. FeedbackDetailReplies $FeedbackDetailRepliesFromJson(
  82. Map<String, dynamic> json) {
  83. final FeedbackDetailReplies feedbackDetailReplies = FeedbackDetailReplies();
  84. final String? id = jsonConvert.convert<String>(json['id']);
  85. if (id != null) {
  86. feedbackDetailReplies.id = id;
  87. }
  88. final String? content = jsonConvert.convert<String>(json['content']);
  89. if (content != null) {
  90. feedbackDetailReplies.content = content;
  91. }
  92. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  93. (e) => jsonConvert.convert<String>(e) as String).toList();
  94. if (resources != null) {
  95. feedbackDetailReplies.resources = resources;
  96. }
  97. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  98. if (createdAt != null) {
  99. feedbackDetailReplies.createdAt = createdAt;
  100. }
  101. final IdNameEntity? accountable = jsonConvert.convert<IdNameEntity>(
  102. json['accountable']);
  103. if (accountable != null) {
  104. feedbackDetailReplies.accountable = accountable;
  105. }
  106. return feedbackDetailReplies;
  107. }
  108. Map<String, dynamic> $FeedbackDetailRepliesToJson(
  109. FeedbackDetailReplies entity) {
  110. final Map<String, dynamic> data = <String, dynamic>{};
  111. data['id'] = entity.id;
  112. data['content'] = entity.content;
  113. data['resources'] = entity.resources;
  114. data['created_at'] = entity.createdAt;
  115. data['accountable'] = entity.accountable?.toJson();
  116. return data;
  117. }
  118. extension FeedbackDetailRepliesExtension on FeedbackDetailReplies {
  119. FeedbackDetailReplies copyWith({
  120. String? id,
  121. String? content,
  122. List<String>? resources,
  123. String? createdAt,
  124. IdNameEntity? accountable,
  125. }) {
  126. return FeedbackDetailReplies()
  127. ..id = id ?? this.id
  128. ..content = content ?? this.content
  129. ..resources = resources ?? this.resources
  130. ..createdAt = createdAt ?? this.createdAt
  131. ..accountable = accountable ?? this.accountable;
  132. }
  133. }