export const CREDIBILITY_LABELS: Record<string, string> = {
  HIGH:   'Hohe Quellenqualität',
  MEDIUM: 'Mittlere Quellenqualität',
  LOW:    'Niedrige Quellenqualität',
}

export const CRITERION_LABEL: Record<string, string> = {
  area: 'Fläche', location: 'Standort', budget: 'Budget', timing: 'Verfügbarkeit',
  prestige: 'Prestige', accessibility: 'Erreichbarkeit', expansionPotential: 'Expansion',
  flexibility: 'Flexibilität', visibility: 'Sichtbarkeit', footfall: 'Passantenfrequenz',
  talentAccess: 'Talent-Zugang', esg: 'ESG / Nachhaltigkeit', taxEnvironment: 'Steuerumfeld',
}

export const HARD_KEYS = new Set(['area', 'location', 'budget', 'timing'])

export function factorLabel(criterion: string): string {
  return CRITERION_LABEL[criterion] ?? criterion
}

// Convert normalised weight to 1-5 importance level relative to other factors in the same set
export function importanceLabel(weight: number, maxWeight: number): { label: string; color: string } {
  const ratio = maxWeight > 0 ? weight / maxWeight : 0
  if (ratio >= 0.85) return { label: 'Entscheidend', color: '#152642' }
  if (ratio >= 0.65) return { label: 'Sehr wichtig', color: '#1d4ed8' }
  if (ratio >= 0.40) return { label: 'Wichtig',      color: '#475569' }
  if (ratio >= 0.20) return { label: 'Wenig wichtig',color: '#94a3b8' }
  return { label: 'Unwichtig', color: '#cbd5e1' }
}
