repair_service_entity.g.dart 6.4 KB

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