import Link from "next/link";
import type { Locale } from "@/types/content";
import { localizedPath } from "@/lib/routing";

type LanguageSwitcherProps = {
  locale: Locale;
  path: string;
};

export function LanguageSwitcher({ locale, path }: LanguageSwitcherProps) {
  const targetLocale: Locale = locale === "en" ? "id" : "en";
  return (
    <Link className="language-switcher" prefetch={false} href={localizedPath(path, targetLocale)} aria-label={`Switch language to ${targetLocale.toUpperCase()}`}>
      {targetLocale.toUpperCase()}
    </Link>
  );
}
