import type { MetadataRoute } from "next"

export default function robots(): MetadataRoute.Robots {
  const base = process.env.NEXT_PUBLIC_APP_URL ?? "https://propertymanagement.network"

  return {
    rules: {
      userAgent: "*",
      allow: "/",
      // Private/app areas. Mirrors PROTECTED_PATHS in proxy.ts, plus the API
      // surface and the token-gated tenant portal (both private but enforced
      // outside the cookie proxy). `/tenant-portal/` keeps the trailing slash so
      // it doesn't also block the indexable `/tenant-portal-info` marketing page.
      disallow: [
        "/dashboard",
        "/admin",
        "/api/",
        "/settings",
        "/onboarding",
        "/team",
        "/tenant-portal/",
        "/calendar",
        "/inspections",
        "/vendors",
        "/reports",
        "/activity",
        "/ai",
        "/ai-dashboard",
        "/predictions",
        "/recommendations",
        "/impact",
        "/follow-ups",
        "/properties",
        "/tenants",
        "/rent",
        "/maintenance",
        "/leases",
        "/expenses",
      ],
    },
    sitemap: `${base}/sitemap.xml`,
    host: base,
  }
}
