/** @type {import('next-sitemap').IConfig} */

const siteUrl = "https://getgreen.uz";
const locales = ["uz", "ru"];

module.exports = {
  siteUrl,
  generateRobotsTxt: true,
  changefreq: "daily",
  priority: 0.7,
  exclude: [],

  alternateRefs: locales.map((locale) => ({
    href: `${siteUrl}/${locale}`,
    hreflang: locale === 'uz' ? 'uz_UZ' : 'ru_RU',
  })),

  additionalPaths: async (config) => {
    const paths = ['/about', '/services', '/useful', '/category'];
    const entries = [];

    for (const path of paths) {
      for (const locale of locales) {
        entries.push({
          loc: `${siteUrl}/${locale}${path}`,
          changefreq: 'daily',
          priority: 0.7,
          alternateRefs: locales.map((altLocale) => ({
            href: `${siteUrl}/${altLocale}${path}`,
            hreflang: altLocale === 'uz' ? 'uz_UZ' : 'ru_RU',
          })),
        });
      }
    }

    return entries;
  },
};
