import { getDictionary } from "../../../utils/getDictionary";
import Global from "../../../components/Global";
import ContactoPage from "../../../components/pages/ContactoPage";

type PageProps = {
  readonly params: Promise<{ lang: string | string[] | undefined }>;
};

export default async function Page({ params }: PageProps) {
  const resolvedParams = await params;
  const rawLang = resolvedParams.lang;
  const lang = Array.isArray(rawLang) ? rawLang[0] : rawLang;
  const safeLang = lang === "es" || lang === "en" ? lang : "es";

  const dict = await getDictionary(safeLang);
  const contactoSection = (dict as any)["contacto-section"] ?? dict;
  return <ContactoPage dict={ {
    title: contactoSection.title,
    description: contactoSection.description,
    form: contactoSection.form,
    locations: contactoSection.locations
  } } />;
}
