// 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.datamanager.v1;

import "google/api/field_behavior.proto";
import "google/protobuf/duration.proto";

option csharp_namespace = "Google.Ads.DataManager.V1";
option go_package = "cloud.google.com/go/datamanager/apiv1/datamanagerpb;datamanagerpb";
option java_multiple_files = true;
option java_outer_classname = "ViewabilityInfoProto";
option java_package = "com.google.ads.datamanager.v1";
option php_namespace = "Google\\Ads\\DataManager\\V1";
option ruby_package = "Google::Ads::DataManager::V1";

// Details of the viewability of the ad served.
message ViewabilityInfo {
  // Required. The type of the event.
  ViewType view_type = 1 [(google.api.field_behavior) = REQUIRED];

  // Optional. The numerical percent (0-100) of the pixels that were viewable.
  int32 viewable_percent = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The amount of time the ad was viewable for.
  google.protobuf.Duration viewable_duration = 3
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether the ad media was skippable or not.
  bool media_skippable = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The amount of the media that was played as discrete quartiles.
  MediaQuartile media_quartile = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The duration of the ad media.
  google.protobuf.Duration media_duration = 6
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The numerical percent (0-100) of the volume of the media
  // playback.
  int32 media_volume_percent = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The duration of playback of the ad media, regardless of whether
  // it was viewable or not.
  google.protobuf.Duration playback_duration = 8
      [(google.api.field_behavior) = OPTIONAL];
}

// The type of the event.
enum ViewType {
  // Unspecified view type.
  VIEW_TYPE_UNSPECIFIED = 0;

  // MRC viewed.
  VIEW_TYPE_MRC_VIEWED = 1;

  // MRC rendered.
  VIEW_TYPE_MRC_RENDERED = 2;
}

// The amount of the media that was played as discrete quartiles.
enum MediaQuartile {
  // Unspecified media quartile.
  MEDIA_QUARTILE_UNSPECIFIED = 0;

  // Start.
  MEDIA_QUARTILE_START = 1;

  // First quartile.
  MEDIA_QUARTILE_FIRST_QUARTILE = 2;

  // Midpoint.
  MEDIA_QUARTILE_MIDPOINT = 3;

  // Third quartile.
  MEDIA_QUARTILE_THIRD_QUARTILE = 4;

  // Complete.
  MEDIA_QUARTILE_COMPLETE = 5;
}
