"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Map=exports.isPositiveInteger=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),chain_1=require("../chain"),fields_1=require("../fields"),state_graph_1=require("../state-graph"),state_type_1=require("./private/state-type"),state_1=require("./state");exports.isPositiveInteger=value=>{const isFloat=Math.floor(value)!==value,isNotPositiveInteger=value<0||value>Number.MAX_SAFE_INTEGER;return!isFloat&&!isNotPositiveInteger};class Map extends state_1.State{constructor(scope,id,props={}){super(scope,id,props);jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_MapProps(props),this.endStates=[this],this.maxConcurrency=props.maxConcurrency,this.itemsPath=props.itemsPath}addRetry(props={}){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_RetryProps(props),super._addRetry(props),this}addCatch(handler,props={}){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(handler),jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_CatchProps(props),super._addCatch(handler.startState,props),this}next(next){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(next),super.makeNext(next.startState),chain_1.Chain.sequence(this,next)}iterator(iterator){jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(iterator);const name=`Map ${this.stateId} Iterator`;return super.addIterator(new state_graph_1.StateGraph(iterator.startState,name)),this}toStateJson(){return{Type:state_type_1.StateType.MAP,Comment:this.comment,ResultPath:state_1.renderJsonPath(this.resultPath),...this.renderNextEnd(),...this.renderInputOutput(),...this.renderParameters(),...this.renderResultSelector(),...this.renderRetryCatch(),...this.renderIterator(),...this.renderItemsPath(),MaxConcurrency:this.maxConcurrency}}validateState(){const errors=[];return this.iteration===void 0&&errors.push("Map state must have a non-empty iterator"),this.maxConcurrency!==void 0&&!exports.isPositiveInteger(this.maxConcurrency)&&errors.push("maxConcurrency has to be a positive integer"),errors}renderItemsPath(){return{ItemsPath:state_1.renderJsonPath(this.itemsPath)}}renderParameters(){return fields_1.FieldUtils.renderObject({Parameters:this.parameters})}}exports.Map=Map,_a=JSII_RTTI_SYMBOL_1,Map[_a]={fqn:"aws-cdk-lib.aws_stepfunctions.Map",version:"2.13.0"};
//# sourceMappingURL=map.js.map
