import { LoginUseCase } from "@/contexts/auth/application";
import { authenticatedUserRepository, tabContextRepository } from "@/contexts/auth/infraestructure";
import { SequelizeTransactionManager } from "@/core/common/infrastructure";
import { AuthService } from "../../domain/services";
import { LoginController } from "./login.controller";
import { loginPresenter } from "./login.presenter";

export const buildLoginController = () => {
  const transactionManager = new SequelizeTransactionManager();
  const authService = new AuthService(authenticatedUserRepository, tabContextRepository);

  const useCase = new LoginUseCase(authService, transactionManager);
  const presenter = loginPresenter;

  return new LoginController(useCase, presenter);
};
