import 'package:domain/generated/json/base/json_field.dart';
import 'package:domain/generated/json/rewards_my_detail_entity.g.dart';
import 'dart:convert';
export 'package:domain/generated/json/rewards_my_detail_entity.g.dart';

@JsonSerializable()
class RewardsMyDetailEntity {
  late int id = 0;
  @JSONField(name: "redemption_code")
  late int redemptionCode = 0;
  @JSONField(name: "used_at")
  late String usedAt = '';
  @JSONField(name: "created_at")
  late String createdAt = '';
  @JSONField(name: "expired_at")
  late String expiredAt = '';
  late int quantity = 0;
  late RewardsMyDetailReward reward;
  late RewardsMyDetailAccount account;

  RewardsMyDetailEntity();

  factory RewardsMyDetailEntity.fromJson(Map<String, dynamic> json) =>
      $RewardsMyDetailEntityFromJson(json);

  Map<String, dynamic> toJson() => $RewardsMyDetailEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class RewardsMyDetailAccount {
  late int id = 0;
  late String name = '';
  late int phone = 0;

  RewardsMyDetailAccount();

  factory RewardsMyDetailAccount.fromJson(Map<String, dynamic> json) =>
      $RewardsMyDetailAccountFromJson(json);

  Map<String, dynamic> toJson() => $RewardsMyDetailAccountToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class RewardsMyDetailReward {
  late int id = 0;
  late String title = '';
  late List<String> resources = [];
  @JSONField(name: "original_point")
  late int originalPoint = 0;
  late int point = 0;
  @JSONField(name: "redeemed_start")
  late String redeemedStart = '';
  @JSONField(name: "redeemed_end")
  late String redeemedEnd = '';

  RewardsMyDetailReward();

  factory RewardsMyDetailReward.fromJson(Map<String, dynamic> json) =>
      $RewardsMyDetailRewardFromJson(json);

  Map<String, dynamic> toJson() => $RewardsMyDetailRewardToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
