import type { AssetType, AvailabilityStatus, ResultType } from '../../domain/enums'
import { RESULT_TYPE_META } from '../../lib/ds'
import { dataQualityColor } from '../../lib/utils'

export function getAssetTypeLabel(type: AssetType): string {
  const labels: Record<string, string> = {
    OFFICE: 'Büro',
    LOGISTICS: 'Logistik',
    RETAIL: 'Retail',
    GASTRO: 'Gastro',
    PRODUCTION: 'Produktion',
    MIXED: 'Gemischt',
    LIGHT_INDUSTRIAL: 'Gewerbe',
    UNKNOWN: 'Unbekannt',
  }
  return labels[type] ?? type
}

export function getAssetTypeColor(type: AssetType): string {
  const colors: Record<string, string> = {
    OFFICE: '#152642',
    LOGISTICS: '#d97706',
    RETAIL: '#7c3aed',
    GASTRO: '#0d9488',
    PRODUCTION: '#92400e',
    MIXED: '#6b7280',
    LIGHT_INDUSTRIAL: '#b45309',
    UNKNOWN: '#9ca3af',
  }
  return colors[type] ?? '#6b7280'
}

export function getAvailabilityLabel(status: AvailabilityStatus): string {
  const labels: Record<string, string> = {
    AVAILABLE_NOW: 'Verfügbar',
    AVAILABLE_SOON: 'Bald verfügbar',
    FUTURE_SIGNAL: 'Zukunftssignal',
    OCCUPIED: 'Belegt',
    UNKNOWN: 'Unbekannt',
  }
  return labels[status] ?? status
}

export function getAvailabilityChipColor(status: AvailabilityStatus): 'success' | 'warning' | 'secondary' | 'error' | 'default' {
  const colors: Record<string, 'success' | 'warning' | 'secondary' | 'error' | 'default'> = {
    AVAILABLE_NOW: 'success',
    AVAILABLE_SOON: 'warning',
    FUTURE_SIGNAL: 'secondary',
    OCCUPIED: 'error',
    UNKNOWN: 'default',
  }
  return colors[status] ?? 'default'
}

export function getResultTypeLabel(type: ResultType): string {
  return RESULT_TYPE_META[type]?.label ?? type
}

export function getResultTypeColor(type: ResultType): string {
  return RESULT_TYPE_META[type]?.color ?? '#6b7280'
}

export const qualityColor = dataQualityColor
