// Copyright 2025 Envoy Project Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package envoy.extensions.path.match.uri_template.v3;

import "udpa/annotations/status.proto";
import "validate/validate.proto";

option java_package = "io.envoyproxy.envoy.extensions.path.match.uri_template.v3";
option java_outer_classname = "UriTemplateMatchProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/path/match/uri_template/v3;uri_templatev3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Uri Template Match Config]
// [#extension: envoy.path.match.uri_template.uri_template_matcher]

// If specified, the route is a template match rule meaning that the
// ``:path`` header (without the query string) must match the given
// ``path_template`` pattern.
//
// Path template matching types:
//
// * ``*`` : Matches a single path component, up to the next path separator: /
//
// * ``**`` : Matches zero or more path segments. If present, must be the last operator.
//
// * ``{name} or {name=*}`` :  A named variable matching one path segment up to the next path separator: /.
//
// * ``{name=videos/*}`` : A named variable matching more than one path segment.
//      The path component matching videos/* is captured as the named variable.
//
// * ``{name=**}`` : A named variable matching zero or more path segments.
//
//
// For example:
//
// * ``/videos/*/*/*.m4s`` would match ``videos/123414/hls/1080p5000_00001.m4s``
//
// * ``/videos/{file}`` would match ``/videos/1080p5000_00001.m4s``
//
// * ``/**.mpd`` would match ``/content/123/india/dash/55/manifest.mpd``
message UriTemplateMatchConfig {
  string path_template = 1 [(validate.rules).string = {min_len: 1 max_len: 256}];
}
