"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.StepFunctionsRestApi=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),iam=require("../../aws-iam"),sfn=require("../../aws-stepfunctions"),_1=require("."),stepfunctions_1=require("./integrations/stepfunctions"),model_1=require("./model");class StepFunctionsRestApi extends _1.RestApi{constructor(scope,id,props){var _b,_c;if(jsiiDeprecationWarnings.aws_cdk_lib_aws_apigateway_StepFunctionsRestApiProps(props),props.defaultIntegration)throw new Error('Cannot specify "defaultIntegration" since Step Functions integration is automatically defined');if(props.stateMachine.node.defaultChild.stateMachineType!==sfn.StateMachineType.EXPRESS)throw new Error('State Machine must be of type "EXPRESS". Please use StateMachineType.EXPRESS as the stateMachineType');const stepfunctionsIntegration=stepfunctions_1.StepFunctionsIntegration.startExecution(props.stateMachine,{credentialsRole:role(scope,props),requestContext:props.requestContext,path:(_b=props.path)!==null&&_b!==void 0?_b:!0,querystring:(_c=props.querystring)!==null&&_c!==void 0?_c:!0,headers:props.headers});super(scope,id,props);this.root.addMethod("ANY",stepfunctionsIntegration,{methodResponses:methodResponse()})}}exports.StepFunctionsRestApi=StepFunctionsRestApi,_a=JSII_RTTI_SYMBOL_1,StepFunctionsRestApi[_a]={fqn:"aws-cdk-lib.aws_apigateway.StepFunctionsRestApi",version:"2.13.0"};function role(scope,props){const roleName="StartSyncExecutionRole",apiRole=new iam.Role(scope,roleName,{assumedBy:new iam.ServicePrincipal("apigateway.amazonaws.com")});return props.stateMachine.grantStartSyncExecution(apiRole),apiRole}function methodResponse(){return[{statusCode:"200",responseModels:{"application/json":model_1.Model.EMPTY_MODEL}},{statusCode:"400",responseModels:{"application/json":model_1.Model.ERROR_MODEL}},{statusCode:"500",responseModels:{"application/json":model_1.Model.ERROR_MODEL}}]}
//# sourceMappingURL=stepfunctions-api.js.map
