import { listCategories } from "@lib/data/categories"
import { listCollections } from "@lib/data/collections"
import { Text, clx } from "@medusajs/ui"
import LocalizedClientLink from "@modules/common/components/localized-client-link"
import MedusaCTA from "@modules/layout/components/medusa-cta"
import { DynamicLayoutRenderer } from "@vibentec/renderer"
import {
  LayoutComponentDefinition,
  LayoutContext,
} from "vibentec/component-map"

export default async function VtFooter({
  nodes,
  context,
}: {
  nodes?: LayoutComponentDefinition
  context: LayoutContext
}) {
  const { collections } = await listCollections({
    fields: "*products",
  })
  const productCategories = await listCategories()
  const props = nodes?.config ?? {}

  return (
    <footer className={props?.className ?? ""}>
      {props?.left && (
        <div className={clx("flex h-full", props?.leftClassName)}>
          <DynamicLayoutRenderer nodes={props?.left} context={context} />
        </div>
      )}
      {props?.center && (
        <div className={clx("flex h-full", props?.centerClassName)}>
          <DynamicLayoutRenderer nodes={props?.center} context={context} />
        </div>
      )}
      {props?.right && (
        <div className={clx("flex h-full", props?.rightClassName)}>
          <DynamicLayoutRenderer nodes={props?.right} context={context} />
        </div>
      )}
    </footer>
  )
}
