/*
* Copyright (C) 2025 The Android Open Source Project
*
* 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 luci.resultdb.v1;

import public "tools/tradefederation/core/proto/resultdb/common.proto";

option go_package = "go.chromium.org/luci/resultdb/proto/v1;resultpb";
option java_package = "com.android.resultdb.proto";
option java_multiple_files = true;

message TestAggregation {
  // The test identifier prefix represented by the test aggregate.
  TestIdentifierPrefix id = 1;

  // The next (finer) aggregation level to use if drilling into this aggregate,
  // based on the currently defined scheme information.
  // Some schemes do not use one or both intermediate hierarchy levels, this
  // makes it easy to skip them.
  // If unset, no finer aggregation is available and the next finer level
  // is test verdicts.
  AggregationLevel next_finer_level = 2;

  // Counts of verdicts, by status v2.
  message VerdictCounts {
    // Counts of verdicts by base status.

    // The number of failed verdicts.
    // Count includes both exonerated and non-exonerated verdicts.
    int32 failed = 1;
    // The number of flaky verdicts.
    int32 flaky = 2;
    // The number of passed verdicts.
    int32 passed = 3;
    // The number of skipped verdicts.
    int32 skipped = 4;
    // The number of execution errored verdicts.
    // Count includes both exonerated and non-exonerated verdicts.
    int32 execution_errored = 5;
    // The number of precluded verdicts.
    // Count includes both exonerated and non-exonerated verdicts.
    int32 precluded = 6;

    // Breakdown of selected failing statuses by override status.
    // Summing all _exonerated_count(s) below yields the total number
    // of exonerated verdicts.

    // The number of failed verdicts with exonerations.
    int32 failed_exonerated = 7;
    // The number of execution errored verdicts with exonerations.
    int32 execution_errored_exonerated = 8;
    // The number of precluded verdicts with exonerations.
    int32 precluded_exonerated = 9;
  }

  // The counts of test verdict statuses rolling up to this aggregation.
  VerdictCounts verdict_counts = 3;

  // In future, we will add module status counts (e.g. failed, flaky) here.
}
