import { GetQuoteUseCase } from "@/contexts/sales/application";
import { NextFunction, Request, Response } from "express";
import { registerQuoteRepository } from "../../../../Quote.repository";
import { ISalesContext } from "../../../../Sales.context";
import { GetQuoteController } from "./GetQuote.controller";
import { GetQuotePresenter } from "./presenter";

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

  registerQuoteRepository(context);

  return new GetQuoteController(
    {
      useCase: new GetQuoteUseCase(context),
      presenter: GetQuotePresenter,
    },
    context
  ).execute(req, res, next);
};
