import { RegisterUseCase } from "@/contexts/auth/application/register";
import { authenticatedUserRepository, tabContextRepository } from "@/contexts/auth/infraestructure";
import { SequelizeTransactionManager } from "@/core/common/infrastructure";
import { AuthService } from "../../domain/services";
import { RegisterController } from "./register.controller";
import { registerPresenter } from "./register.presenter";

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

  const useCase = new RegisterUseCase(authService, transactionManager);
  const presenter = registerPresenter;

  return new RegisterController(useCase, presenter);
};
