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