import React, { useState } from 'react';
import i18n from 'ui-i18n';
import ReassignIcon from '../../../icons/Reassign';
import { SmallIconButtonWithTooltip } from '../../../SmallIconButton';
import { ReassignDialog } from './components/ReassignDialog';
export var ReassignButton = function (_a) {
    var disabled = _a.disabled, changeRequestURI = _a.changeRequestURI, task = _a.task, onChangeTask = _a.onChangeTask, className = _a.className;
    var _b = useState(false), isDialogOpen = _b[0], setIsDialogOpen = _b[1];
    var handleOpenDialog = function () {
        setIsDialogOpen(true);
    };
    var handleCloseDialog = function () {
        setIsDialogOpen(false);
    };
    return (React.createElement(React.Fragment, null,
        React.createElement(SmallIconButtonWithTooltip, { className: className, "data-reltio-id": "reltio-reassign-button", showForDisabled: true, tooltipTitle: i18n.text('Reassign task'), "aria-label": i18n.text('Reassign task'), icon: ReassignIcon, onClick: handleOpenDialog, size: "L", disabled: disabled || !changeRequestURI }),
        React.createElement(ReassignDialog, { isOpen: isDialogOpen, onClose: handleCloseDialog, task: task, onChangeTask: onChangeTask })));
};
