import { RefreshTokenUseCase } from "@/contexts/auth/application";
import { authenticatedUserRepository, tabContextRepository } from "@/contexts/auth/infraestructure";
import { SequelizeTransactionManager } from "@/core/common/infrastructure";
import { AuthService } from "../../domain/services";
import { RefreshTokenController } from "./refresh-token.controller";
import { refreshTokenPresenter } from "./refresh-token.presenter";

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

  const useCase = new RefreshTokenUseCase(authService, transactionManager);
  const presenter = refreshTokenPresenter;

  return new RefreshTokenController(useCase, presenter);
};
