paid_service_entity.g.dart 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/paid_service_entity.dart';
  3. PaidServiceEntity $PaidServiceEntityFromJson(Map<String, dynamic> json) {
  4. final PaidServiceEntity paidServiceEntity = PaidServiceEntity();
  5. final int? count = jsonConvert.convert<int>(json['count']);
  6. if (count != null) {
  7. paidServiceEntity.count = count;
  8. }
  9. final int? page = jsonConvert.convert<int>(json['page']);
  10. if (page != null) {
  11. paidServiceEntity.page = page;
  12. }
  13. final int? limit = jsonConvert.convert<int>(json['limit']);
  14. if (limit != null) {
  15. paidServiceEntity.limit = limit;
  16. }
  17. final int? countPage = jsonConvert.convert<int>(json['count_page']);
  18. if (countPage != null) {
  19. paidServiceEntity.countPage = countPage;
  20. }
  21. final List<PaidServiceList>? list = (json['list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<PaidServiceList>(e) as PaidServiceList).toList();
  23. if (list != null) {
  24. paidServiceEntity.list = list;
  25. }
  26. return paidServiceEntity;
  27. }
  28. Map<String, dynamic> $PaidServiceEntityToJson(PaidServiceEntity 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 PaidServiceEntityExtension on PaidServiceEntity {
  38. PaidServiceEntity copyWith({
  39. int? count,
  40. int? page,
  41. int? limit,
  42. int? countPage,
  43. List<PaidServiceList>? list,
  44. }) {
  45. return PaidServiceEntity()
  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. PaidServiceList $PaidServiceListFromJson(Map<String, dynamic> json) {
  54. final PaidServiceList paidServiceList = PaidServiceList();
  55. final int? id = jsonConvert.convert<int>(json['id']);
  56. if (id != null) {
  57. paidServiceList.id = id;
  58. }
  59. final String? name = jsonConvert.convert<String>(json['name']);
  60. if (name != null) {
  61. paidServiceList.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. paidServiceList.resources = resources;
  67. }
  68. final int? lowestPrice = jsonConvert.convert<int>(json['lowest_price']);
  69. if (lowestPrice != null) {
  70. paidServiceList.lowestPrice = lowestPrice;
  71. }
  72. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  73. if (likesCount != null) {
  74. paidServiceList.likesCount = likesCount;
  75. }
  76. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  77. if (liked != null) {
  78. paidServiceList.liked = liked;
  79. }
  80. final PaidServiceListMerchant? merchant = jsonConvert.convert<PaidServiceListMerchant>(json['merchant']);
  81. if (merchant != null) {
  82. paidServiceList.merchant = merchant;
  83. }
  84. final PaidServiceListCategory? category = jsonConvert.convert<PaidServiceListCategory>(json['category']);
  85. if (category != null) {
  86. paidServiceList.category = category;
  87. }
  88. return paidServiceList;
  89. }
  90. Map<String, dynamic> $PaidServiceListToJson(PaidServiceList 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['lowest_price'] = entity.lowestPrice;
  96. data['likes_count'] = entity.likesCount;
  97. data['liked'] = entity.liked;
  98. data['merchant'] = entity.merchant?.toJson();
  99. data['category'] = entity.category?.toJson();
  100. return data;
  101. }
  102. extension PaidServiceListExtension on PaidServiceList {
  103. PaidServiceList copyWith({
  104. int? id,
  105. String? name,
  106. List<String>? resources,
  107. int? lowestPrice,
  108. int? likesCount,
  109. bool? liked,
  110. PaidServiceListMerchant? merchant,
  111. PaidServiceListCategory? category,
  112. }) {
  113. return PaidServiceList()
  114. ..id = id ?? this.id
  115. ..name = name ?? this.name
  116. ..resources = resources ?? this.resources
  117. ..lowestPrice = lowestPrice ?? this.lowestPrice
  118. ..likesCount = likesCount ?? this.likesCount
  119. ..liked = liked ?? this.liked
  120. ..merchant = merchant ?? this.merchant
  121. ..category = category ?? this.category;
  122. }
  123. }
  124. PaidServiceListMerchant $PaidServiceListMerchantFromJson(Map<String, dynamic> json) {
  125. final PaidServiceListMerchant paidServiceListMerchant = PaidServiceListMerchant();
  126. final int? id = jsonConvert.convert<int>(json['id']);
  127. if (id != null) {
  128. paidServiceListMerchant.id = id;
  129. }
  130. final String? name = jsonConvert.convert<String>(json['name']);
  131. if (name != null) {
  132. paidServiceListMerchant.name = name;
  133. }
  134. return paidServiceListMerchant;
  135. }
  136. Map<String, dynamic> $PaidServiceListMerchantToJson(PaidServiceListMerchant entity) {
  137. final Map<String, dynamic> data = <String, dynamic>{};
  138. data['id'] = entity.id;
  139. data['name'] = entity.name;
  140. return data;
  141. }
  142. extension PaidServiceListMerchantExtension on PaidServiceListMerchant {
  143. PaidServiceListMerchant copyWith({
  144. int? id,
  145. String? name,
  146. }) {
  147. return PaidServiceListMerchant()
  148. ..id = id ?? this.id
  149. ..name = name ?? this.name;
  150. }
  151. }
  152. PaidServiceListCategory $PaidServiceListCategoryFromJson(Map<String, dynamic> json) {
  153. final PaidServiceListCategory paidServiceListCategory = PaidServiceListCategory();
  154. final int? id = jsonConvert.convert<int>(json['id']);
  155. if (id != null) {
  156. paidServiceListCategory.id = id;
  157. }
  158. final String? name = jsonConvert.convert<String>(json['name']);
  159. if (name != null) {
  160. paidServiceListCategory.name = name;
  161. }
  162. final String? type = jsonConvert.convert<String>(json['type']);
  163. if (type != null) {
  164. paidServiceListCategory.type = type;
  165. }
  166. return paidServiceListCategory;
  167. }
  168. Map<String, dynamic> $PaidServiceListCategoryToJson(PaidServiceListCategory entity) {
  169. final Map<String, dynamic> data = <String, dynamic>{};
  170. data['id'] = entity.id;
  171. data['name'] = entity.name;
  172. data['type'] = entity.type;
  173. return data;
  174. }
  175. extension PaidServiceListCategoryExtension on PaidServiceListCategory {
  176. PaidServiceListCategory copyWith({
  177. int? id,
  178. String? name,
  179. String? type,
  180. }) {
  181. return PaidServiceListCategory()
  182. ..id = id ?? this.id
  183. ..name = name ?? this.name
  184. ..type = type ?? this.type;
  185. }
  186. }