class AuthTokenStore {
  String? _token;
  String? _provider;
  bool _cookieMode = false;
  String? _pendingProvider;

  String? getToken() => _token;

  String? getProvider() => _provider;

  bool usesCookie() => _cookieMode;

  void setToken(String token, {String? provider}) {
    _token = token;
    _cookieMode = false;
    _provider = provider;
  }

  void setCookieMode({String? provider}) {
    _cookieMode = true;
    _token = null;
    if (provider != null) {
      _provider = provider;
    }
  }

  String? getPendingProvider() => _pendingProvider;

  void setPendingProvider(String? provider) {
    _pendingProvider = provider;
  }

  void clear() {
    _token = null;
    _provider = null;
    _cookieMode = false;
    _pendingProvider = null;
  }
}

final authTokenStore = AuthTokenStore();
