var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
import React, { forwardRef, useCallback } from 'react';
import i18n from 'ui-i18n';
import { identity } from 'ramda';
import { ActionButton } from '../ActionButton';
import { ActionButtonMode } from '../types';
import NotMatchIcon from '../icons/NotMatchDark';
import { useMarkAsNotMatchRequest } from '../hooks/useMarkAsNotMatchRequest';
export var NotMatchButton = forwardRef(function (_a, ref) {
    var className = _a.className, _b = _a.mode, mode = _b === void 0 ? ActionButtonMode.iconButton : _b, _c = _a.onMenuClose, onMenuClose = _c === void 0 ? identity : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, entity = _a.entity, entities = _a.entities, onStartRequest = _a.onStartRequest, onFinishRequest = _a.onFinishRequest, onError = _a.onError, onSuccess = _a.onSuccess, confirmMessage = _a.confirmMessage, otherProps = __rest(_a, ["className", "mode", "onMenuClose", "disabled", "entity", "entities", "onStartRequest", "onFinishRequest", "onError", "onSuccess", "confirmMessage"]);
    var sendMarkAsNotMatchRequest = useMarkAsNotMatchRequest({
        entity: entity,
        entities: entities,
        onStartRequest: onStartRequest,
        onFinishRequest: onFinishRequest,
        onError: onError,
        onSuccess: onSuccess
    }).sendMarkAsNotMatchRequest;
    var handleClick = useCallback(function () {
        if (confirmMessage && !confirm(confirmMessage))
            return;
        sendMarkAsNotMatchRequest();
    }, [sendMarkAsNotMatchRequest, confirmMessage]);
    return (React.createElement(ActionButton, __assign({ className: className, disabled: disabled, mode: mode, label: i18n.text('Not a match'), icon: NotMatchIcon, onClick: handleClick, onMenuClose: onMenuClose, ref: ref }, otherProps)));
});
NotMatchButton.displayName = 'notMatchButton';
