// Copyright 2025 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/early_ad_break_notification_enums.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/duration.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 = "AdBreakMessagesProto";
option java_package = "com.google.ads.admanager.v1";
option php_namespace = "Google\\Ads\\AdManager\\V1";
option ruby_package = "Google::Ads::AdManager::V1";

// The `AdBreak` resource.
message AdBreak {
  option (google.api.resource) = {
    type: "admanager.googleapis.com/AdBreak"
    pattern: "networks/{network_code}/liveStreamEventsByAssetKey/{asset_key}/adBreaks/{ad_break}"
    plural: "adBreaks"
    singular: "adBreak"
  };

  // Identifier. The resource name of the `AdBreak`.
  // This field uses the `LiveStreamEvent` resource's asset key in the
  // URI, even if the ad break was created, updated, or queried using the custom
  // asset key.
  //
  // Format:
  // `networks/{network_code}/liveStreamEventsByAssetKey/{asset_key}/adBreaks/{ad_break_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Optional. Immutable. `AdBreak` ID.
  // Must consist only of lowercase letters, digits, and hyphens. Ad break IDs
  // have a maximum length of 63 characters.
  // If not set, an ad break ID is generated as a UUID string.
  optional string ad_break_id = 2 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. The asset key of the `LiveStreamEvent` that the ad
  // break belongs to. Either an asset key or a custom asset key must be
  // provided for creation.
  optional string asset_key = 3 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. Immutable. The custom asset key of the `LiveStreamEvent` that the
  // ad break belongs to. Either an asset key or a custom asset key must be
  // provided for creation.
  optional string custom_asset_key = 4 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.field_behavior) = IMMUTABLE
  ];

  // Optional. The expected start time of the ad break.
  // When set, the scheduled ad break will be decisioned shortly before the
  // expected start time.
  // If this field is not set, ad decisioning begins immediately.
  // An ad break can be created up to six hours before the expected start time.
  optional google.protobuf.Timestamp expected_start_time = 5
      [(google.api.field_behavior) = OPTIONAL];

  // Required. The duration of the `AdBreak`.
  // An expected duration in seconds with up to nine fractional digits, ending
  // with `s`, for example, `3.5s`. This value will be updated to match the
  // actual duration from the manifest or pod request after the ad break's state
  // is
  // [`COMPLETE`][google.ads.admanager.v1.AdBreakStateEnum.AdBreakState.COMPLETE].
  optional google.protobuf.Duration duration = 6
      [(google.api.field_behavior) = REQUIRED];

  // Output only. The state of the `AdBreak`.
  optional AdBreakStateEnum.AdBreakState break_state = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The sequence id of the `AdBreak`.
  // The unique sequence number of the created ad break. This value is only set
  // after the `AdBreak` starts decisioning indicated by the ad break state's
  // being
  // [`DECISIONED`][google.ads.admanager.v1.AdBreakStateEnum.AdBreakState.DECISIONED]
  // .
  optional int64 break_sequence = 8 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The pod template name of the `AdBreak`.
  // This field is the required unique name across all pod templates in the
  // network, not the display name.
  optional string pod_template_name = 9
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The key-value pairs to be included on the ad requests for this
  // `AdBreak`. Key-value pairs to include on ad requests for this break for
  // custom criteria targeting in Google Ad Manager, separated by `=` and joined
  // by
  // `&`.
  //
  // Format:"key1=value&key2=value"
  optional string custom_params = 10 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The Base64-encoded SCTE-35 command associated with the `AdBreak`.
  // This field can include the `splice_insert()` or `time_signal()` command.
  //
  // **Examples**
  //
  // * `time_signal()`
  //   ```
  //   /DA0AAAAAAAA///wBQb+cr0AUAAeAhxDVUVJSAAAjn/PAAGlmbAICAAAAAAsoKGKNAIAmsnRfg==
  //   ```
  // * `splice_insert()`
  //   ```
  //   /DAvAAAAAAAA///wFAVIAACPf+/+c2nALv4AUsz1AAAAAAAKAAhDVUVJAAABNWLbowo=
  //   ```
  optional string scte_35_cue_out = 11 [(google.api.field_behavior) = OPTIONAL];
}
