// Copyright 2023 Google LLC
//
// 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 com.android.adservices.shared.proto;
option java_multiple_files = true;
option java_package = "com.android.adservices.shared.proto";

// Describes a sampling interval for a particular error code.
message ErrorCodeSampleInterval {

  // Default sample interval applied if error code is not present in the map.
  // If not defined, then default sample interval = 1 is used (no sampling).
  optional int32 default_sample_interval = 1;

  // A Map of sample interval (represented by the N in 1/N sampling) to list of error codes.
  // Sample interval which is the key in the map represents
  //   A value <=0 disables logging errors.
  //   A value of 1 indicates all the errors are logged.
  //   A value of N indicates that 1 out of N events are sampled.
  map<int32, ErrorCodeList> sample_interval_to_error_codes = 2;
}

message ErrorCodeList {
  repeated int32 error_code = 1;
}