import { ThunderboltOutlined } from '@ant-design/icons'

interface GeneratedMessagesProps {
  messages: string[]
  compact?: boolean
}

/**
 * Renders the "AI generated test messages" block used by dynamic cases.
 * Shared between CaseBlock and CaseDetail; both used to duplicate this.
 */
export default function GeneratedMessages({ messages, compact = false }: GeneratedMessagesProps) {
  if (!messages || messages.length === 0) return null

  return (
    <div style={{ marginBottom: compact ? 10 : 12 }}>
      <div style={{ fontSize: compact ? 11 : 12, color: '#d46b08', fontWeight: 500, marginBottom: 4 }}>
        <ThunderboltOutlined /> AI 生成的测试问题
      </div>
      {messages.map((m, i) => (
        <div
          key={i}
          style={{
            background: '#fff7e6',
            border: '1px solid #ffd591',
            borderRadius: 5,
            padding: '4px 8px',
            marginBottom: 3,
            fontSize: 12,
          }}
        >
          {i + 1}. {m}
        </div>
      ))}
    </div>
  )
}
