"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AssigneeSelector = void 0;
var react_1 = __importDefault(require("react"));
var ui_i18n_1 = __importDefault(require("ui-i18n"));
var DropDownSelector_1 = require("../../../DropDownSelector");
var useWorkflowAssignee_1 = require("../hooks/useWorkflowAssignee");
var AssigneeSelector = function (_a) {
    var taskId = _a.taskId, assignee = _a.assignee, isTaskOpen = _a.isTaskOpen, label = _a.label, onChange = _a.onChange, _b = _a.showCurrentAssignee, showCurrentAssignee = _b === void 0 ? true : _b;
    var _c = (0, useWorkflowAssignee_1.useWorkflowAssignee)({
        taskId: taskId,
        assignee: assignee,
        showCurrentAssignee: showCurrentAssignee,
        isOpen: isTaskOpen,
        onChange: onChange
    }), currentAssignee = _c.assignee, getAssignees = _c.getAssignees, updateAssignee = _c.updateAssignee, updateRequestIsInProgress = _c.updateRequestIsInProgress, readOnly = _c.readOnly;
    var disabled = updateRequestIsInProgress || readOnly;
    return (react_1.default.createElement(DropDownSelector_1.DropDownSelector, { isDisabled: disabled, getOptions: getAssignees, onChange: updateAssignee, hideSelectedOptions: false, label: label || ui_i18n_1.default.text('Assigned to'), value: currentAssignee, defaultOptions: true, TextFieldProps: { disabled: disabled }, height: 40 }));
};
exports.AssigneeSelector = AssigneeSelector;
