/**
 * Copyright (c) 2020-present, Goldman Sachs
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { PostDeploymentAction } from '../../../../../../../../graph/metamodel/pure/functionActivator/PostDeploymentAction.js';
import { INTERNAL__UnknownPostDeploymentProperties, } from '../../../../../../../../graph/metamodel/pure/functionActivator/PostDeploymentProperties.js';
import { V1_INTERNAL__UnknownPostDeploymentProperties, } from '../../../../engine/functionActivator/V1_PostDeploymentProperties.js';
export const V1_buildPostDeploymentProperties = (protocol, context) => {
    if (protocol instanceof V1_INTERNAL__UnknownPostDeploymentProperties) {
        const metamodel = new INTERNAL__UnknownPostDeploymentProperties();
        metamodel.content = protocol.content;
        return metamodel;
    }
    const extraPostProcessorBuilders = context.extensions.plugins.flatMap((plugin) => plugin.V1_getExtraPostDeploymentPropertiesBuilders?.() ?? []);
    for (const builder of extraPostProcessorBuilders) {
        const metamodel = builder(protocol, context);
        if (metamodel) {
            return metamodel;
        }
    }
    return new V1_INTERNAL__UnknownPostDeploymentProperties();
};
export const V1_buildFunctionActivatorActions = (protocol, metamodel, context) => {
    metamodel.actions = protocol.actions.map((value) => {
        const val = new PostDeploymentAction();
        val.automated = value.automated;
        if (value.properties) {
            val.properties = V1_buildPostDeploymentProperties(value.properties, context);
        }
        return val;
    });
};
//# sourceMappingURL=V1_LegendLambdaHelper.js.map