paid_service_entity.g.dart 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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>?)
  22. ?.map(
  23. (e) => jsonConvert.convert<PaidServiceList>(e) as PaidServiceList)
  24. .toList();
  25. if (list != null) {
  26. paidServiceEntity.list = list;
  27. }
  28. return paidServiceEntity;
  29. }
  30. Map<String, dynamic> $PaidServiceEntityToJson(PaidServiceEntity 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 PaidServiceEntityExtension on PaidServiceEntity {
  40. PaidServiceEntity copyWith({
  41. int? count,
  42. int? page,
  43. int? limit,
  44. int? countPage,
  45. List<PaidServiceList>? list,
  46. }) {
  47. return PaidServiceEntity()
  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. PaidServiceList $PaidServiceListFromJson(Map<String, dynamic> json) {
  56. final PaidServiceList paidServiceList = PaidServiceList();
  57. final int? id = jsonConvert.convert<int>(json['id']);
  58. if (id != null) {
  59. paidServiceList.id = id;
  60. }
  61. final String? name = jsonConvert.convert<String>(json['name']);
  62. if (name != null) {
  63. paidServiceList.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. paidServiceList.resources = resources;
  69. }
  70. final int? lowestPrice = jsonConvert.convert<int>(json['lowest_price']);
  71. if (lowestPrice != null) {
  72. paidServiceList.lowestPrice = lowestPrice;
  73. }
  74. final int? likesCount = jsonConvert.convert<int>(json['likes_count']);
  75. if (likesCount != null) {
  76. paidServiceList.likesCount = likesCount;
  77. }
  78. final bool? liked = jsonConvert.convert<bool>(json['liked']);
  79. if (liked != null) {
  80. paidServiceList.liked = liked;
  81. }
  82. final PaidServiceListMerchant? merchant = jsonConvert.convert<
  83. PaidServiceListMerchant>(json['merchant']);
  84. if (merchant != null) {
  85. paidServiceList.merchant = merchant;
  86. }
  87. final PaidServiceListCategory? category = jsonConvert.convert<
  88. PaidServiceListCategory>(json['category']);
  89. if (category != null) {
  90. paidServiceList.category = category;
  91. }
  92. return paidServiceList;
  93. }
  94. Map<String, dynamic> $PaidServiceListToJson(PaidServiceList entity) {
  95. final Map<String, dynamic> data = <String, dynamic>{};
  96. data['id'] = entity.id;
  97. data['name'] = entity.name;
  98. data['resources'] = entity.resources;
  99. data['lowest_price'] = entity.lowestPrice;
  100. data['likes_count'] = entity.likesCount;
  101. data['liked'] = entity.liked;
  102. data['merchant'] = entity.merchant?.toJson();
  103. data['category'] = entity.category?.toJson();
  104. return data;
  105. }
  106. extension PaidServiceListExtension on PaidServiceList {
  107. PaidServiceList copyWith({
  108. int? id,
  109. String? name,
  110. List<String>? resources,
  111. int? lowestPrice,
  112. int? likesCount,
  113. bool? liked,
  114. PaidServiceListMerchant? merchant,
  115. PaidServiceListCategory? category,
  116. }) {
  117. return PaidServiceList()
  118. ..id = id ?? this.id
  119. ..name = name ?? this.name
  120. ..resources = resources ?? this.resources
  121. ..lowestPrice = lowestPrice ?? this.lowestPrice
  122. ..likesCount = likesCount ?? this.likesCount
  123. ..liked = liked ?? this.liked
  124. ..merchant = merchant ?? this.merchant
  125. ..category = category ?? this.category;
  126. }
  127. }
  128. PaidServiceListMerchant $PaidServiceListMerchantFromJson(
  129. Map<String, dynamic> json) {
  130. final PaidServiceListMerchant paidServiceListMerchant = PaidServiceListMerchant();
  131. final int? id = jsonConvert.convert<int>(json['id']);
  132. if (id != null) {
  133. paidServiceListMerchant.id = id;
  134. }
  135. final String? name = jsonConvert.convert<String>(json['name']);
  136. if (name != null) {
  137. paidServiceListMerchant.name = name;
  138. }
  139. return paidServiceListMerchant;
  140. }
  141. Map<String, dynamic> $PaidServiceListMerchantToJson(
  142. PaidServiceListMerchant entity) {
  143. final Map<String, dynamic> data = <String, dynamic>{};
  144. data['id'] = entity.id;
  145. data['name'] = entity.name;
  146. return data;
  147. }
  148. extension PaidServiceListMerchantExtension on PaidServiceListMerchant {
  149. PaidServiceListMerchant copyWith({
  150. int? id,
  151. String? name,
  152. }) {
  153. return PaidServiceListMerchant()
  154. ..id = id ?? this.id
  155. ..name = name ?? this.name;
  156. }
  157. }
  158. PaidServiceListCategory $PaidServiceListCategoryFromJson(
  159. Map<String, dynamic> json) {
  160. final PaidServiceListCategory paidServiceListCategory = PaidServiceListCategory();
  161. final int? id = jsonConvert.convert<int>(json['id']);
  162. if (id != null) {
  163. paidServiceListCategory.id = id;
  164. }
  165. final String? name = jsonConvert.convert<String>(json['name']);
  166. if (name != null) {
  167. paidServiceListCategory.name = name;
  168. }
  169. final String? type = jsonConvert.convert<String>(json['type']);
  170. if (type != null) {
  171. paidServiceListCategory.type = type;
  172. }
  173. return paidServiceListCategory;
  174. }
  175. Map<String, dynamic> $PaidServiceListCategoryToJson(
  176. PaidServiceListCategory entity) {
  177. final Map<String, dynamic> data = <String, dynamic>{};
  178. data['id'] = entity.id;
  179. data['name'] = entity.name;
  180. data['type'] = entity.type;
  181. return data;
  182. }
  183. extension PaidServiceListCategoryExtension on PaidServiceListCategory {
  184. PaidServiceListCategory copyWith({
  185. int? id,
  186. String? name,
  187. String? type,
  188. }) {
  189. return PaidServiceListCategory()
  190. ..id = id ?? this.id
  191. ..name = name ?? this.name
  192. ..type = type ?? this.type;
  193. }
  194. }