import { GetQuoteUseCase } from "@/contexts/sales/application";
import { NextFunction, Request, Response } from "express";
import { registerQuoteRepository } from "../../../../Quote.repository";
import { ISalesContext } from "../../../../Sales.context";
import { ReportQuotePresenter } from "./reporter/ReportQuote.reporter";
import { ReportQuoteController } from "./ReportQuote.controller";

export const reportQuoteController = (req: Request, res: Response, next: NextFunction) => {
  const context: ISalesContext = res.locals.context;

  registerQuoteRepository(context);

  return new ReportQuoteController(
    {
      useCase: new GetQuoteUseCase(context),
      reporter: ReportQuotePresenter,
    },
    context
  ).execute(req, res, next);
};
