// 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/>.

import 'dart:async';

import 'package:wyatt_architecture/wyatt_architecture.dart';
import 'package:wyatt_authentication_bloc/src/core/constants/form_field.dart';
import 'package:wyatt_authentication_bloc/src/core/constants/form_name.dart';
import 'package:wyatt_authentication_bloc/src/domain/entities/account.dart';
import 'package:wyatt_authentication_bloc/src/domain/repositories/authentication_repository.dart';
import 'package:wyatt_authentication_bloc/src/features/edit_account/edit_account.dart';
import 'package:wyatt_form_bloc/wyatt_form_bloc.dart';
import 'package:wyatt_type_utils/wyatt_type_utils.dart';

part 'base_edit_account_cubit.dart';
part 'edit_account_state.dart';

/// {@template edit_account_cubit}
/// Fully featured edit account cubit.
///
/// Sufficient in most cases. (Where fine granularity is not required.)
/// {@endtemplate}
class EditAccountCubit<Data> extends BaseEditAccountCubit<Data>
    with UpdateEmail<Data>, UpdatePassword<Data> {
  /// {@macro edit_account_cubit}
  EditAccountCubit({required super.authenticationRepository});

  @override
  FutureOrResult<Data?> onEmailUpdated(
    Result<Account, AppException> result,
    WyattForm form,
  ) =>
      const Ok(null);

  @override
  FutureOrResult<Data?> onPasswordUpdated(
    Result<Account, AppException> result,
    WyattForm form,
  ) =>
      const Ok(null);
}
