// 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/ads/datamanager/v1/item_parameter.proto";
import "google/api/field_behavior.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 = "CartDataProto";
option java_package = "com.google.ads.datamanager.v1";
option php_namespace = "Google\\Ads\\DataManager\\V1";
option ruby_package = "Google::Ads::DataManager::V1";

// The cart data associated with the event.
message CartData {
  // Optional. The Merchant Center ID associated with the items.
  string merchant_id = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The Merchant Center feed label associated with the feed of the
  // items.
  string merchant_feed_label = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The language code in ISO 639-1 associated with the Merchant
  // Center feed of the items.where your items are uploaded.
  string merchant_feed_language_code = 3
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The sum of all discounts associated with the transaction.
  double transaction_discount = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The list of items associated with the event.
  repeated Item items = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The list of coupon codes that were applied to the cart.
  // Cart-level and item-level coupon codes are independent.
  //
  // If the event is for a Google Analytics destination, only provide a single
  // coupon code. Google Analytics ignores additional coupon codes.
  repeated string coupon_codes = 6 [(google.api.field_behavior) = OPTIONAL];
}

// Represents an item in the cart associated with the event.
message Item {
  // Optional. The product ID within the Merchant Center account.
  string merchant_product_id = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The number of this item associated with the event.
  int64 quantity = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The unit price excluding tax, shipping, and any transaction level
  // discounts.
  double unit_price = 3 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A unique identifier to reference the item.
  string item_id = 4 [(google.api.field_behavior) = OPTIONAL];

  // Optional. A bucket of any [event parameters related to an
  // item](https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events)
  // to be included within the event that were not already specified using other
  // structured fields.
  repeated ItemParameter additional_item_parameters = 5
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The Merchant Center ID associated with the item. For Store Sales
  // events this will override the value set at the cart level.  This field is
  // ignored for other events.
  string merchant_id = 6 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The feed label of the Merchant Center feed. If countries are
  // still being used, the 2-letter country code in ISO-3166-1 alpha-2 can be
  // used instead. For Store Sales events this will override the value set at
  // the cart level. This field is ignored for other events.
  string merchant_feed_label = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The language code in ISO 639-1 associated with the Merchant
  // Center feed where your items are uploaded.
  string merchant_feed_language_code = 8
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The conversion value associated with this item within the event,
  // for cases where the conversion value is different for each item.
  optional double conversion_value = 9 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Additional key/value pair information to send to the conversion
  // containers (conversion action or Floodlight activity), when tracking
  // per-item
  //  conversions.
  repeated ItemCustomVariable custom_variables = 10
      [(google.api.field_behavior) = OPTIONAL];
}

// Item-level custom variable for ads conversions.
message ItemCustomVariable {
  // Optional. The name of the custom variable to set. If the variable is not
  // found for the given destination, it will be ignored.
  string variable = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. The value to store for the custom variable.
  string value = 2 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Reference string used to determine which of the
  // [Event.destination_references][google.ads.datamanager.v1.Event.destination_references]
  // the custom variable should be sent to. If empty, the
  // [Event.destination_references][google.ads.datamanager.v1.Event.destination_references]
  // will be used.
  repeated string destination_references = 3
      [(google.api.field_behavior) = OPTIONAL];
}
