export default function StatusBadge({ status }) {
  const map = {
    // 后端实际使用的状态枚举
    draft:     { text: '草稿',   cls: 'bg-gray-100 text-gray-600 ring-gray-200' },
    published: { text: '已上线', cls: 'bg-emerald-50 text-emerald-700 ring-emerald-200' },
    archived:  { text: '已下线', cls: 'bg-rose-50 text-rose-700 ring-rose-200' },
    testing:   { text: '评测中', cls: 'bg-amber-50 text-amber-700 ring-amber-200' },
    offline:   { text: '已下线', cls: 'bg-rose-50 text-rose-700 ring-rose-200' },
    // 兼容旧字段
    approved:  { text: '正式',   cls: 'bg-emerald-50 text-emerald-700 ring-emerald-200' },
    pending:   { text: '待审核', cls: 'bg-amber-50 text-amber-700 ring-amber-200' },
    rejected:  { text: '已驳回', cls: 'bg-rose-50 text-rose-700 ring-rose-200' },
  }
  const it = map[status] || map.draft
  return (
    <span className={`inline-flex items-center justify-center min-w-[52px] h-5 px-1.5 rounded text-xs font-medium ring-1 ring-inset truncate whitespace-nowrap ${it.cls}`}>
      {it.text}
    </span>
  )
}

export const STATUS_BAR_COLOR = {
  draft:     'bg-gray-300',
  published: 'bg-emerald-400',
  archived:  'bg-rose-400',
  testing:   'bg-amber-400',
  offline:   'bg-rose-400',
  approved:  'bg-emerald-400',
  pending:   'bg-amber-400',
  rejected:  'bg-rose-400',
}
