123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/paid_service_detail_entity.dart';
- PaidServiceDetailEntity $PaidServiceDetailEntityFromJson(Map<String, dynamic> json) {
- final PaidServiceDetailEntity paidServiceDetailEntity = PaidServiceDetailEntity();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceDetailEntity.id = id;
- }
- final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<String>(e) as String).toList();
- if (resources != null) {
- paidServiceDetailEntity.resources = resources;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceDetailEntity.name = name;
- }
- final int? evaluationsAvgScore = jsonConvert.convert<int>(json['evaluations_avg_score']);
- if (evaluationsAvgScore != null) {
- paidServiceDetailEntity.evaluationsAvgScore = evaluationsAvgScore;
- }
- final String? highlight = jsonConvert.convert<String>(json['highlight']);
- if (highlight != null) {
- paidServiceDetailEntity.highlight = highlight;
- }
- final int? urgentPrice = jsonConvert.convert<int>(json['urgent_price']);
- if (urgentPrice != null) {
- paidServiceDetailEntity.urgentPrice = urgentPrice;
- }
- final int? holidayPrice = jsonConvert.convert<int>(json['holiday_price']);
- if (holidayPrice != null) {
- paidServiceDetailEntity.holidayPrice = holidayPrice;
- }
- final double? nightPrice = jsonConvert.convert<double>(json['night_price']);
- if (nightPrice != null) {
- paidServiceDetailEntity.nightPrice = nightPrice;
- }
- final String? servicePeriodStart = jsonConvert.convert<String>(json['service_period_start']);
- if (servicePeriodStart != null) {
- paidServiceDetailEntity.servicePeriodStart = servicePeriodStart;
- }
- final String? servicePeriodEnd = jsonConvert.convert<String>(json['service_period_end']);
- if (servicePeriodEnd != null) {
- paidServiceDetailEntity.servicePeriodEnd = servicePeriodEnd;
- }
- final int? servicePeriodInterval = jsonConvert.convert<int>(json['service_period_interval']);
- if (servicePeriodInterval != null) {
- paidServiceDetailEntity.servicePeriodInterval = servicePeriodInterval;
- }
- final String? description = jsonConvert.convert<String>(json['description']);
- if (description != null) {
- paidServiceDetailEntity.description = description;
- }
- final PaidServiceDetailMerchant? merchant = jsonConvert.convert<PaidServiceDetailMerchant>(json['merchant']);
- if (merchant != null) {
- paidServiceDetailEntity.merchant = merchant;
- }
- final PaidServiceDetailCategory? category = jsonConvert.convert<PaidServiceDetailCategory>(json['category']);
- if (category != null) {
- paidServiceDetailEntity.category = category;
- }
- final List<PaidServiceDetailProducts>? products = (json['products'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<PaidServiceDetailProducts>(e) as PaidServiceDetailProducts).toList();
- if (products != null) {
- paidServiceDetailEntity.products = products;
- }
- final List<PaidServiceDetailEvaluations>? evaluations = (json['evaluations'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<PaidServiceDetailEvaluations>(e) as PaidServiceDetailEvaluations).toList();
- if (evaluations != null) {
- paidServiceDetailEntity.evaluations = evaluations;
- }
- return paidServiceDetailEntity;
- }
- Map<String, dynamic> $PaidServiceDetailEntityToJson(PaidServiceDetailEntity entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['resources'] = entity.resources;
- data['name'] = entity.name;
- data['evaluations_avg_score'] = entity.evaluationsAvgScore;
- data['highlight'] = entity.highlight;
- data['urgent_price'] = entity.urgentPrice;
- data['holiday_price'] = entity.holidayPrice;
- data['night_price'] = entity.nightPrice;
- data['service_period_start'] = entity.servicePeriodStart;
- data['service_period_end'] = entity.servicePeriodEnd;
- data['service_period_interval'] = entity.servicePeriodInterval;
- data['description'] = entity.description;
- data['merchant'] = entity.merchant?.toJson();
- data['category'] = entity.category?.toJson();
- data['products'] = entity.products?.map((v) => v.toJson()).toList();
- data['evaluations'] = entity.evaluations?.map((v) => v.toJson()).toList();
- return data;
- }
- extension PaidServiceDetailEntityExtension on PaidServiceDetailEntity {
- PaidServiceDetailEntity copyWith({
- int? id,
- List<String>? resources,
- String? name,
- int? evaluationsAvgScore,
- String? highlight,
- int? urgentPrice,
- int? holidayPrice,
- double? nightPrice,
- String? servicePeriodStart,
- String? servicePeriodEnd,
- int? servicePeriodInterval,
- String? description,
- PaidServiceDetailMerchant? merchant,
- PaidServiceDetailCategory? category,
- List<PaidServiceDetailProducts>? products,
- List<PaidServiceDetailEvaluations>? evaluations,
- }) {
- return PaidServiceDetailEntity()
- ..id = id ?? this.id
- ..resources = resources ?? this.resources
- ..name = name ?? this.name
- ..evaluationsAvgScore = evaluationsAvgScore ?? this.evaluationsAvgScore
- ..highlight = highlight ?? this.highlight
- ..urgentPrice = urgentPrice ?? this.urgentPrice
- ..holidayPrice = holidayPrice ?? this.holidayPrice
- ..nightPrice = nightPrice ?? this.nightPrice
- ..servicePeriodStart = servicePeriodStart ?? this.servicePeriodStart
- ..servicePeriodEnd = servicePeriodEnd ?? this.servicePeriodEnd
- ..servicePeriodInterval = servicePeriodInterval ?? this.servicePeriodInterval
- ..description = description ?? this.description
- ..merchant = merchant ?? this.merchant
- ..category = category ?? this.category
- ..products = products ?? this.products
- ..evaluations = evaluations ?? this.evaluations;
- }
- }
- PaidServiceDetailMerchant $PaidServiceDetailMerchantFromJson(Map<String, dynamic> json) {
- final PaidServiceDetailMerchant paidServiceDetailMerchant = PaidServiceDetailMerchant();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceDetailMerchant.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceDetailMerchant.name = name;
- }
- return paidServiceDetailMerchant;
- }
- Map<String, dynamic> $PaidServiceDetailMerchantToJson(PaidServiceDetailMerchant entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- return data;
- }
- extension PaidServiceDetailMerchantExtension on PaidServiceDetailMerchant {
- PaidServiceDetailMerchant copyWith({
- int? id,
- String? name,
- }) {
- return PaidServiceDetailMerchant()
- ..id = id ?? this.id
- ..name = name ?? this.name;
- }
- }
- PaidServiceDetailCategory $PaidServiceDetailCategoryFromJson(Map<String, dynamic> json) {
- final PaidServiceDetailCategory paidServiceDetailCategory = PaidServiceDetailCategory();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceDetailCategory.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceDetailCategory.name = name;
- }
- final String? type = jsonConvert.convert<String>(json['type']);
- if (type != null) {
- paidServiceDetailCategory.type = type;
- }
- return paidServiceDetailCategory;
- }
- Map<String, dynamic> $PaidServiceDetailCategoryToJson(PaidServiceDetailCategory entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['type'] = entity.type;
- return data;
- }
- extension PaidServiceDetailCategoryExtension on PaidServiceDetailCategory {
- PaidServiceDetailCategory copyWith({
- int? id,
- String? name,
- String? type,
- }) {
- return PaidServiceDetailCategory()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..type = type ?? this.type;
- }
- }
- PaidServiceDetailProducts $PaidServiceDetailProductsFromJson(Map<String, dynamic> json) {
- final PaidServiceDetailProducts paidServiceDetailProducts = PaidServiceDetailProducts();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceDetailProducts.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceDetailProducts.name = name;
- }
- final String? shortDescription = jsonConvert.convert<String>(json['short_description']);
- if (shortDescription != null) {
- paidServiceDetailProducts.shortDescription = shortDescription;
- }
- final int? price = jsonConvert.convert<int>(json['price']);
- if (price != null) {
- paidServiceDetailProducts.price = price;
- }
- return paidServiceDetailProducts;
- }
- Map<String, dynamic> $PaidServiceDetailProductsToJson(PaidServiceDetailProducts entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['short_description'] = entity.shortDescription;
- data['price'] = entity.price;
- return data;
- }
- extension PaidServiceDetailProductsExtension on PaidServiceDetailProducts {
- PaidServiceDetailProducts copyWith({
- int? id,
- String? name,
- String? shortDescription,
- int? price,
- }) {
- return PaidServiceDetailProducts()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..shortDescription = shortDescription ?? this.shortDescription
- ..price = price ?? this.price;
- }
- }
- PaidServiceDetailEvaluations $PaidServiceDetailEvaluationsFromJson(Map<String, dynamic> json) {
- final PaidServiceDetailEvaluations paidServiceDetailEvaluations = PaidServiceDetailEvaluations();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceDetailEvaluations.id = id;
- }
- final int? score = jsonConvert.convert<int>(json['score']);
- if (score != null) {
- paidServiceDetailEvaluations.score = score;
- }
- final String? comment = jsonConvert.convert<String>(json['comment']);
- if (comment != null) {
- paidServiceDetailEvaluations.comment = comment;
- }
- final List<String>? resources = (json['resources'] as List<dynamic>?)?.map(
- (e) => jsonConvert.convert<String>(e) as String).toList();
- if (resources != null) {
- paidServiceDetailEvaluations.resources = resources;
- }
- final PaidServiceDetailEvaluationsAccount? account = jsonConvert.convert<PaidServiceDetailEvaluationsAccount>(json['account']);
- if (account != null) {
- paidServiceDetailEvaluations.account = account;
- }
- final String? createdAt = jsonConvert.convert<String>(json['created_at']);
- if (createdAt != null) {
- paidServiceDetailEvaluations.createdAt = createdAt;
- }
- return paidServiceDetailEvaluations;
- }
- Map<String, dynamic> $PaidServiceDetailEvaluationsToJson(PaidServiceDetailEvaluations entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['score'] = entity.score;
- data['comment'] = entity.comment;
- data['resources'] = entity.resources;
- data['account'] = entity.account?.toJson();
- data['created_at'] = entity.createdAt;
- return data;
- }
- extension PaidServiceDetailEvaluationsExtension on PaidServiceDetailEvaluations {
- PaidServiceDetailEvaluations copyWith({
- int? id,
- int? score,
- String? comment,
- List<String>? resources,
- PaidServiceDetailEvaluationsAccount? account,
- String? createdAt,
- }) {
- return PaidServiceDetailEvaluations()
- ..id = id ?? this.id
- ..score = score ?? this.score
- ..comment = comment ?? this.comment
- ..resources = resources ?? this.resources
- ..account = account ?? this.account
- ..createdAt = createdAt ?? this.createdAt;
- }
- }
- PaidServiceDetailEvaluationsAccount $PaidServiceDetailEvaluationsAccountFromJson(Map<String, dynamic> json) {
- final PaidServiceDetailEvaluationsAccount paidServiceDetailEvaluationsAccount = PaidServiceDetailEvaluationsAccount();
- final int? id = jsonConvert.convert<int>(json['id']);
- if (id != null) {
- paidServiceDetailEvaluationsAccount.id = id;
- }
- final String? name = jsonConvert.convert<String>(json['name']);
- if (name != null) {
- paidServiceDetailEvaluationsAccount.name = name;
- }
- final String? avatar = jsonConvert.convert<String>(json['avatar']);
- if (avatar != null) {
- paidServiceDetailEvaluationsAccount.avatar = avatar;
- }
- return paidServiceDetailEvaluationsAccount;
- }
- Map<String, dynamic> $PaidServiceDetailEvaluationsAccountToJson(PaidServiceDetailEvaluationsAccount entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['name'] = entity.name;
- data['avatar'] = entity.avatar;
- return data;
- }
- extension PaidServiceDetailEvaluationsAccountExtension on PaidServiceDetailEvaluationsAccount {
- PaidServiceDetailEvaluationsAccount copyWith({
- int? id,
- String? name,
- String? avatar,
- }) {
- return PaidServiceDetailEvaluationsAccount()
- ..id = id ?? this.id
- ..name = name ?? this.name
- ..avatar = avatar ?? this.avatar;
- }
- }
|