import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/repair_service_entity.dart'; RepairServiceEntity $RepairServiceEntityFromJson(Map json) { final RepairServiceEntity repairServiceEntity = RepairServiceEntity(); final int? count = jsonConvert.convert(json['count']); if (count != null) { repairServiceEntity.count = count; } final int? page = jsonConvert.convert(json['page']); if (page != null) { repairServiceEntity.page = page; } final int? limit = jsonConvert.convert(json['limit']); if (limit != null) { repairServiceEntity.limit = limit; } final int? countPage = jsonConvert.convert(json['count_page']); if (countPage != null) { repairServiceEntity.countPage = countPage; } final List? list = (json['list'] as List?) ?.map( (e) => jsonConvert.convert(e) as RepairServiceList) .toList(); if (list != null) { repairServiceEntity.list = list; } return repairServiceEntity; } Map $RepairServiceEntityToJson(RepairServiceEntity 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 RepairServiceEntityExtension on RepairServiceEntity { RepairServiceEntity copyWith({ int? count, int? page, int? limit, int? countPage, List? list, }) { return RepairServiceEntity() ..count = count ?? this.count ..page = page ?? this.page ..limit = limit ?? this.limit ..countPage = countPage ?? this.countPage ..list = list ?? this.list; } } RepairServiceList $RepairServiceListFromJson(Map json) { final RepairServiceList repairServiceList = RepairServiceList(); final int? id = jsonConvert.convert(json['id']); if (id != null) { repairServiceList.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { repairServiceList.name = name; } final int? likesCount = jsonConvert.convert(json['likes_count']); if (likesCount != null) { repairServiceList.likesCount = likesCount; } final bool? liked = jsonConvert.convert(json['liked']); if (liked != null) { repairServiceList.liked = liked; } final RepairServiceListMerchant? merchant = jsonConvert.convert< RepairServiceListMerchant>(json['merchant']); if (merchant != null) { repairServiceList.merchant = merchant; } final RepairServiceListCategory? category = jsonConvert.convert< RepairServiceListCategory>(json['category']); if (category != null) { repairServiceList.category = category; } return repairServiceList; } Map $RepairServiceListToJson(RepairServiceList entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['likes_count'] = entity.likesCount; data['liked'] = entity.liked; data['merchant'] = entity.merchant?.toJson(); data['category'] = entity.category?.toJson(); return data; } extension RepairServiceListExtension on RepairServiceList { RepairServiceList copyWith({ int? id, String? name, int? likesCount, bool? liked, RepairServiceListMerchant? merchant, RepairServiceListCategory? category, }) { return RepairServiceList() ..id = id ?? this.id ..name = name ?? this.name ..likesCount = likesCount ?? this.likesCount ..liked = liked ?? this.liked ..merchant = merchant ?? this.merchant ..category = category ?? this.category; } } RepairServiceListMerchant $RepairServiceListMerchantFromJson( Map json) { final RepairServiceListMerchant repairServiceListMerchant = RepairServiceListMerchant(); final int? id = jsonConvert.convert(json['id']); if (id != null) { repairServiceListMerchant.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { repairServiceListMerchant.name = name; } return repairServiceListMerchant; } Map $RepairServiceListMerchantToJson( RepairServiceListMerchant entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; return data; } extension RepairServiceListMerchantExtension on RepairServiceListMerchant { RepairServiceListMerchant copyWith({ int? id, String? name, }) { return RepairServiceListMerchant() ..id = id ?? this.id ..name = name ?? this.name; } } RepairServiceListCategory $RepairServiceListCategoryFromJson( Map json) { final RepairServiceListCategory repairServiceListCategory = RepairServiceListCategory(); final int? id = jsonConvert.convert(json['id']); if (id != null) { repairServiceListCategory.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { repairServiceListCategory.name = name; } final String? type = jsonConvert.convert(json['type']); if (type != null) { repairServiceListCategory.type = type; } return repairServiceListCategory; } Map $RepairServiceListCategoryToJson( RepairServiceListCategory entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['type'] = entity.type; return data; } extension RepairServiceListCategoryExtension on RepairServiceListCategory { RepairServiceListCategory copyWith({ int? id, String? name, String? type, }) { return RepairServiceListCategory() ..id = id ?? this.id ..name = name ?? this.name ..type = type ?? this.type; } }