import { locales, type Locale } from "@/lib/i18n";

/**
 * Single source of truth for which locales each STATIC (non-blog, non-docs)
 * route is available in, and whether it is indexable. Blog and docs routes are
 * content-driven and derive their availability from the content itself
 * (see `lib/blog/posts.ts` and `lib/docs/navigation.ts`), so they are NOT
 * listed here.
 *
 * Keys are locale-less paths under `/[lang]` (`""` is the home page). Add a
 * route here once and the metadata builder + sitemap stay in agreement.
 */
export const STATIC_ROUTES: Record<
  string,
  { locales: Locale[]; indexable: boolean }
> = {
  "": { locales: [...locales], indexable: true },
  "/pricing": { locales: [...locales], indexable: true },
  "/services": { locales: [...locales], indexable: true },
  "/services/cms-optimization": { locales: [...locales], indexable: true },
  "/services/seo-code-optimization": { locales: [...locales], indexable: true },
  "/services/wordpress-management": { locales: [...locales], indexable: true },
  "/services/wordpress-seo": { locales: [...locales], indexable: true },
  "/about": { locales: [...locales], indexable: false },
  "/contact": { locales: [...locales], indexable: true },
  "/blog": { locales: [...locales], indexable: true },
  "/privacy": { locales: [...locales], indexable: true },
  "/terms": { locales: [...locales], indexable: true },
};

/** Locales a static route is available in (defaults to every locale). */
export function routeLocales(path: string): Locale[] {
  return STATIC_ROUTES[path]?.locales ?? [...locales];
}

/** Whether a static route is indexable (defaults to true). */
export function routeIndexable(path: string): boolean {
  return STATIC_ROUTES[path]?.indexable ?? true;
}
