"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.WebSocketRouteIntegration=exports.WebSocketIntegration=exports.PassthroughBehavior=exports.ContentHandling=exports.WebSocketIntegrationType=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var index_1=()=>{var tmp=require(".././index");return index_1=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},WebSocketIntegrationType;(function(WebSocketIntegrationType2){WebSocketIntegrationType2.AWS_PROXY="AWS_PROXY",WebSocketIntegrationType2.MOCK="MOCK",WebSocketIntegrationType2.AWS="AWS"})(WebSocketIntegrationType||(exports.WebSocketIntegrationType=WebSocketIntegrationType={}));var ContentHandling;(function(ContentHandling2){ContentHandling2.CONVERT_TO_BINARY="CONVERT_TO_BINARY",ContentHandling2.CONVERT_TO_TEXT="CONVERT_TO_TEXT"})(ContentHandling||(exports.ContentHandling=ContentHandling={}));var PassthroughBehavior;(function(PassthroughBehavior2){PassthroughBehavior2.WHEN_NO_MATCH="WHEN_NO_MATCH",PassthroughBehavior2.NEVER="NEVER",PassthroughBehavior2.WHEN_NO_TEMPLATES="WHEN_NO_TEMPLATES"})(PassthroughBehavior||(exports.PassthroughBehavior=PassthroughBehavior={}));class WebSocketIntegration extends core_1().Resource{constructor(scope,id,props){super(scope,id);try{jsiiDeprecationWarnings().aws_cdk_lib_aws_apigatewayv2_WebSocketIntegrationProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,WebSocketIntegration),error}if(props.timeout&&!props.timeout.isUnresolved()&&(props.timeout.toMilliseconds()<50||props.timeout.toMilliseconds()>29e3))throw new Error("Integration timeout must be between 50 milliseconds and 29 seconds.");const integ=new(index_1()).CfnIntegration(this,"Resource",{apiId:props.webSocketApi.apiId,integrationType:props.integrationType,integrationUri:props.integrationUri,integrationMethod:props.integrationMethod,contentHandlingStrategy:props.contentHandling,credentialsArn:props.credentialsRole?.roleArn,requestParameters:props.requestParameters,requestTemplates:props.requestTemplates,passthroughBehavior:props.passthroughBehavior,templateSelectionExpression:props.templateSelectionExpression,timeoutInMillis:props.timeout?.toMilliseconds()});this.integrationId=integ.ref,this.webSocketApi=props.webSocketApi}}exports.WebSocketIntegration=WebSocketIntegration,_a=JSII_RTTI_SYMBOL_1,WebSocketIntegration[_a]={fqn:"aws-cdk-lib.aws_apigatewayv2.WebSocketIntegration",version:"2.159.0"};class WebSocketRouteIntegration{constructor(id){this.id=id}_bindToRoute(options){if(this.integration&&this.integration.webSocketApi.node.addr!==options.route.webSocketApi.node.addr)throw new Error("A single integration cannot be associated with multiple APIs.");if(!this.integration){const config=this.bind(options);this.integration=new WebSocketIntegration(options.scope,this.id,{webSocketApi:options.route.webSocketApi,integrationType:config.type,integrationUri:config.uri,integrationMethod:config.method,contentHandling:config.contentHandling,credentialsRole:config.credentialsRole,requestTemplates:config.requestTemplates,requestParameters:config.requestParameters,timeout:config.timeout,passthroughBehavior:config.passthroughBehavior,templateSelectionExpression:config.templateSelectionExpression})}return{integrationId:this.integration.integrationId}}}exports.WebSocketRouteIntegration=WebSocketRouteIntegration,_b=JSII_RTTI_SYMBOL_1,WebSocketRouteIntegration[_b]={fqn:"aws-cdk-lib.aws_apigatewayv2.WebSocketRouteIntegration",version:"2.159.0"};
