import { Suspense } from "react"

import { GiftIcon, SearchIcon } from "@/components/Icons"
import LanguageSwitcher from "@/components/LanguageSwitcher"
import { getIntl } from "@/i18n"

import HeaderLink from "../HeaderLink"

import styles from "./topMenu.module.css"

import type { TopMenuProps } from "@/types/components/header/topMenu"

export default async function TopMenu({
  languageSwitcher,
  topLink,
}: TopMenuProps) {
  const intl = await getIntl()

  return (
    <div className={styles.topMenu}>
      <div className={styles.content}>
        {topLink ? (
          <HeaderLink className={styles.topLink} href={topLink.href}>
            <GiftIcon width={20} height={20} color="burgundy" />
            {topLink.title}
          </HeaderLink>
        ) : null}
        <div className={styles.options}>
          {languageSwitcher}
          <HeaderLink href="#">
            <SearchIcon width={20} height={20} color="burgundy" />
            {intl.formatMessage({ id: "Find booking" })}
          </HeaderLink>
        </div>
      </div>
    </div>
  )
}
