86 lines
2.7 KiB
Dart

// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
abstract class User {
/// The empty user constructor.
const User.empty();
/// The users display name.
///
/// Will be `null` if signing in anonymously or via password authentication.
String? get displayName;
/// The users email address.
///
/// Will be `null` if signing in anonymously.
String? get email;
/// Returns whether the users email address has been verified.
///
/// To send a verification email, see `SendEmailVerification`.
///
/// Once verified, call `reload` to ensure the latest user information is
/// retrieved from Firebase.
bool get emailVerified;
/// Returns whether the user is a anonymous.
bool get isAnonymous;
/// Returns the users account creation time.
///
/// When this account was created as dictated by the server clock.
DateTime? get creationTime;
/// When the user last signed in as dictated by the server clock.
///
/// This is only accurate up to a granularity of 2 minutes for consecutive
/// sign-in attempts.
DateTime? get lastSignInTime;
/// Returns the users phone number.
///
/// This property will be `null` if the user has not signed in or been has
/// their phone number linked.
String? get phoneNumber;
/// Returns a photo URL for the user.
///
/// This property will be populated if the user has signed in or been linked
/// with a 3rd party OAuth provider (such as Google).
String? get photoURL;
/// Returns a JWT refresh token for the user.
///
/// This property maybe `null` or empty if the underlying platform does not
/// support providing refresh tokens.
String? get refreshToken;
/// The user's unique ID.
String get uid;
/// The provider ID for the user.
String? get providerId;
/// Whether the user account has been recently created.
bool? get isNewUser;
/// Convenience getter to determine whether the current user is empty.
bool get isEmpty;
/// Convenience getter to determine whether the current user is not empty.
bool get isNotEmpty;
}