import type { Metadata } from "next";
import { locales } from "@/i18n/config";
import { getDictionary, getLocale } from "@/i18n/get-dictionary";
import { Footer } from "@/components/layout/footer/footer";
import { Header } from "@/components/layout/header/header";
import { ServiceRequestSection } from "@/features/service-request/request/service-request-section";

export async function generateMetadata(): Promise<Metadata> {
  const { serviceRequest, brand } = await getDictionary();
  return {
    title: `${serviceRequest.metaTitle} | ${brand.name}`,
    alternates: { languages: Object.fromEntries(locales.map((l) => [l, `/${l}/request-service`])) },
  };
}

export default async function RequestServicePage() {
  const [locale, dict] = await Promise.all([getLocale(), getDictionary()]);
  const { selectService, services } = dict.home.contact.form;

  return (
    <>
      {/* Figma highlights "Home" on this page. */}
      <Header locale={locale} nav={dict.nav} activeKey="home" />
      <main>
        <ServiceRequestSection t={dict.serviceRequest} picker={{ selectService, services }} formText={dict.forms} />
      </main>
      {/* Figma: 64px between the form card and the footer (desktop). */}
      <Footer locale={locale} t={dict.footer} brandName={dict.brand.name} className="lg:mt-16" />
    </>
  );
}
