"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TangServers = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const formik_1 = require("formik");
const react_core_1 = require("@patternfly/react-core");
const ui_1 = require("../../ui");
const formik_2 = require("../../ui/formik");
const use_translation_wrapper_1 = require("../../../hooks/use-translation-wrapper");
const TangServers = ({ isDisabled = false, tooltipProps, }) => {
    const { values } = (0, formik_1.useFormikContext)();
    const { t } = (0, use_translation_wrapper_1.useTranslation)();
    return (react_1.default.createElement(formik_1.FieldArray, { name: "diskEncryptionTangServers" }, ({ remove, push }) => (react_1.default.createElement(react_core_1.Stack, { hasGutter: true },
        values.diskEncryptionTangServers.map((tang, index) => (react_1.default.createElement(react_core_1.StackItem, { key: index },
            react_1.default.createElement(formik_2.RemovableField, { hideRemoveButton: index === 0 || isDisabled, onRemove: () => remove(index) },
                react_1.default.createElement("div", null,
                    react_1.default.createElement(react_core_1.Tooltip, Object.assign({}, tooltipProps),
                        react_1.default.createElement(ui_1.InputField, { type: react_core_1.TextInputTypes.url, name: `diskEncryptionTangServers.${index}.url`, helperText: `Must start with "http://" or "https://". Optionally, end with ":<port>"`, label: "Server URL", isRequired: true, isDisabled: isDisabled })),
                    "\u2009",
                    react_1.default.createElement(react_core_1.Tooltip, Object.assign({}, tooltipProps),
                        react_1.default.createElement(ui_1.InputField, { type: react_core_1.TextInputTypes.text, name: `diskEncryptionTangServers.${index}.thumbprint`, label: "Server Thumbprint", isRequired: true, isDisabled: isDisabled })))),
            ' '))),
        !isDisabled && (react_1.default.createElement(react_core_1.StackItem, null,
            react_1.default.createElement(formik_2.AddButton, { onAdd: () => push({ url: '', thumbprint: '' }), isInline: true }, t('ai:Add another Tang server'))))))));
};
exports.TangServers = TangServers;
//# sourceMappingURL=TangServers.js.map