import { DeleteDealerUseCase } from "@/contexts/sales/application";
import { registerDealerRepository } from "../../../../Dealer.repository";
import { ISalesContext } from "../../../../Sales.context";
import { DeleteDealerController } from "./DeleteDealer.controller";

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

  registerDealerRepository(context);
  return new DeleteDealerController(
    {
      useCase: new DeleteDealerUseCase(context),
    },
    context
  ).execute(req, res, next);
};
