import { Badge } from '@cameleer/design-system';

interface Props {
  state: string;
}

const config: Record<string, { color: 'success' | 'error' | 'warning' | 'auto'; label: string }> = {
  RUNNING: { color: 'success', label: 'Running' },
  STOPPED: { color: 'error', label: 'Stopped' },
  NOT_FOUND: { color: 'auto', label: 'No Server' },
  ERROR: { color: 'error', label: 'Error' },
};

export function ServerStatusBadge({ state }: Props) {
  const c = config[state] ?? { color: 'auto' as const, label: state };
  return <Badge color={c.color} label={c.label} />;
}
