import { WidgetConfigs } from "./interface";
import { ButtonWidget } from "./ButtonWidget";
import { BUTTON_WIDGET_CONFIG } from "./ButtonWidget";

import {
  // CONTAINER_EVENT_HANDLER_CONFIG,
  CONTAINER_PANEL_CONFIG,
  CONTAINER_WIDGET_CONFIG,
} from "./ContainerWidget";
import { lazy } from "react";
import { GridCONTAINER_WIDGET_CONFIG } from "./GridContainer/WidgetConfig";
import { GridCONTAINER_PANEL_CONFIG } from "./GridContainer/panelConfig";
import { GridCONTAINER_EVENT_HANDLER_CONFIG } from "./GridContainer/eventHandlerConfig";

import { BUTTON_PANEL_CONFIG } from "./ButtonWidget/panelConfig";

import {
  INPUT_WIDGET_CONFIG,
  INPUT_PANEL_CONFIG,
  InputWidget,
} from "./InputWidget";
import { CHECKBOX_WIDGET_CONFIG,CHECKBOX_PANEL_CONFIG, CheckboxContainer } from "./CheckBoxContainer";
import { TEXT_AREA_WIDGET_CONFIG, TextArea,TEXT_AREA_PANEL_CONFIG } from "./TextAreaContainer";
import { EmptyBox, EMPTY_BOX_CONFIG ,EMPTY_BOX_PANEL_CONFIG} from "./EmptyBoxWidget";

// eslint-disable-next-line react-refresh/only-export-components
export const WidgetConfig: WidgetConfigs = {
  BUTTON_WIDGET: {
    widget: ButtonWidget,
    config: BUTTON_WIDGET_CONFIG,
    panelConfig: BUTTON_PANEL_CONFIG,
    // eventHandlerConfig: TEXT_EVENT_HANDLER_CONFIG,
  },
  // TEXT_WIDGET: {
  //   widget: TextWidget,
  //   config: TEXT_WIDGET_CONFIG,
  //   // panelConfig: TEXT_PANEL_CONFIG,
  //   // eventHandlerConfig: TEXT_EVENT_HANDLER_CONFIG,
  // },
  INPUT_WIDGET: {
    widget: InputWidget,
    config: INPUT_WIDGET_CONFIG,
    panelConfig: INPUT_PANEL_CONFIG,
  },
  //container
  CONTAINER_WIDGET: {
    config: CONTAINER_WIDGET_CONFIG,
    panelConfig: CONTAINER_PANEL_CONFIG,
    // eventHandlerConfig: CONTAINER_EVENT_HANDLER_CONFIG,
    widget: lazy(() => import("@/widgetLibrary/ContainerWidget/container")),
  },
  GridCONTAINER_WIDGET: {
    config: GridCONTAINER_WIDGET_CONFIG,
    panelConfig: GridCONTAINER_PANEL_CONFIG,
    eventHandlerConfig: GridCONTAINER_EVENT_HANDLER_CONFIG,
    widget: lazy(() => import("@/widgetLibrary/GridContainer/GridContainer")),
  },
  CHECKBOX_WIDGET: {
    config: CHECKBOX_WIDGET_CONFIG,
    widget: CheckboxContainer,
    panelConfig:CHECKBOX_PANEL_CONFIG,
  },

  TEXT_AREA_WIDGET: {
    config: TEXT_AREA_WIDGET_CONFIG,
    widget: TextArea,
    panelConfig:TEXT_AREA_PANEL_CONFIG,
  },

  EMPTY_BOX: {
    config: EMPTY_BOX_CONFIG,
    widget: EmptyBox,
    panelConfig:EMPTY_BOX_PANEL_CONFIG,
  },
};
export type WidgetType = keyof typeof WidgetConfig;
export const WidgetTypeList = Object.keys(WidgetConfig);
export const widgetBuilder = (type: WidgetType) => {
  return WidgetConfig[type];
};
