import { SequelizeTransactionManager } from "@/core/common/infrastructure";
import { ListContactsUseCase } from "../../../application";
import { ContactService } from "../../../domain";
import { contactRepository } from "../../../infraestructure";
import { ListContactsController } from "./list-contacts.controller";
import { listContactsPresenter } from "./list-contacts.presenter";

export const listContactsController = () => {
  const transactionManager = new SequelizeTransactionManager();
  const contactService = new ContactService(contactRepository);

  const useCase = new ListContactsUseCase(contactService, transactionManager);
  const presenter = listContactsPresenter;

  return new ListContactsController(useCase, presenter);
};
