import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/property_news_entity.dart'; PropertyNewsEntity $PropertyNewsEntityFromJson(Map json) { final PropertyNewsEntity propertyNewsEntity = PropertyNewsEntity(); final int? count = jsonConvert.convert(json['count']); if (count != null) { propertyNewsEntity.count = count; } final int? page = jsonConvert.convert(json['page']); if (page != null) { propertyNewsEntity.page = page; } final int? limit = jsonConvert.convert(json['limit']); if (limit != null) { propertyNewsEntity.limit = limit; } final int? countPage = jsonConvert.convert(json['count_page']); if (countPage != null) { propertyNewsEntity.countPage = countPage; } final List? list = (json['list'] as List?) ?.map( (e) => jsonConvert.convert(e) as PropertyNewsList) .toList(); if (list != null) { propertyNewsEntity.list = list; } return propertyNewsEntity; } Map $PropertyNewsEntityToJson(PropertyNewsEntity 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 PropertyNewsEntityExtension on PropertyNewsEntity { PropertyNewsEntity copyWith({ int? count, int? page, int? limit, int? countPage, List? list, }) { return PropertyNewsEntity() ..count = count ?? this.count ..page = page ?? this.page ..limit = limit ?? this.limit ..countPage = countPage ?? this.countPage ..list = list ?? this.list; } } PropertyNewsList $PropertyNewsListFromJson(Map json) { final PropertyNewsList propertyNewsList = PropertyNewsList(); final int? id = jsonConvert.convert(json['id']); if (id != null) { propertyNewsList.id = id; } final String? title = jsonConvert.convert(json['title']); if (title != null) { propertyNewsList.title = title; } final String? coverImage = jsonConvert.convert(json['cover_image']); if (coverImage != null) { propertyNewsList.coverImage = coverImage; } final String? content = jsonConvert.convert(json['content']); if (content != null) { propertyNewsList.content = content; } final int? likesCount = jsonConvert.convert(json['likes_count']); if (likesCount != null) { propertyNewsList.likesCount = likesCount; } final bool? liked = jsonConvert.convert(json['liked']); if (liked != null) { propertyNewsList.liked = liked; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { propertyNewsList.createdAt = createdAt; } return propertyNewsList; } Map $PropertyNewsListToJson(PropertyNewsList entity) { final Map data = {}; data['id'] = entity.id; data['title'] = entity.title; data['cover_image'] = entity.coverImage; data['content'] = entity.content; data['likes_count'] = entity.likesCount; data['liked'] = entity.liked; data['created_at'] = entity.createdAt; return data; } extension PropertyNewsListExtension on PropertyNewsList { PropertyNewsList copyWith({ int? id, String? title, String? coverImage, String? content, int? likesCount, bool? liked, String? createdAt, }) { return PropertyNewsList() ..id = id ?? this.id ..title = title ?? this.title ..coverImage = coverImage ?? this.coverImage ..content = content ?? this.content ..likesCount = likesCount ?? this.likesCount ..liked = liked ?? this.liked ..createdAt = createdAt ?? this.createdAt; } }