import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_buy_entity.dart'; RewardsBuyEntity $RewardsBuyEntityFromJson(Map json) { final RewardsBuyEntity rewardsBuyEntity = RewardsBuyEntity(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsBuyEntity.id = id; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { rewardsBuyEntity.createdAt = createdAt; } final RewardsBuyReward? reward = jsonConvert.convert( json['reward']); if (reward != null) { rewardsBuyEntity.reward = reward; } return rewardsBuyEntity; } Map $RewardsBuyEntityToJson(RewardsBuyEntity entity) { final Map data = {}; data['id'] = entity.id; data['created_at'] = entity.createdAt; data['reward'] = entity.reward.toJson(); return data; } extension RewardsBuyEntityExtension on RewardsBuyEntity { RewardsBuyEntity copyWith({ int? id, String? createdAt, RewardsBuyReward? reward, }) { return RewardsBuyEntity() ..id = id ?? this.id ..createdAt = createdAt ?? this.createdAt ..reward = reward ?? this.reward; } } RewardsBuyReward $RewardsBuyRewardFromJson(Map json) { final RewardsBuyReward rewardsBuyReward = RewardsBuyReward(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsBuyReward.id = id; } final String? title = jsonConvert.convert(json['title']); if (title != null) { rewardsBuyReward.title = title; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { rewardsBuyReward.resources = resources; } final int? originalPoint = jsonConvert.convert(json['original_point']); if (originalPoint != null) { rewardsBuyReward.originalPoint = originalPoint; } final int? point = jsonConvert.convert(json['point']); if (point != null) { rewardsBuyReward.point = point; } final String? description = jsonConvert.convert(json['description']); if (description != null) { rewardsBuyReward.description = description; } final bool? reservation = jsonConvert.convert(json['reservation']); if (reservation != null) { rewardsBuyReward.reservation = reservation; } final String? start = jsonConvert.convert(json['start']); if (start != null) { rewardsBuyReward.start = start; } final String? end = jsonConvert.convert(json['end']); if (end != null) { rewardsBuyReward.end = end; } final String? redeemedStart = jsonConvert.convert( json['redeemed_start']); if (redeemedStart != null) { rewardsBuyReward.redeemedStart = redeemedStart; } final String? redeemedEnd = jsonConvert.convert(json['redeemed_end']); if (redeemedEnd != null) { rewardsBuyReward.redeemedEnd = redeemedEnd; } final String? package = jsonConvert.convert(json['package']); if (package != null) { rewardsBuyReward.package = package; } final String? notice = jsonConvert.convert(json['notice']); if (notice != null) { rewardsBuyReward.notice = notice; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { rewardsBuyReward.createdAt = createdAt; } final List< RewardsBuyRewardRedeemable>? redeemable = (json['redeemable'] as List< dynamic>?)?.map( (e) => jsonConvert.convert( e) as RewardsBuyRewardRedeemable).toList(); if (redeemable != null) { rewardsBuyReward.redeemable = redeemable; } return rewardsBuyReward; } Map $RewardsBuyRewardToJson(RewardsBuyReward 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['description'] = entity.description; data['reservation'] = entity.reservation; data['start'] = entity.start; data['end'] = entity.end; data['redeemed_start'] = entity.redeemedStart; data['redeemed_end'] = entity.redeemedEnd; data['package'] = entity.package; data['notice'] = entity.notice; data['created_at'] = entity.createdAt; data['redeemable'] = entity.redeemable.map((v) => v.toJson()).toList(); return data; } extension RewardsBuyRewardExtension on RewardsBuyReward { RewardsBuyReward copyWith({ int? id, String? title, List? resources, int? originalPoint, int? point, String? description, bool? reservation, String? start, String? end, String? redeemedStart, String? redeemedEnd, String? package, String? notice, String? createdAt, List? redeemable, }) { return RewardsBuyReward() ..id = id ?? this.id ..title = title ?? this.title ..resources = resources ?? this.resources ..originalPoint = originalPoint ?? this.originalPoint ..point = point ?? this.point ..description = description ?? this.description ..reservation = reservation ?? this.reservation ..start = start ?? this.start ..end = end ?? this.end ..redeemedStart = redeemedStart ?? this.redeemedStart ..redeemedEnd = redeemedEnd ?? this.redeemedEnd ..package = package ?? this.package ..notice = notice ?? this.notice ..createdAt = createdAt ?? this.createdAt ..redeemable = redeemable ?? this.redeemable; } } RewardsBuyRewardRedeemable $RewardsBuyRewardRedeemableFromJson( Map json) { final RewardsBuyRewardRedeemable rewardsBuyRewardRedeemable = RewardsBuyRewardRedeemable(); final String? day = jsonConvert.convert(json['day']); if (day != null) { rewardsBuyRewardRedeemable.day = day; } final String? time = jsonConvert.convert(json['time']); if (time != null) { rewardsBuyRewardRedeemable.time = time; } return rewardsBuyRewardRedeemable; } Map $RewardsBuyRewardRedeemableToJson( RewardsBuyRewardRedeemable entity) { final Map data = {}; data['day'] = entity.day; data['time'] = entity.time; return data; } extension RewardsBuyRewardRedeemableExtension on RewardsBuyRewardRedeemable { RewardsBuyRewardRedeemable copyWith({ String? day, String? time, }) { return RewardsBuyRewardRedeemable() ..day = day ?? this.day ..time = time ?? this.time; } }