// 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.common.matching.v3;

import "envoy/config/common/matcher/v3/matcher.proto";
import "envoy/config/core/v3/extension.proto";

import "xds/type/matcher/v3/matcher.proto";

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

option java_package = "io.envoyproxy.envoy.extensions.common.matching.v3";
option java_outer_classname = "ExtensionMatcherProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/common/matching/v3;matchingv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Extension matcher]

// Wrapper around an existing extension that provides an associated matcher. This allows
// decorating an existing extension with a matcher, which can be used to match against
// relevant protocol data.
message ExtensionWithMatcher {
  // The associated matcher. This is deprecated in favor of xds_matcher.
  config.common.matcher.v3.Matcher matcher = 1
      [deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

  // The associated matcher.
  xds.type.matcher.v3.Matcher xds_matcher = 3;

  // The underlying extension config.
  config.core.v3.TypedExtensionConfig extension_config = 2
      [(validate.rules).message = {required: true}];
}

// Extra settings on a per virtualhost/route/weighted-cluster level.
message ExtensionWithMatcherPerRoute {
  // Matcher override.
  xds.type.matcher.v3.Matcher xds_matcher = 1;
}
