import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_core/core.dart';
import 'package:krow_data_connect/krow_data_connect.dart';
import 'src/data/repositories_impl/settings_repository_impl.dart';
import 'src/domain/repositories/settings_repository_interface.dart';
import 'src/domain/usecases/sign_out_usecase.dart';
import 'src/presentation/blocs/client_settings_bloc.dart';
import 'src/presentation/pages/client_settings_page.dart';

/// A [Module] for the client settings feature.
class ClientSettingsModule extends Module {
  @override
  List<Module> get imports => <Module>[DataConnectModule()];

  @override
  void binds(Injector i) {
    // Repositories
    i.addLazySingleton<SettingsRepositoryInterface>(SettingsRepositoryImpl.new);

    // UseCases
    i.addLazySingleton(SignOutUseCase.new);

    // BLoCs
    i.add<ClientSettingsBloc>(ClientSettingsBloc.new);
  }

  @override
  void routes(RouteManager r) {
    r.child(
      ClientPaths.childRoute(ClientPaths.settings, ClientPaths.settings),
      child: (_) => const ClientSettingsPage(),
    );
  }
}
