"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.NotificationRule=exports.DetailType=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),codestarnotifications_generated_1=require("./codestarnotifications.generated"),core_1=require("../../core");var DetailType;(function(DetailType2){DetailType2.BASIC="BASIC",DetailType2.FULL="FULL"})(DetailType||(exports.DetailType=DetailType={}));class NotificationRule extends core_1.Resource{static fromNotificationRuleArn(scope,id,notificationRuleArn){class Import extends core_1.Resource{constructor(){super(...arguments),this.notificationRuleArn=notificationRuleArn}addTarget(_target){return!1}}return new Import(scope,id,{environmentFromArn:notificationRuleArn})}constructor(scope,id,props){super(scope,id),this.targets=[],this.events=[];try{jsiiDeprecationWarnings.aws_cdk_lib_aws_codestarnotifications_NotificationRuleProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,NotificationRule),error}const source=props.source.bindAsNotificationRuleSource(this);this.addEvents(props.events);const resource=new codestarnotifications_generated_1.CfnNotificationRule(this,"Resource",{name:props.notificationRuleName||core_1.Names.uniqueId(this).slice(-64),detailType:props.detailType||DetailType.FULL,targets:this.targets,eventTypeIds:this.events,resource:source.sourceArn,status:props.enabled!==void 0?props.enabled?"ENABLED":"DISABLED":void 0});this.notificationRuleArn=resource.ref,props.targets?.forEach(target=>{this.addTarget(target)})}addTarget(target){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_codestarnotifications_INotificationRuleTarget(target)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addTarget),error}return this.targets.push(target.bindAsNotificationRuleTarget(this)),!0}addEvents(events){events.forEach(event=>{this.events.includes(event)||this.events.push(event)})}}exports.NotificationRule=NotificationRule,_a=JSII_RTTI_SYMBOL_1,NotificationRule[_a]={fqn:"aws-cdk-lib.aws_codestarnotifications.NotificationRule",version:"2.96.1"};
