1// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.retail.v2;
18
19import "google/api/field_behavior.proto";
20import "google/protobuf/timestamp.proto";
21
22option csharp_namespace = "Google.Cloud.Retail.V2";
23option go_package = "cloud.google.com/go/retail/apiv2/retailpb;retailpb";
24option java_multiple_files = true;
25option java_outer_classname = "CommonProto";
26option java_package = "com.google.cloud.retail.v2";
27option objc_class_prefix = "RETAIL";
28option php_namespace = "Google\\Cloud\\Retail\\V2";
29option ruby_package = "Google::Cloud::Retail::V2";
30
31// At which level we offer configuration for attributes.
32enum AttributeConfigLevel {
33  // Value used when unset. In this case, server behavior defaults to
34  // [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
35  ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED = 0;
36
37  // At this level, we honor the attribute configurations set in
38  // [Product.attributes][google.cloud.retail.v2.Product.attributes].
39  PRODUCT_LEVEL_ATTRIBUTE_CONFIG = 1;
40
41  // At this level, we honor the attribute configurations set in
42  // [CatalogConfig.attribute_configs][].
43  CATALOG_LEVEL_ATTRIBUTE_CONFIG = 2;
44}
45
46// The type of solution.
47enum SolutionType {
48  // Default value.
49  SOLUTION_TYPE_UNSPECIFIED = 0;
50
51  // Used for Recommendations AI.
52  SOLUTION_TYPE_RECOMMENDATION = 1;
53
54  // Used for Retail Search.
55  SOLUTION_TYPE_SEARCH = 2;
56}
57
58// If filtering for recommendations is enabled.
59enum RecommendationsFilteringOption {
60  // Value used when unset.
61  // In this case, server behavior defaults to
62  // [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED].
63  RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED = 0;
64
65  // Recommendation filtering is disabled.
66  RECOMMENDATIONS_FILTERING_DISABLED = 1;
67
68  // Recommendation filtering is enabled.
69  RECOMMENDATIONS_FILTERING_ENABLED = 3;
70}
71
72// The use case of Cloud Retail Search.
73enum SearchSolutionUseCase {
74  // The value when it's unspecified. In this case, server behavior defaults to
75  // [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
76  SEARCH_SOLUTION_USE_CASE_UNSPECIFIED = 0;
77
78  // Search use case. Expects the traffic has a non-empty
79  // [query][google.cloud.retail.v2.SearchRequest.query].
80  SEARCH_SOLUTION_USE_CASE_SEARCH = 1;
81
82  // Browse use case. Expects the traffic has an empty
83  // [query][google.cloud.retail.v2.SearchRequest.query].
84  SEARCH_SOLUTION_USE_CASE_BROWSE = 2;
85}
86
87// Metadata that is used to define a condition that triggers an action.
88// A valid condition must specify at least one of 'query_terms' or
89// 'products_filter'. If multiple fields are specified, the condition is met if
90// all the fields are satisfied e.g. if a set of query terms and product_filter
91// are set, then only items matching the product_filter for requests with a
92// query matching the query terms wil get boosted.
93message Condition {
94  // Query terms that we want to match on.
95  message QueryTerm {
96    // The value of the term to match on.
97    // Value cannot be empty.
98    // Value can have at most 3 terms if specified as a partial match. Each
99    // space separated string is considered as one term.
100    // For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms
101    // and not allowed for a partial match.
102    string value = 1;
103
104    // Whether this is supposed to be a full or partial match.
105    bool full_match = 2;
106  }
107
108  // Used for time-dependent conditions.
109  // Example: Want to have rule applied for week long sale.
110  message TimeRange {
111    // Start of time range. Range is inclusive.
112    google.protobuf.Timestamp start_time = 1;
113
114    // End of time range. Range is inclusive.
115    google.protobuf.Timestamp end_time = 2;
116  }
117
118  // A list (up to 10 entries) of terms to match the query on. If not
119  // specified, match all queries.
120  // If many query terms are specified, the condition
121  // is matched if any of the terms is a match (i.e. using the OR operator).
122  repeated QueryTerm query_terms = 1;
123
124  // Range of time(s) specifying when Condition is active.
125  // Condition true if any time range matches.
126  repeated TimeRange active_time_range = 3;
127}
128
129// A rule is a condition-action pair
130//
131// * A condition defines when a rule is to be triggered.
132// * An action specifies what occurs on that trigger.
133// Currently rules only work for [controls][google.cloud.retail.v2.Control] with
134// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
135message Rule {
136  // A boost action to apply to results matching condition specified above.
137  message BoostAction {
138    // Strength of the condition boost, which must be in [-1, 1]. Negative
139    // boost means demotion. Default is 0.0.
140    //
141    // Setting to 1.0 gives the item a big promotion. However, it does not
142    // necessarily mean that the boosted item will be the top result at all
143    // times, nor that other items will be excluded. Results could still be
144    // shown even when none of them matches the condition. And results that
145    // are significantly more relevant to the search query can still trump
146    // your heavily favored but irrelevant items.
147    //
148    // Setting to -1.0 gives the item a big demotion. However, results that
149    // are deeply relevant might still be shown. The item will have an
150    // upstream battle to get a fairly high ranking, but it is not blocked out
151    // completely.
152    //
153    // Setting to 0.0 means no boost applied. The boosting condition is
154    // ignored.
155    float boost = 1;
156
157    // The filter can have a max size of 5000 characters.
158    // An expression which specifies which products to apply an action to.
159    // The syntax and supported fields are the same as a filter expression. See
160    // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
161    // detail syntax and limitations.
162    //
163    // Examples:
164    //
165    // * To boost products with product ID "product_1" or "product_2", and
166    // color
167    //   "Red" or "Blue":<br>
168    //   *(id: ANY("product_1", "product_2"))<br>*
169    //   *AND<br>*
170    //   *(colorFamilies: ANY("Red", "Blue"))<br>*
171    string products_filter = 2;
172  }
173
174  // * Rule Condition:
175  //   - No
176  //   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
177  //   provided is a global match.
178  //   - 1 or more
179  //   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
180  //   provided are combined with OR operator.
181  // * Action Input: The request query and filter that are applied to the
182  // retrieved products, in addition to any filters already provided with the
183  // SearchRequest. The AND operator is used to combine the query's existing
184  // filters with the filter rule(s). NOTE: May result in 0 results when
185  // filters conflict.
186  // * Action Result: Filters the returned objects to be ONLY those that passed
187  // the filter.
188  message FilterAction {
189    // A filter to apply on the matching condition results. Supported features:
190    //
191    // * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
192    // * Filter syntax is identical to
193    // [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. See
194    // more
195    //   details at the Retail Search
196    //   [user guide](/retail/search/docs/filter-and-order#filter).
197    // * To filter products with product ID "product_1" or "product_2", and
198    // color
199    //   "Red" or "Blue":<br>
200    //   *(id: ANY("product_1", "product_2"))<br>*
201    //   *AND<br>*
202    //   *(colorFamilies: ANY("Red", "Blue"))<br>*
203    string filter = 1;
204  }
205
206  // Redirects a shopper to a specific page.
207  //
208  // * Rule Condition:
209  //   - Must specify
210  //   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
211  // * Action Input: Request Query
212  // * Action Result: Redirects shopper to provided uri.
213  message RedirectAction {
214    // URL must have length equal or less than 2000 characters.
215    string redirect_uri = 1;
216  }
217
218  // Creates a set of terms that will be treated as synonyms of each other.
219  // Example: synonyms of "sneakers" and "shoes":
220  //
221  //  * "sneakers" will use a synonym of "shoes".
222  //  * "shoes" will use a synonym of "sneakers".
223  message TwowaySynonymsAction {
224    // Defines a set of synonyms.
225    // Can specify up to 100 synonyms.
226    // Must specify at least 2 synonyms.
227    repeated string synonyms = 1;
228  }
229
230  // Maps a set of terms to a set of synonyms.
231  // Set of synonyms will be treated as synonyms of each query term only.
232  // `query_terms` will not be treated as synonyms of each other.
233  // Example: "sneakers" will use a synonym of "shoes".
234  // "shoes" will not use a synonym of "sneakers".
235  message OnewaySynonymsAction {
236    // Terms from the search query.
237    // Will treat synonyms as their synonyms.
238    // Not themselves synonyms of the synonyms.
239    // Can specify up to 100 terms.
240    repeated string query_terms = 3;
241
242    // Defines a set of synonyms.
243    // Cannot contain duplicates.
244    // Can specify up to 100 synonyms.
245    repeated string synonyms = 4;
246
247    // Will be [deprecated = true] post migration;
248    repeated string oneway_terms = 2;
249  }
250
251  // Prevents `query_term` from being associated with specified terms during
252  // search.
253  // Example: Don't associate "gShoe" and "cheap".
254  message DoNotAssociateAction {
255    // Terms from the search query.
256    // Will not consider do_not_associate_terms for search if in search query.
257    // Can specify up to 100 terms.
258    repeated string query_terms = 2;
259
260    // Cannot contain duplicates or the query term.
261    // Can specify up to 100 terms.
262    repeated string do_not_associate_terms = 3;
263
264    // Will be [deprecated = true] post migration;
265    repeated string terms = 1;
266  }
267
268  // Replaces a term in the query. Multiple replacement candidates can be
269  // specified. All `query_terms` will be replaced with the replacement term.
270  // Example: Replace "gShoe" with "google shoe".
271  message ReplacementAction {
272    // Terms from the search query.
273    // Will be replaced by replacement term.
274    // Can specify up to 100 terms.
275    repeated string query_terms = 2;
276
277    // Term that will be used for replacement.
278    string replacement_term = 3;
279
280    // Will be [deprecated = true] post migration;
281    string term = 1;
282  }
283
284  // Prevents a term in the query from being used in search.
285  // Example: Don't search for "shoddy".
286  message IgnoreAction {
287    // Terms to ignore in the search query.
288    repeated string ignore_terms = 1;
289  }
290
291  // An action must be provided.
292  oneof action {
293    // A boost action.
294    BoostAction boost_action = 2;
295
296    // Redirects a shopper to a specific page.
297    RedirectAction redirect_action = 3;
298
299    // Treats specific term as a synonym with a group of terms.
300    // Group of terms will not be treated as synonyms with the specific term.
301    OnewaySynonymsAction oneway_synonyms_action = 6;
302
303    // Prevents term from being associated with other terms.
304    DoNotAssociateAction do_not_associate_action = 7;
305
306    // Replaces specific terms in the query.
307    ReplacementAction replacement_action = 8;
308
309    // Ignores specific terms from query during search.
310    IgnoreAction ignore_action = 9;
311
312    // Filters results.
313    FilterAction filter_action = 10;
314
315    // Treats a set of terms as synonyms of one another.
316    TwowaySynonymsAction twoway_synonyms_action = 11;
317  }
318
319  // Required. The condition that triggers the rule.
320  // If the condition is empty, the rule will always apply.
321  Condition condition = 1 [(google.api.field_behavior) = REQUIRED];
322}
323
324// An intended audience of the [Product][google.cloud.retail.v2.Product] for
325// whom it's sold.
326message Audience {
327  // The genders of the audience. Strongly encouraged to use the standard
328  // values: "male", "female", "unisex".
329  //
330  // At most 5 values are allowed. Each value must be a UTF-8 encoded string
331  // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
332  // is returned.
333  //
334  // Google Merchant Center property
335  // [gender](https://support.google.com/merchants/answer/6324479). Schema.org
336  // property
337  // [Product.audience.suggestedGender](https://schema.org/suggestedGender).
338  repeated string genders = 1;
339
340  // The age groups of the audience. Strongly encouraged to use the standard
341  // values: "newborn" (up to 3 months old), "infant" (3–12 months old),
342  // "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
343  // teens or older).
344  //
345  // At most 5 values are allowed. Each value must be a UTF-8 encoded string
346  // with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
347  // is returned.
348  //
349  // Google Merchant Center property
350  // [age_group](https://support.google.com/merchants/answer/6324463).
351  // Schema.org property
352  // [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
353  // [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
354  repeated string age_groups = 2;
355}
356
357// The color information of a [Product][google.cloud.retail.v2.Product].
358message ColorInfo {
359  // The standard color families. Strongly recommended to use the following
360  // standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
361  // "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and
362  // "Mixed". Normally it is expected to have only 1 color family. May consider
363  // using single "Mixed" instead of multiple values.
364  //
365  // A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
366  // string with a length limit of 128 characters. Otherwise, an
367  // INVALID_ARGUMENT error is returned.
368  //
369  // Google Merchant Center property
370  // [color](https://support.google.com/merchants/answer/6324487). Schema.org
371  // property [Product.color](https://schema.org/color).
372  repeated string color_families = 1;
373
374  // The color display names, which may be different from standard color family
375  // names, such as the color aliases used in the website frontend. Normally
376  // it is expected to have only 1 color. May consider using single "Mixed"
377  // instead of multiple values.
378  //
379  // A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded
380  // string with a length limit of 128 characters. Otherwise, an
381  // INVALID_ARGUMENT error is returned.
382  //
383  // Google Merchant Center property
384  // [color](https://support.google.com/merchants/answer/6324487). Schema.org
385  // property [Product.color](https://schema.org/color).
386  repeated string colors = 2;
387}
388
389// A custom attribute that is not explicitly modeled in
390// [Product][google.cloud.retail.v2.Product].
391message CustomAttribute {
392  // The textual values of this custom attribute. For example, `["yellow",
393  // "green"]` when the key is "color".
394  //
395  // Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
396  // returned.
397  //
398  // Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
399  // [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
400  // Otherwise, an INVALID_ARGUMENT error is returned.
401  repeated string text = 1;
402
403  // The numerical values of this custom attribute. For example, `[2.3, 15.4]`
404  // when the key is "lengths_cm".
405  //
406  // Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
407  // [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
408  // Otherwise, an INVALID_ARGUMENT error is returned.
409  repeated double numbers = 2;
410
411  // This field is normally ignored unless
412  // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
413  // of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
414  // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
415  // attribute configuration, see [Configuration
416  // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
417  // If true, custom attribute values are searchable by text queries in
418  // [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
419  //
420  // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
421  //
422  // Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
423  // set. Otherwise, a INVALID_ARGUMENT error is returned.
424  optional bool searchable = 3 [deprecated = true];
425
426  // This field is normally ignored unless
427  // [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
428  // of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
429  // 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
430  // attribute configuration, see [Configuration
431  // modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
432  // If true, custom attribute values are indexed, so that they can be filtered,
433  // faceted or boosted in
434  // [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
435  //
436  // This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
437  //
438  // See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
439  // [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
440  // and
441  // [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
442  // for more details.
443  optional bool indexable = 4 [deprecated = true];
444}
445
446// Fulfillment information, such as the store IDs for in-store pickup or region
447// IDs for different shipping methods.
448message FulfillmentInfo {
449  // The fulfillment type, including commonly used types (such as pickup in
450  // store and same day delivery), and custom types. Customers have to map
451  // custom types to their display names before rendering UI.
452  //
453  // Supported values:
454  //
455  // * "pickup-in-store"
456  // * "ship-to-store"
457  // * "same-day-delivery"
458  // * "next-day-delivery"
459  // * "custom-type-1"
460  // * "custom-type-2"
461  // * "custom-type-3"
462  // * "custom-type-4"
463  // * "custom-type-5"
464  //
465  // If this field is set to an invalid value other than these, an
466  // INVALID_ARGUMENT error is returned.
467  string type = 1;
468
469  // The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
470  // as the store IDs for
471  // [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
472  // or the region IDs for
473  // [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
474  //
475  // A maximum of 3000 values are allowed. Each value must be a string with a
476  // length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such
477  // as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is
478  // returned.
479  repeated string place_ids = 2;
480}
481
482// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
483// Retail Search do not use product images to improve prediction and search
484// results. However, product images can be returned in results, and are shown in
485// prediction or search previews in the console.
486message Image {
487  // Required. URI of the image.
488  //
489  // This field must be a valid UTF-8 encoded URI with a length limit of 5,000
490  // characters. Otherwise, an INVALID_ARGUMENT error is returned.
491  //
492  // Google Merchant Center property
493  // [image_link](https://support.google.com/merchants/answer/6324350).
494  // Schema.org property [Product.image](https://schema.org/image).
495  string uri = 1 [(google.api.field_behavior) = REQUIRED];
496
497  // Height of the image in number of pixels.
498  //
499  // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
500  // returned.
501  int32 height = 2;
502
503  // Width of the image in number of pixels.
504  //
505  // This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
506  // returned.
507  int32 width = 3;
508}
509
510// A floating point interval.
511message Interval {
512  // The lower bound of the interval. If neither of the min fields are set, then
513  // the lower bound is negative infinity.
514  //
515  // This field must not be larger than max.
516  // Otherwise, an INVALID_ARGUMENT error is returned.
517  oneof min {
518    // Inclusive lower bound.
519    double minimum = 1;
520
521    // Exclusive lower bound.
522    double exclusive_minimum = 2;
523  }
524
525  // The upper bound of the interval. If neither of the max fields are set, then
526  // the upper bound is positive infinity.
527  //
528  // This field must be not smaller than min.
529  // Otherwise, an INVALID_ARGUMENT error is returned.
530  oneof max {
531    // Inclusive upper bound.
532    double maximum = 3;
533
534    // Exclusive upper bound.
535    double exclusive_maximum = 4;
536  }
537}
538
539// The price information of a [Product][google.cloud.retail.v2.Product].
540message PriceInfo {
541  // The price range of all
542  // [variant][google.cloud.retail.v2.Product.Type.VARIANT]
543  // [Product][google.cloud.retail.v2.Product] having the same
544  // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
545  message PriceRange {
546    // The inclusive
547    // [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
548    // interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
549    // [Product][google.cloud.retail.v2.Product] having the same
550    // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
551    Interval price = 1;
552
553    // The inclusive
554    // [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
555    // internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
556    // [Product][google.cloud.retail.v2.Product] having the same
557    // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
558    Interval original_price = 2;
559  }
560
561  // The 3-letter currency code defined in [ISO
562  // 4217](https://www.iso.org/iso-4217-currency-codes.html).
563  //
564  // If this field is an unrecognizable currency code, an INVALID_ARGUMENT
565  // error is returned.
566  //
567  // The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
568  // [Product][google.cloud.retail.v2.Product]s with the same
569  // [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
570  // must share the same
571  // [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
572  // a FAILED_PRECONDITION error is returned.
573  string currency_code = 1;
574
575  // Price of the product.
576  //
577  // Google Merchant Center property
578  // [price](https://support.google.com/merchants/answer/6324371). Schema.org
579  // property [Offer.price](https://schema.org/price).
580  float price = 2;
581
582  // Price of the product without any discount. If zero, by default set to be
583  // the [price][google.cloud.retail.v2.PriceInfo.price]. If set,
584  // [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be
585  // greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price],
586  // otherwise an INVALID_ARGUMENT error is thrown.
587  float original_price = 3;
588
589  // The costs associated with the sale of a particular product. Used for gross
590  // profit reporting.
591  //
592  // * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
593  // [cost][google.cloud.retail.v2.PriceInfo.cost]
594  //
595  // Google Merchant Center property
596  // [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
597  float cost = 4;
598
599  // The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
600  // starts to be effective. This can be set as a future timestamp, and the
601  // [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
602  // after
603  // [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
604  // If so, the
605  // [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
606  // set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
607  // is used before
608  // [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
609  //
610  // Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
611  // effective because it will cause additional latency during search.
612  google.protobuf.Timestamp price_effective_time = 5;
613
614  // The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
615  // stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
616  // is used for search before
617  // [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
618  // this field is set, the
619  // [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
620  // set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
621  // is used after
622  // [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
623  //
624  // Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
625  // effective because it will cause additional latency during search.
626  google.protobuf.Timestamp price_expire_time = 6;
627
628  // Output only. The price range of all the child
629  // [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
630  // [Product][google.cloud.retail.v2.Product]s grouped together on the
631  // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
632  // [Product][google.cloud.retail.v2.Product]. Only populated for
633  // [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
634  // [Product][google.cloud.retail.v2.Product]s.
635  //
636  // Note: This field is OUTPUT_ONLY for
637  // [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
638  // Do not set this field in API requests.
639  PriceRange price_range = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
640}
641
642// The rating of a [Product][google.cloud.retail.v2.Product].
643message Rating {
644  // The total number of ratings. This value is independent of the value of
645  // [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
646  //
647  // This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
648  // returned.
649  int32 rating_count = 1;
650
651  // The average rating of the [Product][google.cloud.retail.v2.Product].
652  //
653  // The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
654  // returned.
655  float average_rating = 2;
656
657  // List of rating counts per rating value (index = rating - 1). The list is
658  // empty if there is no rating. If the list is non-empty, its size is
659  // always 5. Otherwise, an INVALID_ARGUMENT error is returned.
660  //
661  // For example, [41, 14, 13, 47, 303]. It means that the
662  // [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
663  // ratings with 2 star, and so on.
664  repeated int32 rating_histogram = 3;
665}
666
667// Information of an end user.
668message UserInfo {
669  // Highly recommended for logged-in users. Unique identifier for logged-in
670  // user, such as a user name. Don't set for anonymous users.
671  //
672  // Always use a hashed value for this ID.
673  //
674  // Don't set the field to the same fixed ID for different users. This mixes
675  // the event history of those users together, which results in degraded
676  // model quality.
677  //
678  // The field must be a UTF-8 encoded string with a length limit of 128
679  // characters. Otherwise, an INVALID_ARGUMENT error is returned.
680  string user_id = 1;
681
682  // The end user's IP address. This field is used to extract location
683  // information for personalization.
684  //
685  // This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
686  // address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
687  // INVALID_ARGUMENT error is returned.
688  //
689  // This should not be set when:
690  //
691  // * setting
692  // [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
693  // * using the JavaScript tag in
694  // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
695  // or if
696  // [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
697  // is set.
698  string ip_address = 2;
699
700  // User agent as included in the HTTP header. Required for getting
701  // [SearchResponse.sponsored_results][google.cloud.retail.v2.SearchResponse.sponsored_results].
702  //
703  // The field must be a UTF-8 encoded string with a length limit of 1,000
704  // characters. Otherwise, an INVALID_ARGUMENT error is returned.
705  //
706  // This should not be set when using the client side event reporting with
707  // GTM or JavaScript tag in
708  // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
709  // or if
710  // [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
711  // is set.
712  string user_agent = 3;
713
714  // True if the request is made directly from the end user, in which case the
715  // [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
716  // [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
717  // from the HTTP request. This flag should be set only if the API request is
718  // made directly from the end user such as a mobile app (and not if a gateway
719  // or a server is processing and pushing the user events).
720  //
721  // This should not be set when using the JavaScript tag in
722  // [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
723  bool direct_user_request = 4;
724}
725
726// The inventory information at a place (e.g. a store) identified
727// by a place ID.
728message LocalInventory {
729  // The place ID for the current set of inventory information.
730  string place_id = 1;
731
732  // Product price and cost information.
733  //
734  // Google Merchant Center property
735  // [price](https://support.google.com/merchants/answer/6324371).
736  PriceInfo price_info = 2;
737
738  // Additional local inventory attributes, for example, store name, promotion
739  // tags, etc.
740  //
741  // This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
742  // error is returned:
743  //
744  // * At most 30 attributes are allowed.
745  // * The key must be a UTF-8 encoded string with a length limit of 32
746  //   characters.
747  // * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
748  //   key0LikeThis or KEY_1_LIKE_THIS.
749  // * The attribute values must be of the same type (text or number).
750  // * Only 1 value is allowed for each attribute.
751  // * For text values, the length limit is 256 UTF-8 characters.
752  // * The attribute does not support search. The `searchable` field should be
753  //   unset or set to false.
754  // * The max summed total bytes of custom attribute keys and values per
755  //   product is 5MiB.
756  map<string, CustomAttribute> attributes = 3;
757
758  // Input only. Supported fulfillment types. Valid fulfillment type values
759  // include commonly used types (such as pickup in store and same day
760  // delivery), and custom types. Customers have to map custom types to their
761  // display names before rendering UI.
762  //
763  // Supported values:
764  //
765  // * "pickup-in-store"
766  // * "ship-to-store"
767  // * "same-day-delivery"
768  // * "next-day-delivery"
769  // * "custom-type-1"
770  // * "custom-type-2"
771  // * "custom-type-3"
772  // * "custom-type-4"
773  // * "custom-type-5"
774  //
775  // If this field is set to an invalid value other than these, an
776  // INVALID_ARGUMENT error is returned.
777  //
778  // All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
779  // returned.
780  repeated string fulfillment_types = 4
781      [(google.api.field_behavior) = INPUT_ONLY];
782}
783