import 'package:get/get.dart';

import '../../../../utils/device_manager.dart';

class AccountController extends GetxController {
  // 是否是会员（true: Premium, false: Free）
  final isPremium = true.obs;

  // UID
  String uid = '';

  // Free 用户剩余时间
  final freeTime = '01:60:59 / Days';

  // Premium 用户有效期
  final validTerm = 'Year / 2026-12-12';

  // 设备授权数量
  final deviceCount = 1;
  final maxDeviceCount = 4;

  /// 切换会员状态（用于测试）
  void togglePremium() {
    isPremium.value = !isPremium.value;
  }

  @override
  void onInit() {
    super.onInit();
    uid = DeviceManager.getCacheDeviceId().length > 12
        ? '${DeviceManager.getCacheDeviceId().substring(0, 6)}***${DeviceManager.getCacheDeviceId().substring(DeviceManager.getCacheDeviceId().length - 6)}'
        : DeviceManager.getCacheDeviceId();
  }
}
