repair_service_entity.g.dart 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/repair_service_entity.dart';
  3. RepairServiceEntity $RepairServiceEntityFromJson(Map<String, dynamic> json) {
  4. final RepairServiceEntity repairServiceEntity = RepairServiceEntity();
  5. final int? count = jsonConvert.convert<int>(json['count']);
  6. if (count != null) {
  7. repairServiceEntity.count = count;
  8. }
  9. final int? page = jsonConvert.convert<int>(json['page']);
  10. if (page != null) {
  11. repairServiceEntity.page = page;
  12. }
  13. final int? limit = jsonConvert.convert<int>(json['limit']);
  14. if (limit != null) {
  15. repairServiceEntity.limit = limit;
  16. }
  17. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  18. if (countPage != null) {
  19. repairServiceEntity.countPage = countPage;
  20. }
  21. final List<RepairServiceList>? list = (json['list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<RepairServiceList>(e) as RepairServiceList).toList();
  23. if (list != null) {
  24. repairServiceEntity.list = list;
  25. }
  26. return repairServiceEntity;
  27. }
  28. Map<String, dynamic> $RepairServiceEntityToJson(RepairServiceEntity entity) {
  29. final Map<String, dynamic> data = <String, dynamic>{};
  30. data['count'] = entity.count;
  31. data['page'] = entity.page;
  32. data['limit'] = entity.limit;
  33. data['count_page'] = entity.countPage;
  34. data['list'] = entity.list?.map((v) => v.toJson()).toList();
  35. return data;
  36. }
  37. extension RepairServiceEntityExtension on RepairServiceEntity {
  38. RepairServiceEntity copyWith({
  39. int? count,
  40. int? page,
  41. int? limit,
  42. int? countPage,
  43. List<RepairServiceList>? list,
  44. }) {
  45. return RepairServiceEntity()
  46. ..count = count ?? this.count
  47. ..page = page ?? this.page
  48. ..limit = limit ?? this.limit
  49. ..countPage = countPage ?? this.countPage
  50. ..list = list ?? this.list;
  51. }
  52. }
  53. RepairServiceList $RepairServiceListFromJson(Map<String, dynamic> json) {
  54. final RepairServiceList repairServiceList = RepairServiceList();
  55. final int? id = jsonConvert.convert<int>(json['id']);
  56. if (id != null) {
  57. repairServiceList.id = id;
  58. }
  59. final String? name = jsonConvert.convert<String>(json['name']);
  60. if (name != null) {
  61. repairServiceList.name = name;
  62. }
  63. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  64. if (likesCount != null) {
  65. repairServiceList.likesCount = likesCount;
  66. }
  67. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  68. if (liked != null) {
  69. repairServiceList.liked = liked;
  70. }
  71. final RepairServiceListMerchant? merchant = jsonConvert.convert<RepairServiceListMerchant>(json['merchant']);
  72. if (merchant != null) {
  73. repairServiceList.merchant = merchant;
  74. }
  75. final RepairServiceListCategory? category = jsonConvert.convert<RepairServiceListCategory>(json['category']);
  76. if (category != null) {
  77. repairServiceList.category = category;
  78. }
  79. return repairServiceList;
  80. }
  81. Map<String, dynamic> $RepairServiceListToJson(RepairServiceList entity) {
  82. final Map<String, dynamic> data = <String, dynamic>{};
  83. data['id'] = entity.id;
  84. data['name'] = entity.name;
  85. data['likes_count'] = entity.likesCount;
  86. data['liked'] = entity.liked;
  87. data['merchant'] = entity.merchant?.toJson();
  88. data['category'] = entity.category?.toJson();
  89. return data;
  90. }
  91. extension RepairServiceListExtension on RepairServiceList {
  92. RepairServiceList copyWith({
  93. int? id,
  94. String? name,
  95. int? likesCount,
  96. bool? liked,
  97. RepairServiceListMerchant? merchant,
  98. RepairServiceListCategory? category,
  99. }) {
  100. return RepairServiceList()
  101. ..id = id ?? this.id
  102. ..name = name ?? this.name
  103. ..likesCount = likesCount ?? this.likesCount
  104. ..liked = liked ?? this.liked
  105. ..merchant = merchant ?? this.merchant
  106. ..category = category ?? this.category;
  107. }
  108. }
  109. RepairServiceListMerchant $RepairServiceListMerchantFromJson(Map<String, dynamic> json) {
  110. final RepairServiceListMerchant repairServiceListMerchant = RepairServiceListMerchant();
  111. final int? id = jsonConvert.convert<int>(json['id']);
  112. if (id != null) {
  113. repairServiceListMerchant.id = id;
  114. }
  115. final String? name = jsonConvert.convert<String>(json['name']);
  116. if (name != null) {
  117. repairServiceListMerchant.name = name;
  118. }
  119. return repairServiceListMerchant;
  120. }
  121. Map<String, dynamic> $RepairServiceListMerchantToJson(RepairServiceListMerchant entity) {
  122. final Map<String, dynamic> data = <String, dynamic>{};
  123. data['id'] = entity.id;
  124. data['name'] = entity.name;
  125. return data;
  126. }
  127. extension RepairServiceListMerchantExtension on RepairServiceListMerchant {
  128. RepairServiceListMerchant copyWith({
  129. int? id,
  130. String? name,
  131. }) {
  132. return RepairServiceListMerchant()
  133. ..id = id ?? this.id
  134. ..name = name ?? this.name;
  135. }
  136. }
  137. RepairServiceListCategory $RepairServiceListCategoryFromJson(Map<String, dynamic> json) {
  138. final RepairServiceListCategory repairServiceListCategory = RepairServiceListCategory();
  139. final int? id = jsonConvert.convert<int>(json['id']);
  140. if (id != null) {
  141. repairServiceListCategory.id = id;
  142. }
  143. final String? name = jsonConvert.convert<String>(json['name']);
  144. if (name != null) {
  145. repairServiceListCategory.name = name;
  146. }
  147. final String? type = jsonConvert.convert<String>(json['type']);
  148. if (type != null) {
  149. repairServiceListCategory.type = type;
  150. }
  151. return repairServiceListCategory;
  152. }
  153. Map<String, dynamic> $RepairServiceListCategoryToJson(RepairServiceListCategory entity) {
  154. final Map<String, dynamic> data = <String, dynamic>{};
  155. data['id'] = entity.id;
  156. data['name'] = entity.name;
  157. data['type'] = entity.type;
  158. return data;
  159. }
  160. extension RepairServiceListCategoryExtension on RepairServiceListCategory {
  161. RepairServiceListCategory copyWith({
  162. int? id,
  163. String? name,
  164. String? type,
  165. }) {
  166. return RepairServiceListCategory()
  167. ..id = id ?? this.id
  168. ..name = name ?? this.name
  169. ..type = type ?? this.type;
  170. }
  171. }