"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StyledColumnBadgeSettings = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const rebass_1 = require("rebass");
const Tag_1 = require("../../../../../components/Tag");
const AdaptableContext_1 = require("../../../../AdaptableContext");
const StyledColumnBadgeSettings = ({ data }) => {
    const adaptable = (0, AdaptableContext_1.useAdaptable)();
    const badgeStyle = data.BadgeStyle;
    if (!badgeStyle || badgeStyle.Badges.length === 0) {
        return React.createElement("div", null, "No Badges Defined");
    }
    return (React.createElement(rebass_1.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(rebass_1.Box, { mt: 2, mb: 2, key: index },
            React.createElement(Tag_1.Tag, null, ruleString),
            iconOnly && React.createElement(Tag_1.Tag, { ml: 2 }, 'Icon Only'),
            ' ',
            hasIconPosition && React.createElement(Tag_1.Tag, { ml: 2 }, iconPosition),
            ' '));
    })));
};
exports.StyledColumnBadgeSettings = StyledColumnBadgeSettings;
