repair_service_entity.g.dart 6.0 KB

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