import { CreateInvoiceUseCase } from "@contexts/invoices/application/create-invoice.use-case";
import { InvoiceService } from "@contexts/invoices/domain";
import { invoiceRepository } from "@contexts/invoices/intrastructure";
import { SequelizeTransactionManager } from "core/common/infrastructure";
import { CreateInvoiceController } from "./create-invoice.controller";
import { createInvoicePresenter } from "./presenter";

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

  const useCase = new CreateInvoiceUseCase(invoiceService, transactionManager);
  const presenter = createInvoicePresenter;

  return new CreateInvoiceController(useCase, presenter);
};
