/// 是否订阅（区分设备和邮箱）
class KRCheckSubscription {
  /// 当前设备订阅状态
  final bool deviceSubscribed;

  /// 邮箱订阅状态
  final bool emailSubscribed;

  /// 构造函数，默认 false
  KRCheckSubscription({
    this.deviceSubscribed = false,
    this.emailSubscribed = false,
  });

  /// 从 JSON 创建对象
  KRCheckSubscription.fromJson(Map<String, dynamic>? json)
      : deviceSubscribed = (json?['device_status'] == true || json?['deviceStatus'] == "true") ? true : false,
        emailSubscribed = (json?['email_status'] == true || json?['emailStatus'] == "true") ? true : false;

  /// 转换成 JSON
  Map<String, dynamic> toJson() {
    return {
      'deviceStatus': deviceSubscribed,
      'emailStatus': emailSubscribed,
    };
  }

  /// 判断邮箱和设备是否都已订阅
  bool get isFullySubscribed => deviceSubscribed && emailSubscribed;
}
