import type { MetadataRoute } from "next";

const BASE_URL = process.env["BETTER_AUTH_URL"] ?? "http://localhost:3000";

export default function robots(): MetadataRoute.Robots {
  return {
    rules: {
      userAgent: "*",
      allow: ["/", "/features", "/pricing", "/about", "/privacy", "/terms", "/contact"],
      // /r/ and /s/ are unlisted share links (recipe/shopping-list) — "unlisted"
      // means reachable by direct link only, not meant to be crawled/indexed.
      // /u/ (public profiles) is deliberately left crawlable.
      disallow: ["/api/", "/admin/", "/recipes", "/explore", "/meal-plan", "/pantry", "/shopping-lists", "/settings", "/collections", "/nutrition", "/r/", "/s/"],
    },
    sitemap: `${BASE_URL}/sitemap.xml`,
  };
}
