paid_service_detail_entity.g.dart 13 KB

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