import TemplateWidgetFactory from "../Factory/TemplateWidgetFactory";

/* eslint-disable @typescript-eslint/no-explicit-any */
const FactoryRenderer = (props: any) => {
  const standardWidgets =
    TemplateWidgetFactory.getStandardFactory()?.getWidgets();
  const customWidgets = TemplateWidgetFactory.getCustomFactory()?.getWidgets();
  const templateWidgets = TemplateWidgetFactory.getTemplateWidgets();

  const WidgetComponent = customWidgets?.get?.(props.widgetType) ??
    templateWidgets?.get?.(props.widgetType) ??
    standardWidgets?.get?.(props.widgetType) ?? <></>;

  return <WidgetComponent {...props} />;
};
export default FactoryRenderer;
