import { ListAccountsUseCase } from "@/contexts/accounts/application";
import { AccountService } from "@/contexts/accounts/domain";
import { accountRepository } from "@/contexts/accounts/infraestructure";
import { SequelizeTransactionManager } from "@/core/common/infrastructure";
import { ListAccountsController } from "./list-accounts.controller";
import { listAccountsPresenter } from "./list-accounts.presenter";

export const buildListAccountsController = () => {
  const transactionManager = new SequelizeTransactionManager();
  const accountService = new AccountService(accountRepository);

  const useCase = new ListAccountsUseCase(accountService, transactionManager);
  const presenter = listAccountsPresenter;

  return new ListAccountsController(useCase, presenter);
};
