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 { ApplySection } from "@/features/career/apply/apply-section";

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

/** General application ("Join AlReyada Team"), from the Career banner and the "no open roles" page. */
export default async function GeneralApplyPage() {
  const [locale, dict] = await Promise.all([getLocale(), getDictionary()]);

  return (
    <>
      <Header locale={locale} nav={dict.nav} activeKey="career" />
      <main>
        <ApplySection t={dict.apply} formText={dict.forms} backgroundAlt={dict.career.hero.imageAlt} title={dict.apply.titleGeneral} />
      </main>
      {/* Figma: ~40px between the form and the footer (desktop). */}
      <Footer locale={locale} t={dict.footer} brandName={dict.brand.name} className="lg:mt-10" />
    </>
  );
}
