import type { IncomeGroup } from './types'; /** Static mirror of `registry/groups.yaml` regions (World Bank, 7) and income groups (4) used for filters/chips. */ export interface GroupDef { id: string; slug: string; name: string; short: string; } export const WB_REGIONS: readonly GroupDef[] = [ { id: 'NAC', slug: 'north-america', name: 'North America', short: 'N. America' }, { id: 'LCN', slug: 'latin-america-caribbean', name: 'Latin America & Caribbean', short: 'Latin America' }, { id: 'ECS', slug: 'europe-central-asia', name: 'Europe & Central Asia', short: 'Europe & C. Asia' }, { id: 'MEA', slug: 'middle-east-north-africa', name: 'Middle East, North Africa, Afghanistan & Pakistan', short: 'MENA+' }, { id: 'SAS', slug: 'south-asia', name: 'South Asia', short: 'South Asia' }, { id: 'EAS', slug: 'east-asia-pacific', name: 'East Asia & Pacific', short: 'East Asia & Pacific' }, { id: 'SSF', slug: 'sub-saharan-africa', name: 'Sub-Saharan Africa', short: 'Sub-Saharan Africa' }, ]; export const INCOME_GROUPS: readonly (GroupDef & { id: IncomeGroup })[] = [ { id: 'HIC', slug: 'high-income', name: 'High income', short: 'High' }, { id: 'UMC', slug: 'upper-middle-income', name: 'Upper middle income', short: 'Upper middle' }, { id: 'LMC', slug: 'lower-middle-income', name: 'Lower middle income', short: 'Lower middle' }, { id: 'LIC', slug: 'low-income', name: 'Low income', short: 'Low' }, ]; export function regionName(id: string | null | undefined): string | null { if (!id) return null; return WB_REGIONS.find((r) => r.id === id.toUpperCase())?.name ?? null; } export function regionShort(id: string | null | undefined): string | null { if (!id) return null; return WB_REGIONS.find((r) => r.id === id.toUpperCase())?.short ?? null; } export function regionSlug(id: string | null | undefined): string | null { if (!id) return null; return WB_REGIONS.find((r) => r.id === id.toUpperCase())?.slug ?? null; }