import { GetInvoiceUseCase } from "@contexts/invoices/application";
import { InvoiceService } from "@contexts/invoices/domain";
import { invoiceRepository } from "@contexts/invoices/intrastructure";
import { SequelizeTransactionManager } from "core/common/infrastructure";
import { GetInvoiceController } from "./get-invoice.controller";
import { getInvoicePresenter } from "./presenter";

export const buildGetInvoiceController = () => {
  const transactionManager = new SequelizeTransactionManager();
  const invoiceService = new InvoiceService(invoiceRepository);

  const useCase = new GetInvoiceUseCase(invoiceService, transactionManager);
  const presenter = getInvoicePresenter;

  return new GetInvoiceController(useCase, presenter);
};
