import type { MetadataRoute } from "next";
import { getBaseUrlForSeo } from "@/lib/utils/public-url";

/**
 * Static routes included in the sitemap.
 * Only public, indexable routes are listed (matches robots.txt Allow rules).
 * Admin, auth, dashboard, onboard, wishlists, and agents/chat are blocked in robots.txt.
 */
const STATIC_ROUTES: { path: string; priority: number; changeFrequency: "always" | "hourly" | "daily" | "weekly" | "monthly" | "yearly" | "never" }[] = [
  { path: "/", priority: 1, changeFrequency: "daily" },
  { path: "/help", priority: 0.8, changeFrequency: "weekly" },
  { path: "/tech-stack", priority: 0.8, changeFrequency: "weekly" },
  { path: "/overview", priority: 0.8, changeFrequency: "weekly" },
  { path: "/contact", priority: 0.8, changeFrequency: "monthly" },
  { path: "/partners", priority: 0.7, changeFrequency: "weekly" },
  { path: "/retail", priority: 0.7, changeFrequency: "weekly" },
  { path: "/insurance", priority: 0.7, changeFrequency: "weekly" },
  { path: "/isv", priority: 0.7, changeFrequency: "weekly" },
  { path: "/banking", priority: 0.7, changeFrequency: "weekly" },
  { path: "/banking/about", priority: 0.6, changeFrequency: "monthly" },
  { path: "/ai-catalyst", priority: 0.8, changeFrequency: "weekly" },
  { path: "/ai-sales-engineer", priority: 0.8, changeFrequency: "weekly" },
  { path: "/ai-sales-engineer/prototype", priority: 0.6, changeFrequency: "weekly" },
  { path: "/models", priority: 0.9, changeFrequency: "daily" },
  { path: "/agents", priority: 0.9, changeFrequency: "daily" },
  { path: "/gtm/host", priority: 0.5, changeFrequency: "monthly" },
];

export default function sitemap(): MetadataRoute.Sitemap {
  const base = getBaseUrlForSeo();
  const now = new Date();

  return STATIC_ROUTES.map(({ path, priority, changeFrequency }) => ({
    url: `${base}${path}`,
    lastModified: now,
    changeFrequency,
    priority,
  }));
}
