"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.CfnFlowPropsMixin = exports.CfnConnectorProfilePropsMixin = exports.CfnConnectorPropsMixin = 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-appflow"));
/**
 * Creates a new connector profile associated with your AWS account .
 *
 * There is a soft quota of 100 connector profiles per AWS account . If you need more connector profiles than this quota allows, you can submit a request to the Amazon AppFlow team through the Amazon AppFlow support channel. In each connector profile that you create, you can provide the credentials and properties for only one connector.
 *
 * @cloudformationResource AWS::AppFlow::Connector
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appflow-connector.html
 */
class CfnConnectorPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_appflow.CfnConnectorPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["connectorLabel", "connectorProvisioningConfig", "connectorProvisioningType", "description"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::AppFlow::Connector`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_appflow_CfnConnectorMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnConnectorPropsMixin);
            }
            throw error;
        }
        this.props = props;
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnConnector.isCfnConnector(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnConnectorPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnConnectorPropsMixin = CfnConnectorPropsMixin;
/**
 * The `AWS::AppFlow::ConnectorProfile` resource is an Amazon AppFlow resource type that specifies the configuration profile for an instance of a connector.
 *
 * This includes the provided name, credentials ARN, connection-mode, and so on. The fields that are common to all types of connector profiles are explicitly specified under the `Properties` field. The rest of the connector-specific properties are specified under `Properties/ConnectorProfileConfig` .
 *
 * > If you want to use CloudFormation to create a connector profile for connectors that implement OAuth (such as Salesforce, Slack, Zendesk, and Google Analytics), you must fetch the access and refresh tokens. You can do this by implementing your own UI for OAuth, or by retrieving the tokens from elsewhere. Alternatively, you can use the Amazon AppFlow console to create the connector profile, and then use that connector profile in the flow creation CloudFormation template.
 *
 * @cloudformationResource AWS::AppFlow::ConnectorProfile
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appflow-connectorprofile.html
 */
class CfnConnectorProfilePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_appflow.CfnConnectorProfilePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["connectionMode", "connectorLabel", "connectorProfileConfig", "connectorProfileName", "connectorType", "kmsArn"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::AppFlow::ConnectorProfile`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_appflow_CfnConnectorProfileMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnConnectorProfilePropsMixin);
            }
            throw error;
        }
        this.props = props;
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnConnectorProfile.isCfnConnectorProfile(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnConnectorProfilePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnConnectorProfilePropsMixin = CfnConnectorProfilePropsMixin;
/**
 * The `AWS::AppFlow::Flow` resource is an Amazon AppFlow resource type that specifies a new flow.
 *
 * > If you want to use CloudFormation to create a connector profile for connectors that implement OAuth (such as Salesforce, Slack, Zendesk, and Google Analytics), you must fetch the access and refresh tokens. You can do this by implementing your own UI for OAuth, or by retrieving the tokens from elsewhere. Alternatively, you can use the Amazon AppFlow console to create the connector profile, and then use that connector profile in the flow creation CloudFormation template.
 *
 * @cloudformationResource AWS::AppFlow::Flow
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appflow-flow.html
 */
class CfnFlowPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_appflow.CfnFlowPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["description", "destinationFlowConfigList", "flowName", "flowStatus", "kmsArn", "metadataCatalogConfig", "sourceFlowConfig", "tags", "tasks", "triggerConfig"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::AppFlow::Flow`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_appflow_CfnFlowMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnFlowPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnFlowMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnFlow.isCfnFlow(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnFlowPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnFlowPropsMixin = CfnFlowPropsMixin;
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinS3DestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucketName: (!props.bucketName ? undefined : cdk.getRefProperty(props.bucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.bucketName, "bucketName", "s3.IBucketRef | string")),
        bucketPrefix: (!props.bucketPrefix ? undefined : props.bucketPrefix),
        s3OutputFormatConfig: (!props.s3OutputFormatConfig ? undefined : props.s3OutputFormatConfig)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucketName: (!props.bucketName ? undefined : cdk.getRefProperty(props.bucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.bucketName, "bucketName", "s3.IBucketRef | string")),
        bucketPrefix: (!props.bucketPrefix ? undefined : props.bucketPrefix),
        failOnFirstError: (!props.failOnFirstError ? undefined : props.failOnFirstError)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinCustomConnectorDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        customProperties: (!props.customProperties ? undefined : props.customProperties),
        entityName: (!props.entityName ? undefined : props.entityName),
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        idFieldNames: (!props.idFieldNames ? undefined : props.idFieldNames),
        writeOperationType: (!props.writeOperationType ? undefined : props.writeOperationType)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinSuccessResponseHandlingConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucketName: (!props.bucketName ? undefined : cdk.getRefProperty(props.bucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.bucketName, "bucketName", "s3.IBucketRef | string")),
        bucketPrefix: (!props.bucketPrefix ? undefined : props.bucketPrefix)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinSAPODataDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        idFieldNames: (!props.idFieldNames ? undefined : props.idFieldNames),
        objectPath: (!props.objectPath ? undefined : props.objectPath),
        successResponseHandlingConfig: (!props.successResponseHandlingConfig ? undefined : (!props.successResponseHandlingConfig ? undefined : flattenCfnFlowPropsMixinSuccessResponseHandlingConfigProperty(props.successResponseHandlingConfig))),
        writeOperationType: (!props.writeOperationType ? undefined : props.writeOperationType)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinSnowflakeDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucketPrefix: (!props.bucketPrefix ? undefined : props.bucketPrefix),
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        intermediateBucketName: (!props.intermediateBucketName ? undefined : cdk.getRefProperty(props.intermediateBucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.intermediateBucketName, "intermediateBucketName", "s3.IBucketRef | string")),
        object: (!props.object ? undefined : props.object)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinEventBridgeDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        object: (!props.object ? undefined : props.object)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinZendeskDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        idFieldNames: (!props.idFieldNames ? undefined : props.idFieldNames),
        object: (!props.object ? undefined : props.object),
        writeOperationType: (!props.writeOperationType ? undefined : props.writeOperationType)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinMarketoDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        object: (!props.object ? undefined : props.object)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinRedshiftDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucketPrefix: (!props.bucketPrefix ? undefined : props.bucketPrefix),
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        intermediateBucketName: (!props.intermediateBucketName ? undefined : cdk.getRefProperty(props.intermediateBucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.intermediateBucketName, "intermediateBucketName", "s3.IBucketRef | string")),
        object: (!props.object ? undefined : props.object)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinSalesforceDestinationPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        dataTransferApi: (!props.dataTransferApi ? undefined : props.dataTransferApi),
        errorHandlingConfig: (!props.errorHandlingConfig ? undefined : (!props.errorHandlingConfig ? undefined : flattenCfnFlowPropsMixinErrorHandlingConfigProperty(props.errorHandlingConfig))),
        idFieldNames: (!props.idFieldNames ? undefined : props.idFieldNames),
        object: (!props.object ? undefined : props.object),
        writeOperationType: (!props.writeOperationType ? undefined : props.writeOperationType)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinDestinationConnectorPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        customConnector: (!props.customConnector ? undefined : (!props.customConnector ? undefined : flattenCfnFlowPropsMixinCustomConnectorDestinationPropertiesProperty(props.customConnector))),
        eventBridge: (!props.eventBridge ? undefined : (!props.eventBridge ? undefined : flattenCfnFlowPropsMixinEventBridgeDestinationPropertiesProperty(props.eventBridge))),
        lookoutMetrics: (!props.lookoutMetrics ? undefined : props.lookoutMetrics),
        marketo: (!props.marketo ? undefined : (!props.marketo ? undefined : flattenCfnFlowPropsMixinMarketoDestinationPropertiesProperty(props.marketo))),
        redshift: (!props.redshift ? undefined : (!props.redshift ? undefined : flattenCfnFlowPropsMixinRedshiftDestinationPropertiesProperty(props.redshift))),
        s3: (!props.s3 ? undefined : (!props.s3 ? undefined : flattenCfnFlowPropsMixinS3DestinationPropertiesProperty(props.s3))),
        salesforce: (!props.salesforce ? undefined : (!props.salesforce ? undefined : flattenCfnFlowPropsMixinSalesforceDestinationPropertiesProperty(props.salesforce))),
        sapoData: (!props.sapoData ? undefined : (!props.sapoData ? undefined : flattenCfnFlowPropsMixinSAPODataDestinationPropertiesProperty(props.sapoData))),
        snowflake: (!props.snowflake ? undefined : (!props.snowflake ? undefined : flattenCfnFlowPropsMixinSnowflakeDestinationPropertiesProperty(props.snowflake))),
        upsolver: (!props.upsolver ? undefined : props.upsolver),
        zendesk: (!props.zendesk ? undefined : (!props.zendesk ? undefined : flattenCfnFlowPropsMixinZendeskDestinationPropertiesProperty(props.zendesk)))
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinDestinationFlowConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        apiVersion: (!props.apiVersion ? undefined : props.apiVersion),
        connectorProfileName: (!props.connectorProfileName ? undefined : props.connectorProfileName),
        connectorType: (!props.connectorType ? undefined : props.connectorType),
        destinationConnectorProperties: (!props.destinationConnectorProperties ? undefined : flattenCfnFlowPropsMixinDestinationConnectorPropertiesProperty(props.destinationConnectorProperties))
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinS3SourcePropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucketName: (!props.bucketName ? undefined : cdk.getRefProperty(props.bucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.bucketName, "bucketName", "s3.IBucketRef | string")),
        bucketPrefix: (!props.bucketPrefix ? undefined : props.bucketPrefix),
        s3InputFormatConfig: (!props.s3InputFormatConfig ? undefined : props.s3InputFormatConfig)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinSourceConnectorPropertiesProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        amplitude: (!props.amplitude ? undefined : props.amplitude),
        customConnector: (!props.customConnector ? undefined : props.customConnector),
        datadog: (!props.datadog ? undefined : props.datadog),
        dynatrace: (!props.dynatrace ? undefined : props.dynatrace),
        googleAnalytics: (!props.googleAnalytics ? undefined : props.googleAnalytics),
        inforNexus: (!props.inforNexus ? undefined : props.inforNexus),
        marketo: (!props.marketo ? undefined : props.marketo),
        pardot: (!props.pardot ? undefined : props.pardot),
        s3: (!props.s3 ? undefined : (!props.s3 ? undefined : flattenCfnFlowPropsMixinS3SourcePropertiesProperty(props.s3))),
        salesforce: (!props.salesforce ? undefined : props.salesforce),
        sapoData: (!props.sapoData ? undefined : props.sapoData),
        serviceNow: (!props.serviceNow ? undefined : props.serviceNow),
        singular: (!props.singular ? undefined : props.singular),
        slack: (!props.slack ? undefined : props.slack),
        trendmicro: (!props.trendmicro ? undefined : props.trendmicro),
        veeva: (!props.veeva ? undefined : props.veeva),
        zendesk: (!props.zendesk ? undefined : props.zendesk)
    };
}
// @ts-ignore TS6133
function flattenCfnFlowPropsMixinSourceFlowConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        apiVersion: (!props.apiVersion ? undefined : props.apiVersion),
        connectorProfileName: (!props.connectorProfileName ? undefined : props.connectorProfileName),
        connectorType: (!props.connectorType ? undefined : props.connectorType),
        incrementalPullConfig: (!props.incrementalPullConfig ? undefined : props.incrementalPullConfig),
        sourceConnectorProperties: (!props.sourceConnectorProperties ? undefined : flattenCfnFlowPropsMixinSourceConnectorPropertiesProperty(props.sourceConnectorProperties))
    };
}
// @ts-ignore TS6133
function flattenCfnFlowMixinProps(props) {
    const ret = {};
    if ((props.destinationFlowConfigList !== undefined))
        ret.destinationFlowConfigList = (cdk.isResolvableObject(props.destinationFlowConfigList) ? props.destinationFlowConfigList : cdk.mapArrayInPlace(props.destinationFlowConfigList, (item) => flattenCfnFlowPropsMixinDestinationFlowConfigProperty(item)));
    if ((props.kmsArn !== undefined))
        ret.kmsArn = cdk.getRefProperty(props.kmsArn?.keyRef, 'keyArn') ?? cdk.ensureStringOrUndefined(props.kmsArn, "kmsArn", "kms.IKeyRef | string");
    if ((props.sourceFlowConfig !== undefined))
        ret.sourceFlowConfig = flattenCfnFlowPropsMixinSourceFlowConfigProperty(props.sourceFlowConfig);
    return ret;
}
