"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpGatewayRoutePathMatch=exports.HttpRoutePathMatch=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");class HttpRoutePathMatch{static exactly(path){return new HttpRouteWholePathMatch({exact:path})}static regex(regex){return new HttpRouteWholePathMatch({regex})}static startsWith(prefix){return new HttpRoutePrefixPathMatch(prefix)}}exports.HttpRoutePathMatch=HttpRoutePathMatch,_a=JSII_RTTI_SYMBOL_1,HttpRoutePathMatch[_a]={fqn:"aws-cdk-lib.aws_appmesh.HttpRoutePathMatch",version:"2.148.1"};class HttpRoutePrefixPathMatch extends HttpRoutePathMatch{constructor(prefix){if(super(),this.prefix=prefix,prefix&&prefix[0]!=="/")throw new Error(`Prefix Path for the match must start with '/', got: ${prefix}`)}bind(_scope){return{prefixPathMatch:this.prefix}}}class HttpRouteWholePathMatch extends HttpRoutePathMatch{constructor(match){if(super(),this.match=match,match.exact&&match.exact[0]!=="/")throw new Error(`Exact Path for the match must start with '/', got: ${match.exact}`)}bind(_scope){return{wholePathMatch:this.match}}}class HttpGatewayRoutePathMatch{static startsWith(prefix,rewriteTo){return new HttpGatewayRoutePrefixPathMatch(prefix,rewriteTo)}static exactly(path,rewriteTo){return new HttpGatewayRouteWholePathMatch({exact:path},rewriteTo)}static regex(regex,rewriteTo){return new HttpGatewayRouteWholePathMatch({regex},rewriteTo)}}exports.HttpGatewayRoutePathMatch=HttpGatewayRoutePathMatch,_b=JSII_RTTI_SYMBOL_1,HttpGatewayRoutePathMatch[_b]={fqn:"aws-cdk-lib.aws_appmesh.HttpGatewayRoutePathMatch",version:"2.148.1"};class HttpGatewayRoutePrefixPathMatch extends HttpGatewayRoutePathMatch{constructor(prefixPathMatch,rewriteTo){if(super(),this.prefixPathMatch=prefixPathMatch,this.rewriteTo=rewriteTo,prefixPathMatch[0]!=="/")throw new Error(`Prefix path for the match must start with '/', got: ${prefixPathMatch}`);if(rewriteTo){if(prefixPathMatch[prefixPathMatch.length-1]!=="/")throw new Error(`When prefix path for the rewrite is specified, prefix path for the match must end with '/', got: ${prefixPathMatch}`);if(rewriteTo[0]!=="/"||rewriteTo[rewriteTo.length-1]!=="/")throw new Error(`Prefix path for the rewrite must start and end with '/', got: ${rewriteTo}`)}}bind(_scope){return{prefixPathMatch:this.prefixPathMatch,prefixPathRewrite:this.rewriteTo===void 0?void 0:{defaultPrefix:this.rewriteTo===""?"DISABLED":void 0,value:this.rewriteTo===""?void 0:this.rewriteTo}}}}class HttpGatewayRouteWholePathMatch extends HttpGatewayRoutePathMatch{constructor(wholePathMatch,exactPathRewrite){if(super(),this.wholePathMatch=wholePathMatch,this.exactPathRewrite=exactPathRewrite,wholePathMatch.exact&&wholePathMatch.exact[0]!=="/")throw new Error(`Exact Path for the match must start with '/', got: ${wholePathMatch.exact}`);if(exactPathRewrite==="")throw new Error("Exact Path for the rewrite cannot be empty. Unlike startsWith() method, no automatic rewrite on whole path match");if(exactPathRewrite&&exactPathRewrite[0]!=="/")throw new Error(`Exact Path for the rewrite must start with '/', got: ${exactPathRewrite}`)}bind(_scope){return{wholePathMatch:this.wholePathMatch,wholePathRewrite:this.exactPathRewrite===void 0?void 0:{exact:this.exactPathRewrite}}}}
