import 'package:flyinsono/architecture/states/states.dart';
import 'package:flyinsono/architecture/values/features.dart';
import 'package:get/get.dart';

///主页状态
class HomeState {
  final Rx<int> _navIndex = Rx(0);
  final Rx<bool> _isDarkMode = Rx(false);

  final Rx<bool> _isNoRealName = Rx(false);
  final RxBool _isNetworkAbnormal = RxBool(false);
  final Rx<String> _currentRouter = Rx('');

  ///当前路由值
  String get currentRouter => _currentRouter.value;
  set currentRouter(String v) => _currentRouter.value = v;

  /// 导航栏下标 暂时看上去未用到，应该是留的一个入口
  int get navIndex => _navIndex.value;
  set navIndex(int val) => _navIndex.value = val;

  /// 是否是夜间模式
  bool get isDarkMode => _isDarkMode.value;
  set isDarkMode(bool val) => _isDarkMode.value = val;

  /// 是否未实名
  bool get isNoRealName => _isNoRealName.value;
  set isNoRealName(bool val) => _isNoRealName.value = val;

  final Rx<bool> _isMaximized = Rx(false);

  ///窗口是否最大化
  bool get isMaximized => _isMaximized.value;
  set isMaximized(bool v) => _isMaximized.value = v;

  /// 网络是否异常
  bool get isNetworkAbnormal => _isNetworkAbnormal.value;
  set isNetworkAbnormal(bool v) => _isNetworkAbnormal.value = v;

  bool get hasPatientListsAuth =>
      !isNoRealName && Store.user.hasFeature(FeatureKeys.PatientLists);

  bool get hasConsultationAuth =>
      !isNoRealName && Store.user.hasFeature(FeatureKeys.Consultation);
  bool get hasLaboratory =>
      !isNoRealName && Store.user.hasFeature(FeatureKeys.Laboratory);

  bool get hasCollegeAuth =>
      !isNoRealName && Store.user.hasFeature(FeatureKeys.FlyinsonoCollege);
}
