import { Badge } from '~/components/ui/badge';
import { titleize } from '~/utils/format';

const toneForStatus = (status?: string) => {
  if (status === 'resolved' || status === 'ignored') return 'success';
  if (status === 'failed' || status === 'cancelled') return 'danger';
  if (status === 'waiting_for_user' || status === 'changes_ready') {
    return 'warning';
  }
  if (status === 'running' || status === 'queued') return 'primary';
  return 'neutral';
};

export const ThreadStatusBadge = ({ status }: { status?: string }) => (
  <Badge label={titleize(status)} tone={toneForStatus(status)} />
);
