import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/paid_service_entity.dart'; PaidServiceEntity $PaidServiceEntityFromJson(Map json) { final PaidServiceEntity paidServiceEntity = PaidServiceEntity(); final int? count = jsonConvert.convert(json['count']); if (count != null) { paidServiceEntity.count = count; } final int? page = jsonConvert.convert(json['page']); if (page != null) { paidServiceEntity.page = page; } final int? limit = jsonConvert.convert(json['limit']); if (limit != null) { paidServiceEntity.limit = limit; } final int? countPage = jsonConvert.convert(json['count_page']); if (countPage != null) { paidServiceEntity.countPage = countPage; } final List? list = (json['list'] as List?)?.map( (e) => jsonConvert.convert(e) as PaidServiceList).toList(); if (list != null) { paidServiceEntity.list = list; } return paidServiceEntity; } Map $PaidServiceEntityToJson(PaidServiceEntity entity) { final Map data = {}; data['count'] = entity.count; data['page'] = entity.page; data['limit'] = entity.limit; data['count_page'] = entity.countPage; data['list'] = entity.list?.map((v) => v.toJson()).toList(); return data; } extension PaidServiceEntityExtension on PaidServiceEntity { PaidServiceEntity copyWith({ int? count, int? page, int? limit, int? countPage, List? list, }) { return PaidServiceEntity() ..count = count ?? this.count ..page = page ?? this.page ..limit = limit ?? this.limit ..countPage = countPage ?? this.countPage ..list = list ?? this.list; } } PaidServiceList $PaidServiceListFromJson(Map json) { final PaidServiceList paidServiceList = PaidServiceList(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceList.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceList.name = name; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { paidServiceList.resources = resources; } final int? lowestPrice = jsonConvert.convert(json['lowest_price']); if (lowestPrice != null) { paidServiceList.lowestPrice = lowestPrice; } final int? likesCount = jsonConvert.convert(json['likes_count']); if (likesCount != null) { paidServiceList.likesCount = likesCount; } final bool? liked = jsonConvert.convert(json['liked']); if (liked != null) { paidServiceList.liked = liked; } final PaidServiceListMerchant? merchant = jsonConvert.convert(json['merchant']); if (merchant != null) { paidServiceList.merchant = merchant; } final PaidServiceListCategory? category = jsonConvert.convert(json['category']); if (category != null) { paidServiceList.category = category; } return paidServiceList; } Map $PaidServiceListToJson(PaidServiceList entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['resources'] = entity.resources; data['lowest_price'] = entity.lowestPrice; data['likes_count'] = entity.likesCount; data['liked'] = entity.liked; data['merchant'] = entity.merchant?.toJson(); data['category'] = entity.category?.toJson(); return data; } extension PaidServiceListExtension on PaidServiceList { PaidServiceList copyWith({ int? id, String? name, List? resources, int? lowestPrice, int? likesCount, bool? liked, PaidServiceListMerchant? merchant, PaidServiceListCategory? category, }) { return PaidServiceList() ..id = id ?? this.id ..name = name ?? this.name ..resources = resources ?? this.resources ..lowestPrice = lowestPrice ?? this.lowestPrice ..likesCount = likesCount ?? this.likesCount ..liked = liked ?? this.liked ..merchant = merchant ?? this.merchant ..category = category ?? this.category; } } PaidServiceListMerchant $PaidServiceListMerchantFromJson(Map json) { final PaidServiceListMerchant paidServiceListMerchant = PaidServiceListMerchant(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceListMerchant.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceListMerchant.name = name; } return paidServiceListMerchant; } Map $PaidServiceListMerchantToJson(PaidServiceListMerchant entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; return data; } extension PaidServiceListMerchantExtension on PaidServiceListMerchant { PaidServiceListMerchant copyWith({ int? id, String? name, }) { return PaidServiceListMerchant() ..id = id ?? this.id ..name = name ?? this.name; } } PaidServiceListCategory $PaidServiceListCategoryFromJson(Map json) { final PaidServiceListCategory paidServiceListCategory = PaidServiceListCategory(); final int? id = jsonConvert.convert(json['id']); if (id != null) { paidServiceListCategory.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { paidServiceListCategory.name = name; } final String? type = jsonConvert.convert(json['type']); if (type != null) { paidServiceListCategory.type = type; } return paidServiceListCategory; } Map $PaidServiceListCategoryToJson(PaidServiceListCategory entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['type'] = entity.type; return data; } extension PaidServiceListCategoryExtension on PaidServiceListCategory { PaidServiceListCategory copyWith({ int? id, String? name, String? type, }) { return PaidServiceListCategory() ..id = id ?? this.id ..name = name ?? this.name ..type = type ?? this.type; } }