import { Suspense } from "react"

import { LoadingSpinner } from "@scandic-hotels/design-system/LoadingSpinner"
import { DynamicContentEnum } from "@scandic-hotels/trpc/types/dynamicContent"

import EmployeeBenefitsCallToActions from "@/components/DigitalTeamMemberCard/EmployeeBenefits/CallToActions"

import type { HeaderDynamicContentProps } from "@/types/components/headers/dynamicContent"

export default function HeaderDynamicContent(props: HeaderDynamicContentProps) {
  return (
    <Suspense fallback={<LoadingSpinner />}>
      <HeaderDynamicContentComponent {...props} />
    </Suspense>
  )
}

function HeaderDynamicContentComponent(props: HeaderDynamicContentProps) {
  const { component } = props

  switch (component) {
    case DynamicContentEnum.Headers.components
      .dtmc_employee_benefits_call_to_actions:
      return <EmployeeBenefitsCallToActions />
    default:
      return null
  }
}
