"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AlertEntityRow = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const EntityListActionButtons_1 = require("../Components/Buttons/EntityListActionButtons");
const AdaptableObjectRow_1 = require("../Components/AdaptableObjectRow");
const EntityRowItem_1 = require("../Components/EntityRowItem");
const DropdownButton_1 = tslib_1.__importDefault(require("../../components/DropdownButton"));
const Helper_1 = require("../../Utilities/Helpers/Helper");
class AlertEntityRow extends React.Component {
    render() {
        let alertDefinition = this.props.adaptableObject;
        let messageTypes = ['Info', 'Success', 'Warning', 'Error'];
        let colItems = (0, Helper_1.cloneObject)(this.props.colItems);
        colItems[0].Content = (React.createElement(EntityRowItem_1.EntityRowItem, { Content: this.props.api.columnScopeApi.getScopeToString(alertDefinition.Scope) }));
        colItems[1].Content = (React.createElement(EntityRowItem_1.EntityRowItem, { Content: this.props.api.alertApi.internalApi.getAlertRuleDescription(alertDefinition) }));
        colItems[2].Content = (React.createElement("div", null,
            React.createElement(DropdownButton_1.default, { showClearButton: false, items: messageTypes.map((item) => ({
                    value: item,
                    label: item,
                    onClick: () => this.onMessageTypeChanged(alertDefinition, item),
                })), columns: ['label'], accessLevel: this.props.accessLevel }, alertDefinition.MessageType)));
        colItems[3].Content = (React.createElement(EntityListActionButtons_1.EntityListActionButtons, { showSuspend: true, suspendableObject: alertDefinition, confirmDeleteAction: this.props.onDeleteConfirm, showShare: this.props.teamSharingActivated, editClick: () => this.props.onEdit(alertDefinition), shareClick: (config) => this.props.onShare(config), 
            //overrideDisableEdit={!this.props.Column}
            entityType: this.props.moduleInfo.FriendlyName, accessLevel: this.props.accessLevel, onSuspend: this.props.onSuspend, onUnSuspend: this.props.onUnSuspend }));
        return React.createElement(AdaptableObjectRow_1.AdaptableObjectRow, { isSuspended: alertDefinition.IsSuspended, colItems: colItems });
    }
    onMessageTypeChanged(alertDefinition, value) {
        this.props.onChangeMessageType(alertDefinition, value);
    }
}
exports.AlertEntityRow = AlertEntityRow;
