import type { AssetType } from '../../domain/enums'

export function assetTypeLabel(at: AssetType): string {
  const map: Record<string, string> = {
    OFFICE: 'Büro',
    RETAIL: 'Retail',
    LOGISTICS: 'Logistik',
    LIGHT_INDUSTRIAL: 'Gewerbe',
    PRODUCTION: 'Produktion',
    GASTRO: 'Gastro',
    MIXED: 'Mischnutzung',
    UNKNOWN: 'Unbekannt',
  }
  return map[at] ?? 'Fläche'
}

export function latentStatusBadge(status: 'public' | 'paused' | 'expired'): {
  label: string
  bg: string
  fg: string
} {
  if (status === 'public') return { label: 'Öffentlich', bg: '#dcfce7', fg: '#166534' }
  if (status === 'paused') return { label: 'Pausiert', bg: '#fed7aa', fg: '#9a3412' }
  return { label: 'Abgelaufen', bg: '#e8e7e4', fg: '#475569' }
}

// Deterministic pseudo-random match score from string IDs (range 60–96)
export function deterministicMatchScore(propertyId: string, needId: string): number {
  const seed = `${propertyId}::${needId}`
  let h = 0
  for (let i = 0; i < seed.length; i++) {
    h = (h * 31 + seed.charCodeAt(i)) >>> 0
  }
  return 60 + (h % 37)
}
