import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:krow/core/application/di/injectable.dart';
import 'package:krow/core/sevices/auth_state_service/auth_service.dart';
import 'package:krow/features/profile/profile_settings/domain/bloc/profile_settings_event.dart';
import 'package:krow/features/profile/profile_settings/domain/bloc/profile_settings_state.dart';

class ProfileSettingsBloc
    extends Bloc<ProfileSettingsEvent, ProfileSettingsState> {
  ProfileSettingsBloc() : super(const ProfileSettingsState()) {
    on<ProfileSettingsRemoveAccEvent>((event, emit) async {
      await getIt<AuthService>().deleteAccount();

      emit(state.copyWith(isAccRemoved: true));
    });
  }
}
