'use client';

import { localizedModePath, routeIdFromPathname, type Locale } from '@/lib/localization/config';
import type { ThemePreference } from '@/lib/theme/config';
import Image from 'next/image';
import { usePathname } from 'next/navigation';
import styles from './SiteHeader.module.css';

export function BrandLink({
  locale,
  mode,
  label,
}: {
  locale: Locale;
  mode: ThemePreference;
  label: string;
}) {
  const pathname = usePathname();
  return (
    <a
      className={styles.brand}
      href={localizedModePath('home', locale, mode)}
      aria-label={label}
      aria-current={routeIdFromPathname(pathname) === 'home' ? 'page' : undefined}
    >
      <Image
        src="/rentaldrivego.png"
        alt=""
        width={36}
        height={36}
        className={styles.mark}
        priority
        unoptimized
      />
      <span className={styles.brandName}>RentalDriveGo</span>
    </a>
  );
}
