"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SqsSendMessage=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var target_1=()=>{var tmp=require("./target");return target_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class SqsSendMessage extends target_1().ScheduleTargetBase{queue;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_scheduler_targets.SqsSendMessage",version:"2.256.1"};constructor(queue,props={}){super(props,queue.queueArn),this.queue=queue,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sqs_IQueue(queue),jsiiDeprecationWarnings().aws_cdk_lib_aws_scheduler_targets_SqsSendMessageProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SqsSendMessage),error}if(props.messageGroupId!==void 0){if(!core_1().Token.isUnresolved(props.messageGroupId)&&(props.messageGroupId.length<1||props.messageGroupId.length>128))throw new(core_1()).ValidationError((0,literal_string_1().lit)`MessageGroupIdLength`,`messageGroupId length must be between 1 and 128, got ${props.messageGroupId.length}`,queue);if(!queue.fifo)throw new(core_1()).ValidationError((0,literal_string_1().lit)`TargetQueueMessageGroupId`,"target must be a FIFO queue if messageGroupId is specified",queue);if(!queue.node.defaultChild.contentBasedDeduplication)throw new(core_1()).ValidationError((0,literal_string_1().lit)`ContentBasedDeduplicationTrueTarget`,"contentBasedDeduplication must be true if the target is a FIFO queue",queue)}else if(queue.fifo)throw new(core_1()).ValidationError((0,literal_string_1().lit)`MessageGroupIdSpecifiedTarget`,"messageGroupId must be specified if the target is a FIFO queue",queue)}addTargetActionToRole(role){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_iam_IRole(role)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addTargetActionToRole),error}this.queue.grant(role,"sqs:SendMessage"),this.queue.encryptionMasterKey?.grant(role,"kms:Decrypt","kms:GenerateDataKey*")}bindBaseTargetConfig(_schedule){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_scheduler_ISchedule(_schedule)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bindBaseTargetConfig),error}return{...super.bindBaseTargetConfig(_schedule),sqsParameters:{messageGroupId:this.props.messageGroupId}}}}exports.SqsSendMessage=SqsSendMessage;
