import { DeleteInvoiceUseCase } from "@contexts/invoices/application";
import { InvoiceService } from "@contexts/invoices/domain";
import { invoiceRepository } from "@contexts/invoices/intrastructure";
import { SequelizeTransactionManager } from "core/common/infrastructure";
import { DeleteInvoiceController } from "./delete-invoice.controller";

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

  const useCase = new DeleteInvoiceUseCase(invoiceService, transactionManager);

  return new DeleteInvoiceController(useCase);
};
