paid_service_detail_entity.g.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/paid_service_detail_entity.dart';
  3. PaidServiceDetailEntity $PaidServiceDetailEntityFromJson(Map<String, dynamic> json) {
  4. final PaidServiceDetailEntity paidServiceDetailEntity = PaidServiceDetailEntity();
  5. final int? id = jsonConvert.convert<int>(json['id']);
  6. if (id != null) {
  7. paidServiceDetailEntity.id = id;
  8. }
  9. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  10. (e) => jsonConvert.convert<String>(e) as String).toList();
  11. if (resources != null) {
  12. paidServiceDetailEntity.resources = resources;
  13. }
  14. final String? name = jsonConvert.convert<String>(json['name']);
  15. if (name != null) {
  16. paidServiceDetailEntity.name = name;
  17. }
  18. final int? evaluationsAvgScore = jsonConvert.convert<int>(json['evaluations_avg_score']);
  19. if (evaluationsAvgScore != null) {
  20. paidServiceDetailEntity.evaluationsAvgScore = evaluationsAvgScore;
  21. }
  22. final String? highlight = jsonConvert.convert<String>(json['highlight']);
  23. if (highlight != null) {
  24. paidServiceDetailEntity.highlight = highlight;
  25. }
  26. final int? urgentPrice = jsonConvert.convert<int>(json['urgent_price']);
  27. if (urgentPrice != null) {
  28. paidServiceDetailEntity.urgentPrice = urgentPrice;
  29. }
  30. final int? holidayPrice = jsonConvert.convert<int>(json['holiday_price']);
  31. if (holidayPrice != null) {
  32. paidServiceDetailEntity.holidayPrice = holidayPrice;
  33. }
  34. final double? nightPrice = jsonConvert.convert<double>(json['night_price']);
  35. if (nightPrice != null) {
  36. paidServiceDetailEntity.nightPrice = nightPrice;
  37. }
  38. final String? servicePeriodStart = jsonConvert.convert<String>(json['service_period_start']);
  39. if (servicePeriodStart != null) {
  40. paidServiceDetailEntity.servicePeriodStart = servicePeriodStart;
  41. }
  42. final String? servicePeriodEnd = jsonConvert.convert<String>(json['service_period_end']);
  43. if (servicePeriodEnd != null) {
  44. paidServiceDetailEntity.servicePeriodEnd = servicePeriodEnd;
  45. }
  46. final int? servicePeriodInterval = jsonConvert.convert<int>(json['service_period_interval']);
  47. if (servicePeriodInterval != null) {
  48. paidServiceDetailEntity.servicePeriodInterval = servicePeriodInterval;
  49. }
  50. final String? description = jsonConvert.convert<String>(json['description']);
  51. if (description != null) {
  52. paidServiceDetailEntity.description = description;
  53. }
  54. final PaidServiceDetailMerchant? merchant = jsonConvert.convert<PaidServiceDetailMerchant>(json['merchant']);
  55. if (merchant != null) {
  56. paidServiceDetailEntity.merchant = merchant;
  57. }
  58. final PaidServiceDetailCategory? category = jsonConvert.convert<PaidServiceDetailCategory>(json['category']);
  59. if (category != null) {
  60. paidServiceDetailEntity.category = category;
  61. }
  62. final List<PaidServiceDetailProducts>? products = (json['products'] as List<dynamic>?)?.map(
  63. (e) => jsonConvert.convert<PaidServiceDetailProducts>(e) as PaidServiceDetailProducts).toList();
  64. if (products != null) {
  65. paidServiceDetailEntity.products = products;
  66. }
  67. final List<PaidServiceDetailEvaluations>? evaluations = (json['evaluations'] as List<dynamic>?)?.map(
  68. (e) => jsonConvert.convert<PaidServiceDetailEvaluations>(e) as PaidServiceDetailEvaluations).toList();
  69. if (evaluations != null) {
  70. paidServiceDetailEntity.evaluations = evaluations;
  71. }
  72. return paidServiceDetailEntity;
  73. }
  74. Map<String, dynamic> $PaidServiceDetailEntityToJson(PaidServiceDetailEntity entity) {
  75. final Map<String, dynamic> data = <String, dynamic>{};
  76. data['id'] = entity.id;
  77. data['resources'] = entity.resources;
  78. data['name'] = entity.name;
  79. data['evaluations_avg_score'] = entity.evaluationsAvgScore;
  80. data['highlight'] = entity.highlight;
  81. data['urgent_price'] = entity.urgentPrice;
  82. data['holiday_price'] = entity.holidayPrice;
  83. data['night_price'] = entity.nightPrice;
  84. data['service_period_start'] = entity.servicePeriodStart;
  85. data['service_period_end'] = entity.servicePeriodEnd;
  86. data['service_period_interval'] = entity.servicePeriodInterval;
  87. data['description'] = entity.description;
  88. data['merchant'] = entity.merchant?.toJson();
  89. data['category'] = entity.category?.toJson();
  90. data['products'] = entity.products?.map((v) => v.toJson()).toList();
  91. data['evaluations'] = entity.evaluations?.map((v) => v.toJson()).toList();
  92. return data;
  93. }
  94. extension PaidServiceDetailEntityExtension on PaidServiceDetailEntity {
  95. PaidServiceDetailEntity copyWith({
  96. int? id,
  97. List<String>? resources,
  98. String? name,
  99. int? evaluationsAvgScore,
  100. String? highlight,
  101. int? urgentPrice,
  102. int? holidayPrice,
  103. double? nightPrice,
  104. String? servicePeriodStart,
  105. String? servicePeriodEnd,
  106. int? servicePeriodInterval,
  107. String? description,
  108. PaidServiceDetailMerchant? merchant,
  109. PaidServiceDetailCategory? category,
  110. List<PaidServiceDetailProducts>? products,
  111. List<PaidServiceDetailEvaluations>? evaluations,
  112. }) {
  113. return PaidServiceDetailEntity()
  114. ..id = id ?? this.id
  115. ..resources = resources ?? this.resources
  116. ..name = name ?? this.name
  117. ..evaluationsAvgScore = evaluationsAvgScore ?? this.evaluationsAvgScore
  118. ..highlight = highlight ?? this.highlight
  119. ..urgentPrice = urgentPrice ?? this.urgentPrice
  120. ..holidayPrice = holidayPrice ?? this.holidayPrice
  121. ..nightPrice = nightPrice ?? this.nightPrice
  122. ..servicePeriodStart = servicePeriodStart ?? this.servicePeriodStart
  123. ..servicePeriodEnd = servicePeriodEnd ?? this.servicePeriodEnd
  124. ..servicePeriodInterval = servicePeriodInterval ?? this.servicePeriodInterval
  125. ..description = description ?? this.description
  126. ..merchant = merchant ?? this.merchant
  127. ..category = category ?? this.category
  128. ..products = products ?? this.products
  129. ..evaluations = evaluations ?? this.evaluations;
  130. }
  131. }
  132. PaidServiceDetailMerchant $PaidServiceDetailMerchantFromJson(Map<String, dynamic> json) {
  133. final PaidServiceDetailMerchant paidServiceDetailMerchant = PaidServiceDetailMerchant();
  134. final int? id = jsonConvert.convert<int>(json['id']);
  135. if (id != null) {
  136. paidServiceDetailMerchant.id = id;
  137. }
  138. final String? name = jsonConvert.convert<String>(json['name']);
  139. if (name != null) {
  140. paidServiceDetailMerchant.name = name;
  141. }
  142. return paidServiceDetailMerchant;
  143. }
  144. Map<String, dynamic> $PaidServiceDetailMerchantToJson(PaidServiceDetailMerchant entity) {
  145. final Map<String, dynamic> data = <String, dynamic>{};
  146. data['id'] = entity.id;
  147. data['name'] = entity.name;
  148. return data;
  149. }
  150. extension PaidServiceDetailMerchantExtension on PaidServiceDetailMerchant {
  151. PaidServiceDetailMerchant copyWith({
  152. int? id,
  153. String? name,
  154. }) {
  155. return PaidServiceDetailMerchant()
  156. ..id = id ?? this.id
  157. ..name = name ?? this.name;
  158. }
  159. }
  160. PaidServiceDetailCategory $PaidServiceDetailCategoryFromJson(Map<String, dynamic> json) {
  161. final PaidServiceDetailCategory paidServiceDetailCategory = PaidServiceDetailCategory();
  162. final int? id = jsonConvert.convert<int>(json['id']);
  163. if (id != null) {
  164. paidServiceDetailCategory.id = id;
  165. }
  166. final String? name = jsonConvert.convert<String>(json['name']);
  167. if (name != null) {
  168. paidServiceDetailCategory.name = name;
  169. }
  170. final String? type = jsonConvert.convert<String>(json['type']);
  171. if (type != null) {
  172. paidServiceDetailCategory.type = type;
  173. }
  174. return paidServiceDetailCategory;
  175. }
  176. Map<String, dynamic> $PaidServiceDetailCategoryToJson(PaidServiceDetailCategory 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 PaidServiceDetailCategoryExtension on PaidServiceDetailCategory {
  184. PaidServiceDetailCategory copyWith({
  185. int? id,
  186. String? name,
  187. String? type,
  188. }) {
  189. return PaidServiceDetailCategory()
  190. ..id = id ?? this.id
  191. ..name = name ?? this.name
  192. ..type = type ?? this.type;
  193. }
  194. }
  195. PaidServiceDetailProducts $PaidServiceDetailProductsFromJson(Map<String, dynamic> json) {
  196. final PaidServiceDetailProducts paidServiceDetailProducts = PaidServiceDetailProducts();
  197. final int? id = jsonConvert.convert<int>(json['id']);
  198. if (id != null) {
  199. paidServiceDetailProducts.id = id;
  200. }
  201. final String? name = jsonConvert.convert<String>(json['name']);
  202. if (name != null) {
  203. paidServiceDetailProducts.name = name;
  204. }
  205. final String? shortDescription = jsonConvert.convert<String>(json['short_description']);
  206. if (shortDescription != null) {
  207. paidServiceDetailProducts.shortDescription = shortDescription;
  208. }
  209. final int? price = jsonConvert.convert<int>(json['price']);
  210. if (price != null) {
  211. paidServiceDetailProducts.price = price;
  212. }
  213. return paidServiceDetailProducts;
  214. }
  215. Map<String, dynamic> $PaidServiceDetailProductsToJson(PaidServiceDetailProducts entity) {
  216. final Map<String, dynamic> data = <String, dynamic>{};
  217. data['id'] = entity.id;
  218. data['name'] = entity.name;
  219. data['short_description'] = entity.shortDescription;
  220. data['price'] = entity.price;
  221. return data;
  222. }
  223. extension PaidServiceDetailProductsExtension on PaidServiceDetailProducts {
  224. PaidServiceDetailProducts copyWith({
  225. int? id,
  226. String? name,
  227. String? shortDescription,
  228. int? price,
  229. }) {
  230. return PaidServiceDetailProducts()
  231. ..id = id ?? this.id
  232. ..name = name ?? this.name
  233. ..shortDescription = shortDescription ?? this.shortDescription
  234. ..price = price ?? this.price;
  235. }
  236. }
  237. PaidServiceDetailEvaluations $PaidServiceDetailEvaluationsFromJson(Map<String, dynamic> json) {
  238. final PaidServiceDetailEvaluations paidServiceDetailEvaluations = PaidServiceDetailEvaluations();
  239. final int? id = jsonConvert.convert<int>(json['id']);
  240. if (id != null) {
  241. paidServiceDetailEvaluations.id = id;
  242. }
  243. final int? score = jsonConvert.convert<int>(json['score']);
  244. if (score != null) {
  245. paidServiceDetailEvaluations.score = score;
  246. }
  247. final String? comment = jsonConvert.convert<String>(json['comment']);
  248. if (comment != null) {
  249. paidServiceDetailEvaluations.comment = comment;
  250. }
  251. final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
  252. (e) => jsonConvert.convert<String>(e) as String).toList();
  253. if (resources != null) {
  254. paidServiceDetailEvaluations.resources = resources;
  255. }
  256. final PaidServiceDetailEvaluationsAccount? account = jsonConvert.convert<PaidServiceDetailEvaluationsAccount>(json['account']);
  257. if (account != null) {
  258. paidServiceDetailEvaluations.account = account;
  259. }
  260. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  261. if (createdAt != null) {
  262. paidServiceDetailEvaluations.createdAt = createdAt;
  263. }
  264. return paidServiceDetailEvaluations;
  265. }
  266. Map<String, dynamic> $PaidServiceDetailEvaluationsToJson(PaidServiceDetailEvaluations entity) {
  267. final Map<String, dynamic> data = <String, dynamic>{};
  268. data['id'] = entity.id;
  269. data['score'] = entity.score;
  270. data['comment'] = entity.comment;
  271. data['resources'] = entity.resources;
  272. data['account'] = entity.account?.toJson();
  273. data['created_at'] = entity.createdAt;
  274. return data;
  275. }
  276. extension PaidServiceDetailEvaluationsExtension on PaidServiceDetailEvaluations {
  277. PaidServiceDetailEvaluations copyWith({
  278. int? id,
  279. int? score,
  280. String? comment,
  281. List<String>? resources,
  282. PaidServiceDetailEvaluationsAccount? account,
  283. String? createdAt,
  284. }) {
  285. return PaidServiceDetailEvaluations()
  286. ..id = id ?? this.id
  287. ..score = score ?? this.score
  288. ..comment = comment ?? this.comment
  289. ..resources = resources ?? this.resources
  290. ..account = account ?? this.account
  291. ..createdAt = createdAt ?? this.createdAt;
  292. }
  293. }
  294. PaidServiceDetailEvaluationsAccount $PaidServiceDetailEvaluationsAccountFromJson(Map<String, dynamic> json) {
  295. final PaidServiceDetailEvaluationsAccount paidServiceDetailEvaluationsAccount = PaidServiceDetailEvaluationsAccount();
  296. final int? id = jsonConvert.convert<int>(json['id']);
  297. if (id != null) {
  298. paidServiceDetailEvaluationsAccount.id = id;
  299. }
  300. final String? name = jsonConvert.convert<String>(json['name']);
  301. if (name != null) {
  302. paidServiceDetailEvaluationsAccount.name = name;
  303. }
  304. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  305. if (avatar != null) {
  306. paidServiceDetailEvaluationsAccount.avatar = avatar;
  307. }
  308. return paidServiceDetailEvaluationsAccount;
  309. }
  310. Map<String, dynamic> $PaidServiceDetailEvaluationsAccountToJson(PaidServiceDetailEvaluationsAccount entity) {
  311. final Map<String, dynamic> data = <String, dynamic>{};
  312. data['id'] = entity.id;
  313. data['name'] = entity.name;
  314. data['avatar'] = entity.avatar;
  315. return data;
  316. }
  317. extension PaidServiceDetailEvaluationsAccountExtension on PaidServiceDetailEvaluationsAccount {
  318. PaidServiceDetailEvaluationsAccount copyWith({
  319. int? id,
  320. String? name,
  321. String? avatar,
  322. }) {
  323. return PaidServiceDetailEvaluationsAccount()
  324. ..id = id ?? this.id
  325. ..name = name ?? this.name
  326. ..avatar = avatar ?? this.avatar;
  327. }
  328. }