"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.CfnTargetAccountConfigurationPropsMixin = exports.CfnExperimentTemplatePropsMixin = 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-fis"));
/**
 * Specifies an experiment template.
 *
 * An experiment template includes the following components:
 *
 * - *Targets* : A target can be a specific resource in your AWS environment, or one or more resources that match criteria that you specify, for example, resources that have specific tags.
 * - *Actions* : The actions to carry out on the target. You can specify multiple actions, the duration of each action, and when to start each action during an experiment.
 * - *Stop conditions* : If a stop condition is triggered while an experiment is running, the experiment is automatically stopped. You can define a stop condition as a CloudWatch alarm.
 *
 * For more information, see [Experiment templates](https://docs.aws.amazon.com/fis/latest/userguide/experiment-templates.html) in the *AWS Fault Injection Service User Guide* .
 *
 * @cloudformationResource AWS::FIS::ExperimentTemplate
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-fis-experimenttemplate.html
 */
class CfnExperimentTemplatePropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_fis.CfnExperimentTemplatePropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["actions", "description", "experimentOptions", "experimentReportConfiguration", "logConfiguration", "roleArn", "stopConditions", "tags", "targets"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::FIS::ExperimentTemplate`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_fis_CfnExperimentTemplateMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnExperimentTemplatePropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnExperimentTemplateMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnExperimentTemplate.isCfnExperimentTemplate(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnExperimentTemplatePropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnExperimentTemplatePropsMixin = CfnExperimentTemplatePropsMixin;
// @ts-ignore TS6133
function flattenCfnExperimentTemplatePropsMixinExperimentTemplateStopConditionProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        source: (!props.source ? undefined : props.source),
        value: (!props.value ? undefined : cdk.getRefProperty(props.value?.compositeAlarmRef, 'compositeAlarmArn') ?? cdk.ensureStringOrUndefined(props.value, "value", "cloudwatch.ICompositeAlarmRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnExperimentTemplateMixinProps(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.stopConditions !== undefined))
        ret.stopConditions = (cdk.isResolvableObject(props.stopConditions) ? props.stopConditions : cdk.mapArrayInPlace(props.stopConditions, (item) => flattenCfnExperimentTemplatePropsMixinExperimentTemplateStopConditionProperty(item)));
    return ret;
}
/**
 * Creates a target account configuration for the experiment template.
 *
 * A target account configuration is required when `accountTargeting` of `experimentOptions` is set to `multi-account` . For more information, see [experiment options](https://docs.aws.amazon.com/fis/latest/userguide/experiment-options.html) in the *AWS Fault Injection Service User Guide* .
 *
 * @cloudformationResource AWS::FIS::TargetAccountConfiguration
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-fis-targetaccountconfiguration.html
 */
class CfnTargetAccountConfigurationPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_fis.CfnTargetAccountConfigurationPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["accountId", "description", "experimentTemplateId", "roleArn"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::FIS::TargetAccountConfiguration`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_fis_CfnTargetAccountConfigurationMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnTargetAccountConfigurationPropsMixin);
            }
            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.CfnTargetAccountConfiguration.isCfnTargetAccountConfiguration(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnTargetAccountConfigurationPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnTargetAccountConfigurationPropsMixin = CfnTargetAccountConfigurationPropsMixin;
