import { CustomerInvoiceService } from "@/contexts/customer-billing/domain";
import { customerInvoiceRepository } from "@/contexts/customer-billing/infraestructure";
import { SequelizeTransactionManager } from "@/core/common/infrastructure";
import { ListCustomerInvoicesUseCase } from "../../../../application";
import { ListCustomerInvoicesController } from "./list-customer-invoices.controller";
import { listCustomerInvoicesPresenter } from "./list-customer-invoices.presenter";

export const listCustomerInvoicesController = () => {
  const transactionManager = new SequelizeTransactionManager();
  const customerInvoiceService = new CustomerInvoiceService(customerInvoiceRepository);

  const useCase = new ListCustomerInvoicesUseCase(customerInvoiceService, transactionManager);
  const presenter = listCustomerInvoicesPresenter;

  return new ListCustomerInvoicesController(useCase, presenter);
};
