library;

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/hub_repository_impl.dart';
import 'src/domain/repositories/hub_repository_interface.dart';
import 'src/domain/usecases/assign_nfc_tag_usecase.dart';
import 'src/domain/usecases/create_hub_usecase.dart';
import 'src/domain/usecases/delete_hub_usecase.dart';
import 'src/domain/usecases/get_hubs_usecase.dart';
import 'src/presentation/blocs/client_hubs_bloc.dart';
import 'src/presentation/pages/client_hubs_page.dart';

export 'src/presentation/pages/client_hubs_page.dart';

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

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

    // UseCases
    i.addLazySingleton(GetHubsUseCase.new);
    i.addLazySingleton(CreateHubUseCase.new);
    i.addLazySingleton(DeleteHubUseCase.new);
    i.addLazySingleton(AssignNfcTagUseCase.new);

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

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