"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const HostPropertyValidationPopover_1 = tslib_1.__importDefault(require("./HostPropertyValidationPopover"));
const use_translation_wrapper_1 = require("../../hooks/use-translation-wrapper");
const getLabel = (t, validationStatus) => {
    switch (validationStatus) {
        case 'failure':
            return t('ai:Unreachable');
        case 'success':
            return t('ai:Synced');
        default:
            return t('ai:Not available');
    }
};
const NtpValidationStatus = ({ validationsInfo, AdditionalNTPSourcesDialogToggleComponent, }) => {
    var _a;
    const ntpSyncedValidation = (_a = validationsInfo.network) === null || _a === void 0 ? void 0 : _a.find((v) => v.id === 'ntp-synced');
    const actions = [];
    if (AdditionalNTPSourcesDialogToggleComponent) {
        actions.push(react_1.default.createElement(AdditionalNTPSourcesDialogToggleComponent, { key: "add-ntp-sources" }));
    }
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    return (react_1.default.createElement(HostPropertyValidationPopover_1.default, { validation: ntpSyncedValidation, failureActions: actions, pendingActions: actions, showSuccess: true, showPending: true }, getLabel(t, ntpSyncedValidation === null || ntpSyncedValidation === void 0 ? void 0 : ntpSyncedValidation.status)));
};
exports.default = NtpValidationStatus;
//# sourceMappingURL=NtpValidationStatus.js.map