"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.Chain=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),parallel_1=require("./states/parallel");class Chain{constructor(startState,endStates,lastAdded){this.lastAdded=lastAdded,this.id=lastAdded.id,this.startState=startState,this.endStates=endStates}static start(state){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(state),new Chain(state.startState,state.endStates,state)}static sequence(start,next){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(start),jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(next),new Chain(start.startState,next.endStates,next)}static custom(startState,endStates,lastAdded){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_State(startState),jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(lastAdded),new Chain(startState,endStates,lastAdded)}next(next){if(jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_IChainable(next),this.endStates.length===0)throw new Error(`Cannot add to chain: last state in chain (${this.lastAdded.id}) does not allow it`);for(const endState of this.endStates)endState.next(next);return new Chain(this.startState,next.endStates,next)}toSingleState(id,props={}){return jsiiDeprecationWarnings.aws_cdk_lib_aws_stepfunctions_ParallelProps(props),new parallel_1.Parallel(this.startState,id,props).branch(this)}}exports.Chain=Chain,_a=JSII_RTTI_SYMBOL_1,Chain[_a]={fqn:"aws-cdk-lib.aws_stepfunctions.Chain",version:"2.13.0"};
//# sourceMappingURL=chain.js.map
