"use client";

import InquireCta from "@/components/InquireCta";
import { useNavItems } from "@/components/header/nav-items-context";

type Props = {
  className?: string;
  onClick?: () => void;
};

/**
 * The "Contact us" CTA, wired to the header's single segment subscription so it
 * can carry `aria-current="page"` on `/contact-us` — as it did before
 * `InquireCta` was turned back into a Server Component — without opening a
 * second `useSelectedLayoutSegment()` of its own.
 */
export default function HeaderCta({ className, onClick }: Props) {
  const { cta, currentPath } = useNavItems();

  return (
    <InquireCta
      href={cta.href}
      onClick={onClick}
      aria-current={cta.href === currentPath ? "page" : undefined}
      className={className}
    >
      {cta.label}
    </InquireCta>
  );
}
