chromium/components/commerce/core/proto/price_tracking.proto

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

package commerce;

option java_package = "org.chromium.components.commerce";

option optimize_for = LITE_RUNTIME;

import "components/commerce/core/proto/product_category.proto";

// These messages are primarily used for over-the-wire communications. If this
// information needs to be stored locally, consider building a separate proto.
message PriceTrackingData {
  // metadata relating to the product
  optional BuyableProduct buyable_product = 1;

  // price update data for the product
  optional ProductPriceUpdate product_update = 2;
}

message BuyableProduct {
  enum ProductReferenceType {
    UNKNOWN = 0;
    // The product referenced in the product details page.
    MAIN_PRODUCT = 1;
  }

  // One offer title of the product in the current page.
  optional string title = 1;

  // Direct link to the product image.
  optional string image_url = 2;

  // Price as shown in the page.
  optional ProductPrice current_price = 3;

  // Determines how the product is referenced in the current page.
  optional ProductReferenceType reference_type = 4;

  // Docid of the offer.
  optional fixed64 offer_id = 5;

  // Cluster id.
  optional uint64 product_cluster_id = 6;

  // Country code of the offer.
  optional string country_code = 7;

  // The title of the product cluster. This differs from above offer title in
  // that it would exclude attributes (size, color, etc.) and instead describes
  // a broader range of the same product.
  optional string gpc_title = 8;

  // Category data of this product.
  optional CategoryData category_data = 9;
}

message ProductPriceUpdate {
  // Docid of the offer represented by this update.
  optional fixed64 offer_id = 1;

  // Old price as seen on the shopping backend.
  optional ProductPrice old_price = 2;

  // New price as seen on the shopping backend.
  optional ProductPrice new_price = 3;
}

message ProductPrice {
  // Code for the currency e.g. USD.
  optional string currency_code = 1;

  // Price in micros.
  optional int64 amount_micros = 2;
}

// TODO(crbug.com/40251440) Remove PriceDropNotificationPayload
// from chrome/browser/commerce/price_tracking/proto/notifications.proto
// and migrate usages of PriceDropNotificationPayload from chrome/browser
// to here in components.
message PriceDropNotificationPayload {
  optional string product_name = 1;
  optional uint64 offer_id = 2;
  optional string destination_url = 3;
  optional ProductPrice current_price = 4;
  optional ProductPrice previous_price = 5;
  optional uint64 product_cluster_id = 6;
}