// 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/live_stream_event_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 = "LiveStreamMessagesProto";
option java_package = "com.google.ads.admanager.v1";
option php_namespace = "Google\\Ads\\AdManager\\V1";
option ruby_package = "Google::Ads::AdManager::V1";

// A LiveStream encapsulates all the information necessary to enable DAI
// (Dynamic Ad Insertion) into a live video stream.  This includes information
// such as the start and expected end time of the live stream, the URL of the
// actual content for Ad Manager to pull and insert ads into, as well as the
// metadata necessary to generate ad requests during the live stream.
message LiveStream {
  option (google.api.resource) = {
    type: "admanager.googleapis.com/LiveStream"
    pattern: "networks/{network_code}/liveStreams/{live_stream}"
    plural: "liveStreams"
    singular: "liveStream"
  };

  // Identifier. The resource name of the `LiveStream`.
  // Format: `networks/{network_code}/liveStreams/{live_stream_id}`
  string name = 1 [(google.api.field_behavior) = IDENTIFIER];

  // Required. The name of the LiveStream. This value has a maximum length of
  // 255 characters.
  optional string display_name = 2 [(google.api.field_behavior) = REQUIRED];

  // Output only. The status of this LiveStream. Live stream events are created
  // in the
  // [PAUSED][google.ads.admanager.v1.LiveStreamEventStatusEnum.LiveStreamEventStatus.PAUSED]
  // state.
  optional LiveStreamEventStatusEnum.LiveStreamEventStatus status = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The date and time this LiveStream was created.
  google.protobuf.Timestamp create_time = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The date and time this LiveStream was last modified.
  google.protobuf.Timestamp update_time = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The start date and time of this LiveStream. Modifying this
  // attribute for an active live stream can impact traffic.
  google.protobuf.Timestamp start_time = 6
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The scheduled end date and time of this LiveStream. This
  // attribute is required if `unlimitedEndDateTime` is false and ignored if
  // `unlimitedEndDateTime` is true. Modifying this attribute for an active live
  // stream can impact traffic.
  google.protobuf.Timestamp end_time = 7
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether the LiveStream has an end time. Defaults to false. If
  // this field is true, `endDateTime` is ignored.
  optional bool end_time_unlimited = 8 [(google.api.field_behavior) = OPTIONAL];

  // Required. The list of URLs pointing to the live stream content in Content
  // Delivery Network. Can be modified when the live stream is in a
  // [PAUSED][google.ads.admanager.v1.LiveStreamEventStatusEnum.LiveStreamEventStatus.PAUSED]
  // state.
  repeated string content_urls = 9 [(google.api.field_behavior) = REQUIRED];

  // Required. The list of Ad Manager ad tag URLs generated by the Ad Manager
  // trafficking workflow that are associated with this live stream. Currently,
  // the list includes only one element: the master ad tag.
  repeated string ad_tags = 10 [(google.api.field_behavior) = REQUIRED];

  // Output only. The code used in constructing a live stream master playlist
  // URL.
  optional string asset_key = 11 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The slate to use for this live stream. If not set, network
  // default slate will be used. Format:
  // "networks/{network_code}/slates/{slate_id}"
  optional string slate = 12 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = { type: "admanager.googleapis.com/Slate" }
  ];

  // Optional. The duration of the DVR window. If unset the default window as
  // provided by the input encoder will be used. Modifying this value for an
  // active live stream can impact traffic.
  optional google.protobuf.Duration dvr_window_duration = 59
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether the live stream's requests to the IMA SDK API will be
  // authenticated using the DAI authentication keys.
  optional bool enable_dai_authentication_keys = 14
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The type of content that should be used to fill an empty ad
  // break. Defaults to
  // [SLATE][google.ads.admanager.v1.AdBreakFillTypeEnum.AdBreakFillType.SLATE].
  optional AdBreakFillTypeEnum.AdBreakFillType ad_break_fill_type = 15
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The type of content that should be used to fill the time
  // remaining in the ad break when there are not enough ads to fill the entire
  // break. Defaults to
  // [SLATE][google.ads.admanager.v1.AdBreakFillTypeEnum.AdBreakFillType.SLATE].
  // To set this field a network needs to have the "Live stream ad break
  // underfill type" feature enabled.
  optional AdBreakFillTypeEnum.AdBreakFillType underfill_ad_break_fill_type = 16
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The duration, starting from the time the user enters the DAI
  // stream, for which mid-roll decisioning will be skipped. This field is only
  // applicable when an ad holiday is requested in the stream create request.
  // Defaults to 0.
  optional google.protobuf.Duration ad_holiday_duration = 17
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether there will be max filler duration in this live stream. If
  // true, maxFillerDuration should be specified. Defaults to false.
  optional bool enable_max_filler_duration = 18
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The maximum duration that can be used to fill this ad pod, either
  // with a slate or underlying content, depending on your settings. If more
  // time needs to be filled, the ad pod will instead be dropped and the
  // underlying content will be served.
  optional google.protobuf.Duration max_filler_duration = 19
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The duration that can be used when stitching ads for each
  // livestream event. This attribute is only available for Pod Serving HLS
  // Segment Redirect and Pod Serving Dash Segment Redirect.
  optional google.protobuf.Duration pod_serving_segment_duration = 20
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether there will be durationless ad breaks in this live stream.
  // If true, `defaultAdBreakDuration` should be specified. Defaults to false.
  optional bool enable_durationless_ad_breaks = 21
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The default ad pod duration that will be requested when an ad
  // break cue-out does not specify a duration. Defaults to 0.
  optional google.protobuf.Duration default_ad_break_duration = 22
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The list of DaiAuthenticationKey objects used to authenticate
  // stream create requests for this live stream. Modifying settings for an
  // active live stream may break the stream for some users. Exercise caution.
  // Format:
  // "networks/{network_code}/daiAuthenticationKeys/{dai_authentication_key_id}"
  repeated string dai_authentication_keys = 24 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/DaiAuthenticationKey"
    }
  ];

  // Optional. The list of CdnConfigurations that provide settings for ingesting
  // and delivering the videos associated with this source. Modifying settings
  // for an active live stream may break the stream for some users. Exercise
  // caution.
  // Format: "networks/{network_code}/cdnConfigs/{cdn_config_id}"
  repeated string source_content_configurations = 26 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/CdnConfig"
    }
  ];

  // Optional. The CdnConfiguration that provide settings for delivering ad
  // media associated with this source. Format:
  // "networks/{network_code}/cdnConfigs/{cdn_config_id}"
  optional string ad_media_delivery_config = 27 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/CdnConfig"
    }
  ];

  // Optional. The settings specific to Preroll ad breaks. If
  // null, this livestream does not have prerolls enabled.
  PrerollSettings preroll_settings = 28
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The settings that are specific to HTTPS live streaming (HLS)
  // protocol. If it is not set will use the default HLS settings.
  HlsSettings hls_settings = 29 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether specific allowlisted IP addresses should be used to
  // access this live stream. Will default to false. To set this field a network
  // needs to have the "Video live allowlisted IPS enabled" feature enabled.
  // Modifying this field for an active live stream can impact traffic.
  optional bool allowlisted_ips_enabled = 30
      [(google.api.field_behavior) = OPTIONAL];

  // Immutable. The method of dynamic ad insertion that is used to insert ads
  // into this live stream. Defaults to DynamicAdInsertionType.LINEAR.
  optional DynamicAdInsertionTypeEnum.DynamicAdInsertionType
      dynamic_ad_insertion_type = 31 [(google.api.field_behavior) = IMMUTABLE];

  // Optional. Whether the served playlists can include relative URLs. Defaults
  // to false. To set this field a network needs to have the "Video live stream
  // relative playlist URLs" feature enabled. This field can be modified when
  // the live stream is in a LiveStreamEventStatus#PAUSED state.
  optional bool relative_playlist_delivery_enabled = 33
      [(google.api.field_behavior) = OPTIONAL];

  // Immutable. The streaming format of the LiveStream media.
  optional LiveStreamEventStreamingFormatEnum.LiveStreamEventStreamingFormat
      streaming_format = 34 [(google.api.field_behavior) = IMMUTABLE];

  // Optional. Indicates whether the option to prefetch ad requests is enabled.
  optional bool prefetch_enabled = 35 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The information needed to prefetch ad requests for an ad break.
  PrefetchSettings prefetch_settings = 36
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether live stream placement opportunities without `#EXT-CUE-IN`
  // markers should be force closed. Defaults to false. To set this field a
  // network needs to have the "Video live stream forced cue in" feature
  // enabled.
  optional bool forced_cue_in_enabled = 37
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether segments shorter than 1 second at the end of an ad pod
  // should be dropped. Defaults to false. To set this field a network needs to
  // have the "Video live stream short segment dropping" feature enabled.
  optional bool short_segment_dropping_enabled = 38
      [(google.api.field_behavior) = OPTIONAL];

  // Immutable. An additional code that can be used in constructing live stream
  // event URLs. Can only be set for pod serving live streams. The custom asset
  // key may be at most 64 characters and can contain alphanumeric characters
  // and symbols other than the following:
  // ", ', =, !, +, #, *, ~, ;, ^, (, ), <, >, [, ], the white space character.
  optional string custom_asset_key = 39
      [(google.api.field_behavior) = IMMUTABLE];

  // Optional. The list of DaiEncodingProfiles that will be used for this live
  // stream event. Format:
  // "networks/{network_code}/daiEncodingProfiles/{dai_encoding_profile_id}"
  repeated string dai_encoding_profiles = 40 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/DaiEncodingProfile"
    }
  ];

  // Optional. The list of DaiAuthenticationKeys used to authenticate ad segment
  // url requests for this live stream. Format:
  // "networks/{network_code}/daiAuthenticationKeys/{dai_authentication_key_id}"
  repeated string segment_url_authentication_keys = 41 [
    (google.api.field_behavior) = OPTIONAL,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/DaiAuthenticationKey"
    }
  ];

  // Optional. The formats that will be recognized as ad break start/end
  // markers. This field is ignored if `adBreakMarkupTypesEnabled` is false.
  repeated AdBreakMarkupTypeEnum.AdBreakMarkupType ad_break_markups = 42
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Whether this LiveStream is specifying a subset of supported
  // `adBreakMarkups`. If this field is false, all supported formats will be
  // treated as ad break start/end markers.
  optional bool ad_break_markup_types_enabled = 43
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The conditioning to apply to this LiveStream.
  LiveStreamConditioning live_stream_conditioning = 46
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Indicates whether multi-break scheduling via Early Break
  // Notification (EBN) is enabled for this LiveStream.
  optional bool early_break_notification_multi_break_scheduling_enabled = 54
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The maximum amount of time by which a stitched ad pod is
  // allowed to be trimmed before whole ads are dropped instead.
  google.protobuf.Duration ad_pod_trim_tolerance = 55
      [(google.api.field_behavior) = OPTIONAL];

  // Output only. The effective asset key of the live stream. This is the
  // user-defined custom_asset_key if specified; otherwise, it falls back to the
  // autogenerated asset_key.
  optional string effective_asset_key = 56
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The auxiliary ad tag settings for this live stream.
  AuxiliaryAdSettings auxiliary_ad_settings = 57
      [(google.api.field_behavior) = OPTIONAL];
}

// The information needed to prefetch ad requests for an ad break.
message PrefetchSettings {
  // Optional. The duration of the part of the break to be prefetched.
  optional google.protobuf.Duration stage_one_ad_request_duration = 1
      [(google.api.field_behavior) = OPTIONAL];
}

// Settings to specify all types of conditioning to apply to the associated
// LiveStream.
message LiveStreamConditioning {
  // Optional. Specifies DASH Bridge single-period to multi-period MPD
  // conditioning.
  DashBridge dash_bridge = 1 [(google.api.field_behavior) = OPTIONAL];
}

// LiveStream settings that are specific to the HTTP live streaming (HLS)
// protocol.
message HlsSettings {
  // Immutable. Indicates the type of the playlist associated with this live
  // stream. The playlist type is analogous to the `EXT-X-PLAYLIST-TYPE` HLS
  // tag. Will default to
  // [LIVE][google.ads.admanager.v1.HlsSettingsPlaylistTypeEnum.HlsSettingsPlaylistType.LIVE].
  optional HlsSettingsPlaylistTypeEnum.HlsSettingsPlaylistType playlist_type = 1
      [(google.api.field_behavior) = IMMUTABLE];

  // Optional. The settings for the master playlist. If it is
  // not set will default to a `MasterPlaylistSettings` with a refresh type of
  // [AUTOMATIC][google.ads.admanager.v1.HlsMasterPlaylistRefreshTypeEnum.HlsMasterPlaylistRefreshType.AUTOMATIC].
  MasterPlaylistSettings master_playlist_settings = 2
      [(google.api.field_behavior) = OPTIONAL];
}

// A DashBridge is used to decide when to apply DASH Bridge single-period to
// multi-period MPD conditioning. This should always be enabled when the DASH
// manifest type is single-period.
message DashBridge {
  // Optional. Specifies whether to apply DASH Bridge single-period to
  // multi-period MPD conditioning.
  optional bool enabled = 2 [(google.api.field_behavior) = OPTIONAL];
}

// Settings for ad breaks on a livestream that are specific to preroll.
message PrerollSettings {
  // Required. The Ad Manager ad tag URL generated by the Ad Manager trafficking
  // workflow that is associated with this live stream.
  optional string ad_tag = 1 [(google.api.field_behavior) = REQUIRED];

  // Required. The maximum duration for an ad break.
  optional google.protobuf.Duration max_ad_pod_duration = 2
      [(google.api.field_behavior) = REQUIRED];
}

// Settings for auxiliary ads (e.g. pause ads) on a live stream.
message AuxiliaryAdSettings {
  // Required. The ad tag URL used to request auxiliary ads (such as pause ads).
  // This can be a Google Ad Manager ad tag or a third-party ad tag.
  // Publishers are responsible for ensuring the correctness of the URL.
  optional string ad_tag_url = 1 [(google.api.field_behavior) = REQUIRED];
}

// Settings for the HLS (HTTP Live Streaming) master playlist.
message MasterPlaylistSettings {
  // Optional. Indicates how the master playlist gets refreshed. Defaults to
  // [AUTOMATIC][google.ads.admanager.v1.HlsMasterPlaylistRefreshTypeEnum.HlsMasterPlaylistRefreshType.AUTOMATIC].
  // This field can only be modified when the live stream is in a
  // [PAUSED][google.ads.admanager.v1.LiveStreamEventStatusEnum.LiveStreamEventStatus.PAUSED]
  // state.
  optional HlsMasterPlaylistRefreshTypeEnum.HlsMasterPlaylistRefreshType
      refresh_type = 1 [(google.api.field_behavior) = OPTIONAL];
}
