import React from 'react';
import { partition, propEq } from 'ramda';
import Button from '@mui/material/Button';
import { useWorkflowActions } from '../hooks/useWorkflowActions';
export var TaskActionButtons = function (_a) {
    var task = _a.task;
    var taskId = task.taskId, possibleActions = task.possibleActions, assignee = task.assignee, isOpen = task.isOpen, preferredAction = task.preferredAction;
    var _b = useWorkflowActions({
        task: {
            taskId: taskId,
            possibleActions: possibleActions,
            assignee: assignee,
            isOpen: isOpen
        }
    }), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
    var _c = partition(propEq('text', preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
    return (React.createElement(React.Fragment, null,
        otherActions.map(function (action) { return (React.createElement(Button, { variant: "outlined", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); }),
        preferredActions.map(function (action) { return (React.createElement(Button, { variant: "contained", color: "primary", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); })));
};
