import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_my_detail_entity.dart'; RewardsMyDetailEntity $RewardsMyDetailEntityFromJson(Map json) { final RewardsMyDetailEntity rewardsMyDetailEntity = RewardsMyDetailEntity(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsMyDetailEntity.id = id; } final int? redemptionCode = jsonConvert.convert(json['redemption_code']); if (redemptionCode != null) { rewardsMyDetailEntity.redemptionCode = redemptionCode; } final String? usedAt = jsonConvert.convert(json['used_at']); if (usedAt != null) { rewardsMyDetailEntity.usedAt = usedAt; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { rewardsMyDetailEntity.createdAt = createdAt; } final String? expiredAt = jsonConvert.convert(json['expired_at']); if (expiredAt != null) { rewardsMyDetailEntity.expiredAt = expiredAt; } final int? quantity = jsonConvert.convert(json['quantity']); if (quantity != null) { rewardsMyDetailEntity.quantity = quantity; } final RewardsMyDetailReward? reward = jsonConvert.convert(json['reward']); if (reward != null) { rewardsMyDetailEntity.reward = reward; } final RewardsMyDetailAccount? account = jsonConvert.convert(json['account']); if (account != null) { rewardsMyDetailEntity.account = account; } return rewardsMyDetailEntity; } Map $RewardsMyDetailEntityToJson(RewardsMyDetailEntity entity) { final Map data = {}; data['id'] = entity.id; data['redemption_code'] = entity.redemptionCode; data['used_at'] = entity.usedAt; data['created_at'] = entity.createdAt; data['expired_at'] = entity.expiredAt; data['quantity'] = entity.quantity; data['reward'] = entity.reward.toJson(); data['account'] = entity.account.toJson(); return data; } extension RewardsMyDetailEntityExtension on RewardsMyDetailEntity { RewardsMyDetailEntity copyWith({ int? id, int? redemptionCode, String? usedAt, String? createdAt, String? expiredAt, int? quantity, RewardsMyDetailReward? reward, RewardsMyDetailAccount? account, }) { return RewardsMyDetailEntity() ..id = id ?? this.id ..redemptionCode = redemptionCode ?? this.redemptionCode ..usedAt = usedAt ?? this.usedAt ..createdAt = createdAt ?? this.createdAt ..expiredAt = expiredAt ?? this.expiredAt ..quantity = quantity ?? this.quantity ..reward = reward ?? this.reward ..account = account ?? this.account; } } RewardsMyDetailAccount $RewardsMyDetailAccountFromJson(Map json) { final RewardsMyDetailAccount rewardsMyDetailAccount = RewardsMyDetailAccount(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsMyDetailAccount.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { rewardsMyDetailAccount.name = name; } final int? phone = jsonConvert.convert(json['phone']); if (phone != null) { rewardsMyDetailAccount.phone = phone; } return rewardsMyDetailAccount; } Map $RewardsMyDetailAccountToJson(RewardsMyDetailAccount entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['phone'] = entity.phone; return data; } extension RewardsMyDetailAccountExtension on RewardsMyDetailAccount { RewardsMyDetailAccount copyWith({ int? id, String? name, int? phone, }) { return RewardsMyDetailAccount() ..id = id ?? this.id ..name = name ?? this.name ..phone = phone ?? this.phone; } } RewardsMyDetailReward $RewardsMyDetailRewardFromJson(Map json) { final RewardsMyDetailReward rewardsMyDetailReward = RewardsMyDetailReward(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsMyDetailReward.id = id; } final String? title = jsonConvert.convert(json['title']); if (title != null) { rewardsMyDetailReward.title = title; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { rewardsMyDetailReward.resources = resources; } final int? originalPoint = jsonConvert.convert(json['original_point']); if (originalPoint != null) { rewardsMyDetailReward.originalPoint = originalPoint; } final int? point = jsonConvert.convert(json['point']); if (point != null) { rewardsMyDetailReward.point = point; } final String? redeemedStart = jsonConvert.convert(json['redeemed_start']); if (redeemedStart != null) { rewardsMyDetailReward.redeemedStart = redeemedStart; } final String? redeemedEnd = jsonConvert.convert(json['redeemed_end']); if (redeemedEnd != null) { rewardsMyDetailReward.redeemedEnd = redeemedEnd; } return rewardsMyDetailReward; } Map $RewardsMyDetailRewardToJson(RewardsMyDetailReward 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 RewardsMyDetailRewardExtension on RewardsMyDetailReward { RewardsMyDetailReward copyWith({ int? id, String? title, List? resources, int? originalPoint, int? point, String? redeemedStart, String? redeemedEnd, }) { return RewardsMyDetailReward() ..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; } }