export default function LicenseStatus({ site }) {
  const now = new Date()
  const expires = new Date(site.license_expires_at)
  const lastSeen = site.last_seen_at ? new Date(site.last_seen_at) : null
  const hoursAgo = lastSeen ? (now - lastSeen) / 1000 / 3600 : null

  if (site.is_locked) {
    return <span className="inline-flex items-center gap-1.5 text-xs font-medium text-red-400"><span className="w-2 h-2 rounded-full bg-red-500" />Locked</span>
  }
  if (expires < now) {
    return <span className="inline-flex items-center gap-1.5 text-xs font-medium text-red-400"><span className="w-2 h-2 rounded-full bg-red-500" />Expired</span>
  }
  if (hoursAgo === null || hoursAgo > 12) {
    return <span className="inline-flex items-center gap-1.5 text-xs font-medium text-yellow-400"><span className="w-2 h-2 rounded-full bg-yellow-400" />No Heartbeat</span>
  }
  return <span className="inline-flex items-center gap-1.5 text-xs font-medium text-emerald-400"><span className="w-2 h-2 rounded-full bg-emerald-400" />Active</span>
}
