import 'package:domain/generated/json/base/json_convert_content.dart'; import 'package:domain/entity/rewards_detail_entity.dart'; RewardsDetailEntity $RewardsDetailEntityFromJson(Map json) { final RewardsDetailEntity rewardsDetailEntity = RewardsDetailEntity(); final int? id = jsonConvert.convert(json['id']); if (id != null) { rewardsDetailEntity.id = id; } final String? title = jsonConvert.convert(json['title']); if (title != null) { rewardsDetailEntity.title = title; } final List? resources = (json['resources'] as List?)?.map( (e) => jsonConvert.convert(e) as String).toList(); if (resources != null) { rewardsDetailEntity.resources = resources; } final int? originalPoint = jsonConvert.convert(json['original_point']); if (originalPoint != null) { rewardsDetailEntity.originalPoint = originalPoint; } final int? point = jsonConvert.convert(json['point']); if (point != null) { rewardsDetailEntity.point = point; } final String? description = jsonConvert.convert(json['description']); if (description != null) { rewardsDetailEntity.description = description; } final bool? reservation = jsonConvert.convert(json['reservation']); if (reservation != null) { rewardsDetailEntity.reservation = reservation; } final String? start = jsonConvert.convert(json['start']); if (start != null) { rewardsDetailEntity.start = start; } final String? end = jsonConvert.convert(json['end']); if (end != null) { rewardsDetailEntity.end = end; } final String? redeemedStart = jsonConvert.convert( json['redeemed_start']); if (redeemedStart != null) { rewardsDetailEntity.redeemedStart = redeemedStart; } final String? redeemedEnd = jsonConvert.convert(json['redeemed_end']); if (redeemedEnd != null) { rewardsDetailEntity.redeemedEnd = redeemedEnd; } final String? package = jsonConvert.convert(json['package']); if (package != null) { rewardsDetailEntity.package = package; } final String? notice = jsonConvert.convert(json['notice']); if (notice != null) { rewardsDetailEntity.notice = notice; } final String? createdAt = jsonConvert.convert(json['created_at']); if (createdAt != null) { rewardsDetailEntity.createdAt = createdAt; } final List? redeemable = (json['redeemable'] as List< dynamic>?)?.map( (e) => jsonConvert.convert( e) as RewardsDetailRedeemable).toList(); if (redeemable != null) { rewardsDetailEntity.redeemable = redeemable; } return rewardsDetailEntity; } Map $RewardsDetailEntityToJson(RewardsDetailEntity 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 RewardsDetailEntityExtension on RewardsDetailEntity { RewardsDetailEntity 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 RewardsDetailEntity() ..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; } } RewardsDetailRedeemable $RewardsDetailRedeemableFromJson( Map json) { final RewardsDetailRedeemable rewardsDetailRedeemable = RewardsDetailRedeemable(); final String? day = jsonConvert.convert(json['day']); if (day != null) { rewardsDetailRedeemable.day = day; } final String? time = jsonConvert.convert(json['time']); if (time != null) { rewardsDetailRedeemable.time = time; } return rewardsDetailRedeemable; } Map $RewardsDetailRedeemableToJson( RewardsDetailRedeemable entity) { final Map data = {}; data['day'] = entity.day; data['time'] = entity.time; return data; } extension RewardsDetailRedeemableExtension on RewardsDetailRedeemable { RewardsDetailRedeemable copyWith({ String? day, String? time, }) { return RewardsDetailRedeemable() ..day = day ?? this.day ..time = time ?? this.time; } }