syntax = "proto3";

package envoy.extensions.filters.common.dependency.v3;

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

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

// [#protodoc-title: Filter dependency specification]

// Dependency specification and string identifier.
message Dependency {
  enum DependencyType {
    HEADER = 0;
    FILTER_STATE_KEY = 1;
    DYNAMIC_METADATA = 2;
  }

  // The kind of dependency.
  DependencyType type = 1;

  // The string identifier for the dependency.
  string name = 2 [(validate.rules).string = {min_len: 1}];
}

// Dependency specification for a filter. For a filter chain to be valid, any
// dependency that is required must be provided by an earlier filter.
message FilterDependencies {
  // A list of dependencies required on the decode path.
  repeated Dependency decode_required = 1;

  // A list of dependencies provided on the encode path.
  repeated Dependency decode_provided = 2;

  // A list of dependencies required on the decode path.
  repeated Dependency encode_required = 3;

  // A list of dependencies provided on the encode path.
  repeated Dependency encode_provided = 4;
}

// Matching requirements for a filter. For a match tree to be used with a filter, the match
// requirements must be satisfied.
//
// This protobuf is provided by the filter implementation as a way to communicate the matching
// requirements to the filter factories, allowing for config rejection if the requirements are
// not satisfied.
message MatchingRequirements {
  message DataInputAllowList {
    // An explicit list of data inputs that are allowed to be used with this filter.
    repeated string type_url = 1;
  }

  DataInputAllowList data_input_allow_list = 1;
}
