/**
 * 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_transformPostDeploymentProperties = (metamodel, context) => {
    if (metamodel instanceof INTERNAL__UnknownPostDeploymentProperties) {
        const protocol = new V1_INTERNAL__UnknownPostDeploymentProperties();
        protocol.content = metamodel.content;
        return protocol;
    }
    const extraPostDeploymentActionTransformers = context.plugins.flatMap((plugin) => plugin.V1_getExtraPostDeploymentPropertiesTransformers?.() ?? []);
    for (const transformer of extraPostDeploymentActionTransformers) {
        const protocol = transformer(metamodel, context);
        if (protocol) {
            return protocol;
        }
    }
    return new V1_INTERNAL__UnknownPostDeploymentProperties();
};
export const V1_transformFunctionActivatorActions = (protocol, metamodel, context) => {
    metamodel.actions = protocol.actions.map((value) => {
        const val = new PostDeploymentAction();
        val.automated = value.automated;
        if (value.properties) {
            val.properties = V1_transformPostDeploymentProperties(value.properties, context);
        }
        return val;
    });
};
//# sourceMappingURL=V1_LegendLambdaTransformerHelper.js.map