import { jobs, site } from "../data/site";

const paths = [
  "/",
  "/das-unternehmen/",
  "/leistungen/",
  "/referenzen/",
  "/downloads/",
  "/jobs/",
  "/kontakt/",
  "/velux/",
  "/datenverarbeitung-velux/",
  "/impressum/",
  "/datenschutzerklaerung/",
  "/jobs-dachdeckermeister/",
  "/60-jahre-heinz-heidrich-gmbh/",
  "/niklas/",
  ...jobs.map((job) => `/job/${job.slug}/`),
];

export function GET() {
  const body = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${paths
  .map(
    (path) => `  <url>
    <loc>${site.url}${path}</loc>
    <changefreq>monthly</changefreq>
    <priority>${path === "/" ? "1.0" : "0.8"}</priority>
  </url>`,
  )
  .join("\n")}
</urlset>`;

  return new Response(body, {
    headers: { "Content-Type": "application/xml; charset=utf-8" },
  });
}
