"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ocmPermissionsToAIPermissions = exports.getBasePermissions = void 0;
const getBasePermissions = (cluster) => {
    if (cluster.permissions) {
        return { isViewerMode: !cluster.permissions.canEdit };
    }
    const basePermissions = { isViewerMode: false };
    if (!process.env.AIUI_APP_CLUSTER_PERMISSIONS) {
        return basePermissions;
    }
    const ocmPermissions = JSON.parse(process.env.AIUI_APP_CLUSTER_PERMISSIONS);
    return Object.assign(Object.assign({}, basePermissions), (0, exports.ocmPermissionsToAIPermissions)(ocmPermissions));
};
exports.getBasePermissions = getBasePermissions;
const ocmPermissionsToAIPermissions = (ocmPermissions) => {
    const permissions = {};
    if (ocmPermissions.canEdit !== undefined) {
        permissions.isViewerMode = !ocmPermissions.canEdit;
    }
    return permissions;
};
exports.ocmPermissionsToAIPermissions = ocmPermissionsToAIPermissions;
//# sourceMappingURL=constants.js.map