"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.CfnIndexPropsMixin = exports.CfnFaqPropsMixin = exports.CfnDataSourcePropsMixin = 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-kendra"));
/**
 * Creates a data source connector that you want to use with an Amazon Kendra index.
 *
 * You specify a name, data source connector type and description for your data source. You also specify configuration information for the data source connector.
 *
 * > `CreateDataSource` does *not* support connectors which [require a `TemplateConfiguration` object](https://docs.aws.amazon.com/kendra/latest/dg/ds-schemas.html) for connecting to Amazon Kendra .
 *
 * @cloudformationResource AWS::Kendra::DataSource
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kendra-datasource.html
 */
class CfnDataSourcePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_kendra.CfnDataSourcePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["customDocumentEnrichmentConfiguration", "dataSourceConfiguration", "description", "indexId", "languageCode", "name", "roleArn", "schedule", "tags", "type"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::Kendra::DataSource`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_kendra_CfnDataSourceMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnDataSourcePropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnDataSourceMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnDataSource.isCfnDataSource(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnDataSourcePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnDataSourcePropsMixin = CfnDataSourcePropsMixin;
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinHookConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        invocationCondition: (!props.invocationCondition ? undefined : props.invocationCondition),
        lambdaArn: (!props.lambdaArn ? undefined : props.lambdaArn),
        s3Bucket: (!props.s3Bucket ? undefined : cdk.getRefProperty(props.s3Bucket?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.s3Bucket, "s3Bucket", "s3.IBucketRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinCustomDocumentEnrichmentConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        inlineConfigurations: (!props.inlineConfigurations ? undefined : props.inlineConfigurations),
        postExtractionHookConfiguration: (!props.postExtractionHookConfiguration ? undefined : (!props.postExtractionHookConfiguration ? undefined : flattenCfnDataSourcePropsMixinHookConfigurationProperty(props.postExtractionHookConfiguration))),
        preExtractionHookConfiguration: (!props.preExtractionHookConfiguration ? undefined : (!props.preExtractionHookConfiguration ? undefined : flattenCfnDataSourcePropsMixinHookConfigurationProperty(props.preExtractionHookConfiguration))),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinS3DataSourceConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        accessControlListConfiguration: (!props.accessControlListConfiguration ? undefined : props.accessControlListConfiguration),
        bucketName: (!props.bucketName ? undefined : cdk.getRefProperty(props.bucketName?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.bucketName, "bucketName", "s3.IBucketRef | string")),
        documentsMetadataConfiguration: (!props.documentsMetadataConfiguration ? undefined : props.documentsMetadataConfiguration),
        exclusionPatterns: (!props.exclusionPatterns ? undefined : props.exclusionPatterns),
        inclusionPatterns: (!props.inclusionPatterns ? undefined : props.inclusionPatterns),
        inclusionPrefixes: (!props.inclusionPrefixes ? undefined : props.inclusionPrefixes)
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinS3PathProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        bucket: (!props.bucket ? undefined : cdk.getRefProperty(props.bucket?.bucketRef, 'bucketName') ?? cdk.ensureStringOrUndefined(props.bucket, "bucket", "s3.IBucketRef | string")),
        key: (!props.key ? undefined : props.key)
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinSharePointConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        crawlAttachments: (!props.crawlAttachments ? undefined : props.crawlAttachments),
        disableLocalGroups: (!props.disableLocalGroups ? undefined : props.disableLocalGroups),
        documentTitleFieldName: (!props.documentTitleFieldName ? undefined : props.documentTitleFieldName),
        exclusionPatterns: (!props.exclusionPatterns ? undefined : props.exclusionPatterns),
        fieldMappings: (!props.fieldMappings ? undefined : props.fieldMappings),
        inclusionPatterns: (!props.inclusionPatterns ? undefined : props.inclusionPatterns),
        secretArn: (!props.secretArn ? undefined : props.secretArn),
        sharePointVersion: (!props.sharePointVersion ? undefined : props.sharePointVersion),
        sslCertificateS3Path: (!props.sslCertificateS3Path ? undefined : (!props.sslCertificateS3Path ? undefined : flattenCfnDataSourcePropsMixinS3PathProperty(props.sslCertificateS3Path))),
        urls: (!props.urls ? undefined : props.urls),
        useChangeLog: (!props.useChangeLog ? undefined : props.useChangeLog),
        vpcConfiguration: (!props.vpcConfiguration ? undefined : props.vpcConfiguration)
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinOneDriveUsersProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        oneDriveUserList: (!props.oneDriveUserList ? undefined : props.oneDriveUserList),
        oneDriveUserS3Path: (!props.oneDriveUserS3Path ? undefined : (!props.oneDriveUserS3Path ? undefined : flattenCfnDataSourcePropsMixinS3PathProperty(props.oneDriveUserS3Path)))
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinOneDriveConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        disableLocalGroups: (!props.disableLocalGroups ? undefined : props.disableLocalGroups),
        exclusionPatterns: (!props.exclusionPatterns ? undefined : props.exclusionPatterns),
        fieldMappings: (!props.fieldMappings ? undefined : props.fieldMappings),
        inclusionPatterns: (!props.inclusionPatterns ? undefined : props.inclusionPatterns),
        oneDriveUsers: (!props.oneDriveUsers ? undefined : flattenCfnDataSourcePropsMixinOneDriveUsersProperty(props.oneDriveUsers)),
        secretArn: (!props.secretArn ? undefined : props.secretArn),
        tenantDomain: (!props.tenantDomain ? undefined : props.tenantDomain)
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourcePropsMixinDataSourceConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        confluenceConfiguration: (!props.confluenceConfiguration ? undefined : props.confluenceConfiguration),
        databaseConfiguration: (!props.databaseConfiguration ? undefined : props.databaseConfiguration),
        googleDriveConfiguration: (!props.googleDriveConfiguration ? undefined : props.googleDriveConfiguration),
        oneDriveConfiguration: (!props.oneDriveConfiguration ? undefined : (!props.oneDriveConfiguration ? undefined : flattenCfnDataSourcePropsMixinOneDriveConfigurationProperty(props.oneDriveConfiguration))),
        s3Configuration: (!props.s3Configuration ? undefined : (!props.s3Configuration ? undefined : flattenCfnDataSourcePropsMixinS3DataSourceConfigurationProperty(props.s3Configuration))),
        salesforceConfiguration: (!props.salesforceConfiguration ? undefined : props.salesforceConfiguration),
        serviceNowConfiguration: (!props.serviceNowConfiguration ? undefined : props.serviceNowConfiguration),
        sharePointConfiguration: (!props.sharePointConfiguration ? undefined : (!props.sharePointConfiguration ? undefined : flattenCfnDataSourcePropsMixinSharePointConfigurationProperty(props.sharePointConfiguration))),
        templateConfiguration: (!props.templateConfiguration ? undefined : props.templateConfiguration),
        webCrawlerConfiguration: (!props.webCrawlerConfiguration ? undefined : props.webCrawlerConfiguration),
        workDocsConfiguration: (!props.workDocsConfiguration ? undefined : props.workDocsConfiguration)
    };
}
// @ts-ignore TS6133
function flattenCfnDataSourceMixinProps(props) {
    const ret = {};
    if ((props.customDocumentEnrichmentConfiguration !== undefined))
        ret.customDocumentEnrichmentConfiguration = flattenCfnDataSourcePropsMixinCustomDocumentEnrichmentConfigurationProperty(props.customDocumentEnrichmentConfiguration);
    if ((props.dataSourceConfiguration !== undefined))
        ret.dataSourceConfiguration = flattenCfnDataSourcePropsMixinDataSourceConfigurationProperty(props.dataSourceConfiguration);
    if ((props.indexId !== undefined))
        ret.indexId = cdk.getRefProperty(props.indexId?.indexRef, 'indexId') ?? cdk.ensureStringOrUndefined(props.indexId, "indexId", "kendra.IIndexRef | string");
    if ((props.roleArn !== undefined))
        ret.roleArn = cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string");
    return ret;
}
/**
 * Creates an new set of frequently asked question (FAQ) questions and answers.
 *
 * @cloudformationResource AWS::Kendra::Faq
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kendra-faq.html
 */
class CfnFaqPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_kendra.CfnFaqPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["description", "fileFormat", "indexId", "languageCode", "name", "roleArn", "s3Path", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::Kendra::Faq`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_kendra_CfnFaqMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnFaqPropsMixin);
            }
            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.CfnFaq.isCfnFaq(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnFaqPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnFaqPropsMixin = CfnFaqPropsMixin;
/**
 * Creates an Amazon Kendra index.
 *
 * Once the index is active you can add documents to your index using the [BatchPutDocument](https://docs.aws.amazon.com/kendra/latest/dg/BatchPutDocument.html) operation or using one of the supported data sources.
 *
 * @cloudformationResource AWS::Kendra::Index
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kendra-index.html
 */
class CfnIndexPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_kendra.CfnIndexPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["capacityUnits", "description", "documentMetadataConfigurations", "edition", "name", "roleArn", "serverSideEncryptionConfiguration", "tags", "userContextPolicy", "userTokenConfigurations"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::Kendra::Index`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_kendra_CfnIndexMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnIndexPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnIndexMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnIndex.isCfnIndex(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnIndexPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnIndexPropsMixin = CfnIndexPropsMixin;
// @ts-ignore TS6133
function flattenCfnIndexPropsMixinServerSideEncryptionConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        kmsKeyId: (!props.kmsKeyId ? undefined : cdk.getRefProperty(props.kmsKeyId?.keyRef, 'keyId') ?? cdk.ensureStringOrUndefined(props.kmsKeyId, "kmsKeyId", "kms.IKeyRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnIndexMixinProps(props) {
    const ret = {};
    if ((props.roleArn !== undefined))
        ret.roleArn = cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string");
    if ((props.serverSideEncryptionConfiguration !== undefined))
        ret.serverSideEncryptionConfiguration = flattenCfnIndexPropsMixinServerSideEncryptionConfigurationProperty(props.serverSideEncryptionConfiguration);
    return ret;
}
