"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.HttpGatewayRoutePathMatch=exports.HttpRoutePathMatch=void 0;const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var errors_1=()=>{var tmp=require("../../core/lib/errors");return errors_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class HttpRoutePathMatch{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.HttpRoutePathMatch",version:"2.256.1"};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;class HttpRoutePrefixPathMatch extends HttpRoutePathMatch{prefix;constructor(prefix){if(super(),this.prefix=prefix,prefix&&prefix[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathMustStartWithSlash`,`Prefix Path for the match must start with '/', got: ${prefix}`)}bind(_scope){return{prefixPathMatch:this.prefix}}}class HttpRouteWholePathMatch extends HttpRoutePathMatch{match;constructor(match){if(super(),this.match=match,match.exact&&match.exact[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathMustStartWithSlash`,`Exact Path for the match must start with '/', got: ${match.exact}`)}bind(_scope){return{wholePathMatch:this.match}}}class HttpGatewayRoutePathMatch{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_appmesh.HttpGatewayRoutePathMatch",version:"2.256.1"};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;class HttpGatewayRoutePrefixPathMatch extends HttpGatewayRoutePathMatch{prefixPathMatch;rewriteTo;constructor(prefixPathMatch,rewriteTo){if(super(),this.prefixPathMatch=prefixPathMatch,this.rewriteTo=rewriteTo,prefixPathMatch[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathMustStartWithSlash`,`Prefix path for the match must start with '/', got: ${prefixPathMatch}`);if(rewriteTo){if(prefixPathMatch[prefixPathMatch.length-1]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathMustEndWithSlash`,`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(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`PrefixPathRewriteMustStartAndEndWithSlash`,`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{wholePathMatch;exactPathRewrite;constructor(wholePathMatch,exactPathRewrite){if(super(),this.wholePathMatch=wholePathMatch,this.exactPathRewrite=exactPathRewrite,wholePathMatch.exact&&wholePathMatch.exact[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathMustStartWithSlash`,`Exact Path for the match must start with '/', got: ${wholePathMatch.exact}`);if(exactPathRewrite==="")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathRewriteCannotBeEmpty`,"Exact Path for the rewrite cannot be empty. Unlike startsWith() method, no automatic rewrite on whole path match");if(exactPathRewrite&&exactPathRewrite[0]!=="/")throw new(errors_1()).UnscopedValidationError((0,literal_string_1().lit)`ExactPathRewriteMustStartWithSlash`,`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}}}}
