import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_data_connect/krow_data_connect.dart';
import 'package:krow_domain/krow_domain.dart';
import 'data/repositories/tax_forms_repository_impl.dart';
import 'domain/repositories/tax_forms_repository.dart';
import 'domain/usecases/get_tax_forms_usecase.dart';
import 'domain/usecases/submit_i9_form_usecase.dart';
import 'domain/usecases/submit_w4_form_usecase.dart';
import 'presentation/blocs/i9/form_i9_cubit.dart';
import 'presentation/blocs/tax_forms/tax_forms_cubit.dart';
import 'presentation/blocs/w4/form_w4_cubit.dart';
import 'presentation/pages/form_i9_page.dart';
import 'presentation/pages/form_w4_page.dart';
import 'presentation/pages/tax_forms_page.dart';

class StaffTaxFormsModule extends Module {
  @override
  void binds(Injector i) {
    i.addLazySingleton<TaxFormsRepository>(
      () => TaxFormsRepositoryImpl(
        firebaseAuth: FirebaseAuth.instance,
        dataConnect: ExampleConnector.instance,
      ),
    );
    
    // Use Cases
    i.addLazySingleton(GetTaxFormsUseCase.new);
    i.addLazySingleton(SubmitI9FormUseCase.new);
    i.addLazySingleton(SubmitW4FormUseCase.new);

    // Blocs
    i.addLazySingleton(TaxFormsCubit.new);
    i.addLazySingleton(FormI9Cubit.new);
    i.addLazySingleton(FormW4Cubit.new);
  }

  @override
  void routes(RouteManager r) {
    r.child('/', child: (_) => const TaxFormsPage());
    r.child(
      '/i9', 
      child: (_) => FormI9Page(form: r.args.data as TaxForm?),
    );
    r.child(
      '/w4', 
      child: (_) => FormW4Page(form: r.args.data as TaxForm?),
    );
  }
}
