import Link from "next/link";
import { LOCATIONS, SITE, type Lang } from "@/lib/config";

export const revalidate = SITE.revalidateSeconds;

export default function LocationsIndex({ params }: { params: { lang: Lang } }) {
  const { lang } = params;
  return (
    <main className="max-w-6xl mx-auto px-4 py-16">
      <h1 className="text-3xl font-bold">
        {lang === "ar" ? "المناطق" : "Locations"}
      </h1>
      <div className="grid sm:grid-cols-2 md:grid-cols-3 gap-6 mt-6">
        {Object.values(LOCATIONS).map((loc) => (
          <Link
            key={loc.slug.en}
            href={`/${lang}/locations/${loc.slug[lang]}`}
            className="border rounded-xl p-6 hover:border-brand-green transition"
          >
            <h3 className="text-xl font-semibold">{loc.name[lang]}</h3>
          </Link>
        ))}
      </div>
    </main>
  );
}
