import ProductNavbarClient from "@/components/products/ProductNavbarClient";
import type { Product, ProductPageCopy } from "@/data/products.data";
import { getProductLinks } from "@/data/products.data";
import { locales, type Locale } from "@/lib/locales";
import { replaceLocale } from "@/lib/routes";

export default function ProductNavbar({
  bookDemoLabel,
  copy,
  currentPath,
  locale,
  product,
}: {
  bookDemoLabel: string;
  copy: ProductPageCopy;
  currentPath?: string;
  locale: Locale;
  product: Product;
}) {
  const links = getProductLinks(locale, product);
  const localePaths = Object.fromEntries(
    locales.map((supportedLocale) => [
      supportedLocale,
      replaceLocale(currentPath ?? links.productHome, supportedLocale),
    ]),
  ) as Record<Locale, string>;
  return (
    <ProductNavbarClient
      bookDemoLabel={bookDemoLabel}
      copy={copy}
      links={links}
      locale={locale}
      localePaths={localePaths}
      productName={product.name}
      productSlug={product.slug}
      tone={product.tone}
    />
  );
}
