import 'package:json_annotation/json_annotation.dart';

part 'member_status_response.g.dart'; // 自动生成的代码文件

@JsonSerializable()
class MemberStatusResponse {
  @JsonKey(name: 'userId')
  final String userId;

  @JsonKey(name: 'level')
  final int level;

  @JsonKey(name: 'startTimestamp')
  final int startTimestamp;

  @JsonKey(name: 'endTimestamp')
  final int endTimestamp;

  @JsonKey(name: 'serverTimestamp')
  final int serverTimestamp;

  @JsonKey(name: 'expired')
  final bool expired;

  @JsonKey(name: 'permanent')
  final bool permanent;

  @JsonKey(name: 'deviceId')
  final String deviceId;

  @JsonKey(name: 'trialed')
  final bool? trialed;

  @JsonKey(name: 'avatar')
  final String? avatar;

  @JsonKey(name: 'trialEndTimestamp')
  final int? trialEndTimestamp;

  MemberStatusResponse({
    required this.userId,
    required this.level,
    required this.startTimestamp,
    required this.endTimestamp,
    required this.serverTimestamp,
    required this.expired,
    required this.permanent,
    required this.deviceId,
    this.trialed,
    this.avatar,
    this.trialEndTimestamp
  });

  // 反序列化：从 JSON 到 Dart 对象
  factory MemberStatusResponse.fromJson(Map<String, dynamic> json) =>
      _$MemberStatusResponseFromJson(json);
}
