// 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/content_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 = "ContentMessagesProto";
option java_package = "com.google.ads.admanager.v1";
option php_namespace = "Google\\Ads\\AdManager\\V1";
option ruby_package = "Google::Ads::AdManager::V1";
option (google.api.resource_definition) = {
  type: "admanager.googleapis.com/ContentSource"
  pattern: "networks/{network_code}/contentSources/{content_source}"
  plural: "contentSources"
  singular: "contentSource"
};

// A piece of `Content` from a Publisher's CMS.
message Content {
  option (google.api.resource) = {
    type: "admanager.googleapis.com/Content"
    pattern: "networks/{network_code}/content/{content}"
    plural: "content"
    singular: "content"
  };

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

  // Output only. The name of the `Content`.
  optional string display_name = 2 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The status of this `Content`.
  optional ContentStatusEnum.ContentStatus status = 3
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Whether the content status was defined by the user, or by the
  // source CMS from which the `Content` was ingested.
  optional ContentStatusSourceEnum.ContentStatusSource content_status_source = 4
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The current DAI ingest status of the HLS media for the
  // `Content`. This attribute is unset if the `Content` is not eligible for
  // dynamic ad insertion or if the `Content` does not have HLS media.
  optional DaiIngestStatusEnum.DaiIngestStatus hls_ingest_status = 5
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The list of any errors that occurred during the most recent
  // DAI ingestion process of the HLS media. This attribute will be empty if the
  // hlsIngestStatus is [DaiIngestStatus.SUCCESS][] or if the `Content` is
  // not eligible for dynamic ad insertion or if the `Content` does not have
  // HLS media.
  repeated DaiIngestError hls_ingest_errors = 6
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The timestamp at which this `Content`'s HLS media was last
  // ingested for DAI. This attribute will be unset if the `Content` is not
  // eligible for dynamic ad insertion or if the `Content` does not have HLS
  // media.
  optional google.protobuf.Timestamp last_hls_ingest_time = 7
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The current DAI ingest status of the DASH media for the
  // `Content`. This attribute is unset if the `Content` is not eligible for
  // dynamic ad insertion or if the `Content` does not have DASH media.
  optional DaiIngestStatusEnum.DaiIngestStatus dash_ingest_status = 8
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The list of any errors that occurred during the most recent
  // DAI ingestion process of the DASH media. This attribute will be empty if
  // the hlsIngestStatus is [DaiIngestStatus.SUCCESS][] or if the `Content` is
  // not eligible for dynamic ad insertion or if the `Content` does not have
  // DASH media.
  repeated DaiIngestError dash_ingest_errors = 9
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The timestamp at which this `Content`'s DASH media was last
  // ingested for DAI. This attribute will be unset if the `Content` is not
  // eligible for dynamic ad insertion or if the `Content` does not have DASH
  // media.
  optional google.protobuf.Timestamp last_dash_ingest_time = 10
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The timestamp at which this `Content` was published.
  optional google.protobuf.Timestamp import_time = 11
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The timestamp at which this `Content` was last modified.
  // The last modified date time will always be updated when a
  // [ContentBundle][google.ads.admanager.v1.ContentBundle]
  // association is changed, but will not always be updated when a
  // [CmsMetadataValue][google.ads.admanager.v1.CmsMetadataValue]
  // value is changed.
  optional google.protobuf.Timestamp update_time = 12
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. Information about the `Content` from the CMS it was ingested
  // from.
  repeated CmsContent cms_sources = 13
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. The resource names of the
  // [ContentBundles][google.ads.admanager.v1.ContentBundle] of
  // which this `Content` is a member.
  repeated string content_bundles = 14 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/ContentBundle"
    }
  ];

  // Output only. The resource names of the [CmsMetadataValues]
  // [google.ads.admanager.v1.CmsMetadataValue] that
  // are associated with this `Content`.
  repeated string cms_metadata_values = 15 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/CmsMetadataValue"
    }
  ];

  // Output only. The duration of the `Content`.
  optional google.protobuf.Duration duration = 16
      [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Represents an error associated with a Dynamic Ad Insertion (DAI) `Content`'s
// status.
message DaiIngestError {
  // The error associated with the content.
  optional DaiIngestErrorReasonEnum.DaiIngestErrorReason reason = 1;

  // Output only. The field, if any, that triggered the error.
  optional string trigger = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// Contains information about the `Content` from the CMS it was ingested from.
message CmsContent {
  // Output only. The resource name of the
  // [ContentSource][google.ads.admanager.v1.ContentSource] this
  // content was ingested from.
  optional string content_source = 1 [
    (google.api.field_behavior) = OUTPUT_ONLY,
    (google.api.resource_reference) = {
      type: "admanager.googleapis.com/ContentSource"
    }
  ];

  // Output only. The display name of the
  // [ContentSource][google.ads.admanager.v1.ContentSource] this
  // content was ingested from.
  optional string content_source_display_name = 2
      [(google.api.field_behavior) = OUTPUT_ONLY];

  // The ID of the `Content` in the CMS. This ID will be a 3rd party ID,
  // usually the ID of the content in a CMS (Content Management System).
  optional string cms_content_id = 3;
}
