import type { MetadataRoute } from "next";

function siteUrl() {
  const raw = process.env.NEXTAUTH_URL?.trim() || "http://localhost:3000";
  return raw.replace(/\/$/, "");
}

export default function robots(): MetadataRoute.Robots {
  return {
    rules: {
      userAgent: "*",
      allow: "/",
      disallow: ["/api/", "/dashboard", "/jobs"],
    },
    sitemap: `${siteUrl()}/sitemap.xml`,
  };
}
