// Copyright 2020-2025 Buf Technologies, Inc.
//
// 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 buf.alpha.lint.v1;

// Config represents the lint configuration for a module. The rule and category IDs are defined
// by the version and apply across the config. The version is independent of the version of
// the package. The package version refers to the config shape, the version encoded in the Config message
// indicates which rule and category IDs should be used.
//
// The rule and category IDs are not encoded as enums in this package because we may want to support custom rule
// and category IDs in the future. Callers will need to resolve the rule and category ID strings.
message Config {
  // version represents the version of the lint rule and category IDs that should be used with this config.
  string version = 1;
  // use_ids lists the rule and/or category IDs that are included in the lint check.
  repeated string use_ids = 2;
  // except_ids lists the rule and/or category IDs that are excluded from the lint check.
  repeated string except_ids = 3;
  // ignore_paths lists the paths of directories and/or files that should be ignored by the lint check.
  // All paths are relative to the root of the module.
  repeated string ignore_paths = 4;
  // ignore_id_paths is a map of rule and/or category IDs to directory and/or file paths to exclude from the
  // lint check. This corresponds with the ignore_only configuration key.
  repeated IDPaths ignore_id_paths = 5;
  // enum_zero_value_suffix controls the behavior of the ENUM_ZERO_VALUE lint rule ID. By default, this rule
  // verifies that the zero value of all enums ends in _UNSPECIFIED. This config allows the user to override
  // this value with the given string.
  string enum_zero_value_suffix = 6;
  // rpc_allow_same_request_response allows the same message type for both the request and response of an RPC.
  bool rpc_allow_same_request_response = 7;
  // rpc_allow_google_protobuf_empty_requests allows the RPC requests to use the google.protobuf.Empty message.
  bool rpc_allow_google_protobuf_empty_requests = 8;
  // rpc_allow_google_protobuf_empty_responses allows the RPC responses to use the google.protobuf.Empty message.
  bool rpc_allow_google_protobuf_empty_responses = 9;
  // service_suffix applies to the SERVICE_SUFFIX rule ID. By default, the rule verifies that all service names
  // end with the suffix Service. This allows users to override the value with the given string.
  string service_suffix = 10;
  // allow_comment_ignores turns on comment-driven ignores.
  bool allow_comment_ignores = 11;
}

// IDPaths represents a rule or category ID and the file and/or directory paths that are ignored for the rule.
message IDPaths {
  string id = 1;
  repeated string paths = 2;
}
