import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_active_detail_entity.dart'; RewardsActiveDetailEntity $RewardsActiveDetailEntityFromJson(Map json) { final RewardsActiveDetailEntity rewardsActiveDetailEntity = RewardsActiveDetailEntity(); final RewardsActiveDetailData? data = jsonConvert.convert(json['data']); if (data != null) { rewardsActiveDetailEntity.data = data; } return rewardsActiveDetailEntity; } Map $RewardsActiveDetailEntityToJson(RewardsActiveDetailEntity entity) { final Map data = {}; data['data'] = entity.data.toJson(); return data; } extension RewardsActiveDetailEntityExtension on RewardsActiveDetailEntity { RewardsActiveDetailEntity copyWith({ RewardsActiveDetailData? data, }) { return RewardsActiveDetailEntity() ..data = data ?? this.data; } } RewardsActiveDetailData $RewardsActiveDetailDataFromJson(Map json) { final RewardsActiveDetailData rewardsActiveDetailData = RewardsActiveDetailData(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsActiveDetailData.id = id; } final String? redemptionCode = jsonConvert.convert(json['redemption_code']); if (redemptionCode != null) { rewardsActiveDetailData.redemptionCode = redemptionCode; } final String? usedAt = jsonConvert.convert(json['used_at']); if (usedAt != null) { rewardsActiveDetailData.usedAt = usedAt; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { rewardsActiveDetailData.createdAt = createdAt; } final String? expiredAt = jsonConvert.convert(json['expired_at']); if (expiredAt != null) { rewardsActiveDetailData.expiredAt = expiredAt; } final int? quantity = jsonConvert.convert(json['quantity']); if (quantity != null) { rewardsActiveDetailData.quantity = quantity; } final RewardsActiveDetailDataAccount? account = jsonConvert.convert(json['account']); if (account != null) { rewardsActiveDetailData.account = account; } final RewardsActiveDetailDataReward? reward = jsonConvert.convert(json['reward']); if (reward != null) { rewardsActiveDetailData.reward = reward; } return rewardsActiveDetailData; } Map $RewardsActiveDetailDataToJson(RewardsActiveDetailData 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['account'] = entity.account.toJson(); data['reward'] = entity.reward.toJson(); return data; } extension RewardsActiveDetailDataExtension on RewardsActiveDetailData { RewardsActiveDetailData copyWith({ int? id, String? redemptionCode, String? usedAt, String? createdAt, String? expiredAt, int? quantity, RewardsActiveDetailDataAccount? account, RewardsActiveDetailDataReward? reward, }) { return RewardsActiveDetailData() ..id = id ?? this.id ..redemptionCode = redemptionCode ?? this.redemptionCode ..usedAt = usedAt ?? this.usedAt ..createdAt = createdAt ?? this.createdAt ..expiredAt = expiredAt ?? this.expiredAt ..quantity = quantity ?? this.quantity ..account = account ?? this.account ..reward = reward ?? this.reward; } } RewardsActiveDetailDataAccount $RewardsActiveDetailDataAccountFromJson(Map json) { final RewardsActiveDetailDataAccount rewardsActiveDetailDataAccount = RewardsActiveDetailDataAccount(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsActiveDetailDataAccount.id = id; } final String? name = jsonConvert.convert(json['name']); if (name != null) { rewardsActiveDetailDataAccount.name = name; } final String? phone = jsonConvert.convert(json['phone']); if (phone != null) { rewardsActiveDetailDataAccount.phone = phone; } return rewardsActiveDetailDataAccount; } Map $RewardsActiveDetailDataAccountToJson(RewardsActiveDetailDataAccount entity) { final Map data = {}; data['id'] = entity.id; data['name'] = entity.name; data['phone'] = entity.phone; return data; } extension RewardsActiveDetailDataAccountExtension on RewardsActiveDetailDataAccount { RewardsActiveDetailDataAccount copyWith({ int? id, String? name, String? phone, }) { return RewardsActiveDetailDataAccount() ..id = id ?? this.id ..name = name ?? this.name ..phone = phone ?? this.phone; } } RewardsActiveDetailDataReward $RewardsActiveDetailDataRewardFromJson(Map json) { final RewardsActiveDetailDataReward rewardsActiveDetailDataReward = RewardsActiveDetailDataReward(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsActiveDetailDataReward.id = id; } final String? title = jsonConvert.convert(json['title']); if (title != null) { rewardsActiveDetailDataReward.title = title; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { rewardsActiveDetailDataReward.resources = resources; } final int? originalPoint = jsonConvert.convert(json['original_point']); if (originalPoint != null) { rewardsActiveDetailDataReward.originalPoint = originalPoint; } final int? point = jsonConvert.convert(json['point']); if (point != null) { rewardsActiveDetailDataReward.point = point; } final String? redeemedStart = jsonConvert.convert(json['redeemed_start']); if (redeemedStart != null) { rewardsActiveDetailDataReward.redeemedStart = redeemedStart; } final String? redeemedEnd = jsonConvert.convert(json['redeemed_end']); if (redeemedEnd != null) { rewardsActiveDetailDataReward.redeemedEnd = redeemedEnd; } return rewardsActiveDetailDataReward; } Map $RewardsActiveDetailDataRewardToJson(RewardsActiveDetailDataReward 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 RewardsActiveDetailDataRewardExtension on RewardsActiveDetailDataReward { RewardsActiveDetailDataReward copyWith({ int? id, String? title, List? resources, int? originalPoint, int? point, String? redeemedStart, String? redeemedEnd, }) { return RewardsActiveDetailDataReward() ..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; } }