import { jsx } from "react/jsx-runtime";
import { Spinner } from "@uipath/apollo-wind";
import { useMemo } from "react";
import { CanvasIcon } from "../../utils/icon-registry.js";
function getExecutionStatusColor(status) {
    switch(status){
        case 'NotExecuted':
            return 'var(--color-foreground-de-emp)';
        case 'InProgress':
            return 'var(--color-info-icon)';
        case 'Completed':
            return 'var(--color-success-icon)';
        case 'Paused':
        case 'Warning':
            return 'var(--color-warning-icon)';
        case 'Cancelled':
            return 'var(--color-error-icon)';
        case 'UserCancelled':
            return 'var(--color-info-icon)';
        case 'Failed':
            return 'var(--color-error-icon)';
        case 'Terminated':
            return 'var(--color-error-icon)';
        case 'Canceling':
            return 'var(--color-error-icon)';
        case 'Faulted':
            return 'var(--color-error-icon)';
        case 'Pausing':
            return 'var(--color-warning-icon)';
        case 'Pending':
            return 'var(--color-warning-icon)';
        case 'Resuming':
            return 'var(--color-info-icon)';
        case 'Retrying':
            return 'var(--color-info-icon)';
        case 'Running':
            return 'var(--color-info-icon)';
        case 'Upgrading':
            return 'var(--color-info-icon)';
        default:
            return '';
    }
}
function ExecutionStatusIcon({ status, size = 16 }) {
    return useMemo(()=>{
        const color = getExecutionStatusColor(status);
        switch(status){
            case 'InProgress':
                return /*#__PURE__*/ jsx(Spinner, {
                    size: "sm",
                    style: {
                        backgroundColor: 'transparent',
                        width: size,
                        height: size
                    }
                });
            case 'Completed':
                return /*#__PURE__*/ jsx(CanvasIcon, {
                    icon: "circle-check",
                    size: size,
                    color: color
                });
            case 'Paused':
                return /*#__PURE__*/ jsx(CanvasIcon, {
                    icon: "circle-pause",
                    size: size,
                    color: color
                });
            case 'Warning':
                return /*#__PURE__*/ jsx(CanvasIcon, {
                    icon: "triangle-alert",
                    size: size,
                    color: color
                });
            case 'Failed':
                return /*#__PURE__*/ jsx(CanvasIcon, {
                    icon: "circle-alert",
                    size: size,
                    color: color
                });
            case 'Terminated':
                return /*#__PURE__*/ jsx(CanvasIcon, {
                    icon: "circle-x",
                    size: size,
                    color: color
                });
            case 'Cancelled':
                return /*#__PURE__*/ jsx(CanvasIcon, {
                    icon: "circle-stop",
                    size: size,
                    color: color
                });
            case 'NotExecuted':
                return /*#__PURE__*/ jsx(CanvasIcon, {
                    icon: "circle-dashed",
                    size: size,
                    color: color
                });
            default:
                return null;
        }
    }, [
        status,
        size
    ]);
}
export { ExecutionStatusIcon, getExecutionStatusColor };
