// Copyright (C) 2023 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/>.

part of 'authentication_cubit.dart';

/// {@template authentication_status}
/// The status of the authentication cubit.
/// {@endtemplate}
class AuthenticationState<Data> extends Equatable {
  /// {@macro authentication_status}
  const AuthenticationState._(this.status, this.session);

  /// The user is not authenticated.
  const AuthenticationState.unauthenticated()
      : this._(AuthenticationStatus.unauthenticated, null);

  /// The user is authenticated.
  const AuthenticationState.authenticated(AuthenticationSession<Data> session)
      : this._(
          AuthenticationStatus.authenticated,
          session,
        );

  /// The user's authentication status is unknown.
  const AuthenticationState.unknown()
      : this._(AuthenticationStatus.unknown, null);

  /// The status of the authentication cubit.
  final AuthenticationStatus status;

  /// The session of the authentication cubit.
  final AuthenticationSession<Data>? session;

  @override
  List<Object?> get props => [status, session];

  @override
  bool? get stringify => true;
}
