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