import 'package:get/get.dart';

///登录方式
enum SignInMethod {
  ///用户名密码登录
  Account,

  ///验证码登录
  VerificationCode,
}

class LabLoginState {
  final _title = "".obs;
  set title(value) => _title.value = value;
  get title => _title.value;

  final RxString _username = "".obs;
  set username(String value) => _username.value = value;
  String get username => _username.value;

  final RxString _password = "".obs;
  set password(String value) => _password.value = value;
  String get password => _password.value;

  /// 用户code
  final Rx<String> _userCode = Rx('');
  String get userCode => _userCode.value;
  set userCode(String val) => _userCode(val);

  /// 是否同意条款和政策
  final Rx<bool> _isAgreeClause = Rx(false);
  bool get isAgreeClause => _isAgreeClause.value;
  set isAgreeClause(bool val) => _isAgreeClause(val);

  /// 是否记住密码
  final Rx<bool> _isAutoLogin = Rx(false);
  bool get isAutoLogin => _isAutoLogin.value;
  set isAutoLogin(bool val) => _isAutoLogin.value = val;

  /// 是否验证码登录
  bool get isCodeSignIn => signInMethod == SignInMethod.VerificationCode;

  final Rx<SignInMethod> _signInMethod = Rx(SignInMethod.Account);

  /// 登录方式
  SignInMethod get signInMethod => _signInMethod.value;
  set signInMethod(SignInMethod val) => _signInMethod.value = val;
}
