'use client';
import { Chip } from '@heroui/react';

const STATE_STYLES: Record<string, string> = {
    PENDING: 'bg-gray-400 text-gray-900',
    RUNNING: 'bg-blue-500 text-white animate-pulse',
    COMPLETED: 'bg-green-500 text-white',
    FAILED: 'bg-red-500 text-white',
};

const STATE_LABELS: Record<string, string> = {
    PENDING: 'Pending',
    RUNNING: 'Running',
    COMPLETED: 'Completed',
    FAILED: 'Failed',
};

export default function WorkerStateChip({ state }: { state: string }) {
    return (
        <Chip
            className={`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${STATE_STYLES[state] || 'bg-gray-200'}`}
            title={state}
        >
            {STATE_LABELS[state] || state}
        </Chip>
    );
}
