import React from 'react';
import { Tag, Tooltip } from 'antd';
// Last 72 Hr tag is hidden for now (re-enable together with the block below): ClockCircleOutlined
import { FireFilled, SwapOutlined } from '@ant-design/icons';

interface LeadTagBadgesProps {
  /** Created in the last 72 hours (is_last_72_hr from GET /leads; worked out from lead_detail.created_at). */
  isLast72Hr?: boolean;
  /** Carries the Cross tag (is_cross_tagged from GET /leads). */
  isCross?: boolean;
  /** Carries the Super Hot tag (its id is in the lead's stored tag). */
  isSuperHot?: boolean;
  /** Display names from lead_tags, so a rename there shows up here. */
  labels: { last72Hr?: string; cross?: string; superHot?: string };
}

// Same small pill as the "Transferred" indicator beside the customer name, in a colour each of its own.
const pill: React.CSSProperties = { fontSize: 10, lineHeight: '16px', padding: '0 5px', margin: 0, fontWeight: 600, whiteSpace: 'nowrap' };

/**
 * The tags of a lead row in Enquiries: Last 72 Hr (green, clock), Cross (purple, swap) and Super Hot (red, flame).
 * Shown beside the customer name. Each is shown only when it applies, and a lead with none shows nothing. They wrap
 * onto a second line instead of widening the column, so a lead carrying all three stays readable.
 */
// Last 72 Hr is hidden for now, so isLast72Hr / labels.last72Hr are accepted but not shown.
const LeadTagBadges: React.FC<LeadTagBadgesProps> = ({ isCross, isSuperHot, labels }) => {
  // if (!isLast72Hr && !isCross && !isSuperHot) return null;
  if (!isCross && !isSuperHot) return null;
  return (
    <div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 4 }}>
      {/* Last 72 Hr tag hidden for now
      {isLast72Hr && (
        <Tooltip title="Created in the last 72 hours">
          <Tag color="green" icon={<ClockCircleOutlined />} style={pill}>{labels.last72Hr || 'Last 72 Hr'}</Tag>
        </Tooltip>
      )} */}
      {isCross && (
        <Tooltip title="Cross lead">
          <Tag color="purple" icon={<SwapOutlined />} style={pill}>{labels.cross || 'Cross'}</Tag>
        </Tooltip>
      )}
      {isSuperHot && (
        <Tooltip title="Super Hot lead">
          <Tag color="red" icon={<FireFilled />} style={pill}>{labels.superHot || 'Super Hot'}</Tag>
        </Tooltip>
      )}
    </div>
  );
};

export default LeadTagBadges;
