import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import Typography from '../../Typography';
const StepResultStats = ({ metaData }) => {
    const statusDetails = metaData;
    const groupStatus = [
        {
            name: 'Passed',
            count: statusDetails?.totalPassed,
            color: 'var(--status-approved-text-color)',
        },
        {
            name: 'Failed',
            count: statusDetails?.totalFailed,
            color: 'var(--status-rejected-text-color)',
        },
        {
            name: 'Warning',
            count: statusDetails?.totalWarning,
            color: 'var(--status-warning-text-color)',
        },
        {
            name: 'Skipped',
            count: statusDetails?.totalSkipped,
            color: 'var(--status-skipped-text-color)',
        },
        {
            name: 'Terminated',
            count: statusDetails?.totalTerminated,
            color: 'var(--status-skipped-text-color)',
        },
        {
            name: 'Aborted',
            count: statusDetails?.totalAborted,
            color: 'var(--status-skipped-text-color)',
        },
    ];
    const getLabel = (metaData, count) => {
        if (['_startforloop', 'Iteration'].includes(metaData?.type)) {
            return count > 1 ? 'Iterations' : 'Iteration';
        }
        if (metaData?.type === '_iteration') {
            return count > 1 ? 'Steps' : 'Step';
        }
        return '';
    };
    return (_jsx("div", { className: "step-result-stats", children: groupStatus.map((obj) => obj?.count && obj?.count > 0 ? (_jsx(Typography, { color: obj?.color, fontWeight: "semi-bold", as: "div", children: `${obj?.count}/${statusDetails?.total} ${getLabel(metaData, obj?.count)}  ${obj?.name}` }, obj?.name)) : (_jsx(_Fragment, {}))) }));
};
export default StepResultStats;
//# sourceMappingURL=StepResultStats.js.map