"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getClusterCustomManifests = exports.getEmptyManifestsValues = exports.getManifestValues = exports.getEmptyManifest = exports.getFormData = exports.getManifestName = void 0;
const getManifestName = (manifestIdx) => `Custom manifest ${manifestIdx + 1}`;
exports.getManifestName = getManifestName;
const getFormData = (manifests) => {
    return {
        manifests: (0, exports.getClusterCustomManifests)(manifests),
    };
};
exports.getFormData = getFormData;
const getEmptyManifest = () => {
    return {
        folder: 'manifests',
        filename: '',
        manifestYaml: '',
        created: false,
    };
};
exports.getEmptyManifest = getEmptyManifest;
const getManifestValues = (manifests) => {
    if (!!manifests.length) {
        return (0, exports.getFormData)(manifests);
    }
    else {
        return (0, exports.getEmptyManifestsValues)();
    }
};
exports.getManifestValues = getManifestValues;
const getEmptyManifestsValues = () => {
    return { manifests: [(0, exports.getEmptyManifest)()] };
};
exports.getEmptyManifestsValues = getEmptyManifestsValues;
const getClusterCustomManifests = (customManifests) => {
    if (customManifests && customManifests.length > 0) {
        return customManifests.map((manifest) => ({
            folder: manifest.folder || 'manifests',
            filename: manifest.fileName || '',
            manifestYaml: manifest.yamlContent || '',
            created: true,
        }));
    }
    else {
        return [(0, exports.getEmptyManifest)()];
    }
};
exports.getClusterCustomManifests = getClusterCustomManifests;
//# sourceMappingURL=utils.js.map