"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.CfnPipelinePropsMixin = void 0;
const jsiiDeprecationWarnings = require("../../../.warnings.jsii.js");
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
/* eslint-disable @stylistic/max-len, eol-last */
const cdk = __importStar(require("aws-cdk-lib/core"));
const service = __importStar(require("aws-cdk-lib/aws-datapipeline"));
/**
 * The AWS::DataPipeline::Pipeline resource specifies a data pipeline that you can use to automate the movement and transformation of data.
 *
 * > AWS Data Pipeline is no longer available to new customers. Existing customers of AWS Data Pipeline can continue to use the service as normal. [Learn more](https://docs.aws.amazon.com/big-data/migrate-workloads-from-aws-data-pipeline/)
 *
 * In each pipeline, you define pipeline objects, such as activities, schedules, data nodes, and resources.
 *
 * The `AWS::DataPipeline::Pipeline` resource adds tasks, schedules, and preconditions to the specified pipeline. You can use `PutPipelineDefinition` to populate a new pipeline.
 *
 * `PutPipelineDefinition` also validates the configuration as it adds it to the pipeline. Changes to the pipeline are saved unless one of the following validation errors exist in the pipeline.
 *
 * - An object is missing a name or identifier field.
 * - A string or reference field is empty.
 * - The number of objects in the pipeline exceeds the allowed maximum number of objects.
 * - The pipeline is in a FINISHED state.
 *
 * Pipeline object definitions are passed to the [PutPipelineDefinition](https://docs.aws.amazon.com/datapipeline/latest/APIReference/API_PutPipelineDefinition.html) action and returned by the [GetPipelineDefinition](https://docs.aws.amazon.com/datapipeline/latest/APIReference/API_GetPipelineDefinition.html) action.
 *
 * @cloudformationResource AWS::DataPipeline::Pipeline
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datapipeline-pipeline.html
 */
class CfnPipelinePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_datapipeline.CfnPipelinePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["activate", "description", "name", "parameterObjects", "parameterValues", "pipelineObjects", "pipelineTags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::DataPipeline::Pipeline`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_datapipeline_CfnPipelineMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnPipelinePropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnPipelineMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnPipeline.isCfnPipeline(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnPipelinePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnPipelinePropsMixin = CfnPipelinePropsMixin;
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinFieldProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        key: (!props.key ? undefined : props.key),
        refValue: (!props.refValue ? undefined : props.refValue),
        stringValue: (!props.stringValue ? undefined : cdk.getRefProperty(props.stringValue?.topicRef, 'topicArn') ?? cdk.getRefProperty(props.stringValue?.roleRef, 'roleName') ?? cdk.getRefProperty(props.stringValue?.instanceProfileRef, 'instanceProfileName') ?? cdk.ensureStringOrUndefined(props.stringValue, "stringValue", "sns.ITopicRef | iam.IRoleRef | iam.IInstanceProfileRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinPipelineObjectProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        fields: (!props.fields ? undefined : (cdk.isResolvableObject(props.fields) ? props.fields : cdk.mapArrayInPlace(props.fields, (item) => flattenCfnPipelinePropsMixinFieldProperty(item)))),
        id: (!props.id ? undefined : props.id),
        name: (!props.name ? undefined : props.name)
    };
}
// @ts-ignore TS6133
function flattenCfnPipelinePropsMixinParameterValueProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        id: (!props.id ? undefined : props.id),
        stringValue: (!props.stringValue ? undefined : cdk.getRefProperty(props.stringValue?.subnetRef, 'subnetId') ?? cdk.ensureStringOrUndefined(props.stringValue, "stringValue", "ec2.ISubnetRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnPipelineMixinProps(props) {
    const ret = {};
    if ((props.parameterValues !== undefined))
        ret.parameterValues = (cdk.isResolvableObject(props.parameterValues) ? props.parameterValues : cdk.mapArrayInPlace(props.parameterValues, (item) => flattenCfnPipelinePropsMixinParameterValueProperty(item)));
    if ((props.pipelineObjects !== undefined))
        ret.pipelineObjects = (cdk.isResolvableObject(props.pipelineObjects) ? props.pipelineObjects : cdk.mapArrayInPlace(props.pipelineObjects, (item) => flattenCfnPipelinePropsMixinPipelineObjectProperty(item)));
    return ret;
}
