"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_core_1 = require("@patternfly/react-core");
const info_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/info-circle-icon");
const react_1 = tslib_1.__importDefault(require("react"));
const getLabelCollapsedHost = (macAddress, mappingValue, bondPrimaryInterface, bondSecondaryInterface) => {
    if (bondPrimaryInterface !== '' && bondSecondaryInterface !== '') {
        return `${bondPrimaryInterface}/${bondSecondaryInterface} -> ${mappingValue}`;
    }
    else {
        return `${macAddress} -> ${mappingValue}`;
    }
};
const HostSummary = ({ title, macAddress, mappingValue, numInterfaces, hasError, hostIdx, bondPrimaryInterface, bondSecondaryInterface, }) => {
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement(react_core_1.StackItem, { "data-testid": `collapsed-host-${hostIdx}` },
            react_1.default.createElement(react_core_1.Flex, null,
                react_1.default.createElement(react_core_1.FlexItem, null,
                    react_1.default.createElement(react_core_1.Content, { component: react_core_1.ContentVariants.small }, title)),
                hasError && (react_1.default.createElement(react_core_1.Label, { variant: "outline", color: "red", icon: react_1.default.createElement(info_circle_icon_1.InfoCircleIcon, null), "data-testid": "host-errors-label" }, "Missing Information")),
                !hasError && (react_1.default.createElement(react_1.default.Fragment, null,
                    react_1.default.createElement(react_core_1.FlexItem, null,
                        react_1.default.createElement(react_core_1.Label, { variant: "outline", "data-testid": "first-mapping-label" }, getLabelCollapsedHost(macAddress, mappingValue, bondPrimaryInterface, bondSecondaryInterface)),
                        ' '),
                    numInterfaces > 1 && (react_1.default.createElement(react_core_1.FlexItem, null,
                        react_1.default.createElement(react_core_1.Label, { variant: "outline", "data-testid": "remaining-mapping-label" }, `${numInterfaces - 1} left`)))))))));
};
exports.default = HostSummary;
//# sourceMappingURL=CollapsedHost.js.map