"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SuspendToggleButton = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const ToggleButton_1 = require("../../../../components/ToggleButton");
exports.SuspendToggleButton = React.memo(({ suspendableObject, onUnSuspend, onSuspend, style, disabled, accessLevel }) => {
    const handleOnChange = React.useCallback((checked) => {
        if (checked) {
            onUnSuspend(suspendableObject);
        }
        else {
            onSuspend(suspendableObject);
        }
    }, [onUnSuspend, onSuspend]);
    const preparedDisabled = (accessLevel && accessLevel === 'ReadOnly') || disabled;
    const isSuspended = suspendableObject.IsSuspended;
    return (React.createElement(ToggleButton_1.ToggleButton, { className: "ab-SuspendButton", "data-name": suspendableObject.IsSuspended ? 'un-suspend' : 'suspend', disabled: preparedDisabled, style: style, onChange: handleOnChange, checked: !isSuspended }, isSuspended ? 'inactive' : 'active'));
});
