"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.CfnInputPropsMixin = exports.CfnDetectorModelPropsMixin = exports.CfnAlarmModelPropsMixin = 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-iotevents"));
/**
 * Represents an alarm model to monitor an AWS IoT Events input attribute.
 *
 * You can use the alarm to get notified when the value is outside a specified range. For more information, see [Create an alarm model](https://docs.aws.amazon.com/iotevents/latest/developerguide/create-alarms.html) in the *AWS IoT Events Developer Guide* .
 *
 * @cloudformationResource AWS::IoTEvents::AlarmModel
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-alarmmodel.html
 */
class CfnAlarmModelPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_iotevents.CfnAlarmModelPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["alarmCapabilities", "alarmEventActions", "alarmModelDescription", "alarmModelName", "alarmRule", "key", "roleArn", "severity", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::IoTEvents::AlarmModel`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_iotevents_CfnAlarmModelMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnAlarmModelPropsMixin);
            }
            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.CfnAlarmModel.isCfnAlarmModel(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnAlarmModelPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnAlarmModelPropsMixin = CfnAlarmModelPropsMixin;
/**
 * The AWS::IoTEvents::DetectorModel resource creates a detector model.
 *
 * You create a *detector model* (a model of your equipment or process) using *states* . For each state, you define conditional (Boolean) logic that evaluates the incoming inputs to detect significant events. When an event is detected, it can change the state or trigger custom-built or predefined actions using other AWS services. You can define additional events that trigger actions when entering or exiting a state and, optionally, when a condition is met. For more information, see [How to Use AWS IoT Events](https://docs.aws.amazon.com/iotevents/latest/developerguide/how-to-use-iotevents.html) in the *AWS IoT Events Developer Guide* .
 *
 * > When you successfully update a detector model (using the AWS IoT Events console, AWS IoT Events API or CLI commands, or CloudFormation ) all detector instances created by the model are reset to their initial states. (The detector's `state` , and the values of any variables and timers are reset.)
 * >
 * > When you successfully update a detector model (using the AWS IoT Events console, AWS IoT Events API or CLI commands, or CloudFormation ) the version number of the detector model is incremented. (A detector model with version number 1 before the update has version number 2 after the update succeeds.)
 * >
 * > If you attempt to update a detector model using CloudFormation and the update does not succeed, the system may, in some cases, restore the original detector model. When this occurs, the detector model's version is incremented twice (for example, from version 1 to version 3) and the detector instances are reset.
 * >
 * > Also, be aware that if you attempt to update several detector models at once using CloudFormation , some updates may succeed and others fail. In this case, the effects on each detector model's detector instances and version number depend on whether the update succeeded or failed, with the results as stated.
 *
 * @cloudformationResource AWS::IoTEvents::DetectorModel
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-detectormodel.html
 */
class CfnDetectorModelPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_iotevents.CfnDetectorModelPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["detectorModelDefinition", "detectorModelDescription", "detectorModelName", "evaluationMethod", "key", "roleArn", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::IoTEvents::DetectorModel`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_iotevents_CfnDetectorModelMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnDetectorModelPropsMixin);
            }
            throw error;
        }
        this.props = {
            ...props,
            ...flattenCfnDetectorModelMixinProps(props)
        };
        this.strategy = (options.strategy ?? cdk.PropertyMergeStrategy.combine());
    }
    /**
     * Check if this mixin supports the given construct
     */
    supports(construct) {
        return (cdk.CfnResource.isCfnResource(construct) && service.CfnDetectorModel.isCfnDetectorModel(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnDetectorModelPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnDetectorModelPropsMixin = CfnDetectorModelPropsMixin;
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinSnsProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        payload: (!props.payload ? undefined : props.payload),
        targetArn: (!props.targetArn ? undefined : cdk.getRefProperty(props.targetArn?.topicRef, 'topicArn') ?? cdk.ensureStringOrUndefined(props.targetArn, "targetArn", "sns.ITopicRef | string"))
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinActionProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        clearTimer: (!props.clearTimer ? undefined : props.clearTimer),
        dynamoDb: (!props.dynamoDb ? undefined : props.dynamoDb),
        dynamoDBv2: (!props.dynamoDBv2 ? undefined : props.dynamoDBv2),
        firehose: (!props.firehose ? undefined : props.firehose),
        iotEvents: (!props.iotEvents ? undefined : props.iotEvents),
        iotSiteWise: (!props.iotSiteWise ? undefined : props.iotSiteWise),
        iotTopicPublish: (!props.iotTopicPublish ? undefined : props.iotTopicPublish),
        lambda: (!props.lambda ? undefined : props.lambda),
        resetTimer: (!props.resetTimer ? undefined : props.resetTimer),
        setTimer: (!props.setTimer ? undefined : props.setTimer),
        setVariable: (!props.setVariable ? undefined : props.setVariable),
        sns: (!props.sns ? undefined : (!props.sns ? undefined : flattenCfnDetectorModelPropsMixinSnsProperty(props.sns))),
        sqs: (!props.sqs ? undefined : props.sqs)
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinEventProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        actions: (!props.actions ? undefined : (cdk.isResolvableObject(props.actions) ? props.actions : (!props.actions ? undefined : cdk.mapArrayInPlace(props.actions, (item) => flattenCfnDetectorModelPropsMixinActionProperty(item))))),
        condition: (!props.condition ? undefined : props.condition),
        eventName: (!props.eventName ? undefined : props.eventName)
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinTransitionEventProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        actions: (!props.actions ? undefined : (cdk.isResolvableObject(props.actions) ? props.actions : (!props.actions ? undefined : cdk.mapArrayInPlace(props.actions, (item) => flattenCfnDetectorModelPropsMixinActionProperty(item))))),
        condition: (!props.condition ? undefined : props.condition),
        eventName: (!props.eventName ? undefined : props.eventName),
        nextState: (!props.nextState ? undefined : props.nextState)
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinOnInputProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        events: (!props.events ? undefined : (cdk.isResolvableObject(props.events) ? props.events : (!props.events ? undefined : cdk.mapArrayInPlace(props.events, (item) => flattenCfnDetectorModelPropsMixinEventProperty(item))))),
        transitionEvents: (!props.transitionEvents ? undefined : (cdk.isResolvableObject(props.transitionEvents) ? props.transitionEvents : (!props.transitionEvents ? undefined : cdk.mapArrayInPlace(props.transitionEvents, (item) => flattenCfnDetectorModelPropsMixinTransitionEventProperty(item)))))
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinOnExitProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        events: (!props.events ? undefined : (cdk.isResolvableObject(props.events) ? props.events : (!props.events ? undefined : cdk.mapArrayInPlace(props.events, (item) => flattenCfnDetectorModelPropsMixinEventProperty(item)))))
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinOnEnterProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        events: (!props.events ? undefined : (cdk.isResolvableObject(props.events) ? props.events : (!props.events ? undefined : cdk.mapArrayInPlace(props.events, (item) => flattenCfnDetectorModelPropsMixinEventProperty(item)))))
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinStateProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        onEnter: (!props.onEnter ? undefined : (!props.onEnter ? undefined : flattenCfnDetectorModelPropsMixinOnEnterProperty(props.onEnter))),
        onExit: (!props.onExit ? undefined : (!props.onExit ? undefined : flattenCfnDetectorModelPropsMixinOnExitProperty(props.onExit))),
        onInput: (!props.onInput ? undefined : (!props.onInput ? undefined : flattenCfnDetectorModelPropsMixinOnInputProperty(props.onInput))),
        stateName: (!props.stateName ? undefined : props.stateName)
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelPropsMixinDetectorModelDefinitionProperty(props) {
    if (cdk.isResolvableObject(props))
        return props;
    return {
        initialStateName: (!props.initialStateName ? undefined : props.initialStateName),
        states: (!props.states ? undefined : (cdk.isResolvableObject(props.states) ? props.states : cdk.mapArrayInPlace(props.states, (item) => flattenCfnDetectorModelPropsMixinStateProperty(item))))
    };
}
// @ts-ignore TS6133
function flattenCfnDetectorModelMixinProps(props) {
    const ret = {};
    if ((props.detectorModelDefinition !== undefined))
        ret.detectorModelDefinition = flattenCfnDetectorModelPropsMixinDetectorModelDefinitionProperty(props.detectorModelDefinition);
    if ((props.roleArn !== undefined))
        ret.roleArn = cdk.getRefProperty(props.roleArn?.roleRef, 'roleArn') ?? cdk.ensureStringOrUndefined(props.roleArn, "roleArn", "iam.IRoleRef | string");
    return ret;
}
/**
 * The AWS::IoTEvents::Input resource creates an input.
 *
 * To monitor your devices and processes, they must have a way to get telemetry data into AWS IoT Events . This is done by sending messages as *inputs* to AWS IoT Events . For more information, see [How to Use AWS IoT Events](https://docs.aws.amazon.com/iotevents/latest/developerguide/how-to-use-iotevents.html) in the *AWS IoT Events Developer Guide* .
 *
 * @cloudformationResource AWS::IoTEvents::Input
 * @mixin true
 * @stability external
 * @see http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iotevents-input.html
 */
class CfnInputPropsMixin extends cdk.Mixin {
    static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/cfn-property-mixins.aws_iotevents.CfnInputPropsMixin", version: "2.258.1" };
    static CFN_PROPERTY_KEYS = ["inputDefinition", "inputDescription", "inputName", "tags"];
    props;
    strategy;
    /**
     * Create a mixin to apply properties to `AWS::IoTEvents::Input`.
     *
     * @param props L1 properties to apply
     * @param options Mixin options
     */
    constructor(props, options = {}) {
        super();
        try {
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_aws_iotevents_CfnInputMixinProps(props);
            jsiiDeprecationWarnings._aws_cdk_cfn_property_mixins_CfnPropertyMixinOptions(options);
        }
        catch (error) {
            if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
                Error.captureStackTrace(error, CfnInputPropsMixin);
            }
            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.CfnInput.isCfnInput(construct));
    }
    /**
     * Apply the mixin properties to the construct
     */
    applyTo(construct) {
        if (this.supports(construct)) {
            this.strategy.apply(construct, this.props, CfnInputPropsMixin.CFN_PROPERTY_KEYS);
        }
    }
}
exports.CfnInputPropsMixin = CfnInputPropsMixin;
