"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Parallel=void 0;const jsiiDeprecationWarnings=require("../../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),chain_1=require("../chain"),state_graph_1=require("../state-graph"),state_type_1=require("./private/state-type"),state_1=require("./state");class Parallel extends state_1.State{constructor(scope,id,props={}){super(scope,id,props);this._branches=[],jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_ParallelProps(props),this.endStates=[this]}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)}branch(...branches){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(branches),this._branches.push(...branches),this}bindToGraph(graph){jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_StateGraph(graph);for(const branch of this._branches){const name=`Parallel '${this.stateId}' branch ${this.branches.length+1}`;super.addBranch(new state_graph_1.StateGraph(branch.startState,name))}return this._branches.splice(0,this._branches.length),super.bindToGraph(graph)}toStateJson(){return{Type:state_type_1.StateType.PARALLEL,Comment:this.comment,ResultPath:state_1.renderJsonPath(this.resultPath),...this.renderNextEnd(),...this.renderInputOutput(),...this.renderRetryCatch(),...this.renderBranches(),...this.renderResultSelector()}}validateState(){return this.branches.length===0?["Parallel must have at least one branch"]:[]}}exports.Parallel=Parallel,_a=JSII_RTTI_SYMBOL_1,Parallel[_a]={fqn:"aws-cdk-lib.aws_stepfunctions.Parallel",version:"2.13.0"};
//# sourceMappingURL=parallel.js.map
