import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_home_entity.dart'; RewardsHomeEntity $RewardsHomeEntityFromJson(Map json) { final RewardsHomeEntity rewardsHomeEntity = RewardsHomeEntity(); final List? data = (json['data'] as List?) ?.map( (e) => jsonConvert.convert(e) as RewardsHomeData) .toList(); if (data != null) { rewardsHomeEntity.data = data; } final String? message = jsonConvert.convert(json['message']); if (message != null) { rewardsHomeEntity.message = message; } final int? code = jsonConvert.convert(json['code']); if (code != null) { rewardsHomeEntity.code = code; } return rewardsHomeEntity; } Map $RewardsHomeEntityToJson(RewardsHomeEntity entity) { final Map data = {}; data['data'] = entity.data.map((v) => v.toJson()).toList(); data['message'] = entity.message; data['code'] = entity.code; return data; } extension RewardsHomeEntityExtension on RewardsHomeEntity { RewardsHomeEntity copyWith({ List? data, String? message, int? code, }) { return RewardsHomeEntity() ..data = data ?? this.data ..message = message ?? this.message ..code = code ?? this.code; } } RewardsHomeData $RewardsHomeDataFromJson(Map json) { final RewardsHomeData rewardsHomeData = RewardsHomeData(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsHomeData.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { rewardsHomeData.name = name; } final List? rewards = (json['rewards'] as List< dynamic>?) ?.map( (e) => jsonConvert.convert(e) as RewardsHomeDataRewards) .toList(); if (rewards != null) { rewardsHomeData.rewards = rewards; } return rewardsHomeData; } Map $RewardsHomeDataToJson(RewardsHomeData entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['rewards'] = entity.rewards.map((v) => v.toJson()).toList(); return data; } extension RewardsHomeDataExtension on RewardsHomeData { RewardsHomeData copyWith({ int? id, String? name, List? rewards, }) { return RewardsHomeData() ..id = id ?? this.id ..name = name ?? this.name ..rewards = rewards ?? this.rewards; } } RewardsHomeDataRewards $RewardsHomeDataRewardsFromJson( Map json) { final RewardsHomeDataRewards rewardsHomeDataRewards = RewardsHomeDataRewards(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsHomeDataRewards.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { rewardsHomeDataRewards.name = name; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { rewardsHomeDataRewards.resources = resources; } final int? originalPoint = jsonConvert.convert(json['original_point']); if (originalPoint != null) { rewardsHomeDataRewards.originalPoint = originalPoint; } final int? point = jsonConvert.convert(json['point']); if (point != null) { rewardsHomeDataRewards.point = point; } return rewardsHomeDataRewards; } Map $RewardsHomeDataRewardsToJson( RewardsHomeDataRewards entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['resources'] = entity.resources; data['original_point'] = entity.originalPoint; data['point'] = entity.point; return data; } extension RewardsHomeDataRewardsExtension on RewardsHomeDataRewards { RewardsHomeDataRewards copyWith({ int? id, String? name, List? resources, int? originalPoint, int? point, }) { return RewardsHomeDataRewards() ..id = id ?? this.id ..name = name ?? this.name ..resources = resources ?? this.resources ..originalPoint = originalPoint ?? this.originalPoint ..point = point ?? this.point; } }