import type { MetadataRoute } from "next";

const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://drivehub.in";

export default function robots(): MetadataRoute.Robots {
  return {
    rules: [
      {
        userAgent: "*",
        allow: "/",
        disallow: [
          "/admin/",          // Admin panel — no public indexing
          "/api/",            // Backend API
          "/_next/",          // Next.js internals
          "/wizard",          // Car wizard — not SEO-valuable
          "/notifications",   // User-specific
          "/garage",          // User-specific
          "/wishlist",        // User-specific
        ],
      },
      {
        // Block AI crawlers from scraping entire catalogue
        userAgent: [
          "GPTBot", "ChatGPT-User", "Google-Extended",
          "anthropic-ai", "ClaudeBot", "Applebot-Extended",
        ],
        disallow: "/",
      },
    ],
    sitemap: `${BASE_URL}/sitemap.xml`,
    host: BASE_URL,
  };
}
