import { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
  const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || 'https://gnxsoft.com';

  return {
    rules: [
      {
        userAgent: '*',
        allow: '/',
        disallow: [
          '/api/',
          '/admin/',
          '/_next/',
          '/private/',
          '/static/',
          '/*.json$',
        ],
      },
      {
        userAgent: 'Googlebot',
        allow: [
          '/',
          '/services',
          '/services/*',
          '/about-us',
          '/contact-us',
          '/career',
          '/career/*',
          '/case-study',
          '/case-study/*',
          '/insights',
          '/insights/*',
          '/support-center',
          '/policy',
        ],
        disallow: [
          '/api/',
          '/admin/',
          '/private/',
          '/_next/',
          '/static/',
        ],
      },
      {
        userAgent: 'Bingbot',
        allow: [
          '/',
          '/services',
          '/services/*',
          '/about-us',
          '/contact-us',
          '/career',
          '/career/*',
          '/case-study',
          '/case-study/*',
          '/insights',
          '/insights/*',
          '/support-center',
          '/policy',
        ],
        disallow: [
          '/api/',
          '/admin/',
          '/private/',
          '/_next/',
          '/static/',
        ],
      },
    ],
    sitemap: `${baseUrl}/sitemap.xml`,
    host: baseUrl,
  };
}

