import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_core/core.dart';
import 'package:krow_data_connect/krow_data_connect.dart';
import 'data/repositories_impl/coverage_repository_impl.dart';
import 'domain/repositories/coverage_repository.dart';
import 'domain/usecases/get_coverage_stats_usecase.dart';
import 'domain/usecases/get_shifts_for_date_usecase.dart';
import 'presentation/blocs/coverage_bloc.dart';
import 'presentation/pages/coverage_page.dart';

/// Modular module for the coverage feature.
class CoverageModule extends Module {
  @override
  List<Module> get imports => <Module>[DataConnectModule()];

  @override
  void binds(Injector i) {
    // Repositories
    i.addSingleton<CoverageRepository>(CoverageRepositoryImpl.new);

    // Use Cases
    i.addSingleton(GetShiftsForDateUseCase.new);
    i.addSingleton(GetCoverageStatsUseCase.new);

    // BLoCs
    i.addSingleton<CoverageBloc>(CoverageBloc.new);
  }

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