import type { MetadataRoute } from "next";

function getSiteUrl() {
  return process.env.NEXT_PUBLIC_SITE_URL ?? "https://mein-kitaplaner.de";
}

export default function robots(): MetadataRoute.Robots {
  const siteUrl = getSiteUrl();

  return {
    rules: {
      userAgent: "*",
      allow: ["/", "/features/", "/impressum", "/datenschutz"],
      disallow: [
        "/api/",
        "/dashboard/",
        "/invite/",
        "/alert/",
        "/login",
        "/register",
        "/onboarding/",
        "/forbidden",
      ],
    },
    sitemap: `${siteUrl}/sitemap.xml`,
    host: siteUrl,
  };
}
