// Copyright 2026 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 google.ads.admanager.v1;

import "google/ads/admanager/v1/report_definition.proto";
import "google/ads/admanager/v1/report_delivery.proto";
import "google/ads/admanager/v1/report_value.proto";
import "google/ads/admanager/v1/report_visibility_enum.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/timestamp.proto";

option csharp_namespace = "Google.Ads.AdManager.V1";
option go_package = "google.golang.org/genproto/googleapis/ads/admanager/v1;admanager";
option java_multiple_files = true;
option java_outer_classname = "ReportMessagesProto";
option java_package = "com.google.ads.admanager.v1";
option php_namespace = "Google\\Ads\\AdManager\\V1";
option ruby_package = "Google::Ads::AdManager::V1";

// The `Report` resource.
message Report {
  option (google.api.resource) = {
    type: "admanager.googleapis.com/Report"
    pattern: "networks/{network_code}/reports/{report}"
    plural: "reports"
    singular: "report"
  };

  // Identifier. The resource name of the report.
  // Report resource name have the form:
  // `networks/{network_code}/reports/{report_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Output only. Report ID.
  int64 report_id = 3 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The visibility of a report.
  ReportVisibilityEnum.ReportVisibility visibility = 2
      [(google.api.field_behavior) = OPTIONAL];

  // Required. The report definition of the report.
  ReportDefinition report_definition = 4
      [(google.api.field_behavior) = REQUIRED];

  // Optional. Display name for the report.
  string display_name = 5 [(google.api.field_behavior) = OPTIONAL];

  // Output only. The instant this report was last modified.
  google.protobuf.Timestamp update_time = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The instant this report was created.
  google.protobuf.Timestamp create_time = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The locale of this report. Locale is set from the user's
  // locale at the time of the request. Locale can't be modified.
  string locale = 8 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The schedule options of this report.
  ScheduleOptions schedule_options = 9 [(google.api.field_behavior) = OPTIONAL];
}

// A table containing report data including dimension and metric values.
message ReportDataTable {
  // A row of report data.
  message Row {
    // The order of the dimension values is the same as the order of the
    // dimensions specified in the request.
    repeated ReportValue dimension_values = 1;

    //
    // The length of the metric_value_groups
    // field will be equal to the length of the date_ranges field in the
    // fetch response. The metric_value_groups field is
    // ordered such that each index corresponds to the date_range at the same
    // index. For example, given date_ranges [x, y], metric_value_groups will
    // have a length of two. The first entry in metric_value_groups represents
    // the metrics for date x and the second entry in metric_value_groups
    // represents the metrics for date y.
    repeated MetricValueGroup metric_value_groups = 2;
  }

  // Contains all metric values requested for a single date range and set of
  // column dimension values (returned in the columns field of the response).
  // The order of the metrics in each field corresponds to the order of the
  // metrics specified in the request.
  message MetricValueGroup {
    // Data for the PRIMARY MetricValueType.
    repeated ReportValue primary_values = 1;

    // Data for the PRIMARY_PERCENT_OF_TOTAL MetricValueType.
    repeated ReportValue primary_percent_of_total_values = 2;

    // Data for the COMPARISON MetricValueType.
    repeated ReportValue comparison_values = 3;

    // Data for the COMPARISON_PERCENT_OF_TOTAL MetricValueType.
    repeated ReportValue comparison_percent_of_total_values = 4;

    // Data for the ABSOLUTE_CHANGE MetricValueType.
    repeated ReportValue absolute_change_values = 5;

    // Data for the RELATIVE_CHANGE MetricValueType.
    repeated ReportValue relative_change_values = 6;

    // If true, the flag's conditions are met. If false, the flag's
    // conditions are not met. flag_values has the same length as
    // flags and index i of flag_values represents the flag at index i
    // of flags.
    repeated bool flag_values = 7;
  }
}
