import type { MetadataRoute } from 'next';

const siteUrl = process.env['NEXT_PUBLIC_SITE_URL'] || 'https://goodgo.vn';

export default function robots(): MetadataRoute.Robots {
  return {
    rules: [
      {
        userAgent: '*',
        allow: '/',
        disallow: [
          '/dashboard/',
          '/admin/',
          '/auth/',
          '/api/',
          '/*?sort=',      // avoid indexing duplicate sort-order pages
          '/*?page=',      // avoid indexing deep pagination pages
        ],
      },
      {
        userAgent: 'GPTBot',
        disallow: ['/'],    // block AI crawlers if desired
      },
    ],
    sitemap: `${siteUrl}/sitemap.xml`,
    host: siteUrl,
  };
}
