import { MetadataRoute } from "next";
import { routing } from "@/i18n/routing";

const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "https://iddaai.com";

const staticPages = [
  "",
  "/home",
  "/about",
  "/analysis",
  "/leagues",
  "/matches",
  "/teams",
  "/predictions",
  "/spor-toto",
  "/coupon-builder",
  "/h2h",
];

export default function sitemap(): MetadataRoute.Sitemap {
  const sitemapEntries: MetadataRoute.Sitemap = [];

  staticPages.forEach((page) => {
    routing.locales.forEach((locale) => {
      sitemapEntries.push({
        url: `${baseUrl}/${locale}${page}`,
        lastModified: new Date(),
        changeFrequency: "daily",
        priority: page === "" || page === "/home" ? 1.0 : 0.8,
      });
    });
  });

  return sitemapEntries;
}
