// 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/asset_enums.proto";
import "google/ads/admanager/v1/size.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.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 = "CreativeAssetProto";
option java_package = "com.google.ads.admanager.v1";
option php_namespace = "Google\\Ads\\AdManager\\V1";
option ruby_package = "Google::Ads::AdManager::V1";

// A CreativeAsset is an asset that can be used in creatives.
message CreativeAsset {
  // Required. The resource name of the asset. This attribute is generated by
  // Google upon creation. Format: `networks/{network_code}/assets/{asset}`
  optional string asset = 1 [
    (google.api.field_behavior) = REQUIRED,
    (google.api.resource_reference) = { type: "admanager.googleapis.com/Asset" }
  ];

  // Input only. The content of the asset as a byte array. This attribute is
  // required when creating the creative that contains this asset if `asset` is
  // not provided.
  //
  // When updating the content, pass a new byte array, and set `asset` to null.
  // Otherwise, this field can be null.
  //
  // The `asset_byte_array` will be null when the creative is
  // retrieved.
  optional bytes asset_byte_array = 2
      [(google.api.field_behavior) = INPUT_ONLY];

  // Optional. The file name of the asset.
  // This attribute is required when creating a new asset (e.g. when
  // asset_byte_array is not null).
  optional string file_name = 3 [(google.api.field_behavior) = OPTIONAL];

  // Output only. The file size of the asset in bytes.
  optional int64 file_size = 4 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Output only. A URL where the asset can be previewed.
  optional string asset_url = 5 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Optional. The size of the asset.
  // Note that this may not always reflect the actual physical size of the
  // asset, but may reflect the expected size.
  Size size = 6 [(google.api.field_behavior) = OPTIONAL];

  // Output only. The click tags of the asset.
  repeated ClickTag click_tags = 7 [(google.api.field_behavior) = OUTPUT_ONLY];

  // Non-empty default. The display density of the image.
  // This is the ratio between a dimension in pixels of the image and the
  // dimension in pixels that it should occupy in device-independent pixels when
  // displayed. This attribute defaults to ONE_TO_ONE.
  optional AssetImageDensityEnum.AssetImageDensity image_density = 8
      [(google.api.field_behavior) = NON_EMPTY_DEFAULT];
}

// Click tags define click-through URLs for each exit on an HTML5 creative. An
// exit is any area that can be clicked that directs the browser to a landing
// page. Each click tag defines the click-through URL for a different exit. In
// Ad Manager, tracking pixels are attached to the click tags if URLs are
// valid.
message ClickTag {
  // Optional. Name of the click tag. Must match the regular expression
  // `clickTag\d*`.
  optional string display_name = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. URL of the click tag.
  optional string url = 2 [(google.api.field_behavior) = OPTIONAL];
}
