"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TaskActionButtons = void 0;
var react_1 = __importDefault(require("react"));
var ramda_1 = require("ramda");
var Button_1 = __importDefault(require("@mui/material/Button"));
var useWorkflowActions_1 = require("../hooks/useWorkflowActions");
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 = (0, useWorkflowActions_1.useWorkflowActions)({
        task: {
            taskId: taskId,
            possibleActions: possibleActions,
            assignee: assignee,
            isOpen: isOpen
        }
    }), actions = _b.actions, disabled = _b.actionRequestIsInProgress;
    var _c = (0, ramda_1.partition)((0, ramda_1.propEq)('text', preferredAction === null || preferredAction === void 0 ? void 0 : preferredAction.label), actions), preferredActions = _c[0], otherActions = _c[1];
    return (react_1.default.createElement(react_1.default.Fragment, null,
        otherActions.map(function (action) { return (react_1.default.createElement(Button_1.default, { variant: "outlined", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); }),
        preferredActions.map(function (action) { return (react_1.default.createElement(Button_1.default, { variant: "contained", color: "primary", onClick: action.onClick, key: action.text, disabled: disabled }, action.text)); })));
};
exports.TaskActionButtons = TaskActionButtons;
