import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_my_entity.dart'; RewardsMyEntity $RewardsMyEntityFromJson(Map json) { final RewardsMyEntity rewardsMyEntity = RewardsMyEntity(); final int? count = jsonConvert.convert(json['count']); if (count != null) { rewardsMyEntity.count = count; } final int? page = jsonConvert.convert(json['page']); if (page != null) { rewardsMyEntity.page = page; } final int? limit = jsonConvert.convert(json['limit']); if (limit != null) { rewardsMyEntity.limit = limit; } final int? countPage = jsonConvert.convert(json['count_page']); if (countPage != null) { rewardsMyEntity.countPage = countPage; } final List? list = (json['list'] as List?)?.map( (e) => jsonConvert.convert(e) as RewardsMyList).toList(); if (list != null) { rewardsMyEntity.list = list; } return rewardsMyEntity; } Map $RewardsMyEntityToJson(RewardsMyEntity 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 RewardsMyEntityExtension on RewardsMyEntity { RewardsMyEntity copyWith({ int? count, int? page, int? limit, int? countPage, List? list, }) { return RewardsMyEntity() ..count = count ?? this.count ..page = page ?? this.page ..limit = limit ?? this.limit ..countPage = countPage ?? this.countPage ..list = list ?? this.list; } } RewardsMyList $RewardsMyListFromJson(Map json) { final RewardsMyList rewardsMyList = RewardsMyList(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsMyList.id = id; } final int? redemptionCode = jsonConvert.convert(json['redemption_code']); if (redemptionCode != null) { rewardsMyList.redemptionCode = redemptionCode; } final String? usedAt = jsonConvert.convert(json['used_at']); if (usedAt != null) { rewardsMyList.usedAt = usedAt; } final RewardsMyListReward? reward = jsonConvert.convert(json['reward']); if (reward != null) { rewardsMyList.reward = reward; } return rewardsMyList; } Map $RewardsMyListToJson(RewardsMyList entity) { final Map data = {}; data['id'] = entity.id; data['redemption_code'] = entity.redemptionCode; data['used_at'] = entity.usedAt; data['reward'] = entity.reward.toJson(); return data; } extension RewardsMyListExtension on RewardsMyList { RewardsMyList copyWith({ int? id, int? redemptionCode, String? usedAt, RewardsMyListReward? reward, }) { return RewardsMyList() ..id = id ?? this.id ..redemptionCode = redemptionCode ?? this.redemptionCode ..usedAt = usedAt ?? this.usedAt ..reward = reward ?? this.reward; } } RewardsMyListReward $RewardsMyListRewardFromJson(Map json) { final RewardsMyListReward rewardsMyListReward = RewardsMyListReward(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsMyListReward.id = id; } final String? title = jsonConvert.convert(json['title']); if (title != null) { rewardsMyListReward.title = title; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { rewardsMyListReward.resources = resources; } final int? originalPoint = jsonConvert.convert(json['original_point']); if (originalPoint != null) { rewardsMyListReward.originalPoint = originalPoint; } final int? point = jsonConvert.convert(json['point']); if (point != null) { rewardsMyListReward.point = point; } final String? redeemedStart = jsonConvert.convert(json['redeemed_start']); if (redeemedStart != null) { rewardsMyListReward.redeemedStart = redeemedStart; } final String? redeemedEnd = jsonConvert.convert(json['redeemed_end']); if (redeemedEnd != null) { rewardsMyListReward.redeemedEnd = redeemedEnd; } return rewardsMyListReward; } Map $RewardsMyListRewardToJson(RewardsMyListReward entity) { final Map data = {}; data['id'] = entity.id; data['title'] = entity.title; data['resources'] = entity.resources; data['original_point'] = entity.originalPoint; data['point'] = entity.point; data['redeemed_start'] = entity.redeemedStart; data['redeemed_end'] = entity.redeemedEnd; return data; } extension RewardsMyListRewardExtension on RewardsMyListReward { RewardsMyListReward copyWith({ int? id, String? title, List? resources, int? originalPoint, int? point, String? redeemedStart, String? redeemedEnd, }) { return RewardsMyListReward() ..id = id ?? this.id ..title = title ?? this.title ..resources = resources ?? this.resources ..originalPoint = originalPoint ?? this.originalPoint ..point = point ?? this.point ..redeemedStart = redeemedStart ?? this.redeemedStart ..redeemedEnd = redeemedEnd ?? this.redeemedEnd; } }