"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const react_core_1 = require("@patternfly/react-core");
const exclamation_circle_icon_1 = require("@patternfly/react-icons/dist/js/icons/exclamation-circle-icon");
const use_translation_wrapper_1 = require("../../../hooks/use-translation-wrapper");
const DefaultErrorContent = ({ fetchData }) => {
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    return (react_1.default.createElement(react_1.default.Fragment, null,
        t('ai:There was an error retrieving data. Check your connection and'),
        ' ',
        fetchData ? (react_1.default.createElement(react_core_1.Button, { onClick: fetchData, variant: react_core_1.ButtonVariant.link, isInline: true }, t('ai:try again'))) : (t('ai:try again')),
        "."));
};
const ErrorState = ({ title = 'Error loading data', content, fetchData, icon = exclamation_circle_icon_1.ExclamationCircleIcon, variant = react_core_1.EmptyStateVariant.sm, primaryAction, actions, }) => {
    return (react_1.default.createElement(react_core_1.Bullseye, null,
        react_1.default.createElement(react_core_1.EmptyState, { status: "danger", headingLevel: "h2", icon: icon, titleText: react_1.default.createElement(react_1.default.Fragment, null, title), variant: variant },
            react_1.default.createElement(react_core_1.EmptyStateBody, null, content || react_1.default.createElement(DefaultErrorContent, { fetchData: fetchData })),
            react_1.default.createElement(react_core_1.EmptyStateFooter, null,
                primaryAction,
                actions && react_1.default.createElement(react_core_1.EmptyStateActions, null, actions)))));
};
exports.default = ErrorState;
//# sourceMappingURL=ErrorState.js.map