import { Suspense } from "react"

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

import type { HeaderDynamicContentProps } from "@/types/components/headers/dynamicContent"
import { DynamicContentEnum } from "@/types/enums/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
  }
}
