import styles from './VulnerabilityBadge.module.css'

const LABELS = {
  ADDRESS_REUSE:        'Address Reuse',
  CIOH:                 'CIOH',
  DUST:                 'Dust',
  DUST_SPENDING:        'Dust Spend',
  CHANGE_DETECTION:     'Change Detect',
  CONSOLIDATION:        'Consolidation',
  SCRIPT_TYPE_MIXING:   'Script Mixing',
  CLUSTER_MERGE:        'Cluster Merge',
  UTXO_AGE_SPREAD:      'Age Spread',
  EXCHANGE_ORIGIN:      'Exchange Origin',
  TAINTED_UTXO_MERGE:   'Taint Merge',
  BEHAVIORAL_FINGERPRINT: 'Fingerprint',
  DORMANT_UTXOS:        'Dormant UTXOs',
  DIRECT_TAINT:         'Direct Taint',
}

export default function VulnerabilityBadge({ type, severity }) {
  const cls = severity ? severity.toLowerCase() : 'low'
  return (
    <span className={`${styles.badge} ${styles[cls] ?? ''}`}>
      <span className={styles.dot} />
      {LABELS[type] ?? type}
    </span>
  )
}
