/* eslint-disable @typescript-eslint/no-explicit-any */
import { FC, memo } from "react"
import { useSelector } from "react-redux"
import ScaleSquare from "@/page/app/components/ScaleSquare"
// import { ModalScaleSquare } from "@/page/app/components/ScaleSquare/modalScaleSquare"
import { getClientWidgetLayoutInfo } from "@/redux/currentApp/layoutInfo/layoutInfoSelector"
import { ComponentParserProps } from "./interface"
// import { WidgetLayoutInfo } from "@/redux/currentApp/layoutInfo/layoutInfoState"

export const ComponentParser: FC<ComponentParserProps> = (props) => {
  const { displayName, unitW, parentNodeDisplayName, columnNumber } = props
  const widgetLayoutInfo:any = useSelector(getClientWidgetLayoutInfo)
  const currentWidgetLayoutInfo = widgetLayoutInfo[displayName]
  // const containerType = currentWidgetLayoutInfo.containerType
  const widgetType = currentWidgetLayoutInfo.widgetType

  // switch (containerType) {
  //   case "EDITOR_SCALE_SQUARE":
  //     if (widgetType === "MODAL_WIDGET") {
  //       return (
  //         <ModalScaleSquare
  //           displayName={displayName}
  //           widgetType={widgetType}
  //           unitW={unitW}
  //           parentNodeDisplayName={parentNodeDisplayName}
  //           columnNumber={columnNumber}
  //         />
  //       )
  //     }

      return (
        <ScaleSquare
          displayName={displayName}
          widgetType={widgetType}
          unitW={unitW}
          parentNodeDisplayName={parentNodeDisplayName}
          columnNumber={columnNumber}
        />
      )

  //   default:
  //     return null
  // }
}

ComponentParser.displayName = "ComponentParser"

export default memo(ComponentParser)
