import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_index_entity.dart'; RewardsIndexEntity $RewardsIndexEntityFromJson(Map json) { final RewardsIndexEntity rewardsIndexEntity = RewardsIndexEntity(); final int? points = jsonConvert.convert(json['points']); if (points != null) { rewardsIndexEntity.points = points; } final RewardsIndexContinuous? continuous = jsonConvert.convert< RewardsIndexContinuous>(json['continuous']); if (continuous != null) { rewardsIndexEntity.continuous = continuous; } final RewardsIndexTasks? tasks = jsonConvert.convert( json['tasks']); if (tasks != null) { rewardsIndexEntity.tasks = tasks; } final List? latest = (json['latest'] as List?)?.map( (e) => e).toList(); if (latest != null) { rewardsIndexEntity.latest = latest; } return rewardsIndexEntity; } Map $RewardsIndexEntityToJson(RewardsIndexEntity entity) { final Map data = {}; data['points'] = entity.points; data['continuous'] = entity.continuous.toJson(); data['tasks'] = entity.tasks.toJson(); data['latest'] = entity.latest; return data; } extension RewardsIndexEntityExtension on RewardsIndexEntity { RewardsIndexEntity copyWith({ int? points, RewardsIndexContinuous? continuous, RewardsIndexTasks? tasks, List? latest, }) { return RewardsIndexEntity() ..points = points ?? this.points ..continuous = continuous ?? this.continuous ..tasks = tasks ?? this.tasks ..latest = latest ?? this.latest; } } RewardsIndexContinuous $RewardsIndexContinuousFromJson( Map json) { final RewardsIndexContinuous rewardsIndexContinuous = RewardsIndexContinuous(); final int? count = jsonConvert.convert(json['count']); if (count != null) { rewardsIndexContinuous.count = count; } final List< dynamic>? currentWeekCheckin = (json['current_week_checkin'] as List< dynamic>?)?.map( (e) => e).toList(); if (currentWeekCheckin != null) { rewardsIndexContinuous.currentWeekCheckin = currentWeekCheckin; } return rewardsIndexContinuous; } Map $RewardsIndexContinuousToJson( RewardsIndexContinuous entity) { final Map data = {}; data['count'] = entity.count; data['current_week_checkin'] = entity.currentWeekCheckin; return data; } extension RewardsIndexContinuousExtension on RewardsIndexContinuous { RewardsIndexContinuous copyWith({ int? count, List? currentWeekCheckin, }) { return RewardsIndexContinuous() ..count = count ?? this.count ..currentWeekCheckin = currentWeekCheckin ?? this.currentWeekCheckin; } } RewardsIndexTasks $RewardsIndexTasksFromJson(Map json) { final RewardsIndexTasks rewardsIndexTasks = RewardsIndexTasks(); final bool? dailyCheckin = jsonConvert.convert(json['daily_checkin']); if (dailyCheckin != null) { rewardsIndexTasks.dailyCheckin = dailyCheckin; } final bool? newsFeedPost = jsonConvert.convert(json['news_feed_post']); if (newsFeedPost != null) { rewardsIndexTasks.newsFeedPost = newsFeedPost; } final int? give10Likes = jsonConvert.convert(json['give_10_likes']); if (give10Likes != null) { rewardsIndexTasks.give10Likes = give10Likes; } return rewardsIndexTasks; } Map $RewardsIndexTasksToJson(RewardsIndexTasks entity) { final Map data = {}; data['daily_checkin'] = entity.dailyCheckin; data['news_feed_post'] = entity.newsFeedPost; data['give_10_likes'] = entity.give10Likes; return data; } extension RewardsIndexTasksExtension on RewardsIndexTasks { RewardsIndexTasks copyWith({ bool? dailyCheckin, bool? newsFeedPost, int? give10Likes, }) { return RewardsIndexTasks() ..dailyCheckin = dailyCheckin ?? this.dailyCheckin ..newsFeedPost = newsFeedPost ?? this.newsFeedPost ..give10Likes = give10Likes ?? this.give10Likes; } }