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