import React from 'react';

type Status = 'pending' | 'running' | 'complete' | 'error';

interface JobStatusProps {
  status: Status;
  label?: string;
}

const STATUS_CONFIG: Record<Status, { dot: string; badge: string; text: string }> = {
  pending: { dot: 'status-dot-pending', badge: 'badge-warning', text: 'Pending' },
  running: { dot: 'status-dot-running', badge: 'badge-success', text: 'Running' },
  complete: { dot: 'status-dot-complete', badge: 'badge-info', text: 'Complete' },
  error: { dot: 'status-dot-error', badge: 'badge-danger', text: 'Error' },
};

export function JobStatus({ status, label }: JobStatusProps) {
  const config = STATUS_CONFIG[status] || STATUS_CONFIG.pending;

  return (
    <span className={`badge ${config.badge} gap-1.5`}>
      <span className={`status-dot ${config.dot}`} />
      {label || config.text}
    </span>
  );
}
