"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformEditorToEntity = transformEditorToEntity;
const transformFormValuesToEntityPermissionPolicies_1 = require("./transformFormValuesToEntityPermissionPolicies");
/**
 * @private
 * Transforms an IHubChannelEditor object to a partial IHubChannel object
 * @param editor an IHubChannelEditor object
 * @returns a partial IHubChannel object
 */
function transformEditorToEntity(editor) {
    // combine permissions
    const permissionValues = [
        ...editor.publicConfigs,
        ...editor.orgConfigs,
        ...editor.groupConfigs,
        ...editor.userConfigs,
    ];
    return {
        name: editor.name,
        blockWords: editor.blockWords.split(",").map((val) => val.trim()),
        allowAsAnonymous: editor.allowAsAnonymous,
        permissions: (0, transformFormValuesToEntityPermissionPolicies_1.transformFormValuesToEntityPermissionPolicies)(permissionValues),
    };
}
//# sourceMappingURL=transformEditorToEntity.js.map