"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReviewSummaryContent = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_core_1 = require("@patternfly/react-core");
const common_1 = require("../../../../common");
const _1 = require(".");
const ReviewCustomManifestsTable_1 = require("./ReviewCustomManifestsTable");
const PlatformIntegrationNote_1 = tslib_1.__importDefault(require("../platformIntegration/PlatformIntegrationNote"));
const useClusterCustomManifests_1 = tslib_1.__importDefault(require("../../../hooks/useClusterCustomManifests"));
const userProvidedManifests = (manifests) => (manifests !== null && manifests !== void 0 ? manifests : []).filter((m) => m.manifestSource !== 'system');
const ReviewSummaryContent = ({ cluster }) => {
    var _a;
    const { customManifests } = (0, useClusterCustomManifests_1.default)(cluster.id, false);
    const manifestsForReview = userProvidedManifests(customManifests);
    const showCustomManifests = manifestsForReview.length > 0;
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement(_1.TableSummaryExpandable, { title: 'Cluster details', id: 'cluster-details-expandable' },
            react_1.default.createElement(_1.ReviewClusterDetailTable, { cluster: cluster })),
        react_1.default.createElement(_1.ReviewOperatorsTable, { cluster: cluster }),
        react_1.default.createElement(_1.TableSummaryExpandable, { title: 'Host inventory', id: 'host-inventory-expandable' },
            react_1.default.createElement(react_1.default.Fragment, null,
                react_1.default.createElement(common_1.ReviewHostsInventory, { hosts: cluster.hosts }),
                react_1.default.createElement(common_1.RenderIf, { condition: (0, common_1.isClusterPlatformTypeVM)(cluster) },
                    react_1.default.createElement(common_1.DetailList, null,
                        react_1.default.createElement(common_1.DetailItem, { title: 'Platform integration', value: react_1.default.createElement(react_1.default.Fragment, null,
                                react_1.default.createElement(_1.ReviewPlatformTable, { cluster: cluster }),
                                react_1.default.createElement(PlatformIntegrationNote_1.default, { platformType: (_a = cluster.platform) === null || _a === void 0 ? void 0 : _a.type })), testId: "platform-integration-note", classNameValue: 'pf-v6-u-mt-sm' }))))),
        react_1.default.createElement(_1.TableSummaryExpandable, { title: 'Networking', id: 'networking-expandable' },
            react_1.default.createElement(_1.ReviewNetworkingTable, { cluster: cluster })),
        showCustomManifests && (react_1.default.createElement(_1.TableSummaryExpandable, { title: 'Custom manifests', id: 'custom-manifests-expandable' },
            react_1.default.createElement(ReviewCustomManifestsTable_1.ReviewCustomManifestsTable, { manifests: manifestsForReview })))));
};
exports.ReviewSummaryContent = ReviewSummaryContent;
const ReviewSummary = ({ cluster }) => {
    return (react_1.default.createElement(react_core_1.ExpandableSection, { toggleContent: 'Cluster summary', id: 'summary-expandable', isExpanded: true, isIndented: true },
        react_1.default.createElement(exports.ReviewSummaryContent, { cluster: cluster })));
};
exports.default = ReviewSummary;
//# sourceMappingURL=ReviewSummary.js.map