"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomManifests = void 0;
const tslib_1 = require("tslib");
const react_1 = tslib_1.__importDefault(require("react"));
const customManifestsValidationSchema_1 = require("./customManifestsValidationSchema");
const CustomManifestsForm_1 = require("./CustomManifestsForm");
const utils_1 = require("./utils");
const common_1 = require("../../../../../common");
const CustomManifests = ({ cluster, onFormStateChange, }) => {
    const { t } = (0, common_1.useTranslation)();
    const [formProps, setFormProps] = react_1.default.useState();
    react_1.default.useEffect(() => {
        setFormProps({
            onFormStateChange: onFormStateChange,
            validationSchema: (0, customManifestsValidationSchema_1.getFormViewManifestsValidationSchema)(t),
            getInitialValues: (customManifests) => {
                return (0, utils_1.getManifestValues)(customManifests);
            },
            getEmptyValues: () => (0, utils_1.getEmptyManifestsValues)(),
            showEmptyValues: true,
            cluster: cluster,
        });
    }, [cluster, onFormStateChange, t]);
    if (!formProps) {
        return null;
    }
    return react_1.default.createElement(CustomManifestsForm_1.CustomManifestsForm, Object.assign({}, formProps));
};
exports.CustomManifests = CustomManifests;
//# sourceMappingURL=CustomManifests.js.map