import type { MetadataRoute } from "next";
import { marketingPaths } from "@/content/routes";
import { loanCatalog } from "@/content/loan-catalog";
import { assets } from "@/content/assets";
import { home } from "@/content/home";
import { about } from "@/content/about";
export default function sitemap(): MetadataRoute.Sitemap {
  return marketingPaths.map((path) => {
    const loan = loanCatalog.find((item) => `/${item.slug}` === path);
    const images =
      path === "/"
        ? [home.heroImage, ...home.services.map((service) => service.image)]
        : path === "/about"
          ? about.sections.map((section) => section.image)
          : loan
            ? [loan.image]
            : [];
    return {
      url: `https://maxcredit.sg${path}`,
      images: [
        ...new Set(
          images.map((name) => `https://maxcredit.sg${assets[name].src}`),
        ),
      ],
    };
  });
}
