import { MetadataRoute } from 'next';
import { config } from '@/lib/config';

export default function robots(): MetadataRoute.Robots {
    const baseUrl = process.env.NEXT_PUBLIC_DOMAIN || config.domain;
    const protocol = process.env.NODE_ENV === 'production' ? 'https' : 'http';
    const siteUrl = `${protocol}://${baseUrl}`;

    return {
        rules: [
            {
                userAgent: '*',
                allow: '/',
                disallow: ['/admin/', '/api/'],
            },
        ],
        sitemap: `${siteUrl}/sitemap.xml`,
    };
}

