repair_service_entity.g.dart 6.3 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>?)?.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 List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  64. (e) => jsonConvert.convert<String>(e) as String).toList();
  65. if (resources != null) {
  66. repairServiceList.resources = resources;
  67. }
  68. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  69. if (likesCount != null) {
  70. repairServiceList.likesCount = likesCount;
  71. }
  72. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  73. if (liked != null) {
  74. repairServiceList.liked = liked;
  75. }
  76. final RepairServiceListMerchant? merchant = jsonConvert.convert<RepairServiceListMerchant>(json['merchant']);
  77. if (merchant != null) {
  78. repairServiceList.merchant = merchant;
  79. }
  80. final RepairServiceListCategory? category = jsonConvert.convert<RepairServiceListCategory>(json['category']);
  81. if (category != null) {
  82. repairServiceList.category = category;
  83. }
  84. return repairServiceList;
  85. }
  86. Map<String, dynamic> $RepairServiceListToJson(RepairServiceList entity) {
  87. final Map<String, dynamic> data = <String, dynamic>{};
  88. data['id'] = entity.id;
  89. data['name'] = entity.name;
  90. data['resources'] = entity.resources;
  91. data['likes_count'] = entity.likesCount;
  92. data['liked'] = entity.liked;
  93. data['merchant'] = entity.merchant?.toJson();
  94. data['category'] = entity.category?.toJson();
  95. return data;
  96. }
  97. extension RepairServiceListExtension on RepairServiceList {
  98. RepairServiceList copyWith({
  99. int? id,
  100. String? name,
  101. List<String>? resources,
  102. int? likesCount,
  103. bool? liked,
  104. RepairServiceListMerchant? merchant,
  105. RepairServiceListCategory? category,
  106. }) {
  107. return RepairServiceList()
  108. ..id = id ?? this.id
  109. ..name = name ?? this.name
  110. ..resources = resources ?? this.resources
  111. ..likesCount = likesCount ?? this.likesCount
  112. ..liked = liked ?? this.liked
  113. ..merchant = merchant ?? this.merchant
  114. ..category = category ?? this.category;
  115. }
  116. }
  117. RepairServiceListMerchant $RepairServiceListMerchantFromJson(Map<String, dynamic> json) {
  118. final RepairServiceListMerchant repairServiceListMerchant = RepairServiceListMerchant();
  119. final int? id = jsonConvert.convert<int>(json['id']);
  120. if (id != null) {
  121. repairServiceListMerchant.id = id;
  122. }
  123. final String? name = jsonConvert.convert<String>(json['name']);
  124. if (name != null) {
  125. repairServiceListMerchant.name = name;
  126. }
  127. return repairServiceListMerchant;
  128. }
  129. Map<String, dynamic> $RepairServiceListMerchantToJson(RepairServiceListMerchant entity) {
  130. final Map<String, dynamic> data = <String, dynamic>{};
  131. data['id'] = entity.id;
  132. data['name'] = entity.name;
  133. return data;
  134. }
  135. extension RepairServiceListMerchantExtension on RepairServiceListMerchant {
  136. RepairServiceListMerchant copyWith({
  137. int? id,
  138. String? name,
  139. }) {
  140. return RepairServiceListMerchant()
  141. ..id = id ?? this.id
  142. ..name = name ?? this.name;
  143. }
  144. }
  145. RepairServiceListCategory $RepairServiceListCategoryFromJson(Map<String, dynamic> json) {
  146. final RepairServiceListCategory repairServiceListCategory = RepairServiceListCategory();
  147. final int? id = jsonConvert.convert<int>(json['id']);
  148. if (id != null) {
  149. repairServiceListCategory.id = id;
  150. }
  151. final String? name = jsonConvert.convert<String>(json['name']);
  152. if (name != null) {
  153. repairServiceListCategory.name = name;
  154. }
  155. final String? type = jsonConvert.convert<String>(json['type']);
  156. if (type != null) {
  157. repairServiceListCategory.type = type;
  158. }
  159. return repairServiceListCategory;
  160. }
  161. Map<String, dynamic> $RepairServiceListCategoryToJson(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. }