import * as React from 'react';
import { EntityListActionButtons } from '../Components/Buttons/EntityListActionButtons';
import { AdaptableObjectRow } from '../Components/AdaptableObjectRow';
import { EntityRowItem } from '../Components/EntityRowItem';
import DropdownButton from '../../components/DropdownButton';
import { cloneObject } from '../../Utilities/Helpers/Helper';
export class AlertEntityRow extends React.Component {
    render() {
        let alertDefinition = this.props.adaptableObject;
        let messageTypes = ['Info', 'Success', 'Warning', 'Error'];
        let colItems = cloneObject(this.props.colItems);
        colItems[0].Content = (React.createElement(EntityRowItem, { Content: this.props.api.columnScopeApi.getScopeToString(alertDefinition.Scope) }));
        colItems[1].Content = (React.createElement(EntityRowItem, { Content: this.props.api.alertApi.internalApi.getAlertRuleDescription(alertDefinition) }));
        colItems[2].Content = (React.createElement("div", null,
            React.createElement(DropdownButton, { 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, { 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, { isSuspended: alertDefinition.IsSuspended, colItems: colItems });
    }
    onMessageTypeChanged(alertDefinition, value) {
        this.props.onChangeMessageType(alertDefinition, value);
    }
}
