/* eslint-disable @typescript-eslint/no-explicit-any */
// import { PanelConfig } from "@/page/App/components/InspectPanel/interface"
import { WidgetType, widgetBuilder } from "@/widgetLibrary/widgetBuilder"
import { PanelConfig } from "../interface"
import { BUILD_BASIC_CONTAINER_PANEL_CONFIG } from "@/widgetLibrary/BasicContainer/BasicPanel"
import {BUILD_BASIC_NATIVE_CONTAINER_PANEL_CONFIG} from "@/widgetLibrary/NativeContainer/BasicPanel"
import { ScreenPayload } from "@/redux/config/configState"
import { CssGridPanelConfigBuilder } from "@/widgetLibrary/CSSGrid/panelConfig"
import { FORM_PANEL_CONFIG_BUILDER } from "@/widgetLibrary/FormWidget"




export const panelBuilder = (type: WidgetType, currentScreen: ScreenPayload): PanelConfig[] => {
  if (!type) return null
  if(type == "NATIVECANVAS"){
    return BUILD_BASIC_NATIVE_CONTAINER_PANEL_CONFIG(currentScreen)
  }
  if (type == "CANVAS") {

    return BUILD_BASIC_CONTAINER_PANEL_CONFIG(currentScreen)
  }
  if (type == "GridCONTAINER_WIDGET") {
    return CssGridPanelConfigBuilder(currentScreen)
  } else if (type == "FORM_WIDGET") {
    return FORM_PANEL_CONFIG_BUILDER(currentScreen)
  }
  if (!widgetBuilder(type)) return null

  return widgetBuilder(type).panelConfig
}
