library staff_time_card;

import 'package:flutter/widgets.dart';
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/time_card_repository_impl.dart';
import 'domain/repositories/time_card_repository.dart';
import 'domain/usecases/get_time_cards_usecase.dart';
import 'presentation/blocs/time_card_bloc.dart';
import 'presentation/pages/time_card_page.dart';

export 'presentation/pages/time_card_page.dart';

/// Module for the Staff Time Card feature.
///
/// This module configures dependency injection for accessing time card data,
/// including the repositories, use cases, and BLoCs.
class StaffTimeCardModule extends Module {
  @override
  List<Module> get imports => <Module>[DataConnectModule()];

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

    // UseCases
    i.add<GetTimeCardsUseCase>(GetTimeCardsUseCase.new);

    // Blocs
    i.add<TimeCardBloc>(TimeCardBloc.new);
  }

  @override
  void routes(RouteManager r) {
    r.child(
      StaffPaths.childRoute(StaffPaths.timeCard, StaffPaths.timeCard),
      child: (BuildContext context) => const TimeCardPage(),
    );
  }
}
