"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.CfnAnomalyDetectorPropsMixin = exports.CfnAlertPropsMixin = 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-lookoutmetrics"));
/**
 * > End of support notice: On Oct 9, 2025, AWS will end support for Amazon Lookout for Metrics.
 *
 * After Oct 9, 2025, you will no longer be able to access the Amazon Lookout for Metrics console or Amazon Lookout for Metrics resources. For more information, see [Amazon Lookout for Metrics end of support](https://docs.aws.amazon.com//blogs/machine-learning/transitioning-off-amazon-lookout-for-metrics/) .
 *
 * The `AWS::LookoutMetrics::Alert` type creates an alert for an anomaly detector.
 *
 * @cloudformationResource AWS::LookoutMetrics::Alert
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lookoutmetrics-alert.html
 */
class CfnAlertPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_lookoutmetrics.CfnAlertPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["action", "alertDescription", "alertName", "alertSensitivityThreshold", "anomalyDetectorArn"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::LookoutMetrics::Alert`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_lookoutmetrics_CfnAlertMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnAlertPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnAlertMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnAlert.isCfnAlert(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnAlertPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnAlertPropsMixin = CfnAlertPropsMixin;
// @ts-ignore TS6133
function flattenCfnAlertPropsMixinLambdaConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        lambdaArn: (!props.lambdaArn ? undefined : props.lambdaArn),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnAlertPropsMixinSNSConfigurationProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string")),
        snsTopicArn: (!props.snsTopicArn ? undefined : props.snsTopicArn)
    };
}
// @ts-ignore TS6133
function flattenCfnAlertPropsMixinActionProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        lambdaConfiguration: (!props.lambdaConfiguration ? undefined : (!props.lambdaConfiguration ? undefined : flattenCfnAlertPropsMixinLambdaConfigurationProperty(props.lambdaConfiguration))),
        snsConfiguration: (!props.snsConfiguration ? undefined : (!props.snsConfiguration ? undefined : flattenCfnAlertPropsMixinSNSConfigurationProperty(props.snsConfiguration)))
    };
}
// @ts-ignore TS6133
function flattenCfnAlertMixinProps(props) {
    const ret = {};
    if ((props.action !== undefined))
        ret.action = flattenCfnAlertPropsMixinActionProperty(props.action);
    return ret;
}
/**
 * > End of support notice: On Oct 9, 2025, AWS will end support for Amazon Lookout for Metrics.
 *
 * After Oct 9, 2025, you will no longer be able to access the Amazon Lookout for Metrics console or Amazon Lookout for Metrics resources. For more information, see [Amazon Lookout for Metrics end of support](https://docs.aws.amazon.com//blogs/machine-learning/transitioning-off-amazon-lookout-for-metrics/) .
 *
 * The `AWS::LookoutMetrics::AnomalyDetector` type creates an anomaly detector.
 *
 * @cloudformationResource AWS::LookoutMetrics::AnomalyDetector
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lookoutmetrics-anomalydetector.html
 */
class CfnAnomalyDetectorPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_lookoutmetrics.CfnAnomalyDetectorPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["anomalyDetectorConfig", "anomalyDetectorDescription", "anomalyDetectorName", "kmsKeyArn", "metricSetList"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::LookoutMetrics::AnomalyDetector`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_lookoutmetrics_CfnAnomalyDetectorMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnAnomalyDetectorPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnAnomalyDetectorMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnAnomalyDetector.isCfnAnomalyDetector(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnAnomalyDetectorPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnAnomalyDetectorPropsMixin = CfnAnomalyDetectorPropsMixin;
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorPropsMixinS3SourceConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        fileFormatDescriptor: (!props.fileFormatDescriptor ? undefined : props.fileFormatDescriptor),
        historicalDataPathList: (!props.historicalDataPathList ? undefined : props.historicalDataPathList),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string")),
        templatedPathList: (!props.templatedPathList ? undefined : props.templatedPathList)
    };
}
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorPropsMixinCloudwatchConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorPropsMixinRDSSourceConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        databaseHost: (!props.databaseHost ? undefined : props.databaseHost),
        databaseName: (!props.databaseName ? undefined : props.databaseName),
        databasePort: (!props.databasePort ? undefined : props.databasePort),
        dbInstanceIdentifier: (!props.dbInstanceIdentifier ? undefined : props.dbInstanceIdentifier),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string")),
        secretManagerArn: (!props.secretManagerArn ? undefined : props.secretManagerArn),
        tableName: (!props.tableName ? undefined : props.tableName),
        vpcConfiguration: (!props.vpcConfiguration ? undefined : props.vpcConfiguration)
    };
}
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorPropsMixinAppFlowConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        flowName: (!props.flowName ? undefined : props.flowName),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorPropsMixinRedshiftSourceConfigProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        clusterIdentifier: (!props.clusterIdentifier ? undefined : props.clusterIdentifier),
        databaseHost: (!props.databaseHost ? undefined : props.databaseHost),
        databaseName: (!props.databaseName ? undefined : props.databaseName),
        databasePort: (!props.databasePort ? undefined : props.databasePort),
        roleArn: (!props.roleArn ? undefined : cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string")),
        secretManagerArn: (!props.secretManagerArn ? undefined : props.secretManagerArn),
        tableName: (!props.tableName ? undefined : props.tableName),
        vpcConfiguration: (!props.vpcConfiguration ? undefined : props.vpcConfiguration)
    };
}
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorPropsMixinMetricSourceProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        appFlowConfig: (!props.appFlowConfig ? undefined : (!props.appFlowConfig ? undefined : flattenCfnAnomalyDetectorPropsMixinAppFlowConfigProperty(props.appFlowConfig))),
        cloudwatchConfig: (!props.cloudwatchConfig ? undefined : (!props.cloudwatchConfig ? undefined : flattenCfnAnomalyDetectorPropsMixinCloudwatchConfigProperty(props.cloudwatchConfig))),
        rdsSourceConfig: (!props.rdsSourceConfig ? undefined : (!props.rdsSourceConfig ? undefined : flattenCfnAnomalyDetectorPropsMixinRDSSourceConfigProperty(props.rdsSourceConfig))),
        redshiftSourceConfig: (!props.redshiftSourceConfig ? undefined : (!props.redshiftSourceConfig ? undefined : flattenCfnAnomalyDetectorPropsMixinRedshiftSourceConfigProperty(props.redshiftSourceConfig))),
        s3SourceConfig: (!props.s3SourceConfig ? undefined : (!props.s3SourceConfig ? undefined : flattenCfnAnomalyDetectorPropsMixinS3SourceConfigProperty(props.s3SourceConfig)))
    };
}
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorPropsMixinMetricSetProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        dimensionList: (!props.dimensionList ? undefined : props.dimensionList),
        metricList: (!props.metricList ? undefined : props.metricList),
        metricSetDescription: (!props.metricSetDescription ? undefined : props.metricSetDescription),
        metricSetFrequency: (!props.metricSetFrequency ? undefined : props.metricSetFrequency),
        metricSetName: (!props.metricSetName ? undefined : props.metricSetName),
        metricSource: (!props.metricSource ? undefined : flattenCfnAnomalyDetectorPropsMixinMetricSourceProperty(props.metricSource)),
        offset: (!props.offset ? undefined : props.offset),
        timestampColumn: (!props.timestampColumn ? undefined : props.timestampColumn),
        timezone: (!props.timezone ? undefined : props.timezone)
    };
}
// @ts-ignore TS6133
function flattenCfnAnomalyDetectorMixinProps(props) {
    const ret = {};
    if ((props.kmsKeyArn !== undefined))
        ret.kmsKeyArn = cdk.getRefProperty(props.kmsKeyArn?.keyRef, 'keyArn') ?? cdk.ensureStringOrUndefined(props.kmsKeyArn, "kmsKeyArn", "kms.IKeyRef | string");
    if ((props.metricSetList !== undefined))
        ret.metricSetList = (cdk.isResolvableObject(props.metricSetList) ? props.metricSetList : cdk.mapArrayInPlace(props.metricSetList, (item) => flattenCfnAnomalyDetectorPropsMixinMetricSetProperty(item)));
    return ret;
}
