// 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 'email_verification_cubit.dart';

/// {@template email_verification_state}
/// The state of the [EmailVerificationCubit].
/// {@endtemplate}
class EmailVerificationState extends Equatable {
  /// {@macro email_verification_state}
  const EmailVerificationState({
    this.isVerified = false,
    this.status = FormStatus.pure,
    this.errorMessage,
  });

  /// The status of the form.
  final FormStatus status;

  /// Whether the email is verified.
  final bool isVerified;

  /// The error message if any.
  final String? errorMessage;

  EmailVerificationState copyWith({
    FormStatus? status,
    bool? isVerified,
    String? errorMessage,
  }) =>
      EmailVerificationState(
        status: status ?? this.status,
        isVerified: isVerified ?? this.isVerified,
        errorMessage: errorMessage ?? this.errorMessage,
      );

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

  @override
  String toString() => 'EmailVerificationState(status: ${status.name} '
      '${(errorMessage != null) ? " [$errorMessage]" : ""}, '
      'isVerified: $isVerified)';
}
