import * as React from 'react';
import { Box, Flex } from 'rebass';
import { Tag } from '../../../../../components/Tag';
import { useAdaptable } from '../../../../AdaptableContext';
export const StyledColumnBadgeSettings = ({ data }) => {
    const adaptable = useAdaptable();
    const badgeStyle = data.BadgeStyle;
    if (!badgeStyle || badgeStyle.Badges.length === 0) {
        return React.createElement("div", null, "No Badges Defined");
    }
    return (React.createElement(Flex, { flexDirection: "column" }, badgeStyle.Badges.map((badge, index) => {
        let ruleString = 'No Rule';
        if (badge.Predicate) {
            ruleString = adaptable.api.predicateApi.predicateToString(badge.Predicate);
        }
        if (badge.Expression) {
            ruleString = badge.Expression.BooleanExpression;
        }
        const iconOnly = badge.Icon && badge.IconOnly;
        const hasIconPosition = badge.Icon && badge.IconPosition;
        const iconPosition = hasIconPosition ? 'Icon Position: ' + badge.IconPosition : '';
        return (React.createElement(Box, { mt: 2, mb: 2, key: index },
            React.createElement(Tag, null, ruleString),
            iconOnly && React.createElement(Tag, { ml: 2 }, 'Icon Only'),
            ' ',
            hasIconPosition && React.createElement(Tag, { ml: 2 }, iconPosition),
            ' '));
    })));
};
