import { setRequestLocale } from 'next-intl/server';
import type { Metadata } from 'next';
import LoginForm from '@/components/auth/LoginForm';

type Props = {
  params: Promise<{ locale: string }>;
};

export async function generateMetadata({ params }: Props): Promise<Metadata> {
  const { locale } = await params;

  const titles: Record<string, string> = {
    de: 'Login | Damjan Savić',
    en: 'Login | Damjan Savić',
    sr: 'Prijava | Damjan Savić',
  };

  return {
    title: titles[locale] || titles.de,
    robots: {
      index: false,
      follow: false,
      googleBot: {
        index: false,
        follow: false,
      },
    },
  };
}

export default async function LoginPage({ params }: Props) {
  const { locale } = await params;
  setRequestLocale(locale);

  return <LoginForm />;
}
