import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/paid_service_detail_entity.dart'; PaidServiceDetailEntity $PaidServiceDetailEntityFromJson( Map json) { final PaidServiceDetailEntity paidServiceDetailEntity = PaidServiceDetailEntity(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceDetailEntity.id = id; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { paidServiceDetailEntity.resources = resources; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceDetailEntity.name = name; } final int? evaluationsAvgScore = jsonConvert.convert( json['evaluations_avg_score']); if (evaluationsAvgScore != null) { paidServiceDetailEntity.evaluationsAvgScore = evaluationsAvgScore; } final String? highlight = jsonConvert.convert(json['highlight']); if (highlight != null) { paidServiceDetailEntity.highlight = highlight; } final int? urgentPrice = jsonConvert.convert(json['urgent_price']); if (urgentPrice != null) { paidServiceDetailEntity.urgentPrice = urgentPrice; } final int? holidayPrice = jsonConvert.convert(json['holiday_price']); if (holidayPrice != null) { paidServiceDetailEntity.holidayPrice = holidayPrice; } final double? nightPrice = jsonConvert.convert(json['night_price']); if (nightPrice != null) { paidServiceDetailEntity.nightPrice = nightPrice; } final String? servicePeriodStart = jsonConvert.convert( json['service_period_start']); if (servicePeriodStart != null) { paidServiceDetailEntity.servicePeriodStart = servicePeriodStart; } final String? servicePeriodEnd = jsonConvert.convert( json['service_period_end']); if (servicePeriodEnd != null) { paidServiceDetailEntity.servicePeriodEnd = servicePeriodEnd; } final int? servicePeriodInterval = jsonConvert.convert( json['service_period_interval']); if (servicePeriodInterval != null) { paidServiceDetailEntity.servicePeriodInterval = servicePeriodInterval; } final String? description = jsonConvert.convert(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? products = (json['products'] as List< dynamic>?)?.map( (e) => jsonConvert.convert( e) as PaidServiceDetailProducts).toList(); if (products != null) { paidServiceDetailEntity.products = products; } final List< PaidServiceDetailEvaluations>? evaluations = (json['evaluations'] as List< dynamic>?)?.map( (e) => jsonConvert.convert( e) as PaidServiceDetailEvaluations).toList(); if (evaluations != null) { paidServiceDetailEntity.evaluations = evaluations; } return paidServiceDetailEntity; } Map $PaidServiceDetailEntityToJson( PaidServiceDetailEntity entity) { final Map data = {}; 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? 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? products, List? 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 json) { final PaidServiceDetailMerchant paidServiceDetailMerchant = PaidServiceDetailMerchant(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceDetailMerchant.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceDetailMerchant.name = name; } return paidServiceDetailMerchant; } Map $PaidServiceDetailMerchantToJson( PaidServiceDetailMerchant entity) { final Map data = {}; 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 json) { final PaidServiceDetailCategory paidServiceDetailCategory = PaidServiceDetailCategory(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceDetailCategory.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceDetailCategory.name = name; } final String? type = jsonConvert.convert(json['type']); if (type != null) { paidServiceDetailCategory.type = type; } return paidServiceDetailCategory; } Map $PaidServiceDetailCategoryToJson( PaidServiceDetailCategory entity) { final Map data = {}; 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 json) { final PaidServiceDetailProducts paidServiceDetailProducts = PaidServiceDetailProducts(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceDetailProducts.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceDetailProducts.name = name; } final String? shortDescription = jsonConvert.convert( json['short_description']); if (shortDescription != null) { paidServiceDetailProducts.shortDescription = shortDescription; } final int? price = jsonConvert.convert(json['price']); if (price != null) { paidServiceDetailProducts.price = price; } return paidServiceDetailProducts; } Map $PaidServiceDetailProductsToJson( PaidServiceDetailProducts entity) { final Map data = {}; 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 json) { final PaidServiceDetailEvaluations paidServiceDetailEvaluations = PaidServiceDetailEvaluations(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceDetailEvaluations.id = id; } final int? score = jsonConvert.convert(json['score']); if (score != null) { paidServiceDetailEvaluations.score = score; } final String? comment = jsonConvert.convert(json['comment']); if (comment != null) { paidServiceDetailEvaluations.comment = comment; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(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(json['created_at']); if (createdAt != null) { paidServiceDetailEvaluations.createdAt = createdAt; } return paidServiceDetailEvaluations; } Map $PaidServiceDetailEvaluationsToJson( PaidServiceDetailEvaluations entity) { final Map data = {}; 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? 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 json) { final PaidServiceDetailEvaluationsAccount paidServiceDetailEvaluationsAccount = PaidServiceDetailEvaluationsAccount(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceDetailEvaluationsAccount.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceDetailEvaluationsAccount.name = name; } final String? avatar = jsonConvert.convert(json['avatar']); if (avatar != null) { paidServiceDetailEvaluationsAccount.avatar = avatar; } return paidServiceDetailEvaluationsAccount; } Map $PaidServiceDetailEvaluationsAccountToJson( PaidServiceDetailEvaluationsAccount entity) { final Map data = {}; 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; } }