Skip to main content

google_cloud_retail_v2/
model.rs

1// Copyright 2025 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//     https://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//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate gtype;
26extern crate lazy_static;
27extern crate longrunning;
28extern crate lro;
29extern crate reqwest;
30extern crate rpc;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38mod debug;
39mod deserialize;
40mod serialize;
41
42/// Configures what level the product should be uploaded with regards to
43/// how users will be send events and how predictions will be made.
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct ProductLevelConfig {
47    /// The type of [Product][google.cloud.retail.v2.Product]s allowed to be
48    /// ingested into the catalog. Acceptable values are:
49    ///
50    /// * `primary` (default): You can ingest
51    ///   [Product][google.cloud.retail.v2.Product]s of all types. When
52    ///   ingesting a [Product][google.cloud.retail.v2.Product], its type will
53    ///   default to
54    ///   [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if
55    ///   unset.
56    /// * `variant` (incompatible with Retail Search): You can only
57    ///   ingest
58    ///   [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
59    ///   [Product][google.cloud.retail.v2.Product]s. This means
60    ///   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
61    ///   cannot be empty.
62    ///
63    /// If this field is set to an invalid value other than these, an
64    /// INVALID_ARGUMENT error is returned.
65    ///
66    /// If this field is `variant` and
67    /// [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
68    /// is `itemGroupId`, an INVALID_ARGUMENT error is returned.
69    ///
70    /// See [Product
71    /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
72    /// for more details.
73    ///
74    /// [google.cloud.retail.v2.Product]: crate::model::Product
75    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
76    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
77    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
78    /// [google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]: crate::model::ProductLevelConfig::merchant_center_product_id_field
79    pub ingestion_product_type: std::string::String,
80
81    /// Which field of [Merchant Center
82    /// Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
83    /// imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
84    /// values are:
85    ///
86    /// * `offerId` (default): Import `offerId` as the product ID.
87    /// * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
88    ///   API will choose one item from the ones with the same `itemGroupId`, and
89    ///   use it to represent the item group.
90    ///
91    /// If this field is set to an invalid value other than these, an
92    /// INVALID_ARGUMENT error is returned.
93    ///
94    /// If this field is `itemGroupId` and
95    /// [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
96    /// is `variant`, an INVALID_ARGUMENT error is returned.
97    ///
98    /// See [Product
99    /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
100    /// for more details.
101    ///
102    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
103    /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
104    pub merchant_center_product_id_field: std::string::String,
105
106    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
107}
108
109impl ProductLevelConfig {
110    pub fn new() -> Self {
111        std::default::Default::default()
112    }
113
114    /// Sets the value of [ingestion_product_type][crate::model::ProductLevelConfig::ingestion_product_type].
115    ///
116    /// # Example
117    /// ```ignore,no_run
118    /// # use google_cloud_retail_v2::model::ProductLevelConfig;
119    /// let x = ProductLevelConfig::new().set_ingestion_product_type("example");
120    /// ```
121    pub fn set_ingestion_product_type<T: std::convert::Into<std::string::String>>(
122        mut self,
123        v: T,
124    ) -> Self {
125        self.ingestion_product_type = v.into();
126        self
127    }
128
129    /// Sets the value of [merchant_center_product_id_field][crate::model::ProductLevelConfig::merchant_center_product_id_field].
130    ///
131    /// # Example
132    /// ```ignore,no_run
133    /// # use google_cloud_retail_v2::model::ProductLevelConfig;
134    /// let x = ProductLevelConfig::new().set_merchant_center_product_id_field("example");
135    /// ```
136    pub fn set_merchant_center_product_id_field<T: std::convert::Into<std::string::String>>(
137        mut self,
138        v: T,
139    ) -> Self {
140        self.merchant_center_product_id_field = v.into();
141        self
142    }
143}
144
145impl wkt::message::Message for ProductLevelConfig {
146    fn typename() -> &'static str {
147        "type.googleapis.com/google.cloud.retail.v2.ProductLevelConfig"
148    }
149}
150
151/// Catalog level attribute config for an attribute. For example, if customers
152/// want to enable/disable facet for a specific attribute.
153#[derive(Clone, Default, PartialEq)]
154#[non_exhaustive]
155pub struct CatalogAttribute {
156    /// Required. Attribute name.
157    /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
158    /// `attributes.xyz`.
159    /// To be indexable, the attribute name can contain only alpha-numeric
160    /// characters and underscores. For example, an attribute named
161    /// `attributes.abc_xyz` can be indexed, but an attribute named
162    /// `attributes.abc-xyz` cannot be indexed.
163    ///
164    /// If the attribute key starts with `attributes.`, then the attribute is a
165    /// custom attribute. Attributes such as `brands`, `patterns`, and `title` are
166    /// built-in and called system attributes.
167    pub key: std::string::String,
168
169    /// Output only. Indicates whether this attribute has been used by any
170    /// products. `True` if at least one [Product][google.cloud.retail.v2.Product]
171    /// is using this attribute in
172    /// [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
173    /// this field is `False`.
174    ///
175    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
176    /// pre-loaded by using
177    /// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
178    /// or
179    /// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
180    /// APIs. This field is `False` for pre-loaded
181    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
182    ///
183    /// Only pre-loaded [catalog
184    /// attributes][google.cloud.retail.v2.CatalogAttribute] that are neither in
185    /// use by products nor predefined can be deleted. [Catalog
186    /// attributes][google.cloud.retail.v2.CatalogAttribute] that are
187    /// either in use by products or are predefined attributes cannot be deleted;
188    /// however, their configuration properties will reset to default values upon
189    /// removal request.
190    ///
191    /// After catalog changes, it takes about 10 minutes for this field to update.
192    ///
193    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
194    /// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
195    /// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
196    /// [google.cloud.retail.v2.Product]: crate::model::Product
197    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
198    pub in_use: bool,
199
200    /// Output only. The type of this attribute. This is derived from the attribute
201    /// in [Product.attributes][google.cloud.retail.v2.Product.attributes].
202    ///
203    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
204    pub r#type: crate::model::catalog_attribute::AttributeType,
205
206    /// When
207    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
208    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
209    /// are indexed so that it can be filtered, faceted, or boosted in
210    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
211    ///
212    /// Must be specified when
213    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
214    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
215    ///
216    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
217    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
218    pub indexable_option: crate::model::catalog_attribute::IndexableOption,
219
220    /// If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
221    /// facet. Could only be DYNAMIC_FACETABLE_DISABLED if
222    /// [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
223    /// is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
224    ///
225    /// Must be specified, otherwise throws INVALID_FORMAT error.
226    ///
227    /// [google.cloud.retail.v2.CatalogAttribute.indexable_option]: crate::model::CatalogAttribute::indexable_option
228    pub dynamic_facetable_option: crate::model::catalog_attribute::DynamicFacetableOption,
229
230    /// When
231    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
232    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
233    /// are searchable by text queries in
234    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
235    ///
236    /// If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
237    /// will not be searchable by text queries in
238    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
239    /// there are no text values associated to numerical attributes.
240    ///
241    /// Must be specified, when
242    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
243    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
244    ///
245    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
246    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
247    pub searchable_option: crate::model::catalog_attribute::SearchableOption,
248
249    /// If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable.
250    /// This property only applies to textual custom attributes and requires
251    /// indexable set to enabled to enable exact-searchable. If unset, the server
252    /// behavior defaults to
253    /// [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED].
254    ///
255    /// [google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]: crate::model::catalog_attribute::ExactSearchableOption::ExactSearchableDisabled
256    pub exact_searchable_option: crate::model::catalog_attribute::ExactSearchableOption,
257
258    /// If RETRIEVABLE_ENABLED, attribute values are retrievable in the search
259    /// results. If unset, the server behavior defaults to
260    /// [RETRIEVABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED].
261    ///
262    /// [google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED]: crate::model::catalog_attribute::RetrievableOption::RetrievableDisabled
263    pub retrievable_option: crate::model::catalog_attribute::RetrievableOption,
264
265    /// Contains facet options.
266    pub facet_config: std::option::Option<crate::model::catalog_attribute::FacetConfig>,
267
268    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
269}
270
271impl CatalogAttribute {
272    pub fn new() -> Self {
273        std::default::Default::default()
274    }
275
276    /// Sets the value of [key][crate::model::CatalogAttribute::key].
277    ///
278    /// # Example
279    /// ```ignore,no_run
280    /// # use google_cloud_retail_v2::model::CatalogAttribute;
281    /// let x = CatalogAttribute::new().set_key("example");
282    /// ```
283    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
284        self.key = v.into();
285        self
286    }
287
288    /// Sets the value of [in_use][crate::model::CatalogAttribute::in_use].
289    ///
290    /// # Example
291    /// ```ignore,no_run
292    /// # use google_cloud_retail_v2::model::CatalogAttribute;
293    /// let x = CatalogAttribute::new().set_in_use(true);
294    /// ```
295    pub fn set_in_use<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
296        self.in_use = v.into();
297        self
298    }
299
300    /// Sets the value of [r#type][crate::model::CatalogAttribute::type].
301    ///
302    /// # Example
303    /// ```ignore,no_run
304    /// # use google_cloud_retail_v2::model::CatalogAttribute;
305    /// use google_cloud_retail_v2::model::catalog_attribute::AttributeType;
306    /// let x0 = CatalogAttribute::new().set_type(AttributeType::Textual);
307    /// let x1 = CatalogAttribute::new().set_type(AttributeType::Numerical);
308    /// ```
309    pub fn set_type<T: std::convert::Into<crate::model::catalog_attribute::AttributeType>>(
310        mut self,
311        v: T,
312    ) -> Self {
313        self.r#type = v.into();
314        self
315    }
316
317    /// Sets the value of [indexable_option][crate::model::CatalogAttribute::indexable_option].
318    ///
319    /// # Example
320    /// ```ignore,no_run
321    /// # use google_cloud_retail_v2::model::CatalogAttribute;
322    /// use google_cloud_retail_v2::model::catalog_attribute::IndexableOption;
323    /// let x0 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableEnabled);
324    /// let x1 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableDisabled);
325    /// ```
326    pub fn set_indexable_option<
327        T: std::convert::Into<crate::model::catalog_attribute::IndexableOption>,
328    >(
329        mut self,
330        v: T,
331    ) -> Self {
332        self.indexable_option = v.into();
333        self
334    }
335
336    /// Sets the value of [dynamic_facetable_option][crate::model::CatalogAttribute::dynamic_facetable_option].
337    ///
338    /// # Example
339    /// ```ignore,no_run
340    /// # use google_cloud_retail_v2::model::CatalogAttribute;
341    /// use google_cloud_retail_v2::model::catalog_attribute::DynamicFacetableOption;
342    /// let x0 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableEnabled);
343    /// let x1 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableDisabled);
344    /// ```
345    pub fn set_dynamic_facetable_option<
346        T: std::convert::Into<crate::model::catalog_attribute::DynamicFacetableOption>,
347    >(
348        mut self,
349        v: T,
350    ) -> Self {
351        self.dynamic_facetable_option = v.into();
352        self
353    }
354
355    /// Sets the value of [searchable_option][crate::model::CatalogAttribute::searchable_option].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_retail_v2::model::CatalogAttribute;
360    /// use google_cloud_retail_v2::model::catalog_attribute::SearchableOption;
361    /// let x0 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableEnabled);
362    /// let x1 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableDisabled);
363    /// ```
364    pub fn set_searchable_option<
365        T: std::convert::Into<crate::model::catalog_attribute::SearchableOption>,
366    >(
367        mut self,
368        v: T,
369    ) -> Self {
370        self.searchable_option = v.into();
371        self
372    }
373
374    /// Sets the value of [exact_searchable_option][crate::model::CatalogAttribute::exact_searchable_option].
375    ///
376    /// # Example
377    /// ```ignore,no_run
378    /// # use google_cloud_retail_v2::model::CatalogAttribute;
379    /// use google_cloud_retail_v2::model::catalog_attribute::ExactSearchableOption;
380    /// let x0 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableEnabled);
381    /// let x1 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableDisabled);
382    /// ```
383    pub fn set_exact_searchable_option<
384        T: std::convert::Into<crate::model::catalog_attribute::ExactSearchableOption>,
385    >(
386        mut self,
387        v: T,
388    ) -> Self {
389        self.exact_searchable_option = v.into();
390        self
391    }
392
393    /// Sets the value of [retrievable_option][crate::model::CatalogAttribute::retrievable_option].
394    ///
395    /// # Example
396    /// ```ignore,no_run
397    /// # use google_cloud_retail_v2::model::CatalogAttribute;
398    /// use google_cloud_retail_v2::model::catalog_attribute::RetrievableOption;
399    /// let x0 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableEnabled);
400    /// let x1 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableDisabled);
401    /// ```
402    pub fn set_retrievable_option<
403        T: std::convert::Into<crate::model::catalog_attribute::RetrievableOption>,
404    >(
405        mut self,
406        v: T,
407    ) -> Self {
408        self.retrievable_option = v.into();
409        self
410    }
411
412    /// Sets the value of [facet_config][crate::model::CatalogAttribute::facet_config].
413    ///
414    /// # Example
415    /// ```ignore,no_run
416    /// # use google_cloud_retail_v2::model::CatalogAttribute;
417    /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
418    /// let x = CatalogAttribute::new().set_facet_config(FacetConfig::default()/* use setters */);
419    /// ```
420    pub fn set_facet_config<T>(mut self, v: T) -> Self
421    where
422        T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
423    {
424        self.facet_config = std::option::Option::Some(v.into());
425        self
426    }
427
428    /// Sets or clears the value of [facet_config][crate::model::CatalogAttribute::facet_config].
429    ///
430    /// # Example
431    /// ```ignore,no_run
432    /// # use google_cloud_retail_v2::model::CatalogAttribute;
433    /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
434    /// let x = CatalogAttribute::new().set_or_clear_facet_config(Some(FacetConfig::default()/* use setters */));
435    /// let x = CatalogAttribute::new().set_or_clear_facet_config(None::<FacetConfig>);
436    /// ```
437    pub fn set_or_clear_facet_config<T>(mut self, v: std::option::Option<T>) -> Self
438    where
439        T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
440    {
441        self.facet_config = v.map(|x| x.into());
442        self
443    }
444}
445
446impl wkt::message::Message for CatalogAttribute {
447    fn typename() -> &'static str {
448        "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute"
449    }
450}
451
452/// Defines additional types related to [CatalogAttribute].
453pub mod catalog_attribute {
454    #[allow(unused_imports)]
455    use super::*;
456
457    /// Possible options for the facet that corresponds to the current attribute
458    /// config.
459    #[derive(Clone, Default, PartialEq)]
460    #[non_exhaustive]
461    pub struct FacetConfig {
462        /// If you don't set the facet
463        /// [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
464        /// in the request to a numerical attribute, then we use the computed
465        /// intervals with rounded bounds obtained from all its product numerical
466        /// attribute values. The computed intervals might not be ideal for some
467        /// attributes. Therefore, we give you the option to overwrite them with the
468        /// facet_intervals field. The maximum of facet intervals per
469        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
470        /// interval must have a lower bound or an upper bound. If both bounds are
471        /// provided, then the lower bound must be smaller or equal than the upper
472        /// bound.
473        ///
474        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
475        /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
476        pub facet_intervals: std::vec::Vec<crate::model::Interval>,
477
478        /// Each instance represents a list of attribute values to ignore as facet
479        /// values for a specific time range. The maximum number of instances per
480        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
481        ///
482        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
483        pub ignored_facet_values:
484            std::vec::Vec<crate::model::catalog_attribute::facet_config::IgnoredFacetValues>,
485
486        /// Each instance replaces a list of facet values by a merged facet
487        /// value. If a facet value is not in any list, then it will stay the same.
488        /// To avoid conflicts, only paths of length 1 are accepted. In other words,
489        /// if "dark_blue" merged into "BLUE", then the latter can't merge into
490        /// "blues" because this would create a path of length 2. The maximum number
491        /// of instances of MergedFacetValue per
492        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
493        /// feature is available only for textual custom attributes.
494        ///
495        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
496        pub merged_facet_values:
497            std::vec::Vec<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
498
499        /// Use this field only if you want to merge a facet key into another facet
500        /// key.
501        pub merged_facet:
502            std::option::Option<crate::model::catalog_attribute::facet_config::MergedFacet>,
503
504        /// Set this field only if you want to rerank based on facet values engaged
505        /// by the user for the current key. This option is only possible for custom
506        /// facetable textual keys.
507        pub rerank_config:
508            std::option::Option<crate::model::catalog_attribute::facet_config::RerankConfig>,
509
510        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
511    }
512
513    impl FacetConfig {
514        pub fn new() -> Self {
515            std::default::Default::default()
516        }
517
518        /// Sets the value of [facet_intervals][crate::model::catalog_attribute::FacetConfig::facet_intervals].
519        ///
520        /// # Example
521        /// ```ignore,no_run
522        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
523        /// use google_cloud_retail_v2::model::Interval;
524        /// let x = FacetConfig::new()
525        ///     .set_facet_intervals([
526        ///         Interval::default()/* use setters */,
527        ///         Interval::default()/* use (different) setters */,
528        ///     ]);
529        /// ```
530        pub fn set_facet_intervals<T, V>(mut self, v: T) -> Self
531        where
532            T: std::iter::IntoIterator<Item = V>,
533            V: std::convert::Into<crate::model::Interval>,
534        {
535            use std::iter::Iterator;
536            self.facet_intervals = v.into_iter().map(|i| i.into()).collect();
537            self
538        }
539
540        /// Sets the value of [ignored_facet_values][crate::model::catalog_attribute::FacetConfig::ignored_facet_values].
541        ///
542        /// # Example
543        /// ```ignore,no_run
544        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
545        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
546        /// let x = FacetConfig::new()
547        ///     .set_ignored_facet_values([
548        ///         IgnoredFacetValues::default()/* use setters */,
549        ///         IgnoredFacetValues::default()/* use (different) setters */,
550        ///     ]);
551        /// ```
552        pub fn set_ignored_facet_values<T, V>(mut self, v: T) -> Self
553        where
554            T: std::iter::IntoIterator<Item = V>,
555            V: std::convert::Into<
556                    crate::model::catalog_attribute::facet_config::IgnoredFacetValues,
557                >,
558        {
559            use std::iter::Iterator;
560            self.ignored_facet_values = v.into_iter().map(|i| i.into()).collect();
561            self
562        }
563
564        /// Sets the value of [merged_facet_values][crate::model::catalog_attribute::FacetConfig::merged_facet_values].
565        ///
566        /// # Example
567        /// ```ignore,no_run
568        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
569        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
570        /// let x = FacetConfig::new()
571        ///     .set_merged_facet_values([
572        ///         MergedFacetValue::default()/* use setters */,
573        ///         MergedFacetValue::default()/* use (different) setters */,
574        ///     ]);
575        /// ```
576        pub fn set_merged_facet_values<T, V>(mut self, v: T) -> Self
577        where
578            T: std::iter::IntoIterator<Item = V>,
579            V: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
580        {
581            use std::iter::Iterator;
582            self.merged_facet_values = v.into_iter().map(|i| i.into()).collect();
583            self
584        }
585
586        /// Sets the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
587        ///
588        /// # Example
589        /// ```ignore,no_run
590        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
591        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
592        /// let x = FacetConfig::new().set_merged_facet(MergedFacet::default()/* use setters */);
593        /// ```
594        pub fn set_merged_facet<T>(mut self, v: T) -> Self
595        where
596            T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
597        {
598            self.merged_facet = std::option::Option::Some(v.into());
599            self
600        }
601
602        /// Sets or clears the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
603        ///
604        /// # Example
605        /// ```ignore,no_run
606        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
607        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
608        /// let x = FacetConfig::new().set_or_clear_merged_facet(Some(MergedFacet::default()/* use setters */));
609        /// let x = FacetConfig::new().set_or_clear_merged_facet(None::<MergedFacet>);
610        /// ```
611        pub fn set_or_clear_merged_facet<T>(mut self, v: std::option::Option<T>) -> Self
612        where
613            T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
614        {
615            self.merged_facet = v.map(|x| x.into());
616            self
617        }
618
619        /// Sets the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
620        ///
621        /// # Example
622        /// ```ignore,no_run
623        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
624        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
625        /// let x = FacetConfig::new().set_rerank_config(RerankConfig::default()/* use setters */);
626        /// ```
627        pub fn set_rerank_config<T>(mut self, v: T) -> Self
628        where
629            T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
630        {
631            self.rerank_config = std::option::Option::Some(v.into());
632            self
633        }
634
635        /// Sets or clears the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
636        ///
637        /// # Example
638        /// ```ignore,no_run
639        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
640        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
641        /// let x = FacetConfig::new().set_or_clear_rerank_config(Some(RerankConfig::default()/* use setters */));
642        /// let x = FacetConfig::new().set_or_clear_rerank_config(None::<RerankConfig>);
643        /// ```
644        pub fn set_or_clear_rerank_config<T>(mut self, v: std::option::Option<T>) -> Self
645        where
646            T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
647        {
648            self.rerank_config = v.map(|x| x.into());
649            self
650        }
651    }
652
653    impl wkt::message::Message for FacetConfig {
654        fn typename() -> &'static str {
655            "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig"
656        }
657    }
658
659    /// Defines additional types related to [FacetConfig].
660    pub mod facet_config {
661        #[allow(unused_imports)]
662        use super::*;
663
664        /// [Facet values][google.cloud.retail.v2.SearchResponse.Facet.values] to
665        /// ignore on [facets][google.cloud.retail.v2.SearchResponse.Facet] during
666        /// the specified time range for the given
667        /// [SearchResponse.Facet.key][google.cloud.retail.v2.SearchResponse.Facet.key]
668        /// attribute.
669        ///
670        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
671        /// [google.cloud.retail.v2.SearchResponse.Facet.key]: crate::model::search_response::Facet::key
672        /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
673        #[derive(Clone, Default, PartialEq)]
674        #[non_exhaustive]
675        pub struct IgnoredFacetValues {
676            /// List of facet values to ignore for the following time range. The facet
677            /// values are the same as the attribute values. There is a limit of 10
678            /// values per instance of IgnoredFacetValues. Each value can have at most
679            /// 128 characters.
680            pub values: std::vec::Vec<std::string::String>,
681
682            /// Time range for the current list of facet values to ignore.
683            /// If multiple time ranges are specified for an facet value for the
684            /// current attribute, consider all of them. If both are empty, ignore
685            /// always. If start time and end time are set, then start time
686            /// must be before end time.
687            /// If start time is not empty and end time is empty, then will ignore
688            /// these facet values after the start time.
689            pub start_time: std::option::Option<wkt::Timestamp>,
690
691            /// If start time is empty and end time is not empty, then ignore these
692            /// facet values before end time.
693            pub end_time: std::option::Option<wkt::Timestamp>,
694
695            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
696        }
697
698        impl IgnoredFacetValues {
699            pub fn new() -> Self {
700                std::default::Default::default()
701            }
702
703            /// Sets the value of [values][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::values].
704            ///
705            /// # Example
706            /// ```ignore,no_run
707            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
708            /// let x = IgnoredFacetValues::new().set_values(["a", "b", "c"]);
709            /// ```
710            pub fn set_values<T, V>(mut self, v: T) -> Self
711            where
712                T: std::iter::IntoIterator<Item = V>,
713                V: std::convert::Into<std::string::String>,
714            {
715                use std::iter::Iterator;
716                self.values = v.into_iter().map(|i| i.into()).collect();
717                self
718            }
719
720            /// Sets the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
721            ///
722            /// # Example
723            /// ```ignore,no_run
724            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
725            /// use wkt::Timestamp;
726            /// let x = IgnoredFacetValues::new().set_start_time(Timestamp::default()/* use setters */);
727            /// ```
728            pub fn set_start_time<T>(mut self, v: T) -> Self
729            where
730                T: std::convert::Into<wkt::Timestamp>,
731            {
732                self.start_time = std::option::Option::Some(v.into());
733                self
734            }
735
736            /// Sets or clears the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
737            ///
738            /// # Example
739            /// ```ignore,no_run
740            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
741            /// use wkt::Timestamp;
742            /// let x = IgnoredFacetValues::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
743            /// let x = IgnoredFacetValues::new().set_or_clear_start_time(None::<Timestamp>);
744            /// ```
745            pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
746            where
747                T: std::convert::Into<wkt::Timestamp>,
748            {
749                self.start_time = v.map(|x| x.into());
750                self
751            }
752
753            /// Sets the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
754            ///
755            /// # Example
756            /// ```ignore,no_run
757            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
758            /// use wkt::Timestamp;
759            /// let x = IgnoredFacetValues::new().set_end_time(Timestamp::default()/* use setters */);
760            /// ```
761            pub fn set_end_time<T>(mut self, v: T) -> Self
762            where
763                T: std::convert::Into<wkt::Timestamp>,
764            {
765                self.end_time = std::option::Option::Some(v.into());
766                self
767            }
768
769            /// Sets or clears the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
770            ///
771            /// # Example
772            /// ```ignore,no_run
773            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
774            /// use wkt::Timestamp;
775            /// let x = IgnoredFacetValues::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
776            /// let x = IgnoredFacetValues::new().set_or_clear_end_time(None::<Timestamp>);
777            /// ```
778            pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
779            where
780                T: std::convert::Into<wkt::Timestamp>,
781            {
782                self.end_time = v.map(|x| x.into());
783                self
784            }
785        }
786
787        impl wkt::message::Message for IgnoredFacetValues {
788            fn typename() -> &'static str {
789                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues"
790            }
791        }
792
793        /// Replaces a set of textual facet values by the same (possibly different)
794        /// merged facet value. Each facet value should appear at most once as a
795        /// value per [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
796        /// This feature is available only for textual custom attributes.
797        ///
798        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
799        #[derive(Clone, Default, PartialEq)]
800        #[non_exhaustive]
801        pub struct MergedFacetValue {
802            /// All the facet values that are replaces by the same
803            /// [merged_value][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]
804            /// that follows. The maximum number of values per MergedFacetValue is 25.
805            /// Each value can have up to 128 characters.
806            ///
807            /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]: crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value
808            pub values: std::vec::Vec<std::string::String>,
809
810            /// All the previous values are replaced by this merged facet value.
811            /// This merged_value must be non-empty and can have up to 128 characters.
812            pub merged_value: std::string::String,
813
814            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
815        }
816
817        impl MergedFacetValue {
818            pub fn new() -> Self {
819                std::default::Default::default()
820            }
821
822            /// Sets the value of [values][crate::model::catalog_attribute::facet_config::MergedFacetValue::values].
823            ///
824            /// # Example
825            /// ```ignore,no_run
826            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
827            /// let x = MergedFacetValue::new().set_values(["a", "b", "c"]);
828            /// ```
829            pub fn set_values<T, V>(mut self, v: T) -> Self
830            where
831                T: std::iter::IntoIterator<Item = V>,
832                V: std::convert::Into<std::string::String>,
833            {
834                use std::iter::Iterator;
835                self.values = v.into_iter().map(|i| i.into()).collect();
836                self
837            }
838
839            /// Sets the value of [merged_value][crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value].
840            ///
841            /// # Example
842            /// ```ignore,no_run
843            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
844            /// let x = MergedFacetValue::new().set_merged_value("example");
845            /// ```
846            pub fn set_merged_value<T: std::convert::Into<std::string::String>>(
847                mut self,
848                v: T,
849            ) -> Self {
850                self.merged_value = v.into();
851                self
852            }
853        }
854
855        impl wkt::message::Message for MergedFacetValue {
856            fn typename() -> &'static str {
857                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue"
858            }
859        }
860
861        /// The current facet key (i.e. attribute config) maps into the
862        /// [merged_facet_key][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key].
863        /// A facet key can have at most one child. The current facet key and the
864        /// merged facet key need both to be textual custom attributes or both
865        /// numerical custom attributes (same type).
866        ///
867        /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key]: crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key
868        #[derive(Clone, Default, PartialEq)]
869        #[non_exhaustive]
870        pub struct MergedFacet {
871            /// The merged facet key should be a valid facet key that is different than
872            /// the facet key of the current catalog attribute. We refer this is
873            /// merged facet key as the child of the current catalog attribute. This
874            /// merged facet key can't be a parent of another facet key (i.e. no
875            /// directed path of length 2). This merged facet key needs to be either a
876            /// textual custom attribute or a numerical custom attribute.
877            pub merged_facet_key: std::string::String,
878
879            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
880        }
881
882        impl MergedFacet {
883            pub fn new() -> Self {
884                std::default::Default::default()
885            }
886
887            /// Sets the value of [merged_facet_key][crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key].
888            ///
889            /// # Example
890            /// ```ignore,no_run
891            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
892            /// let x = MergedFacet::new().set_merged_facet_key("example");
893            /// ```
894            pub fn set_merged_facet_key<T: std::convert::Into<std::string::String>>(
895                mut self,
896                v: T,
897            ) -> Self {
898                self.merged_facet_key = v.into();
899                self
900            }
901        }
902
903        impl wkt::message::Message for MergedFacet {
904            fn typename() -> &'static str {
905                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet"
906            }
907        }
908
909        /// Options to rerank based on facet values engaged by the user for the
910        /// current key. That key needs to be a custom textual key and facetable.
911        /// To use this control, you also need to pass all the facet keys engaged by
912        /// the user in the request using the field [SearchRequest.FacetSpec]. In
913        /// particular, if you don't pass the facet keys engaged that you want to
914        /// rerank on, this control won't be effective. Moreover, to obtain better
915        /// results, the facet values that you want to rerank on should be close to
916        /// English (ideally made of words, underscores, and spaces).
917        #[derive(Clone, Default, PartialEq)]
918        #[non_exhaustive]
919        pub struct RerankConfig {
920            /// If set to true, then we also rerank the dynamic facets based on the
921            /// facet values engaged by the user for the current attribute key during
922            /// serving.
923            pub rerank_facet: bool,
924
925            /// If empty, rerank on all facet values for the current key. Otherwise,
926            /// will rerank on the facet values from this list only.
927            pub facet_values: std::vec::Vec<std::string::String>,
928
929            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
930        }
931
932        impl RerankConfig {
933            pub fn new() -> Self {
934                std::default::Default::default()
935            }
936
937            /// Sets the value of [rerank_facet][crate::model::catalog_attribute::facet_config::RerankConfig::rerank_facet].
938            ///
939            /// # Example
940            /// ```ignore,no_run
941            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
942            /// let x = RerankConfig::new().set_rerank_facet(true);
943            /// ```
944            pub fn set_rerank_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
945                self.rerank_facet = v.into();
946                self
947            }
948
949            /// Sets the value of [facet_values][crate::model::catalog_attribute::facet_config::RerankConfig::facet_values].
950            ///
951            /// # Example
952            /// ```ignore,no_run
953            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
954            /// let x = RerankConfig::new().set_facet_values(["a", "b", "c"]);
955            /// ```
956            pub fn set_facet_values<T, V>(mut self, v: T) -> Self
957            where
958                T: std::iter::IntoIterator<Item = V>,
959                V: std::convert::Into<std::string::String>,
960            {
961                use std::iter::Iterator;
962                self.facet_values = v.into_iter().map(|i| i.into()).collect();
963                self
964            }
965        }
966
967        impl wkt::message::Message for RerankConfig {
968            fn typename() -> &'static str {
969                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig"
970            }
971        }
972    }
973
974    /// The type of an attribute.
975    ///
976    /// # Working with unknown values
977    ///
978    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
979    /// additional enum variants at any time. Adding new variants is not considered
980    /// a breaking change. Applications should write their code in anticipation of:
981    ///
982    /// - New values appearing in future releases of the client library, **and**
983    /// - New values received dynamically, without application changes.
984    ///
985    /// Please consult the [Working with enums] section in the user guide for some
986    /// guidelines.
987    ///
988    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
989    #[derive(Clone, Debug, PartialEq)]
990    #[non_exhaustive]
991    pub enum AttributeType {
992        /// The type of the attribute is unknown.
993        ///
994        /// Used when type cannot be derived from attribute that is not
995        /// [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
996        ///
997        /// [google.cloud.retail.v2.CatalogAttribute.in_use]: crate::model::CatalogAttribute::in_use
998        Unknown,
999        /// Textual attribute.
1000        Textual,
1001        /// Numerical attribute.
1002        Numerical,
1003        /// If set, the enum was initialized with an unknown value.
1004        ///
1005        /// Applications can examine the value using [AttributeType::value] or
1006        /// [AttributeType::name].
1007        UnknownValue(attribute_type::UnknownValue),
1008    }
1009
1010    #[doc(hidden)]
1011    pub mod attribute_type {
1012        #[allow(unused_imports)]
1013        use super::*;
1014        #[derive(Clone, Debug, PartialEq)]
1015        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1016    }
1017
1018    impl AttributeType {
1019        /// Gets the enum value.
1020        ///
1021        /// Returns `None` if the enum contains an unknown value deserialized from
1022        /// the string representation of enums.
1023        pub fn value(&self) -> std::option::Option<i32> {
1024            match self {
1025                Self::Unknown => std::option::Option::Some(0),
1026                Self::Textual => std::option::Option::Some(1),
1027                Self::Numerical => std::option::Option::Some(2),
1028                Self::UnknownValue(u) => u.0.value(),
1029            }
1030        }
1031
1032        /// Gets the enum value as a string.
1033        ///
1034        /// Returns `None` if the enum contains an unknown value deserialized from
1035        /// the integer representation of enums.
1036        pub fn name(&self) -> std::option::Option<&str> {
1037            match self {
1038                Self::Unknown => std::option::Option::Some("UNKNOWN"),
1039                Self::Textual => std::option::Option::Some("TEXTUAL"),
1040                Self::Numerical => std::option::Option::Some("NUMERICAL"),
1041                Self::UnknownValue(u) => u.0.name(),
1042            }
1043        }
1044    }
1045
1046    impl std::default::Default for AttributeType {
1047        fn default() -> Self {
1048            use std::convert::From;
1049            Self::from(0)
1050        }
1051    }
1052
1053    impl std::fmt::Display for AttributeType {
1054        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1055            wkt::internal::display_enum(f, self.name(), self.value())
1056        }
1057    }
1058
1059    impl std::convert::From<i32> for AttributeType {
1060        fn from(value: i32) -> Self {
1061            match value {
1062                0 => Self::Unknown,
1063                1 => Self::Textual,
1064                2 => Self::Numerical,
1065                _ => Self::UnknownValue(attribute_type::UnknownValue(
1066                    wkt::internal::UnknownEnumValue::Integer(value),
1067                )),
1068            }
1069        }
1070    }
1071
1072    impl std::convert::From<&str> for AttributeType {
1073        fn from(value: &str) -> Self {
1074            use std::string::ToString;
1075            match value {
1076                "UNKNOWN" => Self::Unknown,
1077                "TEXTUAL" => Self::Textual,
1078                "NUMERICAL" => Self::Numerical,
1079                _ => Self::UnknownValue(attribute_type::UnknownValue(
1080                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1081                )),
1082            }
1083        }
1084    }
1085
1086    impl serde::ser::Serialize for AttributeType {
1087        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1088        where
1089            S: serde::Serializer,
1090        {
1091            match self {
1092                Self::Unknown => serializer.serialize_i32(0),
1093                Self::Textual => serializer.serialize_i32(1),
1094                Self::Numerical => serializer.serialize_i32(2),
1095                Self::UnknownValue(u) => u.0.serialize(serializer),
1096            }
1097        }
1098    }
1099
1100    impl<'de> serde::de::Deserialize<'de> for AttributeType {
1101        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1102        where
1103            D: serde::Deserializer<'de>,
1104        {
1105            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeType>::new(
1106                ".google.cloud.retail.v2.CatalogAttribute.AttributeType",
1107            ))
1108        }
1109    }
1110
1111    /// The status of the indexable option of a catalog attribute.
1112    ///
1113    /// # Working with unknown values
1114    ///
1115    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1116    /// additional enum variants at any time. Adding new variants is not considered
1117    /// a breaking change. Applications should write their code in anticipation of:
1118    ///
1119    /// - New values appearing in future releases of the client library, **and**
1120    /// - New values received dynamically, without application changes.
1121    ///
1122    /// Please consult the [Working with enums] section in the user guide for some
1123    /// guidelines.
1124    ///
1125    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1126    #[derive(Clone, Debug, PartialEq)]
1127    #[non_exhaustive]
1128    pub enum IndexableOption {
1129        /// Value used when unset.
1130        Unspecified,
1131        /// Indexable option enabled for an attribute.
1132        IndexableEnabled,
1133        /// Indexable option disabled for an attribute.
1134        IndexableDisabled,
1135        /// If set, the enum was initialized with an unknown value.
1136        ///
1137        /// Applications can examine the value using [IndexableOption::value] or
1138        /// [IndexableOption::name].
1139        UnknownValue(indexable_option::UnknownValue),
1140    }
1141
1142    #[doc(hidden)]
1143    pub mod indexable_option {
1144        #[allow(unused_imports)]
1145        use super::*;
1146        #[derive(Clone, Debug, PartialEq)]
1147        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1148    }
1149
1150    impl IndexableOption {
1151        /// Gets the enum value.
1152        ///
1153        /// Returns `None` if the enum contains an unknown value deserialized from
1154        /// the string representation of enums.
1155        pub fn value(&self) -> std::option::Option<i32> {
1156            match self {
1157                Self::Unspecified => std::option::Option::Some(0),
1158                Self::IndexableEnabled => std::option::Option::Some(1),
1159                Self::IndexableDisabled => std::option::Option::Some(2),
1160                Self::UnknownValue(u) => u.0.value(),
1161            }
1162        }
1163
1164        /// Gets the enum value as a string.
1165        ///
1166        /// Returns `None` if the enum contains an unknown value deserialized from
1167        /// the integer representation of enums.
1168        pub fn name(&self) -> std::option::Option<&str> {
1169            match self {
1170                Self::Unspecified => std::option::Option::Some("INDEXABLE_OPTION_UNSPECIFIED"),
1171                Self::IndexableEnabled => std::option::Option::Some("INDEXABLE_ENABLED"),
1172                Self::IndexableDisabled => std::option::Option::Some("INDEXABLE_DISABLED"),
1173                Self::UnknownValue(u) => u.0.name(),
1174            }
1175        }
1176    }
1177
1178    impl std::default::Default for IndexableOption {
1179        fn default() -> Self {
1180            use std::convert::From;
1181            Self::from(0)
1182        }
1183    }
1184
1185    impl std::fmt::Display for IndexableOption {
1186        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1187            wkt::internal::display_enum(f, self.name(), self.value())
1188        }
1189    }
1190
1191    impl std::convert::From<i32> for IndexableOption {
1192        fn from(value: i32) -> Self {
1193            match value {
1194                0 => Self::Unspecified,
1195                1 => Self::IndexableEnabled,
1196                2 => Self::IndexableDisabled,
1197                _ => Self::UnknownValue(indexable_option::UnknownValue(
1198                    wkt::internal::UnknownEnumValue::Integer(value),
1199                )),
1200            }
1201        }
1202    }
1203
1204    impl std::convert::From<&str> for IndexableOption {
1205        fn from(value: &str) -> Self {
1206            use std::string::ToString;
1207            match value {
1208                "INDEXABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1209                "INDEXABLE_ENABLED" => Self::IndexableEnabled,
1210                "INDEXABLE_DISABLED" => Self::IndexableDisabled,
1211                _ => Self::UnknownValue(indexable_option::UnknownValue(
1212                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1213                )),
1214            }
1215        }
1216    }
1217
1218    impl serde::ser::Serialize for IndexableOption {
1219        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1220        where
1221            S: serde::Serializer,
1222        {
1223            match self {
1224                Self::Unspecified => serializer.serialize_i32(0),
1225                Self::IndexableEnabled => serializer.serialize_i32(1),
1226                Self::IndexableDisabled => serializer.serialize_i32(2),
1227                Self::UnknownValue(u) => u.0.serialize(serializer),
1228            }
1229        }
1230    }
1231
1232    impl<'de> serde::de::Deserialize<'de> for IndexableOption {
1233        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1234        where
1235            D: serde::Deserializer<'de>,
1236        {
1237            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexableOption>::new(
1238                ".google.cloud.retail.v2.CatalogAttribute.IndexableOption",
1239            ))
1240        }
1241    }
1242
1243    /// The status of the dynamic facetable option of a catalog attribute.
1244    ///
1245    /// # Working with unknown values
1246    ///
1247    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1248    /// additional enum variants at any time. Adding new variants is not considered
1249    /// a breaking change. Applications should write their code in anticipation of:
1250    ///
1251    /// - New values appearing in future releases of the client library, **and**
1252    /// - New values received dynamically, without application changes.
1253    ///
1254    /// Please consult the [Working with enums] section in the user guide for some
1255    /// guidelines.
1256    ///
1257    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1258    #[derive(Clone, Debug, PartialEq)]
1259    #[non_exhaustive]
1260    pub enum DynamicFacetableOption {
1261        /// Value used when unset.
1262        Unspecified,
1263        /// Dynamic facetable option enabled for an attribute.
1264        DynamicFacetableEnabled,
1265        /// Dynamic facetable option disabled for an attribute.
1266        DynamicFacetableDisabled,
1267        /// If set, the enum was initialized with an unknown value.
1268        ///
1269        /// Applications can examine the value using [DynamicFacetableOption::value] or
1270        /// [DynamicFacetableOption::name].
1271        UnknownValue(dynamic_facetable_option::UnknownValue),
1272    }
1273
1274    #[doc(hidden)]
1275    pub mod dynamic_facetable_option {
1276        #[allow(unused_imports)]
1277        use super::*;
1278        #[derive(Clone, Debug, PartialEq)]
1279        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1280    }
1281
1282    impl DynamicFacetableOption {
1283        /// Gets the enum value.
1284        ///
1285        /// Returns `None` if the enum contains an unknown value deserialized from
1286        /// the string representation of enums.
1287        pub fn value(&self) -> std::option::Option<i32> {
1288            match self {
1289                Self::Unspecified => std::option::Option::Some(0),
1290                Self::DynamicFacetableEnabled => std::option::Option::Some(1),
1291                Self::DynamicFacetableDisabled => std::option::Option::Some(2),
1292                Self::UnknownValue(u) => u.0.value(),
1293            }
1294        }
1295
1296        /// Gets the enum value as a string.
1297        ///
1298        /// Returns `None` if the enum contains an unknown value deserialized from
1299        /// the integer representation of enums.
1300        pub fn name(&self) -> std::option::Option<&str> {
1301            match self {
1302                Self::Unspecified => {
1303                    std::option::Option::Some("DYNAMIC_FACETABLE_OPTION_UNSPECIFIED")
1304                }
1305                Self::DynamicFacetableEnabled => {
1306                    std::option::Option::Some("DYNAMIC_FACETABLE_ENABLED")
1307                }
1308                Self::DynamicFacetableDisabled => {
1309                    std::option::Option::Some("DYNAMIC_FACETABLE_DISABLED")
1310                }
1311                Self::UnknownValue(u) => u.0.name(),
1312            }
1313        }
1314    }
1315
1316    impl std::default::Default for DynamicFacetableOption {
1317        fn default() -> Self {
1318            use std::convert::From;
1319            Self::from(0)
1320        }
1321    }
1322
1323    impl std::fmt::Display for DynamicFacetableOption {
1324        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1325            wkt::internal::display_enum(f, self.name(), self.value())
1326        }
1327    }
1328
1329    impl std::convert::From<i32> for DynamicFacetableOption {
1330        fn from(value: i32) -> Self {
1331            match value {
1332                0 => Self::Unspecified,
1333                1 => Self::DynamicFacetableEnabled,
1334                2 => Self::DynamicFacetableDisabled,
1335                _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1336                    wkt::internal::UnknownEnumValue::Integer(value),
1337                )),
1338            }
1339        }
1340    }
1341
1342    impl std::convert::From<&str> for DynamicFacetableOption {
1343        fn from(value: &str) -> Self {
1344            use std::string::ToString;
1345            match value {
1346                "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1347                "DYNAMIC_FACETABLE_ENABLED" => Self::DynamicFacetableEnabled,
1348                "DYNAMIC_FACETABLE_DISABLED" => Self::DynamicFacetableDisabled,
1349                _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1350                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1351                )),
1352            }
1353        }
1354    }
1355
1356    impl serde::ser::Serialize for DynamicFacetableOption {
1357        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1358        where
1359            S: serde::Serializer,
1360        {
1361            match self {
1362                Self::Unspecified => serializer.serialize_i32(0),
1363                Self::DynamicFacetableEnabled => serializer.serialize_i32(1),
1364                Self::DynamicFacetableDisabled => serializer.serialize_i32(2),
1365                Self::UnknownValue(u) => u.0.serialize(serializer),
1366            }
1367        }
1368    }
1369
1370    impl<'de> serde::de::Deserialize<'de> for DynamicFacetableOption {
1371        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1372        where
1373            D: serde::Deserializer<'de>,
1374        {
1375            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DynamicFacetableOption>::new(
1376                ".google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption",
1377            ))
1378        }
1379    }
1380
1381    /// The status of the searchable option of a catalog attribute.
1382    ///
1383    /// # Working with unknown values
1384    ///
1385    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1386    /// additional enum variants at any time. Adding new variants is not considered
1387    /// a breaking change. Applications should write their code in anticipation of:
1388    ///
1389    /// - New values appearing in future releases of the client library, **and**
1390    /// - New values received dynamically, without application changes.
1391    ///
1392    /// Please consult the [Working with enums] section in the user guide for some
1393    /// guidelines.
1394    ///
1395    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1396    #[derive(Clone, Debug, PartialEq)]
1397    #[non_exhaustive]
1398    pub enum SearchableOption {
1399        /// Value used when unset.
1400        Unspecified,
1401        /// Searchable option enabled for an attribute.
1402        SearchableEnabled,
1403        /// Searchable option disabled for an attribute.
1404        SearchableDisabled,
1405        /// If set, the enum was initialized with an unknown value.
1406        ///
1407        /// Applications can examine the value using [SearchableOption::value] or
1408        /// [SearchableOption::name].
1409        UnknownValue(searchable_option::UnknownValue),
1410    }
1411
1412    #[doc(hidden)]
1413    pub mod searchable_option {
1414        #[allow(unused_imports)]
1415        use super::*;
1416        #[derive(Clone, Debug, PartialEq)]
1417        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1418    }
1419
1420    impl SearchableOption {
1421        /// Gets the enum value.
1422        ///
1423        /// Returns `None` if the enum contains an unknown value deserialized from
1424        /// the string representation of enums.
1425        pub fn value(&self) -> std::option::Option<i32> {
1426            match self {
1427                Self::Unspecified => std::option::Option::Some(0),
1428                Self::SearchableEnabled => std::option::Option::Some(1),
1429                Self::SearchableDisabled => std::option::Option::Some(2),
1430                Self::UnknownValue(u) => u.0.value(),
1431            }
1432        }
1433
1434        /// Gets the enum value as a string.
1435        ///
1436        /// Returns `None` if the enum contains an unknown value deserialized from
1437        /// the integer representation of enums.
1438        pub fn name(&self) -> std::option::Option<&str> {
1439            match self {
1440                Self::Unspecified => std::option::Option::Some("SEARCHABLE_OPTION_UNSPECIFIED"),
1441                Self::SearchableEnabled => std::option::Option::Some("SEARCHABLE_ENABLED"),
1442                Self::SearchableDisabled => std::option::Option::Some("SEARCHABLE_DISABLED"),
1443                Self::UnknownValue(u) => u.0.name(),
1444            }
1445        }
1446    }
1447
1448    impl std::default::Default for SearchableOption {
1449        fn default() -> Self {
1450            use std::convert::From;
1451            Self::from(0)
1452        }
1453    }
1454
1455    impl std::fmt::Display for SearchableOption {
1456        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1457            wkt::internal::display_enum(f, self.name(), self.value())
1458        }
1459    }
1460
1461    impl std::convert::From<i32> for SearchableOption {
1462        fn from(value: i32) -> Self {
1463            match value {
1464                0 => Self::Unspecified,
1465                1 => Self::SearchableEnabled,
1466                2 => Self::SearchableDisabled,
1467                _ => Self::UnknownValue(searchable_option::UnknownValue(
1468                    wkt::internal::UnknownEnumValue::Integer(value),
1469                )),
1470            }
1471        }
1472    }
1473
1474    impl std::convert::From<&str> for SearchableOption {
1475        fn from(value: &str) -> Self {
1476            use std::string::ToString;
1477            match value {
1478                "SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1479                "SEARCHABLE_ENABLED" => Self::SearchableEnabled,
1480                "SEARCHABLE_DISABLED" => Self::SearchableDisabled,
1481                _ => Self::UnknownValue(searchable_option::UnknownValue(
1482                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1483                )),
1484            }
1485        }
1486    }
1487
1488    impl serde::ser::Serialize for SearchableOption {
1489        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1490        where
1491            S: serde::Serializer,
1492        {
1493            match self {
1494                Self::Unspecified => serializer.serialize_i32(0),
1495                Self::SearchableEnabled => serializer.serialize_i32(1),
1496                Self::SearchableDisabled => serializer.serialize_i32(2),
1497                Self::UnknownValue(u) => u.0.serialize(serializer),
1498            }
1499        }
1500    }
1501
1502    impl<'de> serde::de::Deserialize<'de> for SearchableOption {
1503        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1504        where
1505            D: serde::Deserializer<'de>,
1506        {
1507            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchableOption>::new(
1508                ".google.cloud.retail.v2.CatalogAttribute.SearchableOption",
1509            ))
1510        }
1511    }
1512
1513    /// The status of the exact-searchable option of a catalog attribute.
1514    ///
1515    /// # Working with unknown values
1516    ///
1517    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1518    /// additional enum variants at any time. Adding new variants is not considered
1519    /// a breaking change. Applications should write their code in anticipation of:
1520    ///
1521    /// - New values appearing in future releases of the client library, **and**
1522    /// - New values received dynamically, without application changes.
1523    ///
1524    /// Please consult the [Working with enums] section in the user guide for some
1525    /// guidelines.
1526    ///
1527    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1528    #[derive(Clone, Debug, PartialEq)]
1529    #[non_exhaustive]
1530    pub enum ExactSearchableOption {
1531        /// Value used when unset.
1532        Unspecified,
1533        /// Exact searchable option enabled for an attribute.
1534        ExactSearchableEnabled,
1535        /// Exact searchable option disabled for an attribute.
1536        ExactSearchableDisabled,
1537        /// If set, the enum was initialized with an unknown value.
1538        ///
1539        /// Applications can examine the value using [ExactSearchableOption::value] or
1540        /// [ExactSearchableOption::name].
1541        UnknownValue(exact_searchable_option::UnknownValue),
1542    }
1543
1544    #[doc(hidden)]
1545    pub mod exact_searchable_option {
1546        #[allow(unused_imports)]
1547        use super::*;
1548        #[derive(Clone, Debug, PartialEq)]
1549        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1550    }
1551
1552    impl ExactSearchableOption {
1553        /// Gets the enum value.
1554        ///
1555        /// Returns `None` if the enum contains an unknown value deserialized from
1556        /// the string representation of enums.
1557        pub fn value(&self) -> std::option::Option<i32> {
1558            match self {
1559                Self::Unspecified => std::option::Option::Some(0),
1560                Self::ExactSearchableEnabled => std::option::Option::Some(1),
1561                Self::ExactSearchableDisabled => std::option::Option::Some(2),
1562                Self::UnknownValue(u) => u.0.value(),
1563            }
1564        }
1565
1566        /// Gets the enum value as a string.
1567        ///
1568        /// Returns `None` if the enum contains an unknown value deserialized from
1569        /// the integer representation of enums.
1570        pub fn name(&self) -> std::option::Option<&str> {
1571            match self {
1572                Self::Unspecified => {
1573                    std::option::Option::Some("EXACT_SEARCHABLE_OPTION_UNSPECIFIED")
1574                }
1575                Self::ExactSearchableEnabled => {
1576                    std::option::Option::Some("EXACT_SEARCHABLE_ENABLED")
1577                }
1578                Self::ExactSearchableDisabled => {
1579                    std::option::Option::Some("EXACT_SEARCHABLE_DISABLED")
1580                }
1581                Self::UnknownValue(u) => u.0.name(),
1582            }
1583        }
1584    }
1585
1586    impl std::default::Default for ExactSearchableOption {
1587        fn default() -> Self {
1588            use std::convert::From;
1589            Self::from(0)
1590        }
1591    }
1592
1593    impl std::fmt::Display for ExactSearchableOption {
1594        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1595            wkt::internal::display_enum(f, self.name(), self.value())
1596        }
1597    }
1598
1599    impl std::convert::From<i32> for ExactSearchableOption {
1600        fn from(value: i32) -> Self {
1601            match value {
1602                0 => Self::Unspecified,
1603                1 => Self::ExactSearchableEnabled,
1604                2 => Self::ExactSearchableDisabled,
1605                _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1606                    wkt::internal::UnknownEnumValue::Integer(value),
1607                )),
1608            }
1609        }
1610    }
1611
1612    impl std::convert::From<&str> for ExactSearchableOption {
1613        fn from(value: &str) -> Self {
1614            use std::string::ToString;
1615            match value {
1616                "EXACT_SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1617                "EXACT_SEARCHABLE_ENABLED" => Self::ExactSearchableEnabled,
1618                "EXACT_SEARCHABLE_DISABLED" => Self::ExactSearchableDisabled,
1619                _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1620                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1621                )),
1622            }
1623        }
1624    }
1625
1626    impl serde::ser::Serialize for ExactSearchableOption {
1627        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1628        where
1629            S: serde::Serializer,
1630        {
1631            match self {
1632                Self::Unspecified => serializer.serialize_i32(0),
1633                Self::ExactSearchableEnabled => serializer.serialize_i32(1),
1634                Self::ExactSearchableDisabled => serializer.serialize_i32(2),
1635                Self::UnknownValue(u) => u.0.serialize(serializer),
1636            }
1637        }
1638    }
1639
1640    impl<'de> serde::de::Deserialize<'de> for ExactSearchableOption {
1641        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1642        where
1643            D: serde::Deserializer<'de>,
1644        {
1645            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExactSearchableOption>::new(
1646                ".google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption",
1647            ))
1648        }
1649    }
1650
1651    /// The status of the retrievable option of a catalog attribute.
1652    ///
1653    /// # Working with unknown values
1654    ///
1655    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1656    /// additional enum variants at any time. Adding new variants is not considered
1657    /// a breaking change. Applications should write their code in anticipation of:
1658    ///
1659    /// - New values appearing in future releases of the client library, **and**
1660    /// - New values received dynamically, without application changes.
1661    ///
1662    /// Please consult the [Working with enums] section in the user guide for some
1663    /// guidelines.
1664    ///
1665    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1666    #[derive(Clone, Debug, PartialEq)]
1667    #[non_exhaustive]
1668    pub enum RetrievableOption {
1669        /// Value used when unset.
1670        Unspecified,
1671        /// Retrievable option enabled for an attribute.
1672        RetrievableEnabled,
1673        /// Retrievable option disabled for an attribute.
1674        RetrievableDisabled,
1675        /// If set, the enum was initialized with an unknown value.
1676        ///
1677        /// Applications can examine the value using [RetrievableOption::value] or
1678        /// [RetrievableOption::name].
1679        UnknownValue(retrievable_option::UnknownValue),
1680    }
1681
1682    #[doc(hidden)]
1683    pub mod retrievable_option {
1684        #[allow(unused_imports)]
1685        use super::*;
1686        #[derive(Clone, Debug, PartialEq)]
1687        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1688    }
1689
1690    impl RetrievableOption {
1691        /// Gets the enum value.
1692        ///
1693        /// Returns `None` if the enum contains an unknown value deserialized from
1694        /// the string representation of enums.
1695        pub fn value(&self) -> std::option::Option<i32> {
1696            match self {
1697                Self::Unspecified => std::option::Option::Some(0),
1698                Self::RetrievableEnabled => std::option::Option::Some(1),
1699                Self::RetrievableDisabled => std::option::Option::Some(2),
1700                Self::UnknownValue(u) => u.0.value(),
1701            }
1702        }
1703
1704        /// Gets the enum value as a string.
1705        ///
1706        /// Returns `None` if the enum contains an unknown value deserialized from
1707        /// the integer representation of enums.
1708        pub fn name(&self) -> std::option::Option<&str> {
1709            match self {
1710                Self::Unspecified => std::option::Option::Some("RETRIEVABLE_OPTION_UNSPECIFIED"),
1711                Self::RetrievableEnabled => std::option::Option::Some("RETRIEVABLE_ENABLED"),
1712                Self::RetrievableDisabled => std::option::Option::Some("RETRIEVABLE_DISABLED"),
1713                Self::UnknownValue(u) => u.0.name(),
1714            }
1715        }
1716    }
1717
1718    impl std::default::Default for RetrievableOption {
1719        fn default() -> Self {
1720            use std::convert::From;
1721            Self::from(0)
1722        }
1723    }
1724
1725    impl std::fmt::Display for RetrievableOption {
1726        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1727            wkt::internal::display_enum(f, self.name(), self.value())
1728        }
1729    }
1730
1731    impl std::convert::From<i32> for RetrievableOption {
1732        fn from(value: i32) -> Self {
1733            match value {
1734                0 => Self::Unspecified,
1735                1 => Self::RetrievableEnabled,
1736                2 => Self::RetrievableDisabled,
1737                _ => Self::UnknownValue(retrievable_option::UnknownValue(
1738                    wkt::internal::UnknownEnumValue::Integer(value),
1739                )),
1740            }
1741        }
1742    }
1743
1744    impl std::convert::From<&str> for RetrievableOption {
1745        fn from(value: &str) -> Self {
1746            use std::string::ToString;
1747            match value {
1748                "RETRIEVABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1749                "RETRIEVABLE_ENABLED" => Self::RetrievableEnabled,
1750                "RETRIEVABLE_DISABLED" => Self::RetrievableDisabled,
1751                _ => Self::UnknownValue(retrievable_option::UnknownValue(
1752                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1753                )),
1754            }
1755        }
1756    }
1757
1758    impl serde::ser::Serialize for RetrievableOption {
1759        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1760        where
1761            S: serde::Serializer,
1762        {
1763            match self {
1764                Self::Unspecified => serializer.serialize_i32(0),
1765                Self::RetrievableEnabled => serializer.serialize_i32(1),
1766                Self::RetrievableDisabled => serializer.serialize_i32(2),
1767                Self::UnknownValue(u) => u.0.serialize(serializer),
1768            }
1769        }
1770    }
1771
1772    impl<'de> serde::de::Deserialize<'de> for RetrievableOption {
1773        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1774        where
1775            D: serde::Deserializer<'de>,
1776        {
1777            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetrievableOption>::new(
1778                ".google.cloud.retail.v2.CatalogAttribute.RetrievableOption",
1779            ))
1780        }
1781    }
1782}
1783
1784/// Catalog level attribute config.
1785#[derive(Clone, Default, PartialEq)]
1786#[non_exhaustive]
1787pub struct AttributesConfig {
1788    /// Required. Immutable. The fully qualified resource name of the attribute
1789    /// config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
1790    pub name: std::string::String,
1791
1792    /// Enable attribute(s) config at catalog level.
1793    /// For example, indexable, dynamic_facetable, or searchable for each
1794    /// attribute.
1795    ///
1796    /// The key is catalog attribute's name.
1797    /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
1798    /// `attributes.xyz`.
1799    ///
1800    /// The maximum number of catalog attributes allowed in a request is 1000.
1801    pub catalog_attributes:
1802        std::collections::HashMap<std::string::String, crate::model::CatalogAttribute>,
1803
1804    /// Output only. The
1805    /// [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
1806    /// for this catalog.
1807    ///
1808    /// [google.cloud.retail.v2.AttributeConfigLevel]: crate::model::AttributeConfigLevel
1809    pub attribute_config_level: crate::model::AttributeConfigLevel,
1810
1811    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1812}
1813
1814impl AttributesConfig {
1815    pub fn new() -> Self {
1816        std::default::Default::default()
1817    }
1818
1819    /// Sets the value of [name][crate::model::AttributesConfig::name].
1820    ///
1821    /// # Example
1822    /// ```ignore,no_run
1823    /// # use google_cloud_retail_v2::model::AttributesConfig;
1824    /// let x = AttributesConfig::new().set_name("example");
1825    /// ```
1826    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1827        self.name = v.into();
1828        self
1829    }
1830
1831    /// Sets the value of [catalog_attributes][crate::model::AttributesConfig::catalog_attributes].
1832    ///
1833    /// # Example
1834    /// ```ignore,no_run
1835    /// # use google_cloud_retail_v2::model::AttributesConfig;
1836    /// use google_cloud_retail_v2::model::CatalogAttribute;
1837    /// let x = AttributesConfig::new().set_catalog_attributes([
1838    ///     ("key0", CatalogAttribute::default()/* use setters */),
1839    ///     ("key1", CatalogAttribute::default()/* use (different) setters */),
1840    /// ]);
1841    /// ```
1842    pub fn set_catalog_attributes<T, K, V>(mut self, v: T) -> Self
1843    where
1844        T: std::iter::IntoIterator<Item = (K, V)>,
1845        K: std::convert::Into<std::string::String>,
1846        V: std::convert::Into<crate::model::CatalogAttribute>,
1847    {
1848        use std::iter::Iterator;
1849        self.catalog_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1850        self
1851    }
1852
1853    /// Sets the value of [attribute_config_level][crate::model::AttributesConfig::attribute_config_level].
1854    ///
1855    /// # Example
1856    /// ```ignore,no_run
1857    /// # use google_cloud_retail_v2::model::AttributesConfig;
1858    /// use google_cloud_retail_v2::model::AttributeConfigLevel;
1859    /// let x0 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::ProductLevelAttributeConfig);
1860    /// let x1 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::CatalogLevelAttributeConfig);
1861    /// ```
1862    pub fn set_attribute_config_level<T: std::convert::Into<crate::model::AttributeConfigLevel>>(
1863        mut self,
1864        v: T,
1865    ) -> Self {
1866        self.attribute_config_level = v.into();
1867        self
1868    }
1869}
1870
1871impl wkt::message::Message for AttributesConfig {
1872    fn typename() -> &'static str {
1873        "type.googleapis.com/google.cloud.retail.v2.AttributesConfig"
1874    }
1875}
1876
1877/// Catalog level autocomplete config for customers to customize autocomplete
1878/// feature's settings.
1879#[derive(Clone, Default, PartialEq)]
1880#[non_exhaustive]
1881pub struct CompletionConfig {
1882    /// Required. Immutable. Fully qualified name
1883    /// `projects/*/locations/*/catalogs/*/completionConfig`
1884    pub name: std::string::String,
1885
1886    /// Specifies the matching order for autocomplete suggestions, e.g., a query
1887    /// consisting of 'sh' with 'out-of-order' specified would suggest "women's
1888    /// shoes", whereas a query of 'red s' with 'exact-prefix' specified would
1889    /// suggest "red shoes". Currently supported values:
1890    ///
1891    /// * 'out-of-order'
1892    /// * 'exact-prefix'
1893    ///
1894    /// Default value: 'exact-prefix'.
1895    pub matching_order: std::string::String,
1896
1897    /// The maximum number of autocomplete suggestions returned per term. Default
1898    /// value is 20. If left unset or set to 0, then will fallback to default
1899    /// value.
1900    ///
1901    /// Value range is 1 to 20.
1902    pub max_suggestions: i32,
1903
1904    /// The minimum number of characters needed to be typed in order to get
1905    /// suggestions. Default value is 2. If left unset or set to 0, then will
1906    /// fallback to default value.
1907    ///
1908    /// Value range is 1 to 20.
1909    pub min_prefix_length: i32,
1910
1911    /// If set to true, the auto learning function is enabled. Auto learning uses
1912    /// user data to generate suggestions using ML techniques. Default value is
1913    /// false. Only after enabling auto learning can users use `cloud-retail`
1914    /// data in
1915    /// [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
1916    ///
1917    /// [google.cloud.retail.v2.CompleteQueryRequest]: crate::model::CompleteQueryRequest
1918    pub auto_learning: bool,
1919
1920    /// Output only. The source data for the latest import of the autocomplete
1921    /// suggestion phrases.
1922    pub suggestions_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1923
1924    /// Output only. Name of the LRO corresponding to the latest suggestion terms
1925    /// list import.
1926    ///
1927    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API
1928    /// method to retrieve the latest state of the Long Running Operation.
1929    pub last_suggestions_import_operation: std::string::String,
1930
1931    /// Output only. The source data for the latest import of the autocomplete
1932    /// denylist phrases.
1933    pub denylist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1934
1935    /// Output only. Name of the LRO corresponding to the latest denylist import.
1936    ///
1937    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1938    /// retrieve the latest state of the Long Running Operation.
1939    pub last_denylist_import_operation: std::string::String,
1940
1941    /// Output only. The source data for the latest import of the autocomplete
1942    /// allowlist phrases.
1943    pub allowlist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1944
1945    /// Output only. Name of the LRO corresponding to the latest allowlist import.
1946    ///
1947    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1948    /// retrieve the latest state of the Long Running Operation.
1949    pub last_allowlist_import_operation: std::string::String,
1950
1951    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1952}
1953
1954impl CompletionConfig {
1955    pub fn new() -> Self {
1956        std::default::Default::default()
1957    }
1958
1959    /// Sets the value of [name][crate::model::CompletionConfig::name].
1960    ///
1961    /// # Example
1962    /// ```ignore,no_run
1963    /// # use google_cloud_retail_v2::model::CompletionConfig;
1964    /// let x = CompletionConfig::new().set_name("example");
1965    /// ```
1966    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1967        self.name = v.into();
1968        self
1969    }
1970
1971    /// Sets the value of [matching_order][crate::model::CompletionConfig::matching_order].
1972    ///
1973    /// # Example
1974    /// ```ignore,no_run
1975    /// # use google_cloud_retail_v2::model::CompletionConfig;
1976    /// let x = CompletionConfig::new().set_matching_order("example");
1977    /// ```
1978    pub fn set_matching_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1979        self.matching_order = v.into();
1980        self
1981    }
1982
1983    /// Sets the value of [max_suggestions][crate::model::CompletionConfig::max_suggestions].
1984    ///
1985    /// # Example
1986    /// ```ignore,no_run
1987    /// # use google_cloud_retail_v2::model::CompletionConfig;
1988    /// let x = CompletionConfig::new().set_max_suggestions(42);
1989    /// ```
1990    pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1991        self.max_suggestions = v.into();
1992        self
1993    }
1994
1995    /// Sets the value of [min_prefix_length][crate::model::CompletionConfig::min_prefix_length].
1996    ///
1997    /// # Example
1998    /// ```ignore,no_run
1999    /// # use google_cloud_retail_v2::model::CompletionConfig;
2000    /// let x = CompletionConfig::new().set_min_prefix_length(42);
2001    /// ```
2002    pub fn set_min_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2003        self.min_prefix_length = v.into();
2004        self
2005    }
2006
2007    /// Sets the value of [auto_learning][crate::model::CompletionConfig::auto_learning].
2008    ///
2009    /// # Example
2010    /// ```ignore,no_run
2011    /// # use google_cloud_retail_v2::model::CompletionConfig;
2012    /// let x = CompletionConfig::new().set_auto_learning(true);
2013    /// ```
2014    pub fn set_auto_learning<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2015        self.auto_learning = v.into();
2016        self
2017    }
2018
2019    /// Sets the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2020    ///
2021    /// # Example
2022    /// ```ignore,no_run
2023    /// # use google_cloud_retail_v2::model::CompletionConfig;
2024    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2025    /// let x = CompletionConfig::new().set_suggestions_input_config(CompletionDataInputConfig::default()/* use setters */);
2026    /// ```
2027    pub fn set_suggestions_input_config<T>(mut self, v: T) -> Self
2028    where
2029        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2030    {
2031        self.suggestions_input_config = std::option::Option::Some(v.into());
2032        self
2033    }
2034
2035    /// Sets or clears the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2036    ///
2037    /// # Example
2038    /// ```ignore,no_run
2039    /// # use google_cloud_retail_v2::model::CompletionConfig;
2040    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2041    /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2042    /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(None::<CompletionDataInputConfig>);
2043    /// ```
2044    pub fn set_or_clear_suggestions_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2045    where
2046        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2047    {
2048        self.suggestions_input_config = v.map(|x| x.into());
2049        self
2050    }
2051
2052    /// Sets the value of [last_suggestions_import_operation][crate::model::CompletionConfig::last_suggestions_import_operation].
2053    ///
2054    /// # Example
2055    /// ```ignore,no_run
2056    /// # use google_cloud_retail_v2::model::CompletionConfig;
2057    /// let x = CompletionConfig::new().set_last_suggestions_import_operation("example");
2058    /// ```
2059    pub fn set_last_suggestions_import_operation<T: std::convert::Into<std::string::String>>(
2060        mut self,
2061        v: T,
2062    ) -> Self {
2063        self.last_suggestions_import_operation = v.into();
2064        self
2065    }
2066
2067    /// Sets the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2068    ///
2069    /// # Example
2070    /// ```ignore,no_run
2071    /// # use google_cloud_retail_v2::model::CompletionConfig;
2072    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2073    /// let x = CompletionConfig::new().set_denylist_input_config(CompletionDataInputConfig::default()/* use setters */);
2074    /// ```
2075    pub fn set_denylist_input_config<T>(mut self, v: T) -> Self
2076    where
2077        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2078    {
2079        self.denylist_input_config = std::option::Option::Some(v.into());
2080        self
2081    }
2082
2083    /// Sets or clears the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2084    ///
2085    /// # Example
2086    /// ```ignore,no_run
2087    /// # use google_cloud_retail_v2::model::CompletionConfig;
2088    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2089    /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2090    /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(None::<CompletionDataInputConfig>);
2091    /// ```
2092    pub fn set_or_clear_denylist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2093    where
2094        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2095    {
2096        self.denylist_input_config = v.map(|x| x.into());
2097        self
2098    }
2099
2100    /// Sets the value of [last_denylist_import_operation][crate::model::CompletionConfig::last_denylist_import_operation].
2101    ///
2102    /// # Example
2103    /// ```ignore,no_run
2104    /// # use google_cloud_retail_v2::model::CompletionConfig;
2105    /// let x = CompletionConfig::new().set_last_denylist_import_operation("example");
2106    /// ```
2107    pub fn set_last_denylist_import_operation<T: std::convert::Into<std::string::String>>(
2108        mut self,
2109        v: T,
2110    ) -> Self {
2111        self.last_denylist_import_operation = v.into();
2112        self
2113    }
2114
2115    /// Sets the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2116    ///
2117    /// # Example
2118    /// ```ignore,no_run
2119    /// # use google_cloud_retail_v2::model::CompletionConfig;
2120    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2121    /// let x = CompletionConfig::new().set_allowlist_input_config(CompletionDataInputConfig::default()/* use setters */);
2122    /// ```
2123    pub fn set_allowlist_input_config<T>(mut self, v: T) -> Self
2124    where
2125        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2126    {
2127        self.allowlist_input_config = std::option::Option::Some(v.into());
2128        self
2129    }
2130
2131    /// Sets or clears the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2132    ///
2133    /// # Example
2134    /// ```ignore,no_run
2135    /// # use google_cloud_retail_v2::model::CompletionConfig;
2136    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2137    /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2138    /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(None::<CompletionDataInputConfig>);
2139    /// ```
2140    pub fn set_or_clear_allowlist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2141    where
2142        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2143    {
2144        self.allowlist_input_config = v.map(|x| x.into());
2145        self
2146    }
2147
2148    /// Sets the value of [last_allowlist_import_operation][crate::model::CompletionConfig::last_allowlist_import_operation].
2149    ///
2150    /// # Example
2151    /// ```ignore,no_run
2152    /// # use google_cloud_retail_v2::model::CompletionConfig;
2153    /// let x = CompletionConfig::new().set_last_allowlist_import_operation("example");
2154    /// ```
2155    pub fn set_last_allowlist_import_operation<T: std::convert::Into<std::string::String>>(
2156        mut self,
2157        v: T,
2158    ) -> Self {
2159        self.last_allowlist_import_operation = v.into();
2160        self
2161    }
2162}
2163
2164impl wkt::message::Message for CompletionConfig {
2165    fn typename() -> &'static str {
2166        "type.googleapis.com/google.cloud.retail.v2.CompletionConfig"
2167    }
2168}
2169
2170/// The catalog configuration.
2171#[derive(Clone, Default, PartialEq)]
2172#[non_exhaustive]
2173pub struct Catalog {
2174    /// Required. Immutable. The fully qualified resource name of the catalog.
2175    pub name: std::string::String,
2176
2177    /// Required. Immutable. The catalog display name.
2178    ///
2179    /// This field must be a UTF-8 encoded string with a length limit of 128
2180    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2181    pub display_name: std::string::String,
2182
2183    /// Required. The product level configuration.
2184    pub product_level_config: std::option::Option<crate::model::ProductLevelConfig>,
2185
2186    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2187}
2188
2189impl Catalog {
2190    pub fn new() -> Self {
2191        std::default::Default::default()
2192    }
2193
2194    /// Sets the value of [name][crate::model::Catalog::name].
2195    ///
2196    /// # Example
2197    /// ```ignore,no_run
2198    /// # use google_cloud_retail_v2::model::Catalog;
2199    /// let x = Catalog::new().set_name("example");
2200    /// ```
2201    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2202        self.name = v.into();
2203        self
2204    }
2205
2206    /// Sets the value of [display_name][crate::model::Catalog::display_name].
2207    ///
2208    /// # Example
2209    /// ```ignore,no_run
2210    /// # use google_cloud_retail_v2::model::Catalog;
2211    /// let x = Catalog::new().set_display_name("example");
2212    /// ```
2213    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2214        self.display_name = v.into();
2215        self
2216    }
2217
2218    /// Sets the value of [product_level_config][crate::model::Catalog::product_level_config].
2219    ///
2220    /// # Example
2221    /// ```ignore,no_run
2222    /// # use google_cloud_retail_v2::model::Catalog;
2223    /// use google_cloud_retail_v2::model::ProductLevelConfig;
2224    /// let x = Catalog::new().set_product_level_config(ProductLevelConfig::default()/* use setters */);
2225    /// ```
2226    pub fn set_product_level_config<T>(mut self, v: T) -> Self
2227    where
2228        T: std::convert::Into<crate::model::ProductLevelConfig>,
2229    {
2230        self.product_level_config = std::option::Option::Some(v.into());
2231        self
2232    }
2233
2234    /// Sets or clears the value of [product_level_config][crate::model::Catalog::product_level_config].
2235    ///
2236    /// # Example
2237    /// ```ignore,no_run
2238    /// # use google_cloud_retail_v2::model::Catalog;
2239    /// use google_cloud_retail_v2::model::ProductLevelConfig;
2240    /// let x = Catalog::new().set_or_clear_product_level_config(Some(ProductLevelConfig::default()/* use setters */));
2241    /// let x = Catalog::new().set_or_clear_product_level_config(None::<ProductLevelConfig>);
2242    /// ```
2243    pub fn set_or_clear_product_level_config<T>(mut self, v: std::option::Option<T>) -> Self
2244    where
2245        T: std::convert::Into<crate::model::ProductLevelConfig>,
2246    {
2247        self.product_level_config = v.map(|x| x.into());
2248        self
2249    }
2250}
2251
2252impl wkt::message::Message for Catalog {
2253    fn typename() -> &'static str {
2254        "type.googleapis.com/google.cloud.retail.v2.Catalog"
2255    }
2256}
2257
2258/// Request for
2259/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2260/// method.
2261///
2262/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2263#[derive(Clone, Default, PartialEq)]
2264#[non_exhaustive]
2265pub struct ListCatalogsRequest {
2266    /// Required. The account resource name with an associated location.
2267    ///
2268    /// If the caller does not have permission to list
2269    /// [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
2270    /// of whether or not this location exists, a PERMISSION_DENIED error is
2271    /// returned.
2272    ///
2273    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2274    pub parent: std::string::String,
2275
2276    /// Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
2277    /// unspecified, defaults to 50. The maximum allowed value is 1000. Values
2278    /// above 1000 will be coerced to 1000.
2279    ///
2280    /// If this field is negative, an INVALID_ARGUMENT is returned.
2281    ///
2282    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2283    pub page_size: i32,
2284
2285    /// A page token
2286    /// [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
2287    /// received from a previous
2288    /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2289    /// call. Provide this to retrieve the subsequent page.
2290    ///
2291    /// When paginating, all other parameters provided to
2292    /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2293    /// must match the call that provided the page token. Otherwise, an
2294    /// INVALID_ARGUMENT error is returned.
2295    ///
2296    /// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2297    /// [google.cloud.retail.v2.ListCatalogsResponse.next_page_token]: crate::model::ListCatalogsResponse::next_page_token
2298    pub page_token: std::string::String,
2299
2300    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2301}
2302
2303impl ListCatalogsRequest {
2304    pub fn new() -> Self {
2305        std::default::Default::default()
2306    }
2307
2308    /// Sets the value of [parent][crate::model::ListCatalogsRequest::parent].
2309    ///
2310    /// # Example
2311    /// ```ignore,no_run
2312    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2313    /// let x = ListCatalogsRequest::new().set_parent("example");
2314    /// ```
2315    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2316        self.parent = v.into();
2317        self
2318    }
2319
2320    /// Sets the value of [page_size][crate::model::ListCatalogsRequest::page_size].
2321    ///
2322    /// # Example
2323    /// ```ignore,no_run
2324    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2325    /// let x = ListCatalogsRequest::new().set_page_size(42);
2326    /// ```
2327    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2328        self.page_size = v.into();
2329        self
2330    }
2331
2332    /// Sets the value of [page_token][crate::model::ListCatalogsRequest::page_token].
2333    ///
2334    /// # Example
2335    /// ```ignore,no_run
2336    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2337    /// let x = ListCatalogsRequest::new().set_page_token("example");
2338    /// ```
2339    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2340        self.page_token = v.into();
2341        self
2342    }
2343}
2344
2345impl wkt::message::Message for ListCatalogsRequest {
2346    fn typename() -> &'static str {
2347        "type.googleapis.com/google.cloud.retail.v2.ListCatalogsRequest"
2348    }
2349}
2350
2351/// Response for
2352/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2353/// method.
2354///
2355/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2356#[derive(Clone, Default, PartialEq)]
2357#[non_exhaustive]
2358pub struct ListCatalogsResponse {
2359    /// All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
2360    ///
2361    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2362    pub catalogs: std::vec::Vec<crate::model::Catalog>,
2363
2364    /// A token that can be sent as
2365    /// [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
2366    /// to retrieve the next page. If this field is omitted, there are no
2367    /// subsequent pages.
2368    ///
2369    /// [google.cloud.retail.v2.ListCatalogsRequest.page_token]: crate::model::ListCatalogsRequest::page_token
2370    pub next_page_token: std::string::String,
2371
2372    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2373}
2374
2375impl ListCatalogsResponse {
2376    pub fn new() -> Self {
2377        std::default::Default::default()
2378    }
2379
2380    /// Sets the value of [catalogs][crate::model::ListCatalogsResponse::catalogs].
2381    ///
2382    /// # Example
2383    /// ```ignore,no_run
2384    /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2385    /// use google_cloud_retail_v2::model::Catalog;
2386    /// let x = ListCatalogsResponse::new()
2387    ///     .set_catalogs([
2388    ///         Catalog::default()/* use setters */,
2389    ///         Catalog::default()/* use (different) setters */,
2390    ///     ]);
2391    /// ```
2392    pub fn set_catalogs<T, V>(mut self, v: T) -> Self
2393    where
2394        T: std::iter::IntoIterator<Item = V>,
2395        V: std::convert::Into<crate::model::Catalog>,
2396    {
2397        use std::iter::Iterator;
2398        self.catalogs = v.into_iter().map(|i| i.into()).collect();
2399        self
2400    }
2401
2402    /// Sets the value of [next_page_token][crate::model::ListCatalogsResponse::next_page_token].
2403    ///
2404    /// # Example
2405    /// ```ignore,no_run
2406    /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2407    /// let x = ListCatalogsResponse::new().set_next_page_token("example");
2408    /// ```
2409    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2410        self.next_page_token = v.into();
2411        self
2412    }
2413}
2414
2415impl wkt::message::Message for ListCatalogsResponse {
2416    fn typename() -> &'static str {
2417        "type.googleapis.com/google.cloud.retail.v2.ListCatalogsResponse"
2418    }
2419}
2420
2421#[doc(hidden)]
2422impl gax::paginator::internal::PageableResponse for ListCatalogsResponse {
2423    type PageItem = crate::model::Catalog;
2424
2425    fn items(self) -> std::vec::Vec<Self::PageItem> {
2426        self.catalogs
2427    }
2428
2429    fn next_page_token(&self) -> std::string::String {
2430        use std::clone::Clone;
2431        self.next_page_token.clone()
2432    }
2433}
2434
2435/// Request for
2436/// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
2437/// method.
2438///
2439/// [google.cloud.retail.v2.CatalogService.UpdateCatalog]: crate::client::CatalogService::update_catalog
2440#[derive(Clone, Default, PartialEq)]
2441#[non_exhaustive]
2442pub struct UpdateCatalogRequest {
2443    /// Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
2444    ///
2445    /// If the caller does not have permission to update the
2446    /// [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
2447    /// exists, a PERMISSION_DENIED error is returned.
2448    ///
2449    /// If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
2450    /// a NOT_FOUND error is returned.
2451    ///
2452    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2453    pub catalog: std::option::Option<crate::model::Catalog>,
2454
2455    /// Indicates which fields in the provided
2456    /// [Catalog][google.cloud.retail.v2.Catalog] to update.
2457    ///
2458    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
2459    /// is returned.
2460    ///
2461    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2462    pub update_mask: std::option::Option<wkt::FieldMask>,
2463
2464    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2465}
2466
2467impl UpdateCatalogRequest {
2468    pub fn new() -> Self {
2469        std::default::Default::default()
2470    }
2471
2472    /// Sets the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2473    ///
2474    /// # Example
2475    /// ```ignore,no_run
2476    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2477    /// use google_cloud_retail_v2::model::Catalog;
2478    /// let x = UpdateCatalogRequest::new().set_catalog(Catalog::default()/* use setters */);
2479    /// ```
2480    pub fn set_catalog<T>(mut self, v: T) -> Self
2481    where
2482        T: std::convert::Into<crate::model::Catalog>,
2483    {
2484        self.catalog = std::option::Option::Some(v.into());
2485        self
2486    }
2487
2488    /// Sets or clears the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2489    ///
2490    /// # Example
2491    /// ```ignore,no_run
2492    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2493    /// use google_cloud_retail_v2::model::Catalog;
2494    /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(Some(Catalog::default()/* use setters */));
2495    /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(None::<Catalog>);
2496    /// ```
2497    pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
2498    where
2499        T: std::convert::Into<crate::model::Catalog>,
2500    {
2501        self.catalog = v.map(|x| x.into());
2502        self
2503    }
2504
2505    /// Sets the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2506    ///
2507    /// # Example
2508    /// ```ignore,no_run
2509    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2510    /// use wkt::FieldMask;
2511    /// let x = UpdateCatalogRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2512    /// ```
2513    pub fn set_update_mask<T>(mut self, v: T) -> Self
2514    where
2515        T: std::convert::Into<wkt::FieldMask>,
2516    {
2517        self.update_mask = std::option::Option::Some(v.into());
2518        self
2519    }
2520
2521    /// Sets or clears the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2522    ///
2523    /// # Example
2524    /// ```ignore,no_run
2525    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2526    /// use wkt::FieldMask;
2527    /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2528    /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2529    /// ```
2530    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2531    where
2532        T: std::convert::Into<wkt::FieldMask>,
2533    {
2534        self.update_mask = v.map(|x| x.into());
2535        self
2536    }
2537}
2538
2539impl wkt::message::Message for UpdateCatalogRequest {
2540    fn typename() -> &'static str {
2541        "type.googleapis.com/google.cloud.retail.v2.UpdateCatalogRequest"
2542    }
2543}
2544
2545/// Request message to set a specified branch as new default_branch.
2546#[derive(Clone, Default, PartialEq)]
2547#[non_exhaustive]
2548pub struct SetDefaultBranchRequest {
2549    /// Full resource name of the catalog, such as
2550    /// `projects/*/locations/global/catalogs/default_catalog`.
2551    pub catalog: std::string::String,
2552
2553    /// The final component of the resource name of a branch.
2554    ///
2555    /// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
2556    /// error is returned.
2557    ///
2558    /// If there are no sufficient active products in the targeted branch and
2559    /// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
2560    /// FAILED_PRECONDITION error is returned.
2561    ///
2562    /// [google.cloud.retail.v2.SetDefaultBranchRequest.force]: crate::model::SetDefaultBranchRequest::force
2563    pub branch_id: std::string::String,
2564
2565    /// Some note on this request, this can be retrieved by
2566    /// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
2567    /// before next valid default branch set occurs.
2568    ///
2569    /// This field must be a UTF-8 encoded string with a length limit of 1,000
2570    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2571    ///
2572    /// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2573    pub note: std::string::String,
2574
2575    /// If set to true, it permits switching to a branch with
2576    /// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
2577    /// if it has no sufficient active products.
2578    ///
2579    /// [google.cloud.retail.v2.SetDefaultBranchRequest.branch_id]: crate::model::SetDefaultBranchRequest::branch_id
2580    pub force: bool,
2581
2582    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2583}
2584
2585impl SetDefaultBranchRequest {
2586    pub fn new() -> Self {
2587        std::default::Default::default()
2588    }
2589
2590    /// Sets the value of [catalog][crate::model::SetDefaultBranchRequest::catalog].
2591    ///
2592    /// # Example
2593    /// ```ignore,no_run
2594    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2595    /// let x = SetDefaultBranchRequest::new().set_catalog("example");
2596    /// ```
2597    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2598        self.catalog = v.into();
2599        self
2600    }
2601
2602    /// Sets the value of [branch_id][crate::model::SetDefaultBranchRequest::branch_id].
2603    ///
2604    /// # Example
2605    /// ```ignore,no_run
2606    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2607    /// let x = SetDefaultBranchRequest::new().set_branch_id("example");
2608    /// ```
2609    pub fn set_branch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2610        self.branch_id = v.into();
2611        self
2612    }
2613
2614    /// Sets the value of [note][crate::model::SetDefaultBranchRequest::note].
2615    ///
2616    /// # Example
2617    /// ```ignore,no_run
2618    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2619    /// let x = SetDefaultBranchRequest::new().set_note("example");
2620    /// ```
2621    pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2622        self.note = v.into();
2623        self
2624    }
2625
2626    /// Sets the value of [force][crate::model::SetDefaultBranchRequest::force].
2627    ///
2628    /// # Example
2629    /// ```ignore,no_run
2630    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2631    /// let x = SetDefaultBranchRequest::new().set_force(true);
2632    /// ```
2633    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2634        self.force = v.into();
2635        self
2636    }
2637}
2638
2639impl wkt::message::Message for SetDefaultBranchRequest {
2640    fn typename() -> &'static str {
2641        "type.googleapis.com/google.cloud.retail.v2.SetDefaultBranchRequest"
2642    }
2643}
2644
2645/// Request message to show which branch is currently the default branch.
2646#[derive(Clone, Default, PartialEq)]
2647#[non_exhaustive]
2648pub struct GetDefaultBranchRequest {
2649    /// The parent catalog resource name, such as
2650    /// `projects/*/locations/global/catalogs/default_catalog`.
2651    pub catalog: std::string::String,
2652
2653    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2654}
2655
2656impl GetDefaultBranchRequest {
2657    pub fn new() -> Self {
2658        std::default::Default::default()
2659    }
2660
2661    /// Sets the value of [catalog][crate::model::GetDefaultBranchRequest::catalog].
2662    ///
2663    /// # Example
2664    /// ```ignore,no_run
2665    /// # use google_cloud_retail_v2::model::GetDefaultBranchRequest;
2666    /// let x = GetDefaultBranchRequest::new().set_catalog("example");
2667    /// ```
2668    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2669        self.catalog = v.into();
2670        self
2671    }
2672}
2673
2674impl wkt::message::Message for GetDefaultBranchRequest {
2675    fn typename() -> &'static str {
2676        "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchRequest"
2677    }
2678}
2679
2680/// Response message of
2681/// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch].
2682///
2683/// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2684#[derive(Clone, Default, PartialEq)]
2685#[non_exhaustive]
2686pub struct GetDefaultBranchResponse {
2687    /// Full resource name of the branch id currently set as default branch.
2688    pub branch: std::string::String,
2689
2690    /// The time when this branch is set to default.
2691    pub set_time: std::option::Option<wkt::Timestamp>,
2692
2693    /// This corresponds to
2694    /// [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note]
2695    /// field, when this branch was set as default.
2696    ///
2697    /// [google.cloud.retail.v2.SetDefaultBranchRequest.note]: crate::model::SetDefaultBranchRequest::note
2698    pub note: std::string::String,
2699
2700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2701}
2702
2703impl GetDefaultBranchResponse {
2704    pub fn new() -> Self {
2705        std::default::Default::default()
2706    }
2707
2708    /// Sets the value of [branch][crate::model::GetDefaultBranchResponse::branch].
2709    ///
2710    /// # Example
2711    /// ```ignore,no_run
2712    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2713    /// let x = GetDefaultBranchResponse::new().set_branch("example");
2714    /// ```
2715    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2716        self.branch = v.into();
2717        self
2718    }
2719
2720    /// Sets the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2721    ///
2722    /// # Example
2723    /// ```ignore,no_run
2724    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2725    /// use wkt::Timestamp;
2726    /// let x = GetDefaultBranchResponse::new().set_set_time(Timestamp::default()/* use setters */);
2727    /// ```
2728    pub fn set_set_time<T>(mut self, v: T) -> Self
2729    where
2730        T: std::convert::Into<wkt::Timestamp>,
2731    {
2732        self.set_time = std::option::Option::Some(v.into());
2733        self
2734    }
2735
2736    /// Sets or clears the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2737    ///
2738    /// # Example
2739    /// ```ignore,no_run
2740    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2741    /// use wkt::Timestamp;
2742    /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
2743    /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(None::<Timestamp>);
2744    /// ```
2745    pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
2746    where
2747        T: std::convert::Into<wkt::Timestamp>,
2748    {
2749        self.set_time = v.map(|x| x.into());
2750        self
2751    }
2752
2753    /// Sets the value of [note][crate::model::GetDefaultBranchResponse::note].
2754    ///
2755    /// # Example
2756    /// ```ignore,no_run
2757    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2758    /// let x = GetDefaultBranchResponse::new().set_note("example");
2759    /// ```
2760    pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2761        self.note = v.into();
2762        self
2763    }
2764}
2765
2766impl wkt::message::Message for GetDefaultBranchResponse {
2767    fn typename() -> &'static str {
2768        "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchResponse"
2769    }
2770}
2771
2772/// Request for
2773/// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
2774/// method.
2775///
2776/// [google.cloud.retail.v2.CatalogService.GetCompletionConfig]: crate::client::CatalogService::get_completion_config
2777#[derive(Clone, Default, PartialEq)]
2778#[non_exhaustive]
2779pub struct GetCompletionConfigRequest {
2780    /// Required. Full CompletionConfig resource name. Format:
2781    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
2782    pub name: std::string::String,
2783
2784    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2785}
2786
2787impl GetCompletionConfigRequest {
2788    pub fn new() -> Self {
2789        std::default::Default::default()
2790    }
2791
2792    /// Sets the value of [name][crate::model::GetCompletionConfigRequest::name].
2793    ///
2794    /// # Example
2795    /// ```ignore,no_run
2796    /// # use google_cloud_retail_v2::model::GetCompletionConfigRequest;
2797    /// let x = GetCompletionConfigRequest::new().set_name("example");
2798    /// ```
2799    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2800        self.name = v.into();
2801        self
2802    }
2803}
2804
2805impl wkt::message::Message for GetCompletionConfigRequest {
2806    fn typename() -> &'static str {
2807        "type.googleapis.com/google.cloud.retail.v2.GetCompletionConfigRequest"
2808    }
2809}
2810
2811/// Request for
2812/// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
2813/// method.
2814///
2815/// [google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]: crate::client::CatalogService::update_completion_config
2816#[derive(Clone, Default, PartialEq)]
2817#[non_exhaustive]
2818pub struct UpdateCompletionConfigRequest {
2819    /// Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
2820    /// to update.
2821    ///
2822    /// If the caller does not have permission to update the
2823    /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
2824    /// PERMISSION_DENIED error is returned.
2825    ///
2826    /// If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
2827    /// update does not exist, a NOT_FOUND error is returned.
2828    ///
2829    /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2830    pub completion_config: std::option::Option<crate::model::CompletionConfig>,
2831
2832    /// Indicates which fields in the provided
2833    /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
2834    /// following are the only supported fields:
2835    ///
2836    /// * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
2837    /// * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
2838    /// * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
2839    /// * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
2840    ///
2841    /// If not set, all supported fields are updated.
2842    ///
2843    /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2844    /// [google.cloud.retail.v2.CompletionConfig.auto_learning]: crate::model::CompletionConfig::auto_learning
2845    /// [google.cloud.retail.v2.CompletionConfig.matching_order]: crate::model::CompletionConfig::matching_order
2846    /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
2847    /// [google.cloud.retail.v2.CompletionConfig.min_prefix_length]: crate::model::CompletionConfig::min_prefix_length
2848    pub update_mask: std::option::Option<wkt::FieldMask>,
2849
2850    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2851}
2852
2853impl UpdateCompletionConfigRequest {
2854    pub fn new() -> Self {
2855        std::default::Default::default()
2856    }
2857
2858    /// Sets the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2859    ///
2860    /// # Example
2861    /// ```ignore,no_run
2862    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2863    /// use google_cloud_retail_v2::model::CompletionConfig;
2864    /// let x = UpdateCompletionConfigRequest::new().set_completion_config(CompletionConfig::default()/* use setters */);
2865    /// ```
2866    pub fn set_completion_config<T>(mut self, v: T) -> Self
2867    where
2868        T: std::convert::Into<crate::model::CompletionConfig>,
2869    {
2870        self.completion_config = std::option::Option::Some(v.into());
2871        self
2872    }
2873
2874    /// Sets or clears the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2875    ///
2876    /// # Example
2877    /// ```ignore,no_run
2878    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2879    /// use google_cloud_retail_v2::model::CompletionConfig;
2880    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(Some(CompletionConfig::default()/* use setters */));
2881    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(None::<CompletionConfig>);
2882    /// ```
2883    pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
2884    where
2885        T: std::convert::Into<crate::model::CompletionConfig>,
2886    {
2887        self.completion_config = v.map(|x| x.into());
2888        self
2889    }
2890
2891    /// Sets the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2892    ///
2893    /// # Example
2894    /// ```ignore,no_run
2895    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2896    /// use wkt::FieldMask;
2897    /// let x = UpdateCompletionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2898    /// ```
2899    pub fn set_update_mask<T>(mut self, v: T) -> Self
2900    where
2901        T: std::convert::Into<wkt::FieldMask>,
2902    {
2903        self.update_mask = std::option::Option::Some(v.into());
2904        self
2905    }
2906
2907    /// Sets or clears the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2908    ///
2909    /// # Example
2910    /// ```ignore,no_run
2911    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2912    /// use wkt::FieldMask;
2913    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2914    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2915    /// ```
2916    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2917    where
2918        T: std::convert::Into<wkt::FieldMask>,
2919    {
2920        self.update_mask = v.map(|x| x.into());
2921        self
2922    }
2923}
2924
2925impl wkt::message::Message for UpdateCompletionConfigRequest {
2926    fn typename() -> &'static str {
2927        "type.googleapis.com/google.cloud.retail.v2.UpdateCompletionConfigRequest"
2928    }
2929}
2930
2931/// Request for
2932/// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
2933/// method.
2934///
2935/// [google.cloud.retail.v2.CatalogService.GetAttributesConfig]: crate::client::CatalogService::get_attributes_config
2936#[derive(Clone, Default, PartialEq)]
2937#[non_exhaustive]
2938pub struct GetAttributesConfigRequest {
2939    /// Required. Full AttributesConfig resource name. Format:
2940    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
2941    pub name: std::string::String,
2942
2943    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2944}
2945
2946impl GetAttributesConfigRequest {
2947    pub fn new() -> Self {
2948        std::default::Default::default()
2949    }
2950
2951    /// Sets the value of [name][crate::model::GetAttributesConfigRequest::name].
2952    ///
2953    /// # Example
2954    /// ```ignore,no_run
2955    /// # use google_cloud_retail_v2::model::GetAttributesConfigRequest;
2956    /// let x = GetAttributesConfigRequest::new().set_name("example");
2957    /// ```
2958    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2959        self.name = v.into();
2960        self
2961    }
2962}
2963
2964impl wkt::message::Message for GetAttributesConfigRequest {
2965    fn typename() -> &'static str {
2966        "type.googleapis.com/google.cloud.retail.v2.GetAttributesConfigRequest"
2967    }
2968}
2969
2970/// Request for
2971/// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
2972/// method.
2973///
2974/// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
2975#[derive(Clone, Default, PartialEq)]
2976#[non_exhaustive]
2977pub struct UpdateAttributesConfigRequest {
2978    /// Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
2979    /// to update.
2980    ///
2981    /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
2982    pub attributes_config: std::option::Option<crate::model::AttributesConfig>,
2983
2984    /// Indicates which fields in the provided
2985    /// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
2986    /// following is the only supported field:
2987    ///
2988    /// * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
2989    ///
2990    /// If not set, all supported fields are updated.
2991    ///
2992    /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
2993    /// [google.cloud.retail.v2.AttributesConfig.catalog_attributes]: crate::model::AttributesConfig::catalog_attributes
2994    pub update_mask: std::option::Option<wkt::FieldMask>,
2995
2996    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2997}
2998
2999impl UpdateAttributesConfigRequest {
3000    pub fn new() -> Self {
3001        std::default::Default::default()
3002    }
3003
3004    /// Sets the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3005    ///
3006    /// # Example
3007    /// ```ignore,no_run
3008    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3009    /// use google_cloud_retail_v2::model::AttributesConfig;
3010    /// let x = UpdateAttributesConfigRequest::new().set_attributes_config(AttributesConfig::default()/* use setters */);
3011    /// ```
3012    pub fn set_attributes_config<T>(mut self, v: T) -> Self
3013    where
3014        T: std::convert::Into<crate::model::AttributesConfig>,
3015    {
3016        self.attributes_config = std::option::Option::Some(v.into());
3017        self
3018    }
3019
3020    /// Sets or clears the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3021    ///
3022    /// # Example
3023    /// ```ignore,no_run
3024    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3025    /// use google_cloud_retail_v2::model::AttributesConfig;
3026    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(Some(AttributesConfig::default()/* use setters */));
3027    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(None::<AttributesConfig>);
3028    /// ```
3029    pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
3030    where
3031        T: std::convert::Into<crate::model::AttributesConfig>,
3032    {
3033        self.attributes_config = v.map(|x| x.into());
3034        self
3035    }
3036
3037    /// Sets the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3038    ///
3039    /// # Example
3040    /// ```ignore,no_run
3041    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3042    /// use wkt::FieldMask;
3043    /// let x = UpdateAttributesConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3044    /// ```
3045    pub fn set_update_mask<T>(mut self, v: T) -> Self
3046    where
3047        T: std::convert::Into<wkt::FieldMask>,
3048    {
3049        self.update_mask = std::option::Option::Some(v.into());
3050        self
3051    }
3052
3053    /// Sets or clears the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3054    ///
3055    /// # Example
3056    /// ```ignore,no_run
3057    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3058    /// use wkt::FieldMask;
3059    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3060    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3061    /// ```
3062    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3063    where
3064        T: std::convert::Into<wkt::FieldMask>,
3065    {
3066        self.update_mask = v.map(|x| x.into());
3067        self
3068    }
3069}
3070
3071impl wkt::message::Message for UpdateAttributesConfigRequest {
3072    fn typename() -> &'static str {
3073        "type.googleapis.com/google.cloud.retail.v2.UpdateAttributesConfigRequest"
3074    }
3075}
3076
3077/// Request for
3078/// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
3079/// method.
3080///
3081/// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
3082#[derive(Clone, Default, PartialEq)]
3083#[non_exhaustive]
3084pub struct AddCatalogAttributeRequest {
3085    /// Required. Full AttributesConfig resource name. Format:
3086    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3087    pub attributes_config: std::string::String,
3088
3089    /// Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
3090    /// to add.
3091    ///
3092    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3093    pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3094
3095    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3096}
3097
3098impl AddCatalogAttributeRequest {
3099    pub fn new() -> Self {
3100        std::default::Default::default()
3101    }
3102
3103    /// Sets the value of [attributes_config][crate::model::AddCatalogAttributeRequest::attributes_config].
3104    ///
3105    /// # Example
3106    /// ```ignore,no_run
3107    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3108    /// let x = AddCatalogAttributeRequest::new().set_attributes_config("example");
3109    /// ```
3110    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3111        mut self,
3112        v: T,
3113    ) -> Self {
3114        self.attributes_config = v.into();
3115        self
3116    }
3117
3118    /// Sets the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3119    ///
3120    /// # Example
3121    /// ```ignore,no_run
3122    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3123    /// use google_cloud_retail_v2::model::CatalogAttribute;
3124    /// let x = AddCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3125    /// ```
3126    pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3127    where
3128        T: std::convert::Into<crate::model::CatalogAttribute>,
3129    {
3130        self.catalog_attribute = std::option::Option::Some(v.into());
3131        self
3132    }
3133
3134    /// Sets or clears the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3135    ///
3136    /// # Example
3137    /// ```ignore,no_run
3138    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3139    /// use google_cloud_retail_v2::model::CatalogAttribute;
3140    /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3141    /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3142    /// ```
3143    pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3144    where
3145        T: std::convert::Into<crate::model::CatalogAttribute>,
3146    {
3147        self.catalog_attribute = v.map(|x| x.into());
3148        self
3149    }
3150}
3151
3152impl wkt::message::Message for AddCatalogAttributeRequest {
3153    fn typename() -> &'static str {
3154        "type.googleapis.com/google.cloud.retail.v2.AddCatalogAttributeRequest"
3155    }
3156}
3157
3158/// Request for
3159/// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
3160/// method.
3161///
3162/// [google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]: crate::client::CatalogService::remove_catalog_attribute
3163#[derive(Clone, Default, PartialEq)]
3164#[non_exhaustive]
3165pub struct RemoveCatalogAttributeRequest {
3166    /// Required. Full AttributesConfig resource name. Format:
3167    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3168    pub attributes_config: std::string::String,
3169
3170    /// Required. The attribute name key of the
3171    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
3172    ///
3173    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3174    pub key: std::string::String,
3175
3176    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3177}
3178
3179impl RemoveCatalogAttributeRequest {
3180    pub fn new() -> Self {
3181        std::default::Default::default()
3182    }
3183
3184    /// Sets the value of [attributes_config][crate::model::RemoveCatalogAttributeRequest::attributes_config].
3185    ///
3186    /// # Example
3187    /// ```ignore,no_run
3188    /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3189    /// let x = RemoveCatalogAttributeRequest::new().set_attributes_config("example");
3190    /// ```
3191    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3192        mut self,
3193        v: T,
3194    ) -> Self {
3195        self.attributes_config = v.into();
3196        self
3197    }
3198
3199    /// Sets the value of [key][crate::model::RemoveCatalogAttributeRequest::key].
3200    ///
3201    /// # Example
3202    /// ```ignore,no_run
3203    /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3204    /// let x = RemoveCatalogAttributeRequest::new().set_key("example");
3205    /// ```
3206    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3207        self.key = v.into();
3208        self
3209    }
3210}
3211
3212impl wkt::message::Message for RemoveCatalogAttributeRequest {
3213    fn typename() -> &'static str {
3214        "type.googleapis.com/google.cloud.retail.v2.RemoveCatalogAttributeRequest"
3215    }
3216}
3217
3218/// Request for
3219/// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
3220/// method.
3221///
3222/// [google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]: crate::client::CatalogService::replace_catalog_attribute
3223#[derive(Clone, Default, PartialEq)]
3224#[non_exhaustive]
3225pub struct ReplaceCatalogAttributeRequest {
3226    /// Required. Full AttributesConfig resource name. Format:
3227    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3228    pub attributes_config: std::string::String,
3229
3230    /// Required. The updated
3231    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
3232    ///
3233    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3234    pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3235
3236    /// Indicates which fields in the provided
3237    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
3238    /// following are NOT supported:
3239    ///
3240    /// * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
3241    ///
3242    /// If not set, all supported fields are updated.
3243    ///
3244    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3245    /// [google.cloud.retail.v2.CatalogAttribute.key]: crate::model::CatalogAttribute::key
3246    pub update_mask: std::option::Option<wkt::FieldMask>,
3247
3248    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3249}
3250
3251impl ReplaceCatalogAttributeRequest {
3252    pub fn new() -> Self {
3253        std::default::Default::default()
3254    }
3255
3256    /// Sets the value of [attributes_config][crate::model::ReplaceCatalogAttributeRequest::attributes_config].
3257    ///
3258    /// # Example
3259    /// ```ignore,no_run
3260    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3261    /// let x = ReplaceCatalogAttributeRequest::new().set_attributes_config("example");
3262    /// ```
3263    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3264        mut self,
3265        v: T,
3266    ) -> Self {
3267        self.attributes_config = v.into();
3268        self
3269    }
3270
3271    /// Sets the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3272    ///
3273    /// # Example
3274    /// ```ignore,no_run
3275    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3276    /// use google_cloud_retail_v2::model::CatalogAttribute;
3277    /// let x = ReplaceCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3278    /// ```
3279    pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3280    where
3281        T: std::convert::Into<crate::model::CatalogAttribute>,
3282    {
3283        self.catalog_attribute = std::option::Option::Some(v.into());
3284        self
3285    }
3286
3287    /// Sets or clears the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3288    ///
3289    /// # Example
3290    /// ```ignore,no_run
3291    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3292    /// use google_cloud_retail_v2::model::CatalogAttribute;
3293    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3294    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3295    /// ```
3296    pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3297    where
3298        T: std::convert::Into<crate::model::CatalogAttribute>,
3299    {
3300        self.catalog_attribute = v.map(|x| x.into());
3301        self
3302    }
3303
3304    /// Sets the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3305    ///
3306    /// # Example
3307    /// ```ignore,no_run
3308    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3309    /// use wkt::FieldMask;
3310    /// let x = ReplaceCatalogAttributeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3311    /// ```
3312    pub fn set_update_mask<T>(mut self, v: T) -> Self
3313    where
3314        T: std::convert::Into<wkt::FieldMask>,
3315    {
3316        self.update_mask = std::option::Option::Some(v.into());
3317        self
3318    }
3319
3320    /// Sets or clears the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3321    ///
3322    /// # Example
3323    /// ```ignore,no_run
3324    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3325    /// use wkt::FieldMask;
3326    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3327    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3328    /// ```
3329    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3330    where
3331        T: std::convert::Into<wkt::FieldMask>,
3332    {
3333        self.update_mask = v.map(|x| x.into());
3334        self
3335    }
3336}
3337
3338impl wkt::message::Message for ReplaceCatalogAttributeRequest {
3339    fn typename() -> &'static str {
3340        "type.googleapis.com/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"
3341    }
3342}
3343
3344/// Metadata that is used to define a condition that triggers an action.
3345/// A valid condition must specify at least one of 'query_terms' or
3346/// 'products_filter'. If multiple fields are specified, the condition is met if
3347/// all the fields are satisfied e.g. if a set of query terms and product_filter
3348/// are set, then only items matching the product_filter for requests with a
3349/// query matching the query terms wil get boosted.
3350#[derive(Clone, Default, PartialEq)]
3351#[non_exhaustive]
3352pub struct Condition {
3353    /// A list (up to 10 entries) of terms to match the query on. If not
3354    /// specified, match all queries.
3355    /// If many query terms are specified, the condition
3356    /// is matched if any of the terms is a match (i.e. using the OR operator).
3357    pub query_terms: std::vec::Vec<crate::model::condition::QueryTerm>,
3358
3359    /// Range of time(s) specifying when Condition is active.
3360    /// Condition true if any time range matches.
3361    pub active_time_range: std::vec::Vec<crate::model::condition::TimeRange>,
3362
3363    /// Used to support browse uses cases.
3364    /// A list (up to 10 entries) of categories or departments.
3365    /// The format should be the same as
3366    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
3367    ///
3368    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
3369    pub page_categories: std::vec::Vec<std::string::String>,
3370
3371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3372}
3373
3374impl Condition {
3375    pub fn new() -> Self {
3376        std::default::Default::default()
3377    }
3378
3379    /// Sets the value of [query_terms][crate::model::Condition::query_terms].
3380    ///
3381    /// # Example
3382    /// ```ignore,no_run
3383    /// # use google_cloud_retail_v2::model::Condition;
3384    /// use google_cloud_retail_v2::model::condition::QueryTerm;
3385    /// let x = Condition::new()
3386    ///     .set_query_terms([
3387    ///         QueryTerm::default()/* use setters */,
3388    ///         QueryTerm::default()/* use (different) setters */,
3389    ///     ]);
3390    /// ```
3391    pub fn set_query_terms<T, V>(mut self, v: T) -> Self
3392    where
3393        T: std::iter::IntoIterator<Item = V>,
3394        V: std::convert::Into<crate::model::condition::QueryTerm>,
3395    {
3396        use std::iter::Iterator;
3397        self.query_terms = v.into_iter().map(|i| i.into()).collect();
3398        self
3399    }
3400
3401    /// Sets the value of [active_time_range][crate::model::Condition::active_time_range].
3402    ///
3403    /// # Example
3404    /// ```ignore,no_run
3405    /// # use google_cloud_retail_v2::model::Condition;
3406    /// use google_cloud_retail_v2::model::condition::TimeRange;
3407    /// let x = Condition::new()
3408    ///     .set_active_time_range([
3409    ///         TimeRange::default()/* use setters */,
3410    ///         TimeRange::default()/* use (different) setters */,
3411    ///     ]);
3412    /// ```
3413    pub fn set_active_time_range<T, V>(mut self, v: T) -> Self
3414    where
3415        T: std::iter::IntoIterator<Item = V>,
3416        V: std::convert::Into<crate::model::condition::TimeRange>,
3417    {
3418        use std::iter::Iterator;
3419        self.active_time_range = v.into_iter().map(|i| i.into()).collect();
3420        self
3421    }
3422
3423    /// Sets the value of [page_categories][crate::model::Condition::page_categories].
3424    ///
3425    /// # Example
3426    /// ```ignore,no_run
3427    /// # use google_cloud_retail_v2::model::Condition;
3428    /// let x = Condition::new().set_page_categories(["a", "b", "c"]);
3429    /// ```
3430    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
3431    where
3432        T: std::iter::IntoIterator<Item = V>,
3433        V: std::convert::Into<std::string::String>,
3434    {
3435        use std::iter::Iterator;
3436        self.page_categories = v.into_iter().map(|i| i.into()).collect();
3437        self
3438    }
3439}
3440
3441impl wkt::message::Message for Condition {
3442    fn typename() -> &'static str {
3443        "type.googleapis.com/google.cloud.retail.v2.Condition"
3444    }
3445}
3446
3447/// Defines additional types related to [Condition].
3448pub mod condition {
3449    #[allow(unused_imports)]
3450    use super::*;
3451
3452    /// Query terms that we want to match on.
3453    #[derive(Clone, Default, PartialEq)]
3454    #[non_exhaustive]
3455    pub struct QueryTerm {
3456        /// The value of the term to match on.
3457        /// Value cannot be empty.
3458        /// Value can have at most 3 terms if specified as a partial match. Each
3459        /// space separated string is considered as one term.
3460        /// For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms
3461        /// and not allowed for a partial match.
3462        pub value: std::string::String,
3463
3464        /// Whether this is supposed to be a full or partial match.
3465        pub full_match: bool,
3466
3467        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3468    }
3469
3470    impl QueryTerm {
3471        pub fn new() -> Self {
3472            std::default::Default::default()
3473        }
3474
3475        /// Sets the value of [value][crate::model::condition::QueryTerm::value].
3476        ///
3477        /// # Example
3478        /// ```ignore,no_run
3479        /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3480        /// let x = QueryTerm::new().set_value("example");
3481        /// ```
3482        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3483            self.value = v.into();
3484            self
3485        }
3486
3487        /// Sets the value of [full_match][crate::model::condition::QueryTerm::full_match].
3488        ///
3489        /// # Example
3490        /// ```ignore,no_run
3491        /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3492        /// let x = QueryTerm::new().set_full_match(true);
3493        /// ```
3494        pub fn set_full_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3495            self.full_match = v.into();
3496            self
3497        }
3498    }
3499
3500    impl wkt::message::Message for QueryTerm {
3501        fn typename() -> &'static str {
3502            "type.googleapis.com/google.cloud.retail.v2.Condition.QueryTerm"
3503        }
3504    }
3505
3506    /// Used for time-dependent conditions.
3507    /// Example: Want to have rule applied for week long sale.
3508    #[derive(Clone, Default, PartialEq)]
3509    #[non_exhaustive]
3510    pub struct TimeRange {
3511        /// Start of time range. Range is inclusive.
3512        pub start_time: std::option::Option<wkt::Timestamp>,
3513
3514        /// End of time range. Range is inclusive.
3515        pub end_time: std::option::Option<wkt::Timestamp>,
3516
3517        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3518    }
3519
3520    impl TimeRange {
3521        pub fn new() -> Self {
3522            std::default::Default::default()
3523        }
3524
3525        /// Sets the value of [start_time][crate::model::condition::TimeRange::start_time].
3526        ///
3527        /// # Example
3528        /// ```ignore,no_run
3529        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3530        /// use wkt::Timestamp;
3531        /// let x = TimeRange::new().set_start_time(Timestamp::default()/* use setters */);
3532        /// ```
3533        pub fn set_start_time<T>(mut self, v: T) -> Self
3534        where
3535            T: std::convert::Into<wkt::Timestamp>,
3536        {
3537            self.start_time = std::option::Option::Some(v.into());
3538            self
3539        }
3540
3541        /// Sets or clears the value of [start_time][crate::model::condition::TimeRange::start_time].
3542        ///
3543        /// # Example
3544        /// ```ignore,no_run
3545        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3546        /// use wkt::Timestamp;
3547        /// let x = TimeRange::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3548        /// let x = TimeRange::new().set_or_clear_start_time(None::<Timestamp>);
3549        /// ```
3550        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3551        where
3552            T: std::convert::Into<wkt::Timestamp>,
3553        {
3554            self.start_time = v.map(|x| x.into());
3555            self
3556        }
3557
3558        /// Sets the value of [end_time][crate::model::condition::TimeRange::end_time].
3559        ///
3560        /// # Example
3561        /// ```ignore,no_run
3562        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3563        /// use wkt::Timestamp;
3564        /// let x = TimeRange::new().set_end_time(Timestamp::default()/* use setters */);
3565        /// ```
3566        pub fn set_end_time<T>(mut self, v: T) -> Self
3567        where
3568            T: std::convert::Into<wkt::Timestamp>,
3569        {
3570            self.end_time = std::option::Option::Some(v.into());
3571            self
3572        }
3573
3574        /// Sets or clears the value of [end_time][crate::model::condition::TimeRange::end_time].
3575        ///
3576        /// # Example
3577        /// ```ignore,no_run
3578        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3579        /// use wkt::Timestamp;
3580        /// let x = TimeRange::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3581        /// let x = TimeRange::new().set_or_clear_end_time(None::<Timestamp>);
3582        /// ```
3583        pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3584        where
3585            T: std::convert::Into<wkt::Timestamp>,
3586        {
3587            self.end_time = v.map(|x| x.into());
3588            self
3589        }
3590    }
3591
3592    impl wkt::message::Message for TimeRange {
3593        fn typename() -> &'static str {
3594            "type.googleapis.com/google.cloud.retail.v2.Condition.TimeRange"
3595        }
3596    }
3597}
3598
3599/// A rule is a condition-action pair
3600///
3601/// * A condition defines when a rule is to be triggered.
3602/// * An action specifies what occurs on that trigger.
3603///   Currently rules only work for [controls][google.cloud.retail.v2.Control] with
3604///   [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
3605///
3606/// [google.cloud.retail.v2.Control]: crate::model::Control
3607/// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
3608#[derive(Clone, Default, PartialEq)]
3609#[non_exhaustive]
3610pub struct Rule {
3611    /// Required. The condition that triggers the rule.
3612    /// If the condition is empty, the rule will always apply.
3613    pub condition: std::option::Option<crate::model::Condition>,
3614
3615    /// An action must be provided.
3616    pub action: std::option::Option<crate::model::rule::Action>,
3617
3618    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3619}
3620
3621impl Rule {
3622    pub fn new() -> Self {
3623        std::default::Default::default()
3624    }
3625
3626    /// Sets the value of [condition][crate::model::Rule::condition].
3627    ///
3628    /// # Example
3629    /// ```ignore,no_run
3630    /// # use google_cloud_retail_v2::model::Rule;
3631    /// use google_cloud_retail_v2::model::Condition;
3632    /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
3633    /// ```
3634    pub fn set_condition<T>(mut self, v: T) -> Self
3635    where
3636        T: std::convert::Into<crate::model::Condition>,
3637    {
3638        self.condition = std::option::Option::Some(v.into());
3639        self
3640    }
3641
3642    /// Sets or clears the value of [condition][crate::model::Rule::condition].
3643    ///
3644    /// # Example
3645    /// ```ignore,no_run
3646    /// # use google_cloud_retail_v2::model::Rule;
3647    /// use google_cloud_retail_v2::model::Condition;
3648    /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
3649    /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
3650    /// ```
3651    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
3652    where
3653        T: std::convert::Into<crate::model::Condition>,
3654    {
3655        self.condition = v.map(|x| x.into());
3656        self
3657    }
3658
3659    /// Sets the value of [action][crate::model::Rule::action].
3660    ///
3661    /// Note that all the setters affecting `action` are mutually
3662    /// exclusive.
3663    ///
3664    /// # Example
3665    /// ```ignore,no_run
3666    /// # use google_cloud_retail_v2::model::Rule;
3667    /// use google_cloud_retail_v2::model::rule::BoostAction;
3668    /// let x = Rule::new().set_action(Some(
3669    ///     google_cloud_retail_v2::model::rule::Action::BoostAction(BoostAction::default().into())));
3670    /// ```
3671    pub fn set_action<T: std::convert::Into<std::option::Option<crate::model::rule::Action>>>(
3672        mut self,
3673        v: T,
3674    ) -> Self {
3675        self.action = v.into();
3676        self
3677    }
3678
3679    /// The value of [action][crate::model::Rule::action]
3680    /// if it holds a `BoostAction`, `None` if the field is not set or
3681    /// holds a different branch.
3682    pub fn boost_action(
3683        &self,
3684    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::BoostAction>> {
3685        #[allow(unreachable_patterns)]
3686        self.action.as_ref().and_then(|v| match v {
3687            crate::model::rule::Action::BoostAction(v) => std::option::Option::Some(v),
3688            _ => std::option::Option::None,
3689        })
3690    }
3691
3692    /// Sets the value of [action][crate::model::Rule::action]
3693    /// to hold a `BoostAction`.
3694    ///
3695    /// Note that all the setters affecting `action` are
3696    /// mutually exclusive.
3697    ///
3698    /// # Example
3699    /// ```ignore,no_run
3700    /// # use google_cloud_retail_v2::model::Rule;
3701    /// use google_cloud_retail_v2::model::rule::BoostAction;
3702    /// let x = Rule::new().set_boost_action(BoostAction::default()/* use setters */);
3703    /// assert!(x.boost_action().is_some());
3704    /// assert!(x.redirect_action().is_none());
3705    /// assert!(x.oneway_synonyms_action().is_none());
3706    /// assert!(x.do_not_associate_action().is_none());
3707    /// assert!(x.replacement_action().is_none());
3708    /// assert!(x.ignore_action().is_none());
3709    /// assert!(x.filter_action().is_none());
3710    /// assert!(x.twoway_synonyms_action().is_none());
3711    /// assert!(x.force_return_facet_action().is_none());
3712    /// assert!(x.remove_facet_action().is_none());
3713    /// assert!(x.pin_action().is_none());
3714    /// ```
3715    pub fn set_boost_action<
3716        T: std::convert::Into<std::boxed::Box<crate::model::rule::BoostAction>>,
3717    >(
3718        mut self,
3719        v: T,
3720    ) -> Self {
3721        self.action = std::option::Option::Some(crate::model::rule::Action::BoostAction(v.into()));
3722        self
3723    }
3724
3725    /// The value of [action][crate::model::Rule::action]
3726    /// if it holds a `RedirectAction`, `None` if the field is not set or
3727    /// holds a different branch.
3728    pub fn redirect_action(
3729        &self,
3730    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RedirectAction>> {
3731        #[allow(unreachable_patterns)]
3732        self.action.as_ref().and_then(|v| match v {
3733            crate::model::rule::Action::RedirectAction(v) => std::option::Option::Some(v),
3734            _ => std::option::Option::None,
3735        })
3736    }
3737
3738    /// Sets the value of [action][crate::model::Rule::action]
3739    /// to hold a `RedirectAction`.
3740    ///
3741    /// Note that all the setters affecting `action` are
3742    /// mutually exclusive.
3743    ///
3744    /// # Example
3745    /// ```ignore,no_run
3746    /// # use google_cloud_retail_v2::model::Rule;
3747    /// use google_cloud_retail_v2::model::rule::RedirectAction;
3748    /// let x = Rule::new().set_redirect_action(RedirectAction::default()/* use setters */);
3749    /// assert!(x.redirect_action().is_some());
3750    /// assert!(x.boost_action().is_none());
3751    /// assert!(x.oneway_synonyms_action().is_none());
3752    /// assert!(x.do_not_associate_action().is_none());
3753    /// assert!(x.replacement_action().is_none());
3754    /// assert!(x.ignore_action().is_none());
3755    /// assert!(x.filter_action().is_none());
3756    /// assert!(x.twoway_synonyms_action().is_none());
3757    /// assert!(x.force_return_facet_action().is_none());
3758    /// assert!(x.remove_facet_action().is_none());
3759    /// assert!(x.pin_action().is_none());
3760    /// ```
3761    pub fn set_redirect_action<
3762        T: std::convert::Into<std::boxed::Box<crate::model::rule::RedirectAction>>,
3763    >(
3764        mut self,
3765        v: T,
3766    ) -> Self {
3767        self.action =
3768            std::option::Option::Some(crate::model::rule::Action::RedirectAction(v.into()));
3769        self
3770    }
3771
3772    /// The value of [action][crate::model::Rule::action]
3773    /// if it holds a `OnewaySynonymsAction`, `None` if the field is not set or
3774    /// holds a different branch.
3775    pub fn oneway_synonyms_action(
3776        &self,
3777    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::OnewaySynonymsAction>> {
3778        #[allow(unreachable_patterns)]
3779        self.action.as_ref().and_then(|v| match v {
3780            crate::model::rule::Action::OnewaySynonymsAction(v) => std::option::Option::Some(v),
3781            _ => std::option::Option::None,
3782        })
3783    }
3784
3785    /// Sets the value of [action][crate::model::Rule::action]
3786    /// to hold a `OnewaySynonymsAction`.
3787    ///
3788    /// Note that all the setters affecting `action` are
3789    /// mutually exclusive.
3790    ///
3791    /// # Example
3792    /// ```ignore,no_run
3793    /// # use google_cloud_retail_v2::model::Rule;
3794    /// use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
3795    /// let x = Rule::new().set_oneway_synonyms_action(OnewaySynonymsAction::default()/* use setters */);
3796    /// assert!(x.oneway_synonyms_action().is_some());
3797    /// assert!(x.boost_action().is_none());
3798    /// assert!(x.redirect_action().is_none());
3799    /// assert!(x.do_not_associate_action().is_none());
3800    /// assert!(x.replacement_action().is_none());
3801    /// assert!(x.ignore_action().is_none());
3802    /// assert!(x.filter_action().is_none());
3803    /// assert!(x.twoway_synonyms_action().is_none());
3804    /// assert!(x.force_return_facet_action().is_none());
3805    /// assert!(x.remove_facet_action().is_none());
3806    /// assert!(x.pin_action().is_none());
3807    /// ```
3808    pub fn set_oneway_synonyms_action<
3809        T: std::convert::Into<std::boxed::Box<crate::model::rule::OnewaySynonymsAction>>,
3810    >(
3811        mut self,
3812        v: T,
3813    ) -> Self {
3814        self.action =
3815            std::option::Option::Some(crate::model::rule::Action::OnewaySynonymsAction(v.into()));
3816        self
3817    }
3818
3819    /// The value of [action][crate::model::Rule::action]
3820    /// if it holds a `DoNotAssociateAction`, `None` if the field is not set or
3821    /// holds a different branch.
3822    pub fn do_not_associate_action(
3823        &self,
3824    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::DoNotAssociateAction>> {
3825        #[allow(unreachable_patterns)]
3826        self.action.as_ref().and_then(|v| match v {
3827            crate::model::rule::Action::DoNotAssociateAction(v) => std::option::Option::Some(v),
3828            _ => std::option::Option::None,
3829        })
3830    }
3831
3832    /// Sets the value of [action][crate::model::Rule::action]
3833    /// to hold a `DoNotAssociateAction`.
3834    ///
3835    /// Note that all the setters affecting `action` are
3836    /// mutually exclusive.
3837    ///
3838    /// # Example
3839    /// ```ignore,no_run
3840    /// # use google_cloud_retail_v2::model::Rule;
3841    /// use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
3842    /// let x = Rule::new().set_do_not_associate_action(DoNotAssociateAction::default()/* use setters */);
3843    /// assert!(x.do_not_associate_action().is_some());
3844    /// assert!(x.boost_action().is_none());
3845    /// assert!(x.redirect_action().is_none());
3846    /// assert!(x.oneway_synonyms_action().is_none());
3847    /// assert!(x.replacement_action().is_none());
3848    /// assert!(x.ignore_action().is_none());
3849    /// assert!(x.filter_action().is_none());
3850    /// assert!(x.twoway_synonyms_action().is_none());
3851    /// assert!(x.force_return_facet_action().is_none());
3852    /// assert!(x.remove_facet_action().is_none());
3853    /// assert!(x.pin_action().is_none());
3854    /// ```
3855    pub fn set_do_not_associate_action<
3856        T: std::convert::Into<std::boxed::Box<crate::model::rule::DoNotAssociateAction>>,
3857    >(
3858        mut self,
3859        v: T,
3860    ) -> Self {
3861        self.action =
3862            std::option::Option::Some(crate::model::rule::Action::DoNotAssociateAction(v.into()));
3863        self
3864    }
3865
3866    /// The value of [action][crate::model::Rule::action]
3867    /// if it holds a `ReplacementAction`, `None` if the field is not set or
3868    /// holds a different branch.
3869    pub fn replacement_action(
3870        &self,
3871    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ReplacementAction>> {
3872        #[allow(unreachable_patterns)]
3873        self.action.as_ref().and_then(|v| match v {
3874            crate::model::rule::Action::ReplacementAction(v) => std::option::Option::Some(v),
3875            _ => std::option::Option::None,
3876        })
3877    }
3878
3879    /// Sets the value of [action][crate::model::Rule::action]
3880    /// to hold a `ReplacementAction`.
3881    ///
3882    /// Note that all the setters affecting `action` are
3883    /// mutually exclusive.
3884    ///
3885    /// # Example
3886    /// ```ignore,no_run
3887    /// # use google_cloud_retail_v2::model::Rule;
3888    /// use google_cloud_retail_v2::model::rule::ReplacementAction;
3889    /// let x = Rule::new().set_replacement_action(ReplacementAction::default()/* use setters */);
3890    /// assert!(x.replacement_action().is_some());
3891    /// assert!(x.boost_action().is_none());
3892    /// assert!(x.redirect_action().is_none());
3893    /// assert!(x.oneway_synonyms_action().is_none());
3894    /// assert!(x.do_not_associate_action().is_none());
3895    /// assert!(x.ignore_action().is_none());
3896    /// assert!(x.filter_action().is_none());
3897    /// assert!(x.twoway_synonyms_action().is_none());
3898    /// assert!(x.force_return_facet_action().is_none());
3899    /// assert!(x.remove_facet_action().is_none());
3900    /// assert!(x.pin_action().is_none());
3901    /// ```
3902    pub fn set_replacement_action<
3903        T: std::convert::Into<std::boxed::Box<crate::model::rule::ReplacementAction>>,
3904    >(
3905        mut self,
3906        v: T,
3907    ) -> Self {
3908        self.action =
3909            std::option::Option::Some(crate::model::rule::Action::ReplacementAction(v.into()));
3910        self
3911    }
3912
3913    /// The value of [action][crate::model::Rule::action]
3914    /// if it holds a `IgnoreAction`, `None` if the field is not set or
3915    /// holds a different branch.
3916    pub fn ignore_action(
3917        &self,
3918    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::IgnoreAction>> {
3919        #[allow(unreachable_patterns)]
3920        self.action.as_ref().and_then(|v| match v {
3921            crate::model::rule::Action::IgnoreAction(v) => std::option::Option::Some(v),
3922            _ => std::option::Option::None,
3923        })
3924    }
3925
3926    /// Sets the value of [action][crate::model::Rule::action]
3927    /// to hold a `IgnoreAction`.
3928    ///
3929    /// Note that all the setters affecting `action` are
3930    /// mutually exclusive.
3931    ///
3932    /// # Example
3933    /// ```ignore,no_run
3934    /// # use google_cloud_retail_v2::model::Rule;
3935    /// use google_cloud_retail_v2::model::rule::IgnoreAction;
3936    /// let x = Rule::new().set_ignore_action(IgnoreAction::default()/* use setters */);
3937    /// assert!(x.ignore_action().is_some());
3938    /// assert!(x.boost_action().is_none());
3939    /// assert!(x.redirect_action().is_none());
3940    /// assert!(x.oneway_synonyms_action().is_none());
3941    /// assert!(x.do_not_associate_action().is_none());
3942    /// assert!(x.replacement_action().is_none());
3943    /// assert!(x.filter_action().is_none());
3944    /// assert!(x.twoway_synonyms_action().is_none());
3945    /// assert!(x.force_return_facet_action().is_none());
3946    /// assert!(x.remove_facet_action().is_none());
3947    /// assert!(x.pin_action().is_none());
3948    /// ```
3949    pub fn set_ignore_action<
3950        T: std::convert::Into<std::boxed::Box<crate::model::rule::IgnoreAction>>,
3951    >(
3952        mut self,
3953        v: T,
3954    ) -> Self {
3955        self.action = std::option::Option::Some(crate::model::rule::Action::IgnoreAction(v.into()));
3956        self
3957    }
3958
3959    /// The value of [action][crate::model::Rule::action]
3960    /// if it holds a `FilterAction`, `None` if the field is not set or
3961    /// holds a different branch.
3962    pub fn filter_action(
3963        &self,
3964    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::FilterAction>> {
3965        #[allow(unreachable_patterns)]
3966        self.action.as_ref().and_then(|v| match v {
3967            crate::model::rule::Action::FilterAction(v) => std::option::Option::Some(v),
3968            _ => std::option::Option::None,
3969        })
3970    }
3971
3972    /// Sets the value of [action][crate::model::Rule::action]
3973    /// to hold a `FilterAction`.
3974    ///
3975    /// Note that all the setters affecting `action` are
3976    /// mutually exclusive.
3977    ///
3978    /// # Example
3979    /// ```ignore,no_run
3980    /// # use google_cloud_retail_v2::model::Rule;
3981    /// use google_cloud_retail_v2::model::rule::FilterAction;
3982    /// let x = Rule::new().set_filter_action(FilterAction::default()/* use setters */);
3983    /// assert!(x.filter_action().is_some());
3984    /// assert!(x.boost_action().is_none());
3985    /// assert!(x.redirect_action().is_none());
3986    /// assert!(x.oneway_synonyms_action().is_none());
3987    /// assert!(x.do_not_associate_action().is_none());
3988    /// assert!(x.replacement_action().is_none());
3989    /// assert!(x.ignore_action().is_none());
3990    /// assert!(x.twoway_synonyms_action().is_none());
3991    /// assert!(x.force_return_facet_action().is_none());
3992    /// assert!(x.remove_facet_action().is_none());
3993    /// assert!(x.pin_action().is_none());
3994    /// ```
3995    pub fn set_filter_action<
3996        T: std::convert::Into<std::boxed::Box<crate::model::rule::FilterAction>>,
3997    >(
3998        mut self,
3999        v: T,
4000    ) -> Self {
4001        self.action = std::option::Option::Some(crate::model::rule::Action::FilterAction(v.into()));
4002        self
4003    }
4004
4005    /// The value of [action][crate::model::Rule::action]
4006    /// if it holds a `TwowaySynonymsAction`, `None` if the field is not set or
4007    /// holds a different branch.
4008    pub fn twoway_synonyms_action(
4009        &self,
4010    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::TwowaySynonymsAction>> {
4011        #[allow(unreachable_patterns)]
4012        self.action.as_ref().and_then(|v| match v {
4013            crate::model::rule::Action::TwowaySynonymsAction(v) => std::option::Option::Some(v),
4014            _ => std::option::Option::None,
4015        })
4016    }
4017
4018    /// Sets the value of [action][crate::model::Rule::action]
4019    /// to hold a `TwowaySynonymsAction`.
4020    ///
4021    /// Note that all the setters affecting `action` are
4022    /// mutually exclusive.
4023    ///
4024    /// # Example
4025    /// ```ignore,no_run
4026    /// # use google_cloud_retail_v2::model::Rule;
4027    /// use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4028    /// let x = Rule::new().set_twoway_synonyms_action(TwowaySynonymsAction::default()/* use setters */);
4029    /// assert!(x.twoway_synonyms_action().is_some());
4030    /// assert!(x.boost_action().is_none());
4031    /// assert!(x.redirect_action().is_none());
4032    /// assert!(x.oneway_synonyms_action().is_none());
4033    /// assert!(x.do_not_associate_action().is_none());
4034    /// assert!(x.replacement_action().is_none());
4035    /// assert!(x.ignore_action().is_none());
4036    /// assert!(x.filter_action().is_none());
4037    /// assert!(x.force_return_facet_action().is_none());
4038    /// assert!(x.remove_facet_action().is_none());
4039    /// assert!(x.pin_action().is_none());
4040    /// ```
4041    pub fn set_twoway_synonyms_action<
4042        T: std::convert::Into<std::boxed::Box<crate::model::rule::TwowaySynonymsAction>>,
4043    >(
4044        mut self,
4045        v: T,
4046    ) -> Self {
4047        self.action =
4048            std::option::Option::Some(crate::model::rule::Action::TwowaySynonymsAction(v.into()));
4049        self
4050    }
4051
4052    /// The value of [action][crate::model::Rule::action]
4053    /// if it holds a `ForceReturnFacetAction`, `None` if the field is not set or
4054    /// holds a different branch.
4055    pub fn force_return_facet_action(
4056        &self,
4057    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ForceReturnFacetAction>> {
4058        #[allow(unreachable_patterns)]
4059        self.action.as_ref().and_then(|v| match v {
4060            crate::model::rule::Action::ForceReturnFacetAction(v) => std::option::Option::Some(v),
4061            _ => std::option::Option::None,
4062        })
4063    }
4064
4065    /// Sets the value of [action][crate::model::Rule::action]
4066    /// to hold a `ForceReturnFacetAction`.
4067    ///
4068    /// Note that all the setters affecting `action` are
4069    /// mutually exclusive.
4070    ///
4071    /// # Example
4072    /// ```ignore,no_run
4073    /// # use google_cloud_retail_v2::model::Rule;
4074    /// use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4075    /// let x = Rule::new().set_force_return_facet_action(ForceReturnFacetAction::default()/* use setters */);
4076    /// assert!(x.force_return_facet_action().is_some());
4077    /// assert!(x.boost_action().is_none());
4078    /// assert!(x.redirect_action().is_none());
4079    /// assert!(x.oneway_synonyms_action().is_none());
4080    /// assert!(x.do_not_associate_action().is_none());
4081    /// assert!(x.replacement_action().is_none());
4082    /// assert!(x.ignore_action().is_none());
4083    /// assert!(x.filter_action().is_none());
4084    /// assert!(x.twoway_synonyms_action().is_none());
4085    /// assert!(x.remove_facet_action().is_none());
4086    /// assert!(x.pin_action().is_none());
4087    /// ```
4088    pub fn set_force_return_facet_action<
4089        T: std::convert::Into<std::boxed::Box<crate::model::rule::ForceReturnFacetAction>>,
4090    >(
4091        mut self,
4092        v: T,
4093    ) -> Self {
4094        self.action =
4095            std::option::Option::Some(crate::model::rule::Action::ForceReturnFacetAction(v.into()));
4096        self
4097    }
4098
4099    /// The value of [action][crate::model::Rule::action]
4100    /// if it holds a `RemoveFacetAction`, `None` if the field is not set or
4101    /// holds a different branch.
4102    pub fn remove_facet_action(
4103        &self,
4104    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RemoveFacetAction>> {
4105        #[allow(unreachable_patterns)]
4106        self.action.as_ref().and_then(|v| match v {
4107            crate::model::rule::Action::RemoveFacetAction(v) => std::option::Option::Some(v),
4108            _ => std::option::Option::None,
4109        })
4110    }
4111
4112    /// Sets the value of [action][crate::model::Rule::action]
4113    /// to hold a `RemoveFacetAction`.
4114    ///
4115    /// Note that all the setters affecting `action` are
4116    /// mutually exclusive.
4117    ///
4118    /// # Example
4119    /// ```ignore,no_run
4120    /// # use google_cloud_retail_v2::model::Rule;
4121    /// use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4122    /// let x = Rule::new().set_remove_facet_action(RemoveFacetAction::default()/* use setters */);
4123    /// assert!(x.remove_facet_action().is_some());
4124    /// assert!(x.boost_action().is_none());
4125    /// assert!(x.redirect_action().is_none());
4126    /// assert!(x.oneway_synonyms_action().is_none());
4127    /// assert!(x.do_not_associate_action().is_none());
4128    /// assert!(x.replacement_action().is_none());
4129    /// assert!(x.ignore_action().is_none());
4130    /// assert!(x.filter_action().is_none());
4131    /// assert!(x.twoway_synonyms_action().is_none());
4132    /// assert!(x.force_return_facet_action().is_none());
4133    /// assert!(x.pin_action().is_none());
4134    /// ```
4135    pub fn set_remove_facet_action<
4136        T: std::convert::Into<std::boxed::Box<crate::model::rule::RemoveFacetAction>>,
4137    >(
4138        mut self,
4139        v: T,
4140    ) -> Self {
4141        self.action =
4142            std::option::Option::Some(crate::model::rule::Action::RemoveFacetAction(v.into()));
4143        self
4144    }
4145
4146    /// The value of [action][crate::model::Rule::action]
4147    /// if it holds a `PinAction`, `None` if the field is not set or
4148    /// holds a different branch.
4149    pub fn pin_action(
4150        &self,
4151    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::PinAction>> {
4152        #[allow(unreachable_patterns)]
4153        self.action.as_ref().and_then(|v| match v {
4154            crate::model::rule::Action::PinAction(v) => std::option::Option::Some(v),
4155            _ => std::option::Option::None,
4156        })
4157    }
4158
4159    /// Sets the value of [action][crate::model::Rule::action]
4160    /// to hold a `PinAction`.
4161    ///
4162    /// Note that all the setters affecting `action` are
4163    /// mutually exclusive.
4164    ///
4165    /// # Example
4166    /// ```ignore,no_run
4167    /// # use google_cloud_retail_v2::model::Rule;
4168    /// use google_cloud_retail_v2::model::rule::PinAction;
4169    /// let x = Rule::new().set_pin_action(PinAction::default()/* use setters */);
4170    /// assert!(x.pin_action().is_some());
4171    /// assert!(x.boost_action().is_none());
4172    /// assert!(x.redirect_action().is_none());
4173    /// assert!(x.oneway_synonyms_action().is_none());
4174    /// assert!(x.do_not_associate_action().is_none());
4175    /// assert!(x.replacement_action().is_none());
4176    /// assert!(x.ignore_action().is_none());
4177    /// assert!(x.filter_action().is_none());
4178    /// assert!(x.twoway_synonyms_action().is_none());
4179    /// assert!(x.force_return_facet_action().is_none());
4180    /// assert!(x.remove_facet_action().is_none());
4181    /// ```
4182    pub fn set_pin_action<T: std::convert::Into<std::boxed::Box<crate::model::rule::PinAction>>>(
4183        mut self,
4184        v: T,
4185    ) -> Self {
4186        self.action = std::option::Option::Some(crate::model::rule::Action::PinAction(v.into()));
4187        self
4188    }
4189}
4190
4191impl wkt::message::Message for Rule {
4192    fn typename() -> &'static str {
4193        "type.googleapis.com/google.cloud.retail.v2.Rule"
4194    }
4195}
4196
4197/// Defines additional types related to [Rule].
4198pub mod rule {
4199    #[allow(unused_imports)]
4200    use super::*;
4201
4202    /// A boost action to apply to results matching condition specified above.
4203    #[derive(Clone, Default, PartialEq)]
4204    #[non_exhaustive]
4205    pub struct BoostAction {
4206        /// Strength of the condition boost, which must be in [-1, 1]. Negative
4207        /// boost means demotion. Default is 0.0.
4208        ///
4209        /// Setting to 1.0 gives the item a big promotion. However, it does not
4210        /// necessarily mean that the boosted item will be the top result at all
4211        /// times, nor that other items will be excluded. Results could still be
4212        /// shown even when none of them matches the condition. And results that
4213        /// are significantly more relevant to the search query can still trump
4214        /// your heavily favored but irrelevant items.
4215        ///
4216        /// Setting to -1.0 gives the item a big demotion. However, results that
4217        /// are deeply relevant might still be shown. The item will have an
4218        /// upstream battle to get a fairly high ranking, but it is not blocked out
4219        /// completely.
4220        ///
4221        /// Setting to 0.0 means no boost applied. The boosting condition is
4222        /// ignored.
4223        pub boost: f32,
4224
4225        /// The filter can have a max size of 5000 characters.
4226        /// An expression which specifies which products to apply an action to.
4227        /// The syntax and supported fields are the same as a filter expression. See
4228        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
4229        /// detail syntax and limitations.
4230        ///
4231        /// Examples:
4232        ///
4233        /// * To boost products with product ID "product_1" or "product_2", and
4234        ///   color
4235        ///   "Red" or "Blue":\<br\>
4236        ///   *(id: ANY("product_1", "product_2"))<br>*
4237        ///   *AND<br>*
4238        ///   *(colorFamilies: ANY("Red", "Blue"))<br>*
4239        ///
4240        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4241        pub products_filter: std::string::String,
4242
4243        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4244    }
4245
4246    impl BoostAction {
4247        pub fn new() -> Self {
4248            std::default::Default::default()
4249        }
4250
4251        /// Sets the value of [boost][crate::model::rule::BoostAction::boost].
4252        ///
4253        /// # Example
4254        /// ```ignore,no_run
4255        /// # use google_cloud_retail_v2::model::rule::BoostAction;
4256        /// let x = BoostAction::new().set_boost(42.0);
4257        /// ```
4258        pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4259            self.boost = v.into();
4260            self
4261        }
4262
4263        /// Sets the value of [products_filter][crate::model::rule::BoostAction::products_filter].
4264        ///
4265        /// # Example
4266        /// ```ignore,no_run
4267        /// # use google_cloud_retail_v2::model::rule::BoostAction;
4268        /// let x = BoostAction::new().set_products_filter("example");
4269        /// ```
4270        pub fn set_products_filter<T: std::convert::Into<std::string::String>>(
4271            mut self,
4272            v: T,
4273        ) -> Self {
4274            self.products_filter = v.into();
4275            self
4276        }
4277    }
4278
4279    impl wkt::message::Message for BoostAction {
4280        fn typename() -> &'static str {
4281            "type.googleapis.com/google.cloud.retail.v2.Rule.BoostAction"
4282        }
4283    }
4284
4285    /// * Rule Condition:
4286    ///
4287    ///   - No
4288    ///     [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4289    ///     provided is a global match.
4290    ///   - 1 or more
4291    ///     [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4292    ///     provided are combined with OR operator.
4293    /// * Action Input: The request query and filter that are applied to the
4294    ///   retrieved products, in addition to any filters already provided with the
4295    ///   SearchRequest. The AND operator is used to combine the query's existing
4296    ///   filters with the filter rule(s). NOTE: May result in 0 results when
4297    ///   filters conflict.
4298    ///
4299    /// * Action Result: Filters the returned objects to be ONLY those that passed
4300    ///   the filter.
4301    ///
4302    ///
4303    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4304    #[derive(Clone, Default, PartialEq)]
4305    #[non_exhaustive]
4306    pub struct FilterAction {
4307        /// A filter to apply on the matching condition results. Supported features:
4308        ///
4309        /// * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
4310        /// * Filter syntax is identical to
4311        ///   [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. For
4312        ///   more
4313        ///   information, see [Filter](/retail/docs/filter-and-order#filter).
4314        /// * To filter products with product ID "product_1" or "product_2", and
4315        ///   color
4316        ///   "Red" or "Blue":\<br\>
4317        ///   *(id: ANY("product_1", "product_2"))<br>*
4318        ///   *AND<br>*
4319        ///   *(colorFamilies: ANY("Red", "Blue"))<br>*
4320        ///
4321        /// [google.cloud.retail.v2.Rule.FilterAction.filter]: crate::model::rule::FilterAction::filter
4322        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4323        pub filter: std::string::String,
4324
4325        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4326    }
4327
4328    impl FilterAction {
4329        pub fn new() -> Self {
4330            std::default::Default::default()
4331        }
4332
4333        /// Sets the value of [filter][crate::model::rule::FilterAction::filter].
4334        ///
4335        /// # Example
4336        /// ```ignore,no_run
4337        /// # use google_cloud_retail_v2::model::rule::FilterAction;
4338        /// let x = FilterAction::new().set_filter("example");
4339        /// ```
4340        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4341            self.filter = v.into();
4342            self
4343        }
4344    }
4345
4346    impl wkt::message::Message for FilterAction {
4347        fn typename() -> &'static str {
4348            "type.googleapis.com/google.cloud.retail.v2.Rule.FilterAction"
4349        }
4350    }
4351
4352    /// Redirects a shopper to a specific page.
4353    ///
4354    /// * Rule Condition:
4355    ///   Must specify
4356    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
4357    /// * Action Input: Request Query
4358    /// * Action Result: Redirects shopper to provided uri.
4359    ///
4360    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4361    #[derive(Clone, Default, PartialEq)]
4362    #[non_exhaustive]
4363    pub struct RedirectAction {
4364        /// URL must have length equal or less than 2000 characters.
4365        pub redirect_uri: std::string::String,
4366
4367        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4368    }
4369
4370    impl RedirectAction {
4371        pub fn new() -> Self {
4372            std::default::Default::default()
4373        }
4374
4375        /// Sets the value of [redirect_uri][crate::model::rule::RedirectAction::redirect_uri].
4376        ///
4377        /// # Example
4378        /// ```ignore,no_run
4379        /// # use google_cloud_retail_v2::model::rule::RedirectAction;
4380        /// let x = RedirectAction::new().set_redirect_uri("example");
4381        /// ```
4382        pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(
4383            mut self,
4384            v: T,
4385        ) -> Self {
4386            self.redirect_uri = v.into();
4387            self
4388        }
4389    }
4390
4391    impl wkt::message::Message for RedirectAction {
4392        fn typename() -> &'static str {
4393            "type.googleapis.com/google.cloud.retail.v2.Rule.RedirectAction"
4394        }
4395    }
4396
4397    /// Creates a set of terms that will be treated as synonyms of each other.
4398    /// Example: synonyms of "sneakers" and "shoes":
4399    ///
4400    /// * "sneakers" will use a synonym of "shoes".
4401    /// * "shoes" will use a synonym of "sneakers".
4402    #[derive(Clone, Default, PartialEq)]
4403    #[non_exhaustive]
4404    pub struct TwowaySynonymsAction {
4405        /// Defines a set of synonyms.
4406        /// Can specify up to 100 synonyms.
4407        /// Must specify at least 2 synonyms.
4408        pub synonyms: std::vec::Vec<std::string::String>,
4409
4410        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4411    }
4412
4413    impl TwowaySynonymsAction {
4414        pub fn new() -> Self {
4415            std::default::Default::default()
4416        }
4417
4418        /// Sets the value of [synonyms][crate::model::rule::TwowaySynonymsAction::synonyms].
4419        ///
4420        /// # Example
4421        /// ```ignore,no_run
4422        /// # use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4423        /// let x = TwowaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4424        /// ```
4425        pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4426        where
4427            T: std::iter::IntoIterator<Item = V>,
4428            V: std::convert::Into<std::string::String>,
4429        {
4430            use std::iter::Iterator;
4431            self.synonyms = v.into_iter().map(|i| i.into()).collect();
4432            self
4433        }
4434    }
4435
4436    impl wkt::message::Message for TwowaySynonymsAction {
4437        fn typename() -> &'static str {
4438            "type.googleapis.com/google.cloud.retail.v2.Rule.TwowaySynonymsAction"
4439        }
4440    }
4441
4442    /// Maps a set of terms to a set of synonyms.
4443    /// Set of synonyms will be treated as synonyms of each query term only.
4444    /// `query_terms` will not be treated as synonyms of each other.
4445    /// Example: "sneakers" will use a synonym of "shoes".
4446    /// "shoes" will not use a synonym of "sneakers".
4447    #[derive(Clone, Default, PartialEq)]
4448    #[non_exhaustive]
4449    pub struct OnewaySynonymsAction {
4450        /// Terms from the search query.
4451        /// Will treat synonyms as their synonyms.
4452        /// Not themselves synonyms of the synonyms.
4453        /// Can specify up to 100 terms.
4454        pub query_terms: std::vec::Vec<std::string::String>,
4455
4456        /// Defines a set of synonyms.
4457        /// Cannot contain duplicates.
4458        /// Can specify up to 100 synonyms.
4459        pub synonyms: std::vec::Vec<std::string::String>,
4460
4461        /// Will be [deprecated = true] post migration;
4462        pub oneway_terms: std::vec::Vec<std::string::String>,
4463
4464        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4465    }
4466
4467    impl OnewaySynonymsAction {
4468        pub fn new() -> Self {
4469            std::default::Default::default()
4470        }
4471
4472        /// Sets the value of [query_terms][crate::model::rule::OnewaySynonymsAction::query_terms].
4473        ///
4474        /// # Example
4475        /// ```ignore,no_run
4476        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4477        /// let x = OnewaySynonymsAction::new().set_query_terms(["a", "b", "c"]);
4478        /// ```
4479        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4480        where
4481            T: std::iter::IntoIterator<Item = V>,
4482            V: std::convert::Into<std::string::String>,
4483        {
4484            use std::iter::Iterator;
4485            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4486            self
4487        }
4488
4489        /// Sets the value of [synonyms][crate::model::rule::OnewaySynonymsAction::synonyms].
4490        ///
4491        /// # Example
4492        /// ```ignore,no_run
4493        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4494        /// let x = OnewaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4495        /// ```
4496        pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4497        where
4498            T: std::iter::IntoIterator<Item = V>,
4499            V: std::convert::Into<std::string::String>,
4500        {
4501            use std::iter::Iterator;
4502            self.synonyms = v.into_iter().map(|i| i.into()).collect();
4503            self
4504        }
4505
4506        /// Sets the value of [oneway_terms][crate::model::rule::OnewaySynonymsAction::oneway_terms].
4507        ///
4508        /// # Example
4509        /// ```ignore,no_run
4510        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4511        /// let x = OnewaySynonymsAction::new().set_oneway_terms(["a", "b", "c"]);
4512        /// ```
4513        pub fn set_oneway_terms<T, V>(mut self, v: T) -> Self
4514        where
4515            T: std::iter::IntoIterator<Item = V>,
4516            V: std::convert::Into<std::string::String>,
4517        {
4518            use std::iter::Iterator;
4519            self.oneway_terms = v.into_iter().map(|i| i.into()).collect();
4520            self
4521        }
4522    }
4523
4524    impl wkt::message::Message for OnewaySynonymsAction {
4525        fn typename() -> &'static str {
4526            "type.googleapis.com/google.cloud.retail.v2.Rule.OnewaySynonymsAction"
4527        }
4528    }
4529
4530    /// Prevents `query_term` from being associated with specified terms during
4531    /// search.
4532    /// Example: Don't associate "gShoe" and "cheap".
4533    #[derive(Clone, Default, PartialEq)]
4534    #[non_exhaustive]
4535    pub struct DoNotAssociateAction {
4536        /// Terms from the search query.
4537        /// Will not consider do_not_associate_terms for search if in search query.
4538        /// Can specify up to 100 terms.
4539        pub query_terms: std::vec::Vec<std::string::String>,
4540
4541        /// Cannot contain duplicates or the query term.
4542        /// Can specify up to 100 terms.
4543        pub do_not_associate_terms: std::vec::Vec<std::string::String>,
4544
4545        /// Will be [deprecated = true] post migration;
4546        pub terms: std::vec::Vec<std::string::String>,
4547
4548        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4549    }
4550
4551    impl DoNotAssociateAction {
4552        pub fn new() -> Self {
4553            std::default::Default::default()
4554        }
4555
4556        /// Sets the value of [query_terms][crate::model::rule::DoNotAssociateAction::query_terms].
4557        ///
4558        /// # Example
4559        /// ```ignore,no_run
4560        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4561        /// let x = DoNotAssociateAction::new().set_query_terms(["a", "b", "c"]);
4562        /// ```
4563        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4564        where
4565            T: std::iter::IntoIterator<Item = V>,
4566            V: std::convert::Into<std::string::String>,
4567        {
4568            use std::iter::Iterator;
4569            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4570            self
4571        }
4572
4573        /// Sets the value of [do_not_associate_terms][crate::model::rule::DoNotAssociateAction::do_not_associate_terms].
4574        ///
4575        /// # Example
4576        /// ```ignore,no_run
4577        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4578        /// let x = DoNotAssociateAction::new().set_do_not_associate_terms(["a", "b", "c"]);
4579        /// ```
4580        pub fn set_do_not_associate_terms<T, V>(mut self, v: T) -> Self
4581        where
4582            T: std::iter::IntoIterator<Item = V>,
4583            V: std::convert::Into<std::string::String>,
4584        {
4585            use std::iter::Iterator;
4586            self.do_not_associate_terms = v.into_iter().map(|i| i.into()).collect();
4587            self
4588        }
4589
4590        /// Sets the value of [terms][crate::model::rule::DoNotAssociateAction::terms].
4591        ///
4592        /// # Example
4593        /// ```ignore,no_run
4594        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4595        /// let x = DoNotAssociateAction::new().set_terms(["a", "b", "c"]);
4596        /// ```
4597        pub fn set_terms<T, V>(mut self, v: T) -> Self
4598        where
4599            T: std::iter::IntoIterator<Item = V>,
4600            V: std::convert::Into<std::string::String>,
4601        {
4602            use std::iter::Iterator;
4603            self.terms = v.into_iter().map(|i| i.into()).collect();
4604            self
4605        }
4606    }
4607
4608    impl wkt::message::Message for DoNotAssociateAction {
4609        fn typename() -> &'static str {
4610            "type.googleapis.com/google.cloud.retail.v2.Rule.DoNotAssociateAction"
4611        }
4612    }
4613
4614    /// Replaces a term in the query. Multiple replacement candidates can be
4615    /// specified. All `query_terms` will be replaced with the replacement term.
4616    /// Example: Replace "gShoe" with "google shoe".
4617    #[derive(Clone, Default, PartialEq)]
4618    #[non_exhaustive]
4619    pub struct ReplacementAction {
4620        /// Terms from the search query.
4621        /// Will be replaced by replacement term.
4622        /// Can specify up to 100 terms.
4623        pub query_terms: std::vec::Vec<std::string::String>,
4624
4625        /// Term that will be used for replacement.
4626        pub replacement_term: std::string::String,
4627
4628        /// Will be [deprecated = true] post migration;
4629        pub term: std::string::String,
4630
4631        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4632    }
4633
4634    impl ReplacementAction {
4635        pub fn new() -> Self {
4636            std::default::Default::default()
4637        }
4638
4639        /// Sets the value of [query_terms][crate::model::rule::ReplacementAction::query_terms].
4640        ///
4641        /// # Example
4642        /// ```ignore,no_run
4643        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4644        /// let x = ReplacementAction::new().set_query_terms(["a", "b", "c"]);
4645        /// ```
4646        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4647        where
4648            T: std::iter::IntoIterator<Item = V>,
4649            V: std::convert::Into<std::string::String>,
4650        {
4651            use std::iter::Iterator;
4652            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4653            self
4654        }
4655
4656        /// Sets the value of [replacement_term][crate::model::rule::ReplacementAction::replacement_term].
4657        ///
4658        /// # Example
4659        /// ```ignore,no_run
4660        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4661        /// let x = ReplacementAction::new().set_replacement_term("example");
4662        /// ```
4663        pub fn set_replacement_term<T: std::convert::Into<std::string::String>>(
4664            mut self,
4665            v: T,
4666        ) -> Self {
4667            self.replacement_term = v.into();
4668            self
4669        }
4670
4671        /// Sets the value of [term][crate::model::rule::ReplacementAction::term].
4672        ///
4673        /// # Example
4674        /// ```ignore,no_run
4675        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4676        /// let x = ReplacementAction::new().set_term("example");
4677        /// ```
4678        pub fn set_term<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4679            self.term = v.into();
4680            self
4681        }
4682    }
4683
4684    impl wkt::message::Message for ReplacementAction {
4685        fn typename() -> &'static str {
4686            "type.googleapis.com/google.cloud.retail.v2.Rule.ReplacementAction"
4687        }
4688    }
4689
4690    /// Prevents a term in the query from being used in search.
4691    /// Example: Don't search for "shoddy".
4692    #[derive(Clone, Default, PartialEq)]
4693    #[non_exhaustive]
4694    pub struct IgnoreAction {
4695        /// Terms to ignore in the search query.
4696        pub ignore_terms: std::vec::Vec<std::string::String>,
4697
4698        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4699    }
4700
4701    impl IgnoreAction {
4702        pub fn new() -> Self {
4703            std::default::Default::default()
4704        }
4705
4706        /// Sets the value of [ignore_terms][crate::model::rule::IgnoreAction::ignore_terms].
4707        ///
4708        /// # Example
4709        /// ```ignore,no_run
4710        /// # use google_cloud_retail_v2::model::rule::IgnoreAction;
4711        /// let x = IgnoreAction::new().set_ignore_terms(["a", "b", "c"]);
4712        /// ```
4713        pub fn set_ignore_terms<T, V>(mut self, v: T) -> Self
4714        where
4715            T: std::iter::IntoIterator<Item = V>,
4716            V: std::convert::Into<std::string::String>,
4717        {
4718            use std::iter::Iterator;
4719            self.ignore_terms = v.into_iter().map(|i| i.into()).collect();
4720            self
4721        }
4722    }
4723
4724    impl wkt::message::Message for IgnoreAction {
4725        fn typename() -> &'static str {
4726            "type.googleapis.com/google.cloud.retail.v2.Rule.IgnoreAction"
4727        }
4728    }
4729
4730    /// Force returns an attribute/facet in the request around a certain position
4731    /// or above.
4732    ///
4733    /// * Rule Condition:
4734    ///   Must specify non-empty
4735    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4736    ///   (for search only) or
4737    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4738    ///   (for browse only), but can't specify both.
4739    ///
4740    /// * Action Inputs: attribute name, position
4741    ///
4742    /// * Action Result: Will force return a facet key around a certain position
4743    ///   or above if the condition is satisfied.
4744    ///
4745    ///
4746    /// Example: Suppose the query is "shoes", the
4747    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4748    /// "shoes", the
4749    /// [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]
4750    /// is "size" and the
4751    /// [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]
4752    /// is 8.
4753    ///
4754    /// Two cases: a) The facet key "size" is not already in the top 8 slots, then
4755    /// the facet "size" will appear at a position close to 8. b) The facet key
4756    /// "size" in among the top 8 positions in the request, then it will stay at
4757    /// its current rank.
4758    ///
4759    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4760    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4761    /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name
4762    /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position
4763    #[derive(Clone, Default, PartialEq)]
4764    #[non_exhaustive]
4765    pub struct ForceReturnFacetAction {
4766        /// Each instance corresponds to a force return attribute for the given
4767        /// condition. There can't be more 15 instances here.
4768        pub facet_position_adjustments:
4769            std::vec::Vec<crate::model::rule::force_return_facet_action::FacetPositionAdjustment>,
4770
4771        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4772    }
4773
4774    impl ForceReturnFacetAction {
4775        pub fn new() -> Self {
4776            std::default::Default::default()
4777        }
4778
4779        /// Sets the value of [facet_position_adjustments][crate::model::rule::ForceReturnFacetAction::facet_position_adjustments].
4780        ///
4781        /// # Example
4782        /// ```ignore,no_run
4783        /// # use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4784        /// use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4785        /// let x = ForceReturnFacetAction::new()
4786        ///     .set_facet_position_adjustments([
4787        ///         FacetPositionAdjustment::default()/* use setters */,
4788        ///         FacetPositionAdjustment::default()/* use (different) setters */,
4789        ///     ]);
4790        /// ```
4791        pub fn set_facet_position_adjustments<T, V>(mut self, v: T) -> Self
4792        where
4793            T: std::iter::IntoIterator<Item = V>,
4794            V: std::convert::Into<
4795                    crate::model::rule::force_return_facet_action::FacetPositionAdjustment,
4796                >,
4797        {
4798            use std::iter::Iterator;
4799            self.facet_position_adjustments = v.into_iter().map(|i| i.into()).collect();
4800            self
4801        }
4802    }
4803
4804    impl wkt::message::Message for ForceReturnFacetAction {
4805        fn typename() -> &'static str {
4806            "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction"
4807        }
4808    }
4809
4810    /// Defines additional types related to [ForceReturnFacetAction].
4811    pub mod force_return_facet_action {
4812        #[allow(unused_imports)]
4813        use super::*;
4814
4815        /// Each facet position adjustment consists of a single attribute name (i.e.
4816        /// facet key) along with a specified position.
4817        #[derive(Clone, Default, PartialEq)]
4818        #[non_exhaustive]
4819        pub struct FacetPositionAdjustment {
4820            /// The attribute name to force return as a facet. Each attribute name
4821            /// should be a valid attribute name, be non-empty and contain at most 80
4822            /// characters long.
4823            pub attribute_name: std::string::String,
4824
4825            /// This is the position in the request as explained above. It should be
4826            /// strictly positive be at most 100.
4827            pub position: i32,
4828
4829            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4830        }
4831
4832        impl FacetPositionAdjustment {
4833            pub fn new() -> Self {
4834                std::default::Default::default()
4835            }
4836
4837            /// Sets the value of [attribute_name][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name].
4838            ///
4839            /// # Example
4840            /// ```ignore,no_run
4841            /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4842            /// let x = FacetPositionAdjustment::new().set_attribute_name("example");
4843            /// ```
4844            pub fn set_attribute_name<T: std::convert::Into<std::string::String>>(
4845                mut self,
4846                v: T,
4847            ) -> Self {
4848                self.attribute_name = v.into();
4849                self
4850            }
4851
4852            /// Sets the value of [position][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position].
4853            ///
4854            /// # Example
4855            /// ```ignore,no_run
4856            /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4857            /// let x = FacetPositionAdjustment::new().set_position(42);
4858            /// ```
4859            pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4860                self.position = v.into();
4861                self
4862            }
4863        }
4864
4865        impl wkt::message::Message for FacetPositionAdjustment {
4866            fn typename() -> &'static str {
4867                "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment"
4868            }
4869        }
4870    }
4871
4872    /// Removes an attribute/facet in the request if is present.
4873    ///
4874    /// * Rule Condition:
4875    ///   Must specify non-empty
4876    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4877    ///   (for search only) or
4878    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4879    ///   (for browse only), but can't specify both.
4880    ///
4881    /// * Action Input: attribute name
4882    ///
4883    /// * Action Result: Will remove the attribute (as a facet) from the request
4884    ///   if it is present.
4885    ///
4886    ///
4887    /// Example: Suppose the query is "shoes", the
4888    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4889    /// "shoes" and the attribute name "size", then facet key "size" will be
4890    /// removed from the request (if it is present).
4891    ///
4892    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4893    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4894    #[derive(Clone, Default, PartialEq)]
4895    #[non_exhaustive]
4896    pub struct RemoveFacetAction {
4897        /// The attribute names (i.e. facet keys) to remove from the dynamic facets
4898        /// (if present in the request). There can't be more 3 attribute names.
4899        /// Each attribute name should be a valid attribute name, be non-empty and
4900        /// contain at most 80 characters.
4901        pub attribute_names: std::vec::Vec<std::string::String>,
4902
4903        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4904    }
4905
4906    impl RemoveFacetAction {
4907        pub fn new() -> Self {
4908            std::default::Default::default()
4909        }
4910
4911        /// Sets the value of [attribute_names][crate::model::rule::RemoveFacetAction::attribute_names].
4912        ///
4913        /// # Example
4914        /// ```ignore,no_run
4915        /// # use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4916        /// let x = RemoveFacetAction::new().set_attribute_names(["a", "b", "c"]);
4917        /// ```
4918        pub fn set_attribute_names<T, V>(mut self, v: T) -> Self
4919        where
4920            T: std::iter::IntoIterator<Item = V>,
4921            V: std::convert::Into<std::string::String>,
4922        {
4923            use std::iter::Iterator;
4924            self.attribute_names = v.into_iter().map(|i| i.into()).collect();
4925            self
4926        }
4927    }
4928
4929    impl wkt::message::Message for RemoveFacetAction {
4930        fn typename() -> &'static str {
4931            "type.googleapis.com/google.cloud.retail.v2.Rule.RemoveFacetAction"
4932        }
4933    }
4934
4935    /// Pins one or more specified products to a specific position in the
4936    /// results.
4937    ///
4938    /// * Rule Condition:
4939    ///   Must specify non-empty
4940    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4941    ///   (for search only) or
4942    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4943    ///   (for browse only), but can't specify both.
4944    ///
4945    /// * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
4946    ///   uses 1-based indexing).
4947    ///
4948    /// * Action Result: Will pin products with matching ids to the position
4949    ///   specified in the final result order.
4950    ///
4951    ///
4952    /// Example: Suppose the query is `shoes`, the
4953    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4954    /// `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
4955    /// pinned to the top position in the final results.
4956    ///
4957    /// If multiple PinActions are matched to a single request the actions will
4958    /// be processed from most to least recently updated.
4959    ///
4960    /// Pins to positions larger than the max allowed page size of 120 are not
4961    /// allowed.
4962    ///
4963    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4964    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4965    #[derive(Clone, Default, PartialEq)]
4966    #[non_exhaustive]
4967    pub struct PinAction {
4968        /// Required. A map of positions to product_ids.
4969        ///
4970        /// Partial matches per action are allowed, if a certain position in the map
4971        /// is already filled that `[position, product_id]` pair will be ignored
4972        /// but the rest may still be applied. This case will only occur if multiple
4973        /// pin actions are matched to a single request, as the map guarantees that
4974        /// pin positions are unique within the same action.
4975        ///
4976        /// Duplicate product_ids are not permitted within a single pin map.
4977        ///
4978        /// The max size of this map is 120, equivalent to the max [request page
4979        /// size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
4980        pub pin_map: std::collections::HashMap<i64, std::string::String>,
4981
4982        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4983    }
4984
4985    impl PinAction {
4986        pub fn new() -> Self {
4987            std::default::Default::default()
4988        }
4989
4990        /// Sets the value of [pin_map][crate::model::rule::PinAction::pin_map].
4991        ///
4992        /// # Example
4993        /// ```ignore,no_run
4994        /// # use google_cloud_retail_v2::model::rule::PinAction;
4995        /// let x = PinAction::new().set_pin_map([
4996        ///     (0, "abc"),
4997        ///     (1, "xyz"),
4998        /// ]);
4999        /// ```
5000        pub fn set_pin_map<T, K, V>(mut self, v: T) -> Self
5001        where
5002            T: std::iter::IntoIterator<Item = (K, V)>,
5003            K: std::convert::Into<i64>,
5004            V: std::convert::Into<std::string::String>,
5005        {
5006            use std::iter::Iterator;
5007            self.pin_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5008            self
5009        }
5010    }
5011
5012    impl wkt::message::Message for PinAction {
5013        fn typename() -> &'static str {
5014            "type.googleapis.com/google.cloud.retail.v2.Rule.PinAction"
5015        }
5016    }
5017
5018    /// An action must be provided.
5019    #[derive(Clone, Debug, PartialEq)]
5020    #[non_exhaustive]
5021    pub enum Action {
5022        /// A boost action.
5023        BoostAction(std::boxed::Box<crate::model::rule::BoostAction>),
5024        /// Redirects a shopper to a specific page.
5025        RedirectAction(std::boxed::Box<crate::model::rule::RedirectAction>),
5026        /// Treats specific term as a synonym with a group of terms.
5027        /// Group of terms will not be treated as synonyms with the specific term.
5028        OnewaySynonymsAction(std::boxed::Box<crate::model::rule::OnewaySynonymsAction>),
5029        /// Prevents term from being associated with other terms.
5030        DoNotAssociateAction(std::boxed::Box<crate::model::rule::DoNotAssociateAction>),
5031        /// Replaces specific terms in the query.
5032        ReplacementAction(std::boxed::Box<crate::model::rule::ReplacementAction>),
5033        /// Ignores specific terms from query during search.
5034        IgnoreAction(std::boxed::Box<crate::model::rule::IgnoreAction>),
5035        /// Filters results.
5036        FilterAction(std::boxed::Box<crate::model::rule::FilterAction>),
5037        /// Treats a set of terms as synonyms of one another.
5038        TwowaySynonymsAction(std::boxed::Box<crate::model::rule::TwowaySynonymsAction>),
5039        /// Force returns an attribute as a facet in the request.
5040        ForceReturnFacetAction(std::boxed::Box<crate::model::rule::ForceReturnFacetAction>),
5041        /// Remove an attribute as a facet in the request (if present).
5042        RemoveFacetAction(std::boxed::Box<crate::model::rule::RemoveFacetAction>),
5043        /// Pins one or more specified products to a specific position in the
5044        /// results.
5045        PinAction(std::boxed::Box<crate::model::rule::PinAction>),
5046    }
5047}
5048
5049/// An intended audience of the [Product][google.cloud.retail.v2.Product] for
5050/// whom it's sold.
5051///
5052/// [google.cloud.retail.v2.Product]: crate::model::Product
5053#[derive(Clone, Default, PartialEq)]
5054#[non_exhaustive]
5055pub struct Audience {
5056    /// The genders of the audience. Strongly encouraged to use the standard
5057    /// values: "male", "female", "unisex".
5058    ///
5059    /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5060    /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5061    /// is returned.
5062    ///
5063    /// Google Merchant Center property
5064    /// [gender](https://support.google.com/merchants/answer/6324479). Schema.org
5065    /// property
5066    /// [Product.audience.suggestedGender](https://schema.org/suggestedGender).
5067    pub genders: std::vec::Vec<std::string::String>,
5068
5069    /// The age groups of the audience. Strongly encouraged to use the standard
5070    /// values: "newborn" (up to 3 months old), "infant" (3–12 months old),
5071    /// "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
5072    /// teens or older).
5073    ///
5074    /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5075    /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5076    /// is returned.
5077    ///
5078    /// Google Merchant Center property
5079    /// [age_group](https://support.google.com/merchants/answer/6324463).
5080    /// Schema.org property
5081    /// [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
5082    /// [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
5083    pub age_groups: std::vec::Vec<std::string::String>,
5084
5085    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5086}
5087
5088impl Audience {
5089    pub fn new() -> Self {
5090        std::default::Default::default()
5091    }
5092
5093    /// Sets the value of [genders][crate::model::Audience::genders].
5094    ///
5095    /// # Example
5096    /// ```ignore,no_run
5097    /// # use google_cloud_retail_v2::model::Audience;
5098    /// let x = Audience::new().set_genders(["a", "b", "c"]);
5099    /// ```
5100    pub fn set_genders<T, V>(mut self, v: T) -> Self
5101    where
5102        T: std::iter::IntoIterator<Item = V>,
5103        V: std::convert::Into<std::string::String>,
5104    {
5105        use std::iter::Iterator;
5106        self.genders = v.into_iter().map(|i| i.into()).collect();
5107        self
5108    }
5109
5110    /// Sets the value of [age_groups][crate::model::Audience::age_groups].
5111    ///
5112    /// # Example
5113    /// ```ignore,no_run
5114    /// # use google_cloud_retail_v2::model::Audience;
5115    /// let x = Audience::new().set_age_groups(["a", "b", "c"]);
5116    /// ```
5117    pub fn set_age_groups<T, V>(mut self, v: T) -> Self
5118    where
5119        T: std::iter::IntoIterator<Item = V>,
5120        V: std::convert::Into<std::string::String>,
5121    {
5122        use std::iter::Iterator;
5123        self.age_groups = v.into_iter().map(|i| i.into()).collect();
5124        self
5125    }
5126}
5127
5128impl wkt::message::Message for Audience {
5129    fn typename() -> &'static str {
5130        "type.googleapis.com/google.cloud.retail.v2.Audience"
5131    }
5132}
5133
5134/// The color information of a [Product][google.cloud.retail.v2.Product].
5135///
5136/// [google.cloud.retail.v2.Product]: crate::model::Product
5137#[derive(Clone, Default, PartialEq)]
5138#[non_exhaustive]
5139pub struct ColorInfo {
5140    /// The standard color families. Strongly recommended to use the following
5141    /// standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
5142    /// "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
5143    /// Normally it is expected to have only 1 color family. May consider using
5144    /// single "Mixed" instead of multiple values.
5145    ///
5146    /// A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
5147    /// string with a length limit of 128 characters. Otherwise, an
5148    /// INVALID_ARGUMENT error is returned.
5149    ///
5150    /// Google Merchant Center property
5151    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5152    /// property [Product.color](https://schema.org/color).
5153    ///
5154    /// The colorFamilies field as a system attribute is not a required field but
5155    /// strongly recommended to be specified. Google Search models treat this field
5156    /// as more important than a custom product attribute when specified.
5157    pub color_families: std::vec::Vec<std::string::String>,
5158
5159    /// The color display names, which may be different from standard color family
5160    /// names, such as the color aliases used in the website frontend. Normally
5161    /// it is expected to have only 1 color. May consider using single "Mixed"
5162    /// instead of multiple values.
5163    ///
5164    /// A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded
5165    /// string with a length limit of 128 characters. Otherwise, an
5166    /// INVALID_ARGUMENT error is returned.
5167    ///
5168    /// Google Merchant Center property
5169    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5170    /// property [Product.color](https://schema.org/color).
5171    pub colors: std::vec::Vec<std::string::String>,
5172
5173    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5174}
5175
5176impl ColorInfo {
5177    pub fn new() -> Self {
5178        std::default::Default::default()
5179    }
5180
5181    /// Sets the value of [color_families][crate::model::ColorInfo::color_families].
5182    ///
5183    /// # Example
5184    /// ```ignore,no_run
5185    /// # use google_cloud_retail_v2::model::ColorInfo;
5186    /// let x = ColorInfo::new().set_color_families(["a", "b", "c"]);
5187    /// ```
5188    pub fn set_color_families<T, V>(mut self, v: T) -> Self
5189    where
5190        T: std::iter::IntoIterator<Item = V>,
5191        V: std::convert::Into<std::string::String>,
5192    {
5193        use std::iter::Iterator;
5194        self.color_families = v.into_iter().map(|i| i.into()).collect();
5195        self
5196    }
5197
5198    /// Sets the value of [colors][crate::model::ColorInfo::colors].
5199    ///
5200    /// # Example
5201    /// ```ignore,no_run
5202    /// # use google_cloud_retail_v2::model::ColorInfo;
5203    /// let x = ColorInfo::new().set_colors(["a", "b", "c"]);
5204    /// ```
5205    pub fn set_colors<T, V>(mut self, v: T) -> Self
5206    where
5207        T: std::iter::IntoIterator<Item = V>,
5208        V: std::convert::Into<std::string::String>,
5209    {
5210        use std::iter::Iterator;
5211        self.colors = v.into_iter().map(|i| i.into()).collect();
5212        self
5213    }
5214}
5215
5216impl wkt::message::Message for ColorInfo {
5217    fn typename() -> &'static str {
5218        "type.googleapis.com/google.cloud.retail.v2.ColorInfo"
5219    }
5220}
5221
5222/// A custom attribute that is not explicitly modeled in
5223/// [Product][google.cloud.retail.v2.Product].
5224///
5225/// [google.cloud.retail.v2.Product]: crate::model::Product
5226#[derive(Clone, Default, PartialEq)]
5227#[non_exhaustive]
5228pub struct CustomAttribute {
5229    /// The textual values of this custom attribute. For example, `["yellow",
5230    /// "green"]` when the key is "color".
5231    ///
5232    /// Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
5233    /// returned.
5234    ///
5235    /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5236    /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5237    /// Otherwise, an INVALID_ARGUMENT error is returned.
5238    ///
5239    /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5240    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5241    pub text: std::vec::Vec<std::string::String>,
5242
5243    /// The numerical values of this custom attribute. For example, `[2.3, 15.4]`
5244    /// when the key is "lengths_cm".
5245    ///
5246    /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5247    /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5248    /// Otherwise, an INVALID_ARGUMENT error is returned.
5249    ///
5250    /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5251    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5252    pub numbers: std::vec::Vec<f64>,
5253
5254    /// This field is normally ignored unless
5255    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5256    /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5257    /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5258    /// attribute configuration, see [Configuration
5259    /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5260    /// If true, custom attribute values are searchable by text queries in
5261    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5262    ///
5263    /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5264    ///
5265    /// Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
5266    /// set. Otherwise, a INVALID_ARGUMENT error is returned.
5267    ///
5268    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5269    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5270    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5271    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5272    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5273    #[deprecated]
5274    pub searchable: std::option::Option<bool>,
5275
5276    /// This field is normally ignored unless
5277    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5278    /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5279    /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5280    /// attribute configuration, see [Configuration
5281    /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5282    /// If true, custom attribute values are indexed, so that they can be filtered,
5283    /// faceted or boosted in
5284    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5285    ///
5286    /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5287    ///
5288    /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
5289    /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
5290    /// and
5291    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
5292    /// for more details.
5293    ///
5294    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5295    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5296    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
5297    /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
5298    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
5299    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5300    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5301    #[deprecated]
5302    pub indexable: std::option::Option<bool>,
5303
5304    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5305}
5306
5307impl CustomAttribute {
5308    pub fn new() -> Self {
5309        std::default::Default::default()
5310    }
5311
5312    /// Sets the value of [text][crate::model::CustomAttribute::text].
5313    ///
5314    /// # Example
5315    /// ```ignore,no_run
5316    /// # use google_cloud_retail_v2::model::CustomAttribute;
5317    /// let x = CustomAttribute::new().set_text(["a", "b", "c"]);
5318    /// ```
5319    pub fn set_text<T, V>(mut self, v: T) -> Self
5320    where
5321        T: std::iter::IntoIterator<Item = V>,
5322        V: std::convert::Into<std::string::String>,
5323    {
5324        use std::iter::Iterator;
5325        self.text = v.into_iter().map(|i| i.into()).collect();
5326        self
5327    }
5328
5329    /// Sets the value of [numbers][crate::model::CustomAttribute::numbers].
5330    ///
5331    /// # Example
5332    /// ```ignore,no_run
5333    /// # use google_cloud_retail_v2::model::CustomAttribute;
5334    /// let x = CustomAttribute::new().set_numbers([1.0, 2.0, 3.0]);
5335    /// ```
5336    pub fn set_numbers<T, V>(mut self, v: T) -> Self
5337    where
5338        T: std::iter::IntoIterator<Item = V>,
5339        V: std::convert::Into<f64>,
5340    {
5341        use std::iter::Iterator;
5342        self.numbers = v.into_iter().map(|i| i.into()).collect();
5343        self
5344    }
5345
5346    /// Sets the value of [searchable][crate::model::CustomAttribute::searchable].
5347    ///
5348    /// # Example
5349    /// ```ignore,no_run
5350    /// # use google_cloud_retail_v2::model::CustomAttribute;
5351    /// let x = CustomAttribute::new().set_searchable(true);
5352    /// ```
5353    #[deprecated]
5354    pub fn set_searchable<T>(mut self, v: T) -> Self
5355    where
5356        T: std::convert::Into<bool>,
5357    {
5358        self.searchable = std::option::Option::Some(v.into());
5359        self
5360    }
5361
5362    /// Sets or clears the value of [searchable][crate::model::CustomAttribute::searchable].
5363    ///
5364    /// # Example
5365    /// ```ignore,no_run
5366    /// # use google_cloud_retail_v2::model::CustomAttribute;
5367    /// let x = CustomAttribute::new().set_or_clear_searchable(Some(false));
5368    /// let x = CustomAttribute::new().set_or_clear_searchable(None::<bool>);
5369    /// ```
5370    #[deprecated]
5371    pub fn set_or_clear_searchable<T>(mut self, v: std::option::Option<T>) -> Self
5372    where
5373        T: std::convert::Into<bool>,
5374    {
5375        self.searchable = v.map(|x| x.into());
5376        self
5377    }
5378
5379    /// Sets the value of [indexable][crate::model::CustomAttribute::indexable].
5380    ///
5381    /// # Example
5382    /// ```ignore,no_run
5383    /// # use google_cloud_retail_v2::model::CustomAttribute;
5384    /// let x = CustomAttribute::new().set_indexable(true);
5385    /// ```
5386    #[deprecated]
5387    pub fn set_indexable<T>(mut self, v: T) -> Self
5388    where
5389        T: std::convert::Into<bool>,
5390    {
5391        self.indexable = std::option::Option::Some(v.into());
5392        self
5393    }
5394
5395    /// Sets or clears the value of [indexable][crate::model::CustomAttribute::indexable].
5396    ///
5397    /// # Example
5398    /// ```ignore,no_run
5399    /// # use google_cloud_retail_v2::model::CustomAttribute;
5400    /// let x = CustomAttribute::new().set_or_clear_indexable(Some(false));
5401    /// let x = CustomAttribute::new().set_or_clear_indexable(None::<bool>);
5402    /// ```
5403    #[deprecated]
5404    pub fn set_or_clear_indexable<T>(mut self, v: std::option::Option<T>) -> Self
5405    where
5406        T: std::convert::Into<bool>,
5407    {
5408        self.indexable = v.map(|x| x.into());
5409        self
5410    }
5411}
5412
5413impl wkt::message::Message for CustomAttribute {
5414    fn typename() -> &'static str {
5415        "type.googleapis.com/google.cloud.retail.v2.CustomAttribute"
5416    }
5417}
5418
5419/// Fulfillment information, such as the store IDs for in-store pickup or region
5420/// IDs for different shipping methods.
5421#[derive(Clone, Default, PartialEq)]
5422#[non_exhaustive]
5423pub struct FulfillmentInfo {
5424    /// The fulfillment type, including commonly used types (such as pickup in
5425    /// store and same day delivery), and custom types. Customers have to map
5426    /// custom types to their display names before rendering UI.
5427    ///
5428    /// Supported values:
5429    ///
5430    /// * "pickup-in-store"
5431    /// * "ship-to-store"
5432    /// * "same-day-delivery"
5433    /// * "next-day-delivery"
5434    /// * "custom-type-1"
5435    /// * "custom-type-2"
5436    /// * "custom-type-3"
5437    /// * "custom-type-4"
5438    /// * "custom-type-5"
5439    ///
5440    /// If this field is set to an invalid value other than these, an
5441    /// INVALID_ARGUMENT error is returned.
5442    pub r#type: std::string::String,
5443
5444    /// The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
5445    /// as the store IDs for
5446    /// [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
5447    /// or the region IDs for
5448    /// [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
5449    ///
5450    /// A maximum of 3000 values are allowed. Each value must be a string with a
5451    /// length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such
5452    /// as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is
5453    /// returned.
5454    ///
5455    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
5456    pub place_ids: std::vec::Vec<std::string::String>,
5457
5458    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5459}
5460
5461impl FulfillmentInfo {
5462    pub fn new() -> Self {
5463        std::default::Default::default()
5464    }
5465
5466    /// Sets the value of [r#type][crate::model::FulfillmentInfo::type].
5467    ///
5468    /// # Example
5469    /// ```ignore,no_run
5470    /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5471    /// let x = FulfillmentInfo::new().set_type("example");
5472    /// ```
5473    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5474        self.r#type = v.into();
5475        self
5476    }
5477
5478    /// Sets the value of [place_ids][crate::model::FulfillmentInfo::place_ids].
5479    ///
5480    /// # Example
5481    /// ```ignore,no_run
5482    /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5483    /// let x = FulfillmentInfo::new().set_place_ids(["a", "b", "c"]);
5484    /// ```
5485    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
5486    where
5487        T: std::iter::IntoIterator<Item = V>,
5488        V: std::convert::Into<std::string::String>,
5489    {
5490        use std::iter::Iterator;
5491        self.place_ids = v.into_iter().map(|i| i.into()).collect();
5492        self
5493    }
5494}
5495
5496impl wkt::message::Message for FulfillmentInfo {
5497    fn typename() -> &'static str {
5498        "type.googleapis.com/google.cloud.retail.v2.FulfillmentInfo"
5499    }
5500}
5501
5502/// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
5503/// Retail Search use product images to improve prediction and search results.
5504/// Product images can be returned in results, and are shown in prediction or
5505/// search previews in the console. Please try to provide correct product images
5506/// and avoid using images with size too small.
5507///
5508/// [google.cloud.retail.v2.Product]: crate::model::Product
5509#[derive(Clone, Default, PartialEq)]
5510#[non_exhaustive]
5511pub struct Image {
5512    /// Required. URI of the image.
5513    ///
5514    /// This field must be a valid UTF-8 encoded URI with a length limit of 5,000
5515    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
5516    ///
5517    /// Google Merchant Center property
5518    /// [image_link](https://support.google.com/merchants/answer/6324350).
5519    /// Schema.org property [Product.image](https://schema.org/image).
5520    pub uri: std::string::String,
5521
5522    /// Height of the image in number of pixels.
5523    ///
5524    /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5525    /// returned.
5526    pub height: i32,
5527
5528    /// Width of the image in number of pixels.
5529    ///
5530    /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5531    /// returned.
5532    pub width: i32,
5533
5534    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5535}
5536
5537impl Image {
5538    pub fn new() -> Self {
5539        std::default::Default::default()
5540    }
5541
5542    /// Sets the value of [uri][crate::model::Image::uri].
5543    ///
5544    /// # Example
5545    /// ```ignore,no_run
5546    /// # use google_cloud_retail_v2::model::Image;
5547    /// let x = Image::new().set_uri("example");
5548    /// ```
5549    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5550        self.uri = v.into();
5551        self
5552    }
5553
5554    /// Sets the value of [height][crate::model::Image::height].
5555    ///
5556    /// # Example
5557    /// ```ignore,no_run
5558    /// # use google_cloud_retail_v2::model::Image;
5559    /// let x = Image::new().set_height(42);
5560    /// ```
5561    pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5562        self.height = v.into();
5563        self
5564    }
5565
5566    /// Sets the value of [width][crate::model::Image::width].
5567    ///
5568    /// # Example
5569    /// ```ignore,no_run
5570    /// # use google_cloud_retail_v2::model::Image;
5571    /// let x = Image::new().set_width(42);
5572    /// ```
5573    pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5574        self.width = v.into();
5575        self
5576    }
5577}
5578
5579impl wkt::message::Message for Image {
5580    fn typename() -> &'static str {
5581        "type.googleapis.com/google.cloud.retail.v2.Image"
5582    }
5583}
5584
5585/// A floating point interval.
5586#[derive(Clone, Default, PartialEq)]
5587#[non_exhaustive]
5588pub struct Interval {
5589    /// The lower bound of the interval. If neither of the min fields are set, then
5590    /// the lower bound is negative infinity.
5591    ///
5592    /// This field must not be larger than max.
5593    /// Otherwise, an INVALID_ARGUMENT error is returned.
5594    pub min: std::option::Option<crate::model::interval::Min>,
5595
5596    /// The upper bound of the interval. If neither of the max fields are set, then
5597    /// the upper bound is positive infinity.
5598    ///
5599    /// This field must be not smaller than min.
5600    /// Otherwise, an INVALID_ARGUMENT error is returned.
5601    pub max: std::option::Option<crate::model::interval::Max>,
5602
5603    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5604}
5605
5606impl Interval {
5607    pub fn new() -> Self {
5608        std::default::Default::default()
5609    }
5610
5611    /// Sets the value of [min][crate::model::Interval::min].
5612    ///
5613    /// Note that all the setters affecting `min` are mutually
5614    /// exclusive.
5615    ///
5616    /// # Example
5617    /// ```ignore,no_run
5618    /// # use google_cloud_retail_v2::model::Interval;
5619    /// use google_cloud_retail_v2::model::interval::Min;
5620    /// let x = Interval::new().set_min(Some(Min::Minimum(42.0)));
5621    /// ```
5622    pub fn set_min<T: std::convert::Into<std::option::Option<crate::model::interval::Min>>>(
5623        mut self,
5624        v: T,
5625    ) -> Self {
5626        self.min = v.into();
5627        self
5628    }
5629
5630    /// The value of [min][crate::model::Interval::min]
5631    /// if it holds a `Minimum`, `None` if the field is not set or
5632    /// holds a different branch.
5633    pub fn minimum(&self) -> std::option::Option<&f64> {
5634        #[allow(unreachable_patterns)]
5635        self.min.as_ref().and_then(|v| match v {
5636            crate::model::interval::Min::Minimum(v) => std::option::Option::Some(v),
5637            _ => std::option::Option::None,
5638        })
5639    }
5640
5641    /// Sets the value of [min][crate::model::Interval::min]
5642    /// to hold a `Minimum`.
5643    ///
5644    /// Note that all the setters affecting `min` are
5645    /// mutually exclusive.
5646    ///
5647    /// # Example
5648    /// ```ignore,no_run
5649    /// # use google_cloud_retail_v2::model::Interval;
5650    /// let x = Interval::new().set_minimum(42.0);
5651    /// assert!(x.minimum().is_some());
5652    /// assert!(x.exclusive_minimum().is_none());
5653    /// ```
5654    pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5655        self.min = std::option::Option::Some(crate::model::interval::Min::Minimum(v.into()));
5656        self
5657    }
5658
5659    /// The value of [min][crate::model::Interval::min]
5660    /// if it holds a `ExclusiveMinimum`, `None` if the field is not set or
5661    /// holds a different branch.
5662    pub fn exclusive_minimum(&self) -> std::option::Option<&f64> {
5663        #[allow(unreachable_patterns)]
5664        self.min.as_ref().and_then(|v| match v {
5665            crate::model::interval::Min::ExclusiveMinimum(v) => std::option::Option::Some(v),
5666            _ => std::option::Option::None,
5667        })
5668    }
5669
5670    /// Sets the value of [min][crate::model::Interval::min]
5671    /// to hold a `ExclusiveMinimum`.
5672    ///
5673    /// Note that all the setters affecting `min` are
5674    /// mutually exclusive.
5675    ///
5676    /// # Example
5677    /// ```ignore,no_run
5678    /// # use google_cloud_retail_v2::model::Interval;
5679    /// let x = Interval::new().set_exclusive_minimum(42.0);
5680    /// assert!(x.exclusive_minimum().is_some());
5681    /// assert!(x.minimum().is_none());
5682    /// ```
5683    pub fn set_exclusive_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5684        self.min =
5685            std::option::Option::Some(crate::model::interval::Min::ExclusiveMinimum(v.into()));
5686        self
5687    }
5688
5689    /// Sets the value of [max][crate::model::Interval::max].
5690    ///
5691    /// Note that all the setters affecting `max` are mutually
5692    /// exclusive.
5693    ///
5694    /// # Example
5695    /// ```ignore,no_run
5696    /// # use google_cloud_retail_v2::model::Interval;
5697    /// use google_cloud_retail_v2::model::interval::Max;
5698    /// let x = Interval::new().set_max(Some(Max::Maximum(42.0)));
5699    /// ```
5700    pub fn set_max<T: std::convert::Into<std::option::Option<crate::model::interval::Max>>>(
5701        mut self,
5702        v: T,
5703    ) -> Self {
5704        self.max = v.into();
5705        self
5706    }
5707
5708    /// The value of [max][crate::model::Interval::max]
5709    /// if it holds a `Maximum`, `None` if the field is not set or
5710    /// holds a different branch.
5711    pub fn maximum(&self) -> std::option::Option<&f64> {
5712        #[allow(unreachable_patterns)]
5713        self.max.as_ref().and_then(|v| match v {
5714            crate::model::interval::Max::Maximum(v) => std::option::Option::Some(v),
5715            _ => std::option::Option::None,
5716        })
5717    }
5718
5719    /// Sets the value of [max][crate::model::Interval::max]
5720    /// to hold a `Maximum`.
5721    ///
5722    /// Note that all the setters affecting `max` are
5723    /// mutually exclusive.
5724    ///
5725    /// # Example
5726    /// ```ignore,no_run
5727    /// # use google_cloud_retail_v2::model::Interval;
5728    /// let x = Interval::new().set_maximum(42.0);
5729    /// assert!(x.maximum().is_some());
5730    /// assert!(x.exclusive_maximum().is_none());
5731    /// ```
5732    pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5733        self.max = std::option::Option::Some(crate::model::interval::Max::Maximum(v.into()));
5734        self
5735    }
5736
5737    /// The value of [max][crate::model::Interval::max]
5738    /// if it holds a `ExclusiveMaximum`, `None` if the field is not set or
5739    /// holds a different branch.
5740    pub fn exclusive_maximum(&self) -> std::option::Option<&f64> {
5741        #[allow(unreachable_patterns)]
5742        self.max.as_ref().and_then(|v| match v {
5743            crate::model::interval::Max::ExclusiveMaximum(v) => std::option::Option::Some(v),
5744            _ => std::option::Option::None,
5745        })
5746    }
5747
5748    /// Sets the value of [max][crate::model::Interval::max]
5749    /// to hold a `ExclusiveMaximum`.
5750    ///
5751    /// Note that all the setters affecting `max` are
5752    /// mutually exclusive.
5753    ///
5754    /// # Example
5755    /// ```ignore,no_run
5756    /// # use google_cloud_retail_v2::model::Interval;
5757    /// let x = Interval::new().set_exclusive_maximum(42.0);
5758    /// assert!(x.exclusive_maximum().is_some());
5759    /// assert!(x.maximum().is_none());
5760    /// ```
5761    pub fn set_exclusive_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5762        self.max =
5763            std::option::Option::Some(crate::model::interval::Max::ExclusiveMaximum(v.into()));
5764        self
5765    }
5766}
5767
5768impl wkt::message::Message for Interval {
5769    fn typename() -> &'static str {
5770        "type.googleapis.com/google.cloud.retail.v2.Interval"
5771    }
5772}
5773
5774/// Defines additional types related to [Interval].
5775pub mod interval {
5776    #[allow(unused_imports)]
5777    use super::*;
5778
5779    /// The lower bound of the interval. If neither of the min fields are set, then
5780    /// the lower bound is negative infinity.
5781    ///
5782    /// This field must not be larger than max.
5783    /// Otherwise, an INVALID_ARGUMENT error is returned.
5784    #[derive(Clone, Debug, PartialEq)]
5785    #[non_exhaustive]
5786    pub enum Min {
5787        /// Inclusive lower bound.
5788        Minimum(f64),
5789        /// Exclusive lower bound.
5790        ExclusiveMinimum(f64),
5791    }
5792
5793    /// The upper bound of the interval. If neither of the max fields are set, then
5794    /// the upper bound is positive infinity.
5795    ///
5796    /// This field must be not smaller than min.
5797    /// Otherwise, an INVALID_ARGUMENT error is returned.
5798    #[derive(Clone, Debug, PartialEq)]
5799    #[non_exhaustive]
5800    pub enum Max {
5801        /// Inclusive upper bound.
5802        Maximum(f64),
5803        /// Exclusive upper bound.
5804        ExclusiveMaximum(f64),
5805    }
5806}
5807
5808/// The price information of a [Product][google.cloud.retail.v2.Product].
5809///
5810/// [google.cloud.retail.v2.Product]: crate::model::Product
5811#[derive(Clone, Default, PartialEq)]
5812#[non_exhaustive]
5813pub struct PriceInfo {
5814    /// The 3-letter currency code defined in [ISO
5815    /// 4217](https://www.iso.org/iso-4217-currency-codes.html).
5816    ///
5817    /// If this field is an unrecognizable currency code, an INVALID_ARGUMENT
5818    /// error is returned.
5819    ///
5820    /// The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5821    /// [Product][google.cloud.retail.v2.Product]s with the same
5822    /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
5823    /// must share the same
5824    /// [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
5825    /// a FAILED_PRECONDITION error is returned.
5826    ///
5827    /// [google.cloud.retail.v2.PriceInfo.currency_code]: crate::model::PriceInfo::currency_code
5828    /// [google.cloud.retail.v2.Product]: crate::model::Product
5829    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5830    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
5831    pub currency_code: std::string::String,
5832
5833    /// Price of the product.
5834    ///
5835    /// Google Merchant Center property
5836    /// [price](https://support.google.com/merchants/answer/6324371). Schema.org
5837    /// property [Offer.price](https://schema.org/price).
5838    pub price: f32,
5839
5840    /// Price of the product without any discount. If zero, by default set to be
5841    /// the [price][google.cloud.retail.v2.PriceInfo.price]. If set,
5842    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be
5843    /// greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price],
5844    /// otherwise an INVALID_ARGUMENT error is thrown.
5845    ///
5846    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5847    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5848    pub original_price: f32,
5849
5850    /// The costs associated with the sale of a particular product. Used for gross
5851    /// profit reporting.
5852    ///
5853    /// * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
5854    ///   [cost][google.cloud.retail.v2.PriceInfo.cost]
5855    ///
5856    /// Google Merchant Center property
5857    /// [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
5858    ///
5859    /// [google.cloud.retail.v2.PriceInfo.cost]: crate::model::PriceInfo::cost
5860    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5861    pub cost: f32,
5862
5863    /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5864    /// starts to be effective. This can be set as a future timestamp, and the
5865    /// [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
5866    /// after
5867    /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5868    /// If so, the
5869    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5870    /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5871    /// is used before
5872    /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5873    ///
5874    /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5875    /// effective because it will cause additional latency during search.
5876    ///
5877    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5878    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5879    /// [google.cloud.retail.v2.PriceInfo.price_effective_time]: crate::model::PriceInfo::price_effective_time
5880    pub price_effective_time: std::option::Option<wkt::Timestamp>,
5881
5882    /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5883    /// stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
5884    /// is used for search before
5885    /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
5886    /// this field is set, the
5887    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5888    /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5889    /// is used after
5890    /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
5891    ///
5892    /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5893    /// effective because it will cause additional latency during search.
5894    ///
5895    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5896    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5897    /// [google.cloud.retail.v2.PriceInfo.price_expire_time]: crate::model::PriceInfo::price_expire_time
5898    pub price_expire_time: std::option::Option<wkt::Timestamp>,
5899
5900    /// Output only. The price range of all the child
5901    /// [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5902    /// [Product][google.cloud.retail.v2.Product]s grouped together on the
5903    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5904    /// [Product][google.cloud.retail.v2.Product]. Only populated for
5905    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5906    /// [Product][google.cloud.retail.v2.Product]s.
5907    ///
5908    /// Note: This field is OUTPUT_ONLY for
5909    /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
5910    /// Do not set this field in API requests.
5911    ///
5912    /// [google.cloud.retail.v2.Product]: crate::model::Product
5913    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
5914    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5915    /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
5916    pub price_range: std::option::Option<crate::model::price_info::PriceRange>,
5917
5918    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5919}
5920
5921impl PriceInfo {
5922    pub fn new() -> Self {
5923        std::default::Default::default()
5924    }
5925
5926    /// Sets the value of [currency_code][crate::model::PriceInfo::currency_code].
5927    ///
5928    /// # Example
5929    /// ```ignore,no_run
5930    /// # use google_cloud_retail_v2::model::PriceInfo;
5931    /// let x = PriceInfo::new().set_currency_code("example");
5932    /// ```
5933    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5934        self.currency_code = v.into();
5935        self
5936    }
5937
5938    /// Sets the value of [price][crate::model::PriceInfo::price].
5939    ///
5940    /// # Example
5941    /// ```ignore,no_run
5942    /// # use google_cloud_retail_v2::model::PriceInfo;
5943    /// let x = PriceInfo::new().set_price(42.0);
5944    /// ```
5945    pub fn set_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5946        self.price = v.into();
5947        self
5948    }
5949
5950    /// Sets the value of [original_price][crate::model::PriceInfo::original_price].
5951    ///
5952    /// # Example
5953    /// ```ignore,no_run
5954    /// # use google_cloud_retail_v2::model::PriceInfo;
5955    /// let x = PriceInfo::new().set_original_price(42.0);
5956    /// ```
5957    pub fn set_original_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5958        self.original_price = v.into();
5959        self
5960    }
5961
5962    /// Sets the value of [cost][crate::model::PriceInfo::cost].
5963    ///
5964    /// # Example
5965    /// ```ignore,no_run
5966    /// # use google_cloud_retail_v2::model::PriceInfo;
5967    /// let x = PriceInfo::new().set_cost(42.0);
5968    /// ```
5969    pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5970        self.cost = v.into();
5971        self
5972    }
5973
5974    /// Sets the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
5975    ///
5976    /// # Example
5977    /// ```ignore,no_run
5978    /// # use google_cloud_retail_v2::model::PriceInfo;
5979    /// use wkt::Timestamp;
5980    /// let x = PriceInfo::new().set_price_effective_time(Timestamp::default()/* use setters */);
5981    /// ```
5982    pub fn set_price_effective_time<T>(mut self, v: T) -> Self
5983    where
5984        T: std::convert::Into<wkt::Timestamp>,
5985    {
5986        self.price_effective_time = std::option::Option::Some(v.into());
5987        self
5988    }
5989
5990    /// Sets or clears the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
5991    ///
5992    /// # Example
5993    /// ```ignore,no_run
5994    /// # use google_cloud_retail_v2::model::PriceInfo;
5995    /// use wkt::Timestamp;
5996    /// let x = PriceInfo::new().set_or_clear_price_effective_time(Some(Timestamp::default()/* use setters */));
5997    /// let x = PriceInfo::new().set_or_clear_price_effective_time(None::<Timestamp>);
5998    /// ```
5999    pub fn set_or_clear_price_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6000    where
6001        T: std::convert::Into<wkt::Timestamp>,
6002    {
6003        self.price_effective_time = v.map(|x| x.into());
6004        self
6005    }
6006
6007    /// Sets the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6008    ///
6009    /// # Example
6010    /// ```ignore,no_run
6011    /// # use google_cloud_retail_v2::model::PriceInfo;
6012    /// use wkt::Timestamp;
6013    /// let x = PriceInfo::new().set_price_expire_time(Timestamp::default()/* use setters */);
6014    /// ```
6015    pub fn set_price_expire_time<T>(mut self, v: T) -> Self
6016    where
6017        T: std::convert::Into<wkt::Timestamp>,
6018    {
6019        self.price_expire_time = std::option::Option::Some(v.into());
6020        self
6021    }
6022
6023    /// Sets or clears the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6024    ///
6025    /// # Example
6026    /// ```ignore,no_run
6027    /// # use google_cloud_retail_v2::model::PriceInfo;
6028    /// use wkt::Timestamp;
6029    /// let x = PriceInfo::new().set_or_clear_price_expire_time(Some(Timestamp::default()/* use setters */));
6030    /// let x = PriceInfo::new().set_or_clear_price_expire_time(None::<Timestamp>);
6031    /// ```
6032    pub fn set_or_clear_price_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
6033    where
6034        T: std::convert::Into<wkt::Timestamp>,
6035    {
6036        self.price_expire_time = v.map(|x| x.into());
6037        self
6038    }
6039
6040    /// Sets the value of [price_range][crate::model::PriceInfo::price_range].
6041    ///
6042    /// # Example
6043    /// ```ignore,no_run
6044    /// # use google_cloud_retail_v2::model::PriceInfo;
6045    /// use google_cloud_retail_v2::model::price_info::PriceRange;
6046    /// let x = PriceInfo::new().set_price_range(PriceRange::default()/* use setters */);
6047    /// ```
6048    pub fn set_price_range<T>(mut self, v: T) -> Self
6049    where
6050        T: std::convert::Into<crate::model::price_info::PriceRange>,
6051    {
6052        self.price_range = std::option::Option::Some(v.into());
6053        self
6054    }
6055
6056    /// Sets or clears the value of [price_range][crate::model::PriceInfo::price_range].
6057    ///
6058    /// # Example
6059    /// ```ignore,no_run
6060    /// # use google_cloud_retail_v2::model::PriceInfo;
6061    /// use google_cloud_retail_v2::model::price_info::PriceRange;
6062    /// let x = PriceInfo::new().set_or_clear_price_range(Some(PriceRange::default()/* use setters */));
6063    /// let x = PriceInfo::new().set_or_clear_price_range(None::<PriceRange>);
6064    /// ```
6065    pub fn set_or_clear_price_range<T>(mut self, v: std::option::Option<T>) -> Self
6066    where
6067        T: std::convert::Into<crate::model::price_info::PriceRange>,
6068    {
6069        self.price_range = v.map(|x| x.into());
6070        self
6071    }
6072}
6073
6074impl wkt::message::Message for PriceInfo {
6075    fn typename() -> &'static str {
6076        "type.googleapis.com/google.cloud.retail.v2.PriceInfo"
6077    }
6078}
6079
6080/// Defines additional types related to [PriceInfo].
6081pub mod price_info {
6082    #[allow(unused_imports)]
6083    use super::*;
6084
6085    /// The price range of all
6086    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6087    /// [Product][google.cloud.retail.v2.Product] having the same
6088    /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6089    ///
6090    /// [google.cloud.retail.v2.Product]: crate::model::Product
6091    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6092    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6093    #[derive(Clone, Default, PartialEq)]
6094    #[non_exhaustive]
6095    pub struct PriceRange {
6096        /// The inclusive
6097        /// [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
6098        /// interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6099        /// [Product][google.cloud.retail.v2.Product] having the same
6100        /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6101        ///
6102        /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
6103        /// [google.cloud.retail.v2.Product]: crate::model::Product
6104        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6105        /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6106        pub price: std::option::Option<crate::model::Interval>,
6107
6108        /// The inclusive
6109        /// [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
6110        /// internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6111        /// [Product][google.cloud.retail.v2.Product] having the same
6112        /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6113        ///
6114        /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
6115        /// [google.cloud.retail.v2.Product]: crate::model::Product
6116        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6117        /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6118        pub original_price: std::option::Option<crate::model::Interval>,
6119
6120        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6121    }
6122
6123    impl PriceRange {
6124        pub fn new() -> Self {
6125            std::default::Default::default()
6126        }
6127
6128        /// Sets the value of [price][crate::model::price_info::PriceRange::price].
6129        ///
6130        /// # Example
6131        /// ```ignore,no_run
6132        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6133        /// use google_cloud_retail_v2::model::Interval;
6134        /// let x = PriceRange::new().set_price(Interval::default()/* use setters */);
6135        /// ```
6136        pub fn set_price<T>(mut self, v: T) -> Self
6137        where
6138            T: std::convert::Into<crate::model::Interval>,
6139        {
6140            self.price = std::option::Option::Some(v.into());
6141            self
6142        }
6143
6144        /// Sets or clears the value of [price][crate::model::price_info::PriceRange::price].
6145        ///
6146        /// # Example
6147        /// ```ignore,no_run
6148        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6149        /// use google_cloud_retail_v2::model::Interval;
6150        /// let x = PriceRange::new().set_or_clear_price(Some(Interval::default()/* use setters */));
6151        /// let x = PriceRange::new().set_or_clear_price(None::<Interval>);
6152        /// ```
6153        pub fn set_or_clear_price<T>(mut self, v: std::option::Option<T>) -> Self
6154        where
6155            T: std::convert::Into<crate::model::Interval>,
6156        {
6157            self.price = v.map(|x| x.into());
6158            self
6159        }
6160
6161        /// Sets the value of [original_price][crate::model::price_info::PriceRange::original_price].
6162        ///
6163        /// # Example
6164        /// ```ignore,no_run
6165        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6166        /// use google_cloud_retail_v2::model::Interval;
6167        /// let x = PriceRange::new().set_original_price(Interval::default()/* use setters */);
6168        /// ```
6169        pub fn set_original_price<T>(mut self, v: T) -> Self
6170        where
6171            T: std::convert::Into<crate::model::Interval>,
6172        {
6173            self.original_price = std::option::Option::Some(v.into());
6174            self
6175        }
6176
6177        /// Sets or clears the value of [original_price][crate::model::price_info::PriceRange::original_price].
6178        ///
6179        /// # Example
6180        /// ```ignore,no_run
6181        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6182        /// use google_cloud_retail_v2::model::Interval;
6183        /// let x = PriceRange::new().set_or_clear_original_price(Some(Interval::default()/* use setters */));
6184        /// let x = PriceRange::new().set_or_clear_original_price(None::<Interval>);
6185        /// ```
6186        pub fn set_or_clear_original_price<T>(mut self, v: std::option::Option<T>) -> Self
6187        where
6188            T: std::convert::Into<crate::model::Interval>,
6189        {
6190            self.original_price = v.map(|x| x.into());
6191            self
6192        }
6193    }
6194
6195    impl wkt::message::Message for PriceRange {
6196        fn typename() -> &'static str {
6197            "type.googleapis.com/google.cloud.retail.v2.PriceInfo.PriceRange"
6198        }
6199    }
6200}
6201
6202/// The rating of a [Product][google.cloud.retail.v2.Product].
6203///
6204/// [google.cloud.retail.v2.Product]: crate::model::Product
6205#[derive(Clone, Default, PartialEq)]
6206#[non_exhaustive]
6207pub struct Rating {
6208    /// The total number of ratings. This value is independent of the value of
6209    /// [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
6210    ///
6211    /// This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
6212    /// returned.
6213    ///
6214    /// [google.cloud.retail.v2.Rating.rating_histogram]: crate::model::Rating::rating_histogram
6215    pub rating_count: i32,
6216
6217    /// The average rating of the [Product][google.cloud.retail.v2.Product].
6218    ///
6219    /// The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
6220    /// returned.
6221    ///
6222    /// [google.cloud.retail.v2.Product]: crate::model::Product
6223    pub average_rating: f32,
6224
6225    /// List of rating counts per rating value (index = rating - 1). The list is
6226    /// empty if there is no rating. If the list is non-empty, its size is
6227    /// always 5. Otherwise, an INVALID_ARGUMENT error is returned.
6228    ///
6229    /// For example, [41, 14, 13, 47, 303]. It means that the
6230    /// [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
6231    /// ratings with 2 star, and so on.
6232    ///
6233    /// [google.cloud.retail.v2.Product]: crate::model::Product
6234    pub rating_histogram: std::vec::Vec<i32>,
6235
6236    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6237}
6238
6239impl Rating {
6240    pub fn new() -> Self {
6241        std::default::Default::default()
6242    }
6243
6244    /// Sets the value of [rating_count][crate::model::Rating::rating_count].
6245    ///
6246    /// # Example
6247    /// ```ignore,no_run
6248    /// # use google_cloud_retail_v2::model::Rating;
6249    /// let x = Rating::new().set_rating_count(42);
6250    /// ```
6251    pub fn set_rating_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6252        self.rating_count = v.into();
6253        self
6254    }
6255
6256    /// Sets the value of [average_rating][crate::model::Rating::average_rating].
6257    ///
6258    /// # Example
6259    /// ```ignore,no_run
6260    /// # use google_cloud_retail_v2::model::Rating;
6261    /// let x = Rating::new().set_average_rating(42.0);
6262    /// ```
6263    pub fn set_average_rating<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6264        self.average_rating = v.into();
6265        self
6266    }
6267
6268    /// Sets the value of [rating_histogram][crate::model::Rating::rating_histogram].
6269    ///
6270    /// # Example
6271    /// ```ignore,no_run
6272    /// # use google_cloud_retail_v2::model::Rating;
6273    /// let x = Rating::new().set_rating_histogram([1, 2, 3]);
6274    /// ```
6275    pub fn set_rating_histogram<T, V>(mut self, v: T) -> Self
6276    where
6277        T: std::iter::IntoIterator<Item = V>,
6278        V: std::convert::Into<i32>,
6279    {
6280        use std::iter::Iterator;
6281        self.rating_histogram = v.into_iter().map(|i| i.into()).collect();
6282        self
6283    }
6284}
6285
6286impl wkt::message::Message for Rating {
6287    fn typename() -> &'static str {
6288        "type.googleapis.com/google.cloud.retail.v2.Rating"
6289    }
6290}
6291
6292/// Information of an end user.
6293#[derive(Clone, Default, PartialEq)]
6294#[non_exhaustive]
6295pub struct UserInfo {
6296    /// Highly recommended for logged-in users. Unique identifier for logged-in
6297    /// user, such as a user name. Don't set for anonymous users.
6298    ///
6299    /// Always use a hashed value for this ID.
6300    ///
6301    /// Don't set the field to the same fixed ID for different users. This mixes
6302    /// the event history of those users together, which results in degraded
6303    /// model quality.
6304    ///
6305    /// The field must be a UTF-8 encoded string with a length limit of 128
6306    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6307    pub user_id: std::string::String,
6308
6309    /// The end user's IP address. This field is used to extract location
6310    /// information for personalization.
6311    ///
6312    /// This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
6313    /// address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
6314    /// INVALID_ARGUMENT error is returned.
6315    ///
6316    /// This should not be set when:
6317    ///
6318    /// * setting
6319    ///   [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
6320    /// * using the JavaScript tag in
6321    ///   [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6322    ///   or if
6323    ///   [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6324    ///   is set.
6325    ///
6326    /// [google.cloud.retail.v2.SearchRequest.user_info]: crate::model::SearchRequest::user_info
6327    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6328    /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6329    pub ip_address: std::string::String,
6330
6331    /// User agent as included in the HTTP header.
6332    /// The field must be a UTF-8 encoded string with a length limit of 1,000
6333    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6334    ///
6335    /// This should not be set when using the client side event reporting with
6336    /// GTM or JavaScript tag in
6337    /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6338    /// or if
6339    /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6340    /// is set.
6341    ///
6342    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6343    /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6344    pub user_agent: std::string::String,
6345
6346    /// True if the request is made directly from the end user, in which case the
6347    /// [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
6348    /// [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
6349    /// from the HTTP request. This flag should be set only if the API request is
6350    /// made directly from the end user such as a mobile app (and not if a gateway
6351    /// or a server is processing and pushing the user events).
6352    ///
6353    /// This should not be set when using the JavaScript tag in
6354    /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
6355    ///
6356    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6357    /// [google.cloud.retail.v2.UserInfo.ip_address]: crate::model::UserInfo::ip_address
6358    /// [google.cloud.retail.v2.UserInfo.user_agent]: crate::model::UserInfo::user_agent
6359    pub direct_user_request: bool,
6360
6361    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6362}
6363
6364impl UserInfo {
6365    pub fn new() -> Self {
6366        std::default::Default::default()
6367    }
6368
6369    /// Sets the value of [user_id][crate::model::UserInfo::user_id].
6370    ///
6371    /// # Example
6372    /// ```ignore,no_run
6373    /// # use google_cloud_retail_v2::model::UserInfo;
6374    /// let x = UserInfo::new().set_user_id("example");
6375    /// ```
6376    pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6377        self.user_id = v.into();
6378        self
6379    }
6380
6381    /// Sets the value of [ip_address][crate::model::UserInfo::ip_address].
6382    ///
6383    /// # Example
6384    /// ```ignore,no_run
6385    /// # use google_cloud_retail_v2::model::UserInfo;
6386    /// let x = UserInfo::new().set_ip_address("example");
6387    /// ```
6388    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6389        self.ip_address = v.into();
6390        self
6391    }
6392
6393    /// Sets the value of [user_agent][crate::model::UserInfo::user_agent].
6394    ///
6395    /// # Example
6396    /// ```ignore,no_run
6397    /// # use google_cloud_retail_v2::model::UserInfo;
6398    /// let x = UserInfo::new().set_user_agent("example");
6399    /// ```
6400    pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6401        self.user_agent = v.into();
6402        self
6403    }
6404
6405    /// Sets the value of [direct_user_request][crate::model::UserInfo::direct_user_request].
6406    ///
6407    /// # Example
6408    /// ```ignore,no_run
6409    /// # use google_cloud_retail_v2::model::UserInfo;
6410    /// let x = UserInfo::new().set_direct_user_request(true);
6411    /// ```
6412    pub fn set_direct_user_request<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6413        self.direct_user_request = v.into();
6414        self
6415    }
6416}
6417
6418impl wkt::message::Message for UserInfo {
6419    fn typename() -> &'static str {
6420        "type.googleapis.com/google.cloud.retail.v2.UserInfo"
6421    }
6422}
6423
6424/// The inventory information at a place (e.g. a store) identified
6425/// by a place ID.
6426#[derive(Clone, Default, PartialEq)]
6427#[non_exhaustive]
6428pub struct LocalInventory {
6429    /// Optional. The place ID for the current set of inventory information.
6430    pub place_id: std::string::String,
6431
6432    /// Optional. Product price and cost information.
6433    ///
6434    /// Google Merchant Center property
6435    /// [price](https://support.google.com/merchants/answer/6324371).
6436    pub price_info: std::option::Option<crate::model::PriceInfo>,
6437
6438    /// Optional. Additional local inventory attributes, for example, store name,
6439    /// promotion tags, etc.
6440    ///
6441    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
6442    /// error is returned:
6443    ///
6444    /// * At most 30 attributes are allowed.
6445    /// * The key must be a UTF-8 encoded string with a length limit of 32
6446    ///   characters.
6447    /// * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
6448    ///   key0LikeThis or KEY_1_LIKE_THIS.
6449    /// * The attribute values must be of the same type (text or number).
6450    /// * Only 1 value is allowed for each attribute.
6451    /// * For text values, the length limit is 256 UTF-8 characters.
6452    /// * The attribute does not support search. The `searchable` field should be
6453    ///   unset or set to false.
6454    /// * The max summed total bytes of custom attribute keys and values per
6455    ///   product is 5MiB.
6456    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
6457
6458    /// Optional. Supported fulfillment types. Valid fulfillment type values
6459    /// include commonly used types (such as pickup in store and same day
6460    /// delivery), and custom types. Customers have to map custom types to their
6461    /// display names before rendering UI.
6462    ///
6463    /// Supported values:
6464    ///
6465    /// * "pickup-in-store"
6466    /// * "ship-to-store"
6467    /// * "same-day-delivery"
6468    /// * "next-day-delivery"
6469    /// * "custom-type-1"
6470    /// * "custom-type-2"
6471    /// * "custom-type-3"
6472    /// * "custom-type-4"
6473    /// * "custom-type-5"
6474    ///
6475    /// If this field is set to an invalid value other than these, an
6476    /// INVALID_ARGUMENT error is returned.
6477    ///
6478    /// All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
6479    /// returned.
6480    pub fulfillment_types: std::vec::Vec<std::string::String>,
6481
6482    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6483}
6484
6485impl LocalInventory {
6486    pub fn new() -> Self {
6487        std::default::Default::default()
6488    }
6489
6490    /// Sets the value of [place_id][crate::model::LocalInventory::place_id].
6491    ///
6492    /// # Example
6493    /// ```ignore,no_run
6494    /// # use google_cloud_retail_v2::model::LocalInventory;
6495    /// let x = LocalInventory::new().set_place_id("example");
6496    /// ```
6497    pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6498        self.place_id = v.into();
6499        self
6500    }
6501
6502    /// Sets the value of [price_info][crate::model::LocalInventory::price_info].
6503    ///
6504    /// # Example
6505    /// ```ignore,no_run
6506    /// # use google_cloud_retail_v2::model::LocalInventory;
6507    /// use google_cloud_retail_v2::model::PriceInfo;
6508    /// let x = LocalInventory::new().set_price_info(PriceInfo::default()/* use setters */);
6509    /// ```
6510    pub fn set_price_info<T>(mut self, v: T) -> Self
6511    where
6512        T: std::convert::Into<crate::model::PriceInfo>,
6513    {
6514        self.price_info = std::option::Option::Some(v.into());
6515        self
6516    }
6517
6518    /// Sets or clears the value of [price_info][crate::model::LocalInventory::price_info].
6519    ///
6520    /// # Example
6521    /// ```ignore,no_run
6522    /// # use google_cloud_retail_v2::model::LocalInventory;
6523    /// use google_cloud_retail_v2::model::PriceInfo;
6524    /// let x = LocalInventory::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
6525    /// let x = LocalInventory::new().set_or_clear_price_info(None::<PriceInfo>);
6526    /// ```
6527    pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
6528    where
6529        T: std::convert::Into<crate::model::PriceInfo>,
6530    {
6531        self.price_info = v.map(|x| x.into());
6532        self
6533    }
6534
6535    /// Sets the value of [attributes][crate::model::LocalInventory::attributes].
6536    ///
6537    /// # Example
6538    /// ```ignore,no_run
6539    /// # use google_cloud_retail_v2::model::LocalInventory;
6540    /// use google_cloud_retail_v2::model::CustomAttribute;
6541    /// let x = LocalInventory::new().set_attributes([
6542    ///     ("key0", CustomAttribute::default()/* use setters */),
6543    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
6544    /// ]);
6545    /// ```
6546    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6547    where
6548        T: std::iter::IntoIterator<Item = (K, V)>,
6549        K: std::convert::Into<std::string::String>,
6550        V: std::convert::Into<crate::model::CustomAttribute>,
6551    {
6552        use std::iter::Iterator;
6553        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6554        self
6555    }
6556
6557    /// Sets the value of [fulfillment_types][crate::model::LocalInventory::fulfillment_types].
6558    ///
6559    /// # Example
6560    /// ```ignore,no_run
6561    /// # use google_cloud_retail_v2::model::LocalInventory;
6562    /// let x = LocalInventory::new().set_fulfillment_types(["a", "b", "c"]);
6563    /// ```
6564    pub fn set_fulfillment_types<T, V>(mut self, v: T) -> Self
6565    where
6566        T: std::iter::IntoIterator<Item = V>,
6567        V: std::convert::Into<std::string::String>,
6568    {
6569        use std::iter::Iterator;
6570        self.fulfillment_types = v.into_iter().map(|i| i.into()).collect();
6571        self
6572    }
6573}
6574
6575impl wkt::message::Message for LocalInventory {
6576    fn typename() -> &'static str {
6577        "type.googleapis.com/google.cloud.retail.v2.LocalInventory"
6578    }
6579}
6580
6581/// Metadata for pinning to be returned in the response.
6582/// This is used for distinguishing between applied vs dropped pins.
6583#[derive(Clone, Default, PartialEq)]
6584#[non_exhaustive]
6585pub struct PinControlMetadata {
6586    /// Map of all matched pins, keyed by pin position.
6587    pub all_matched_pins:
6588        std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6589
6590    /// Map of pins that were dropped due to overlap with other matching pins,
6591    /// keyed by pin position.
6592    pub dropped_pins:
6593        std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6594
6595    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6596}
6597
6598impl PinControlMetadata {
6599    pub fn new() -> Self {
6600        std::default::Default::default()
6601    }
6602
6603    /// Sets the value of [all_matched_pins][crate::model::PinControlMetadata::all_matched_pins].
6604    ///
6605    /// # Example
6606    /// ```ignore,no_run
6607    /// # use google_cloud_retail_v2::model::PinControlMetadata;
6608    /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6609    /// let x = PinControlMetadata::new().set_all_matched_pins([
6610    ///     (0, ProductPins::default()/* use setters */),
6611    ///     (1, ProductPins::default()/* use (different) setters */),
6612    /// ]);
6613    /// ```
6614    pub fn set_all_matched_pins<T, K, V>(mut self, v: T) -> Self
6615    where
6616        T: std::iter::IntoIterator<Item = (K, V)>,
6617        K: std::convert::Into<i64>,
6618        V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6619    {
6620        use std::iter::Iterator;
6621        self.all_matched_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6622        self
6623    }
6624
6625    /// Sets the value of [dropped_pins][crate::model::PinControlMetadata::dropped_pins].
6626    ///
6627    /// # Example
6628    /// ```ignore,no_run
6629    /// # use google_cloud_retail_v2::model::PinControlMetadata;
6630    /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6631    /// let x = PinControlMetadata::new().set_dropped_pins([
6632    ///     (0, ProductPins::default()/* use setters */),
6633    ///     (1, ProductPins::default()/* use (different) setters */),
6634    /// ]);
6635    /// ```
6636    pub fn set_dropped_pins<T, K, V>(mut self, v: T) -> Self
6637    where
6638        T: std::iter::IntoIterator<Item = (K, V)>,
6639        K: std::convert::Into<i64>,
6640        V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6641    {
6642        use std::iter::Iterator;
6643        self.dropped_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6644        self
6645    }
6646}
6647
6648impl wkt::message::Message for PinControlMetadata {
6649    fn typename() -> &'static str {
6650        "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata"
6651    }
6652}
6653
6654/// Defines additional types related to [PinControlMetadata].
6655pub mod pin_control_metadata {
6656    #[allow(unused_imports)]
6657    use super::*;
6658
6659    /// List of product ids which have associated pins.
6660    #[derive(Clone, Default, PartialEq)]
6661    #[non_exhaustive]
6662    pub struct ProductPins {
6663        /// List of product ids which have associated pins.
6664        pub product_id: std::vec::Vec<std::string::String>,
6665
6666        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6667    }
6668
6669    impl ProductPins {
6670        pub fn new() -> Self {
6671            std::default::Default::default()
6672        }
6673
6674        /// Sets the value of [product_id][crate::model::pin_control_metadata::ProductPins::product_id].
6675        ///
6676        /// # Example
6677        /// ```ignore,no_run
6678        /// # use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6679        /// let x = ProductPins::new().set_product_id(["a", "b", "c"]);
6680        /// ```
6681        pub fn set_product_id<T, V>(mut self, v: T) -> Self
6682        where
6683            T: std::iter::IntoIterator<Item = V>,
6684            V: std::convert::Into<std::string::String>,
6685        {
6686            use std::iter::Iterator;
6687            self.product_id = v.into_iter().map(|i| i.into()).collect();
6688            self
6689        }
6690    }
6691
6692    impl wkt::message::Message for ProductPins {
6693        fn typename() -> &'static str {
6694            "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata.ProductPins"
6695        }
6696    }
6697}
6698
6699/// A list of string values.
6700#[derive(Clone, Default, PartialEq)]
6701#[non_exhaustive]
6702pub struct StringList {
6703    /// String values.
6704    pub values: std::vec::Vec<std::string::String>,
6705
6706    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6707}
6708
6709impl StringList {
6710    pub fn new() -> Self {
6711        std::default::Default::default()
6712    }
6713
6714    /// Sets the value of [values][crate::model::StringList::values].
6715    ///
6716    /// # Example
6717    /// ```ignore,no_run
6718    /// # use google_cloud_retail_v2::model::StringList;
6719    /// let x = StringList::new().set_values(["a", "b", "c"]);
6720    /// ```
6721    pub fn set_values<T, V>(mut self, v: T) -> Self
6722    where
6723        T: std::iter::IntoIterator<Item = V>,
6724        V: std::convert::Into<std::string::String>,
6725    {
6726        use std::iter::Iterator;
6727        self.values = v.into_iter().map(|i| i.into()).collect();
6728        self
6729    }
6730}
6731
6732impl wkt::message::Message for StringList {
6733    fn typename() -> &'static str {
6734        "type.googleapis.com/google.cloud.retail.v2.StringList"
6735    }
6736}
6737
6738/// A message with a list of double values.
6739#[derive(Clone, Default, PartialEq)]
6740#[non_exhaustive]
6741pub struct DoubleList {
6742    /// The list of double values.
6743    pub values: std::vec::Vec<f64>,
6744
6745    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6746}
6747
6748impl DoubleList {
6749    pub fn new() -> Self {
6750        std::default::Default::default()
6751    }
6752
6753    /// Sets the value of [values][crate::model::DoubleList::values].
6754    ///
6755    /// # Example
6756    /// ```ignore,no_run
6757    /// # use google_cloud_retail_v2::model::DoubleList;
6758    /// let x = DoubleList::new().set_values([1.0, 2.0, 3.0]);
6759    /// ```
6760    pub fn set_values<T, V>(mut self, v: T) -> Self
6761    where
6762        T: std::iter::IntoIterator<Item = V>,
6763        V: std::convert::Into<f64>,
6764    {
6765        use std::iter::Iterator;
6766        self.values = v.into_iter().map(|i| i.into()).collect();
6767        self
6768    }
6769}
6770
6771impl wkt::message::Message for DoubleList {
6772    fn typename() -> &'static str {
6773        "type.googleapis.com/google.cloud.retail.v2.DoubleList"
6774    }
6775}
6776
6777/// Autocomplete parameters.
6778#[derive(Clone, Default, PartialEq)]
6779#[non_exhaustive]
6780pub struct CompleteQueryRequest {
6781    /// Required. Catalog for which the completion is performed.
6782    ///
6783    /// Full resource name of catalog, such as
6784    /// `projects/*/locations/global/catalogs/default_catalog`.
6785    pub catalog: std::string::String,
6786
6787    /// Required. The query used to generate suggestions.
6788    ///
6789    /// The maximum number of allowed characters is 255.
6790    pub query: std::string::String,
6791
6792    /// Recommended field. A unique identifier for tracking visitors. For example,
6793    /// this could be implemented with an HTTP cookie, which should be able to
6794    /// uniquely identify a visitor on a single device. This unique identifier
6795    /// should not change if the visitor logs in or out of the website.
6796    ///
6797    /// The field must be a UTF-8 encoded string with a length limit of 128
6798    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6799    pub visitor_id: std::string::String,
6800
6801    /// Note that this field applies for `user-data` dataset only. For requests
6802    /// with `cloud-retail` dataset, setting this field has no effect.
6803    ///
6804    /// The language filters applied to the output suggestions. If set, it should
6805    /// contain the language of the query. If not set, suggestions are returned
6806    /// without considering language restrictions. This is the BCP-47 language
6807    /// code, such as "en-US" or "sr-Latn". For more information, see [Tags for
6808    /// Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum
6809    /// number of language codes is 3.
6810    pub language_codes: std::vec::Vec<std::string::String>,
6811
6812    /// The device type context for completion suggestions. We recommend that you
6813    /// leave this field empty.
6814    ///
6815    /// It can apply different suggestions on different device types, e.g.
6816    /// `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device
6817    /// types.
6818    ///
6819    /// Supported formats:
6820    ///
6821    /// * `UNKNOWN_DEVICE_TYPE`
6822    ///
6823    /// * `DESKTOP`
6824    ///
6825    /// * `MOBILE`
6826    ///
6827    /// * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`.
6828    ///
6829    pub device_type: std::string::String,
6830
6831    /// Determines which dataset to use for fetching completion. "user-data" will
6832    /// use the dataset imported through
6833    /// [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData].
6834    /// `cloud-retail` will use the dataset generated by Cloud Retail based on user
6835    /// events. If left empty, completions will be fetched from the `user-data`
6836    /// dataset.
6837    ///
6838    /// Current supported values:
6839    ///
6840    /// * user-data
6841    ///
6842    /// * cloud-retail:
6843    ///   This option requires enabling auto-learning function first. See
6844    ///   [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset).
6845    ///
6846    ///
6847    /// [google.cloud.retail.v2.CompletionService.ImportCompletionData]: crate::client::CompletionService::import_completion_data
6848    pub dataset: std::string::String,
6849
6850    /// Completion max suggestions. If left unset or set to 0, then will fallback
6851    /// to the configured value
6852    /// [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
6853    ///
6854    /// The maximum allowed max suggestions is 20. If it is set higher, it will be
6855    /// capped by 20.
6856    ///
6857    /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
6858    pub max_suggestions: i32,
6859
6860    /// If true, attribute suggestions are enabled and provided in the response.
6861    ///
6862    /// This field is only available for the `cloud-retail` dataset.
6863    pub enable_attribute_suggestions: bool,
6864
6865    /// The entity for customers who run multiple entities, domains, sites, or
6866    /// regions, for example, `Google US`, `Google Ads`, `Waymo`,
6867    /// `google.com`, `youtube.com`, etc.
6868    /// If this is set, it must be an exact match with
6869    /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get
6870    /// per-entity autocomplete results. This field will be applied to
6871    /// `completion_results` only. It has no effect on the `attribute_results`.
6872    /// Also, this entity should be limited to 256 characters, if too long, it will
6873    /// be truncated to 256 characters in both generation and serving time, and may
6874    /// lead to mis-match. To ensure it works, please set the entity with string
6875    /// within 256 characters.
6876    ///
6877    /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
6878    pub entity: std::string::String,
6879
6880    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6881}
6882
6883impl CompleteQueryRequest {
6884    pub fn new() -> Self {
6885        std::default::Default::default()
6886    }
6887
6888    /// Sets the value of [catalog][crate::model::CompleteQueryRequest::catalog].
6889    ///
6890    /// # Example
6891    /// ```ignore,no_run
6892    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6893    /// let x = CompleteQueryRequest::new().set_catalog("example");
6894    /// ```
6895    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6896        self.catalog = v.into();
6897        self
6898    }
6899
6900    /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
6901    ///
6902    /// # Example
6903    /// ```ignore,no_run
6904    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6905    /// let x = CompleteQueryRequest::new().set_query("example");
6906    /// ```
6907    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6908        self.query = v.into();
6909        self
6910    }
6911
6912    /// Sets the value of [visitor_id][crate::model::CompleteQueryRequest::visitor_id].
6913    ///
6914    /// # Example
6915    /// ```ignore,no_run
6916    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6917    /// let x = CompleteQueryRequest::new().set_visitor_id("example");
6918    /// ```
6919    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6920        self.visitor_id = v.into();
6921        self
6922    }
6923
6924    /// Sets the value of [language_codes][crate::model::CompleteQueryRequest::language_codes].
6925    ///
6926    /// # Example
6927    /// ```ignore,no_run
6928    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6929    /// let x = CompleteQueryRequest::new().set_language_codes(["a", "b", "c"]);
6930    /// ```
6931    pub fn set_language_codes<T, V>(mut self, v: T) -> Self
6932    where
6933        T: std::iter::IntoIterator<Item = V>,
6934        V: std::convert::Into<std::string::String>,
6935    {
6936        use std::iter::Iterator;
6937        self.language_codes = v.into_iter().map(|i| i.into()).collect();
6938        self
6939    }
6940
6941    /// Sets the value of [device_type][crate::model::CompleteQueryRequest::device_type].
6942    ///
6943    /// # Example
6944    /// ```ignore,no_run
6945    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6946    /// let x = CompleteQueryRequest::new().set_device_type("example");
6947    /// ```
6948    pub fn set_device_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6949        self.device_type = v.into();
6950        self
6951    }
6952
6953    /// Sets the value of [dataset][crate::model::CompleteQueryRequest::dataset].
6954    ///
6955    /// # Example
6956    /// ```ignore,no_run
6957    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6958    /// let x = CompleteQueryRequest::new().set_dataset("example");
6959    /// ```
6960    pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6961        self.dataset = v.into();
6962        self
6963    }
6964
6965    /// Sets the value of [max_suggestions][crate::model::CompleteQueryRequest::max_suggestions].
6966    ///
6967    /// # Example
6968    /// ```ignore,no_run
6969    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6970    /// let x = CompleteQueryRequest::new().set_max_suggestions(42);
6971    /// ```
6972    pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6973        self.max_suggestions = v.into();
6974        self
6975    }
6976
6977    /// Sets the value of [enable_attribute_suggestions][crate::model::CompleteQueryRequest::enable_attribute_suggestions].
6978    ///
6979    /// # Example
6980    /// ```ignore,no_run
6981    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6982    /// let x = CompleteQueryRequest::new().set_enable_attribute_suggestions(true);
6983    /// ```
6984    pub fn set_enable_attribute_suggestions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6985        self.enable_attribute_suggestions = v.into();
6986        self
6987    }
6988
6989    /// Sets the value of [entity][crate::model::CompleteQueryRequest::entity].
6990    ///
6991    /// # Example
6992    /// ```ignore,no_run
6993    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6994    /// let x = CompleteQueryRequest::new().set_entity("example");
6995    /// ```
6996    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6997        self.entity = v.into();
6998        self
6999    }
7000}
7001
7002impl wkt::message::Message for CompleteQueryRequest {
7003    fn typename() -> &'static str {
7004        "type.googleapis.com/google.cloud.retail.v2.CompleteQueryRequest"
7005    }
7006}
7007
7008/// Response of the autocomplete query.
7009#[derive(Clone, Default, PartialEq)]
7010#[non_exhaustive]
7011pub struct CompleteQueryResponse {
7012    /// Results of the matching suggestions. The result list is ordered and the
7013    /// first result is top suggestion.
7014    pub completion_results: std::vec::Vec<crate::model::complete_query_response::CompletionResult>,
7015
7016    /// A unique complete token. This should be included in the
7017    /// [UserEvent.completion_detail][google.cloud.retail.v2.UserEvent.completion_detail]
7018    /// for search events resulting from this completion, which enables accurate
7019    /// attribution of complete model performance.
7020    ///
7021    /// [google.cloud.retail.v2.UserEvent.completion_detail]: crate::model::UserEvent::completion_detail
7022    pub attribution_token: std::string::String,
7023
7024    /// Deprecated. Matched recent searches of this user. The maximum number of
7025    /// recent searches is 10. This field is a restricted feature. If you want to
7026    /// enable it, contact Retail Search support.
7027    ///
7028    /// This feature is only available when
7029    /// [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
7030    /// field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
7031    /// The recent searches satisfy the follow rules:
7032    ///
7033    /// * They are ordered from latest to oldest.
7034    ///
7035    /// * They are matched with
7036    ///   [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
7037    ///   case insensitively.
7038    ///
7039    /// * They are transformed to lower case.
7040    ///
7041    /// * They are UTF-8 safe.
7042    ///
7043    ///
7044    /// Recent searches are deduplicated. More recent searches will be reserved
7045    /// when duplication happens.
7046    ///
7047    /// [google.cloud.retail.v2.CompleteQueryRequest.query]: crate::model::CompleteQueryRequest::query
7048    /// [google.cloud.retail.v2.CompleteQueryRequest.visitor_id]: crate::model::CompleteQueryRequest::visitor_id
7049    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
7050    #[deprecated]
7051    pub recent_search_results:
7052        std::vec::Vec<crate::model::complete_query_response::RecentSearchResult>,
7053
7054    /// A map of matched attribute suggestions. This field is only available for
7055    /// `cloud-retail` dataset.
7056    ///
7057    /// Current supported keys:
7058    ///
7059    /// * `brands`
7060    ///
7061    /// * `categories`
7062    ///
7063    pub attribute_results: std::collections::HashMap<
7064        std::string::String,
7065        crate::model::complete_query_response::AttributeResult,
7066    >,
7067
7068    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7069}
7070
7071impl CompleteQueryResponse {
7072    pub fn new() -> Self {
7073        std::default::Default::default()
7074    }
7075
7076    /// Sets the value of [completion_results][crate::model::CompleteQueryResponse::completion_results].
7077    ///
7078    /// # Example
7079    /// ```ignore,no_run
7080    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7081    /// use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7082    /// let x = CompleteQueryResponse::new()
7083    ///     .set_completion_results([
7084    ///         CompletionResult::default()/* use setters */,
7085    ///         CompletionResult::default()/* use (different) setters */,
7086    ///     ]);
7087    /// ```
7088    pub fn set_completion_results<T, V>(mut self, v: T) -> Self
7089    where
7090        T: std::iter::IntoIterator<Item = V>,
7091        V: std::convert::Into<crate::model::complete_query_response::CompletionResult>,
7092    {
7093        use std::iter::Iterator;
7094        self.completion_results = v.into_iter().map(|i| i.into()).collect();
7095        self
7096    }
7097
7098    /// Sets the value of [attribution_token][crate::model::CompleteQueryResponse::attribution_token].
7099    ///
7100    /// # Example
7101    /// ```ignore,no_run
7102    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7103    /// let x = CompleteQueryResponse::new().set_attribution_token("example");
7104    /// ```
7105    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
7106        mut self,
7107        v: T,
7108    ) -> Self {
7109        self.attribution_token = v.into();
7110        self
7111    }
7112
7113    /// Sets the value of [recent_search_results][crate::model::CompleteQueryResponse::recent_search_results].
7114    ///
7115    /// # Example
7116    /// ```ignore,no_run
7117    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7118    /// use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7119    /// let x = CompleteQueryResponse::new()
7120    ///     .set_recent_search_results([
7121    ///         RecentSearchResult::default()/* use setters */,
7122    ///         RecentSearchResult::default()/* use (different) setters */,
7123    ///     ]);
7124    /// ```
7125    #[deprecated]
7126    pub fn set_recent_search_results<T, V>(mut self, v: T) -> Self
7127    where
7128        T: std::iter::IntoIterator<Item = V>,
7129        V: std::convert::Into<crate::model::complete_query_response::RecentSearchResult>,
7130    {
7131        use std::iter::Iterator;
7132        self.recent_search_results = v.into_iter().map(|i| i.into()).collect();
7133        self
7134    }
7135
7136    /// Sets the value of [attribute_results][crate::model::CompleteQueryResponse::attribute_results].
7137    ///
7138    /// # Example
7139    /// ```ignore,no_run
7140    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7141    /// use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7142    /// let x = CompleteQueryResponse::new().set_attribute_results([
7143    ///     ("key0", AttributeResult::default()/* use setters */),
7144    ///     ("key1", AttributeResult::default()/* use (different) setters */),
7145    /// ]);
7146    /// ```
7147    pub fn set_attribute_results<T, K, V>(mut self, v: T) -> Self
7148    where
7149        T: std::iter::IntoIterator<Item = (K, V)>,
7150        K: std::convert::Into<std::string::String>,
7151        V: std::convert::Into<crate::model::complete_query_response::AttributeResult>,
7152    {
7153        use std::iter::Iterator;
7154        self.attribute_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7155        self
7156    }
7157}
7158
7159impl wkt::message::Message for CompleteQueryResponse {
7160    fn typename() -> &'static str {
7161        "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse"
7162    }
7163}
7164
7165/// Defines additional types related to [CompleteQueryResponse].
7166pub mod complete_query_response {
7167    #[allow(unused_imports)]
7168    use super::*;
7169
7170    /// Resource that represents completion results.
7171    #[derive(Clone, Default, PartialEq)]
7172    #[non_exhaustive]
7173    pub struct CompletionResult {
7174        /// The suggestion for the query.
7175        pub suggestion: std::string::String,
7176
7177        /// Custom attributes for the suggestion term.
7178        ///
7179        /// * For `user-data`, the attributes are additional custom attributes
7180        ///   ingested through BigQuery.
7181        ///
7182        /// * For `cloud-retail`, the attributes are product attributes generated
7183        ///   by Cloud Retail. It requires
7184        ///   [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details]
7185        ///   is imported properly.
7186        ///
7187        ///
7188        /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
7189        pub attributes:
7190            std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
7191
7192        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7193    }
7194
7195    impl CompletionResult {
7196        pub fn new() -> Self {
7197            std::default::Default::default()
7198        }
7199
7200        /// Sets the value of [suggestion][crate::model::complete_query_response::CompletionResult::suggestion].
7201        ///
7202        /// # Example
7203        /// ```ignore,no_run
7204        /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7205        /// let x = CompletionResult::new().set_suggestion("example");
7206        /// ```
7207        pub fn set_suggestion<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7208            self.suggestion = v.into();
7209            self
7210        }
7211
7212        /// Sets the value of [attributes][crate::model::complete_query_response::CompletionResult::attributes].
7213        ///
7214        /// # Example
7215        /// ```ignore,no_run
7216        /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7217        /// use google_cloud_retail_v2::model::CustomAttribute;
7218        /// let x = CompletionResult::new().set_attributes([
7219        ///     ("key0", CustomAttribute::default()/* use setters */),
7220        ///     ("key1", CustomAttribute::default()/* use (different) setters */),
7221        /// ]);
7222        /// ```
7223        pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7224        where
7225            T: std::iter::IntoIterator<Item = (K, V)>,
7226            K: std::convert::Into<std::string::String>,
7227            V: std::convert::Into<crate::model::CustomAttribute>,
7228        {
7229            use std::iter::Iterator;
7230            self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7231            self
7232        }
7233    }
7234
7235    impl wkt::message::Message for CompletionResult {
7236        fn typename() -> &'static str {
7237            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
7238        }
7239    }
7240
7241    /// Deprecated: Recent search of this user.
7242    #[derive(Clone, Default, PartialEq)]
7243    #[non_exhaustive]
7244    #[deprecated]
7245    pub struct RecentSearchResult {
7246        /// The recent search query.
7247        pub recent_search: std::string::String,
7248
7249        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7250    }
7251
7252    impl RecentSearchResult {
7253        pub fn new() -> Self {
7254            std::default::Default::default()
7255        }
7256
7257        /// Sets the value of [recent_search][crate::model::complete_query_response::RecentSearchResult::recent_search].
7258        ///
7259        /// # Example
7260        /// ```ignore,no_run
7261        /// # use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7262        /// let x = RecentSearchResult::new().set_recent_search("example");
7263        /// ```
7264        pub fn set_recent_search<T: std::convert::Into<std::string::String>>(
7265            mut self,
7266            v: T,
7267        ) -> Self {
7268            self.recent_search = v.into();
7269            self
7270        }
7271    }
7272
7273    impl wkt::message::Message for RecentSearchResult {
7274        fn typename() -> &'static str {
7275            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
7276        }
7277    }
7278
7279    /// Resource that represents attribute results.
7280    #[derive(Clone, Default, PartialEq)]
7281    #[non_exhaustive]
7282    pub struct AttributeResult {
7283        /// The list of suggestions for the attribute.
7284        pub suggestions: std::vec::Vec<std::string::String>,
7285
7286        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7287    }
7288
7289    impl AttributeResult {
7290        pub fn new() -> Self {
7291            std::default::Default::default()
7292        }
7293
7294        /// Sets the value of [suggestions][crate::model::complete_query_response::AttributeResult::suggestions].
7295        ///
7296        /// # Example
7297        /// ```ignore,no_run
7298        /// # use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7299        /// let x = AttributeResult::new().set_suggestions(["a", "b", "c"]);
7300        /// ```
7301        pub fn set_suggestions<T, V>(mut self, v: T) -> Self
7302        where
7303            T: std::iter::IntoIterator<Item = V>,
7304            V: std::convert::Into<std::string::String>,
7305        {
7306            use std::iter::Iterator;
7307            self.suggestions = v.into_iter().map(|i| i.into()).collect();
7308            self
7309        }
7310    }
7311
7312    impl wkt::message::Message for AttributeResult {
7313        fn typename() -> &'static str {
7314            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.AttributeResult"
7315        }
7316    }
7317}
7318
7319/// Configures dynamic metadata that can be linked to a
7320/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
7321/// recommendation results at serving time.
7322///
7323/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7324#[derive(Clone, Default, PartialEq)]
7325#[non_exhaustive]
7326pub struct Control {
7327    /// Immutable. Fully qualified name
7328    /// `projects/*/locations/global/catalogs/*/controls/*`
7329    pub name: std::string::String,
7330
7331    /// Required. The human readable control display name. Used in Retail UI.
7332    ///
7333    /// This field must be a UTF-8 encoded string with a length limit of 128
7334    /// characters. Otherwise, an INVALID_ARGUMENT error is thrown.
7335    pub display_name: std::string::String,
7336
7337    /// Output only. List of [serving config][google.cloud.retail.v2.ServingConfig]
7338    /// ids that are associated with this control in the same
7339    /// [Catalog][google.cloud.retail.v2.Catalog].
7340    ///
7341    /// Note the association is managed via the
7342    /// [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
7343    /// only denormalized view.
7344    ///
7345    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
7346    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7347    pub associated_serving_config_ids: std::vec::Vec<std::string::String>,
7348
7349    /// Required. Immutable. The solution types that the control is used for.
7350    /// Currently we support setting only one type of solution at creation time.
7351    ///
7352    /// Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
7353    /// If no solution type is provided at creation time, will default to
7354    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
7355    ///
7356    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
7357    pub solution_types: std::vec::Vec<crate::model::SolutionType>,
7358
7359    /// Specifies the use case for the control.
7360    /// Affects what condition fields can be set.
7361    /// Only settable by search controls.
7362    /// Will default to
7363    /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
7364    /// if not specified. Currently only allow one search_solution_use_case per
7365    /// control.
7366    ///
7367    /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
7368    pub search_solution_use_case: std::vec::Vec<crate::model::SearchSolutionUseCase>,
7369
7370    /// The behavior/type of the control
7371    ///
7372    /// A behavior/type must be specified on creation. Type cannot be changed once
7373    /// specified (e.g. A Rule control will always be a Rule control.). An
7374    /// INVALID_ARGUMENT will be returned if either condition is violated.
7375    pub control: std::option::Option<crate::model::control::Control>,
7376
7377    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7378}
7379
7380impl Control {
7381    pub fn new() -> Self {
7382        std::default::Default::default()
7383    }
7384
7385    /// Sets the value of [name][crate::model::Control::name].
7386    ///
7387    /// # Example
7388    /// ```ignore,no_run
7389    /// # use google_cloud_retail_v2::model::Control;
7390    /// let x = Control::new().set_name("example");
7391    /// ```
7392    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7393        self.name = v.into();
7394        self
7395    }
7396
7397    /// Sets the value of [display_name][crate::model::Control::display_name].
7398    ///
7399    /// # Example
7400    /// ```ignore,no_run
7401    /// # use google_cloud_retail_v2::model::Control;
7402    /// let x = Control::new().set_display_name("example");
7403    /// ```
7404    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7405        self.display_name = v.into();
7406        self
7407    }
7408
7409    /// Sets the value of [associated_serving_config_ids][crate::model::Control::associated_serving_config_ids].
7410    ///
7411    /// # Example
7412    /// ```ignore,no_run
7413    /// # use google_cloud_retail_v2::model::Control;
7414    /// let x = Control::new().set_associated_serving_config_ids(["a", "b", "c"]);
7415    /// ```
7416    pub fn set_associated_serving_config_ids<T, V>(mut self, v: T) -> Self
7417    where
7418        T: std::iter::IntoIterator<Item = V>,
7419        V: std::convert::Into<std::string::String>,
7420    {
7421        use std::iter::Iterator;
7422        self.associated_serving_config_ids = v.into_iter().map(|i| i.into()).collect();
7423        self
7424    }
7425
7426    /// Sets the value of [solution_types][crate::model::Control::solution_types].
7427    ///
7428    /// # Example
7429    /// ```ignore,no_run
7430    /// # use google_cloud_retail_v2::model::Control;
7431    /// use google_cloud_retail_v2::model::SolutionType;
7432    /// let x = Control::new().set_solution_types([
7433    ///     SolutionType::Recommendation,
7434    ///     SolutionType::Search,
7435    /// ]);
7436    /// ```
7437    pub fn set_solution_types<T, V>(mut self, v: T) -> Self
7438    where
7439        T: std::iter::IntoIterator<Item = V>,
7440        V: std::convert::Into<crate::model::SolutionType>,
7441    {
7442        use std::iter::Iterator;
7443        self.solution_types = v.into_iter().map(|i| i.into()).collect();
7444        self
7445    }
7446
7447    /// Sets the value of [search_solution_use_case][crate::model::Control::search_solution_use_case].
7448    ///
7449    /// # Example
7450    /// ```ignore,no_run
7451    /// # use google_cloud_retail_v2::model::Control;
7452    /// use google_cloud_retail_v2::model::SearchSolutionUseCase;
7453    /// let x = Control::new().set_search_solution_use_case([
7454    ///     SearchSolutionUseCase::Search,
7455    ///     SearchSolutionUseCase::Browse,
7456    /// ]);
7457    /// ```
7458    pub fn set_search_solution_use_case<T, V>(mut self, v: T) -> Self
7459    where
7460        T: std::iter::IntoIterator<Item = V>,
7461        V: std::convert::Into<crate::model::SearchSolutionUseCase>,
7462    {
7463        use std::iter::Iterator;
7464        self.search_solution_use_case = v.into_iter().map(|i| i.into()).collect();
7465        self
7466    }
7467
7468    /// Sets the value of [control][crate::model::Control::control].
7469    ///
7470    /// Note that all the setters affecting `control` are mutually
7471    /// exclusive.
7472    ///
7473    /// # Example
7474    /// ```ignore,no_run
7475    /// # use google_cloud_retail_v2::model::Control;
7476    /// use google_cloud_retail_v2::model::Rule;
7477    /// let x = Control::new().set_control(Some(
7478    ///     google_cloud_retail_v2::model::control::Control::Rule(Rule::default().into())));
7479    /// ```
7480    pub fn set_control<
7481        T: std::convert::Into<std::option::Option<crate::model::control::Control>>,
7482    >(
7483        mut self,
7484        v: T,
7485    ) -> Self {
7486        self.control = v.into();
7487        self
7488    }
7489
7490    /// The value of [control][crate::model::Control::control]
7491    /// if it holds a `Rule`, `None` if the field is not set or
7492    /// holds a different branch.
7493    pub fn rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::Rule>> {
7494        #[allow(unreachable_patterns)]
7495        self.control.as_ref().and_then(|v| match v {
7496            crate::model::control::Control::Rule(v) => std::option::Option::Some(v),
7497            _ => std::option::Option::None,
7498        })
7499    }
7500
7501    /// Sets the value of [control][crate::model::Control::control]
7502    /// to hold a `Rule`.
7503    ///
7504    /// Note that all the setters affecting `control` are
7505    /// mutually exclusive.
7506    ///
7507    /// # Example
7508    /// ```ignore,no_run
7509    /// # use google_cloud_retail_v2::model::Control;
7510    /// use google_cloud_retail_v2::model::Rule;
7511    /// let x = Control::new().set_rule(Rule::default()/* use setters */);
7512    /// assert!(x.rule().is_some());
7513    /// ```
7514    pub fn set_rule<T: std::convert::Into<std::boxed::Box<crate::model::Rule>>>(
7515        mut self,
7516        v: T,
7517    ) -> Self {
7518        self.control = std::option::Option::Some(crate::model::control::Control::Rule(v.into()));
7519        self
7520    }
7521}
7522
7523impl wkt::message::Message for Control {
7524    fn typename() -> &'static str {
7525        "type.googleapis.com/google.cloud.retail.v2.Control"
7526    }
7527}
7528
7529/// Defines additional types related to [Control].
7530pub mod control {
7531    #[allow(unused_imports)]
7532    use super::*;
7533
7534    /// The behavior/type of the control
7535    ///
7536    /// A behavior/type must be specified on creation. Type cannot be changed once
7537    /// specified (e.g. A Rule control will always be a Rule control.). An
7538    /// INVALID_ARGUMENT will be returned if either condition is violated.
7539    #[derive(Clone, Debug, PartialEq)]
7540    #[non_exhaustive]
7541    pub enum Control {
7542        /// A rule control - a condition-action pair.
7543        /// Enacts a set action when the condition is triggered.
7544        /// For example: Boost "gShoe" when query full matches "Running Shoes".
7545        Rule(std::boxed::Box<crate::model::Rule>),
7546    }
7547}
7548
7549/// Request for CreateControl method.
7550#[derive(Clone, Default, PartialEq)]
7551#[non_exhaustive]
7552pub struct CreateControlRequest {
7553    /// Required. Full resource name of parent catalog. Format:
7554    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7555    pub parent: std::string::String,
7556
7557    /// Required. The Control to create.
7558    pub control: std::option::Option<crate::model::Control>,
7559
7560    /// Required. The ID to use for the Control, which will become the final
7561    /// component of the Control's resource name.
7562    ///
7563    /// This value should be 4-63 characters, and valid characters
7564    /// are /[a-z][0-9]-_/.
7565    pub control_id: std::string::String,
7566
7567    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7568}
7569
7570impl CreateControlRequest {
7571    pub fn new() -> Self {
7572        std::default::Default::default()
7573    }
7574
7575    /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
7576    ///
7577    /// # Example
7578    /// ```ignore,no_run
7579    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7580    /// let x = CreateControlRequest::new().set_parent("example");
7581    /// ```
7582    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7583        self.parent = v.into();
7584        self
7585    }
7586
7587    /// Sets the value of [control][crate::model::CreateControlRequest::control].
7588    ///
7589    /// # Example
7590    /// ```ignore,no_run
7591    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7592    /// use google_cloud_retail_v2::model::Control;
7593    /// let x = CreateControlRequest::new().set_control(Control::default()/* use setters */);
7594    /// ```
7595    pub fn set_control<T>(mut self, v: T) -> Self
7596    where
7597        T: std::convert::Into<crate::model::Control>,
7598    {
7599        self.control = std::option::Option::Some(v.into());
7600        self
7601    }
7602
7603    /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
7604    ///
7605    /// # Example
7606    /// ```ignore,no_run
7607    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7608    /// use google_cloud_retail_v2::model::Control;
7609    /// let x = CreateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7610    /// let x = CreateControlRequest::new().set_or_clear_control(None::<Control>);
7611    /// ```
7612    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7613    where
7614        T: std::convert::Into<crate::model::Control>,
7615    {
7616        self.control = v.map(|x| x.into());
7617        self
7618    }
7619
7620    /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
7621    ///
7622    /// # Example
7623    /// ```ignore,no_run
7624    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7625    /// let x = CreateControlRequest::new().set_control_id("example");
7626    /// ```
7627    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7628        self.control_id = v.into();
7629        self
7630    }
7631}
7632
7633impl wkt::message::Message for CreateControlRequest {
7634    fn typename() -> &'static str {
7635        "type.googleapis.com/google.cloud.retail.v2.CreateControlRequest"
7636    }
7637}
7638
7639/// Request for UpdateControl method.
7640#[derive(Clone, Default, PartialEq)]
7641#[non_exhaustive]
7642pub struct UpdateControlRequest {
7643    /// Required. The Control to update.
7644    pub control: std::option::Option<crate::model::Control>,
7645
7646    /// Indicates which fields in the provided
7647    /// [Control][google.cloud.retail.v2.Control] to update. The following are NOT
7648    /// supported:
7649    ///
7650    /// * [Control.name][google.cloud.retail.v2.Control.name]
7651    ///
7652    /// If not set or empty, all supported fields are updated.
7653    ///
7654    /// [google.cloud.retail.v2.Control]: crate::model::Control
7655    /// [google.cloud.retail.v2.Control.name]: crate::model::Control::name
7656    pub update_mask: std::option::Option<wkt::FieldMask>,
7657
7658    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7659}
7660
7661impl UpdateControlRequest {
7662    pub fn new() -> Self {
7663        std::default::Default::default()
7664    }
7665
7666    /// Sets the value of [control][crate::model::UpdateControlRequest::control].
7667    ///
7668    /// # Example
7669    /// ```ignore,no_run
7670    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7671    /// use google_cloud_retail_v2::model::Control;
7672    /// let x = UpdateControlRequest::new().set_control(Control::default()/* use setters */);
7673    /// ```
7674    pub fn set_control<T>(mut self, v: T) -> Self
7675    where
7676        T: std::convert::Into<crate::model::Control>,
7677    {
7678        self.control = std::option::Option::Some(v.into());
7679        self
7680    }
7681
7682    /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
7683    ///
7684    /// # Example
7685    /// ```ignore,no_run
7686    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7687    /// use google_cloud_retail_v2::model::Control;
7688    /// let x = UpdateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7689    /// let x = UpdateControlRequest::new().set_or_clear_control(None::<Control>);
7690    /// ```
7691    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7692    where
7693        T: std::convert::Into<crate::model::Control>,
7694    {
7695        self.control = v.map(|x| x.into());
7696        self
7697    }
7698
7699    /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7700    ///
7701    /// # Example
7702    /// ```ignore,no_run
7703    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7704    /// use wkt::FieldMask;
7705    /// let x = UpdateControlRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7706    /// ```
7707    pub fn set_update_mask<T>(mut self, v: T) -> Self
7708    where
7709        T: std::convert::Into<wkt::FieldMask>,
7710    {
7711        self.update_mask = std::option::Option::Some(v.into());
7712        self
7713    }
7714
7715    /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7716    ///
7717    /// # Example
7718    /// ```ignore,no_run
7719    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7720    /// use wkt::FieldMask;
7721    /// let x = UpdateControlRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7722    /// let x = UpdateControlRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7723    /// ```
7724    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7725    where
7726        T: std::convert::Into<wkt::FieldMask>,
7727    {
7728        self.update_mask = v.map(|x| x.into());
7729        self
7730    }
7731}
7732
7733impl wkt::message::Message for UpdateControlRequest {
7734    fn typename() -> &'static str {
7735        "type.googleapis.com/google.cloud.retail.v2.UpdateControlRequest"
7736    }
7737}
7738
7739/// Request for DeleteControl method.
7740#[derive(Clone, Default, PartialEq)]
7741#[non_exhaustive]
7742pub struct DeleteControlRequest {
7743    /// Required. The resource name of the Control to delete. Format:
7744    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7745    pub name: std::string::String,
7746
7747    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7748}
7749
7750impl DeleteControlRequest {
7751    pub fn new() -> Self {
7752        std::default::Default::default()
7753    }
7754
7755    /// Sets the value of [name][crate::model::DeleteControlRequest::name].
7756    ///
7757    /// # Example
7758    /// ```ignore,no_run
7759    /// # use google_cloud_retail_v2::model::DeleteControlRequest;
7760    /// let x = DeleteControlRequest::new().set_name("example");
7761    /// ```
7762    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7763        self.name = v.into();
7764        self
7765    }
7766}
7767
7768impl wkt::message::Message for DeleteControlRequest {
7769    fn typename() -> &'static str {
7770        "type.googleapis.com/google.cloud.retail.v2.DeleteControlRequest"
7771    }
7772}
7773
7774/// Request for GetControl method.
7775#[derive(Clone, Default, PartialEq)]
7776#[non_exhaustive]
7777pub struct GetControlRequest {
7778    /// Required. The resource name of the Control to get. Format:
7779    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7780    pub name: std::string::String,
7781
7782    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7783}
7784
7785impl GetControlRequest {
7786    pub fn new() -> Self {
7787        std::default::Default::default()
7788    }
7789
7790    /// Sets the value of [name][crate::model::GetControlRequest::name].
7791    ///
7792    /// # Example
7793    /// ```ignore,no_run
7794    /// # use google_cloud_retail_v2::model::GetControlRequest;
7795    /// let x = GetControlRequest::new().set_name("example");
7796    /// ```
7797    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7798        self.name = v.into();
7799        self
7800    }
7801}
7802
7803impl wkt::message::Message for GetControlRequest {
7804    fn typename() -> &'static str {
7805        "type.googleapis.com/google.cloud.retail.v2.GetControlRequest"
7806    }
7807}
7808
7809/// Request for ListControls method.
7810#[derive(Clone, Default, PartialEq)]
7811#[non_exhaustive]
7812pub struct ListControlsRequest {
7813    /// Required. The catalog resource name. Format:
7814    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7815    pub parent: std::string::String,
7816
7817    /// Optional. Maximum number of results to return. If unspecified, defaults
7818    /// to 50. Max allowed value is 1000.
7819    pub page_size: i32,
7820
7821    /// Optional. A page token, received from a previous `ListControls` call.
7822    /// Provide this to retrieve the subsequent page.
7823    pub page_token: std::string::String,
7824
7825    /// Optional. A filter to apply on the list results. Supported features:
7826    ///
7827    /// * List all the products under the parent branch if
7828    ///   [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
7829    /// * List controls that are used in a single ServingConfig:
7830    ///   'serving_config = "boosted_home_page_cvr"'
7831    ///
7832    /// [google.cloud.retail.v2.ListControlsRequest.filter]: crate::model::ListControlsRequest::filter
7833    pub filter: std::string::String,
7834
7835    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7836}
7837
7838impl ListControlsRequest {
7839    pub fn new() -> Self {
7840        std::default::Default::default()
7841    }
7842
7843    /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
7844    ///
7845    /// # Example
7846    /// ```ignore,no_run
7847    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7848    /// let x = ListControlsRequest::new().set_parent("example");
7849    /// ```
7850    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7851        self.parent = v.into();
7852        self
7853    }
7854
7855    /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
7856    ///
7857    /// # Example
7858    /// ```ignore,no_run
7859    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7860    /// let x = ListControlsRequest::new().set_page_size(42);
7861    /// ```
7862    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7863        self.page_size = v.into();
7864        self
7865    }
7866
7867    /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
7868    ///
7869    /// # Example
7870    /// ```ignore,no_run
7871    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7872    /// let x = ListControlsRequest::new().set_page_token("example");
7873    /// ```
7874    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7875        self.page_token = v.into();
7876        self
7877    }
7878
7879    /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
7880    ///
7881    /// # Example
7882    /// ```ignore,no_run
7883    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7884    /// let x = ListControlsRequest::new().set_filter("example");
7885    /// ```
7886    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7887        self.filter = v.into();
7888        self
7889    }
7890}
7891
7892impl wkt::message::Message for ListControlsRequest {
7893    fn typename() -> &'static str {
7894        "type.googleapis.com/google.cloud.retail.v2.ListControlsRequest"
7895    }
7896}
7897
7898/// Response for ListControls method.
7899#[derive(Clone, Default, PartialEq)]
7900#[non_exhaustive]
7901pub struct ListControlsResponse {
7902    /// All the Controls for a given catalog.
7903    pub controls: std::vec::Vec<crate::model::Control>,
7904
7905    /// Pagination token, if not returned indicates the last page.
7906    pub next_page_token: std::string::String,
7907
7908    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7909}
7910
7911impl ListControlsResponse {
7912    pub fn new() -> Self {
7913        std::default::Default::default()
7914    }
7915
7916    /// Sets the value of [controls][crate::model::ListControlsResponse::controls].
7917    ///
7918    /// # Example
7919    /// ```ignore,no_run
7920    /// # use google_cloud_retail_v2::model::ListControlsResponse;
7921    /// use google_cloud_retail_v2::model::Control;
7922    /// let x = ListControlsResponse::new()
7923    ///     .set_controls([
7924    ///         Control::default()/* use setters */,
7925    ///         Control::default()/* use (different) setters */,
7926    ///     ]);
7927    /// ```
7928    pub fn set_controls<T, V>(mut self, v: T) -> Self
7929    where
7930        T: std::iter::IntoIterator<Item = V>,
7931        V: std::convert::Into<crate::model::Control>,
7932    {
7933        use std::iter::Iterator;
7934        self.controls = v.into_iter().map(|i| i.into()).collect();
7935        self
7936    }
7937
7938    /// Sets the value of [next_page_token][crate::model::ListControlsResponse::next_page_token].
7939    ///
7940    /// # Example
7941    /// ```ignore,no_run
7942    /// # use google_cloud_retail_v2::model::ListControlsResponse;
7943    /// let x = ListControlsResponse::new().set_next_page_token("example");
7944    /// ```
7945    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7946        self.next_page_token = v.into();
7947        self
7948    }
7949}
7950
7951impl wkt::message::Message for ListControlsResponse {
7952    fn typename() -> &'static str {
7953        "type.googleapis.com/google.cloud.retail.v2.ListControlsResponse"
7954    }
7955}
7956
7957#[doc(hidden)]
7958impl gax::paginator::internal::PageableResponse for ListControlsResponse {
7959    type PageItem = crate::model::Control;
7960
7961    fn items(self) -> std::vec::Vec<Self::PageItem> {
7962        self.controls
7963    }
7964
7965    fn next_page_token(&self) -> std::string::String {
7966        use std::clone::Clone;
7967        self.next_page_token.clone()
7968    }
7969}
7970
7971/// Request message for
7972/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
7973/// method.
7974#[derive(Clone, Default, PartialEq)]
7975#[non_exhaustive]
7976pub struct ConversationalSearchRequest {
7977    /// Required. The resource name of the search engine placement, such as
7978    /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`
7979    /// or
7980    /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
7981    /// This field is used to identify the serving config name and the set
7982    /// of models that will be used to make the search.
7983    pub placement: std::string::String,
7984
7985    /// Required. The branch resource name, such as
7986    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
7987    ///
7988    /// Use "default_branch" as the branch ID or leave this field empty, to search
7989    /// products under the default branch.
7990    pub branch: std::string::String,
7991
7992    /// Optional. Raw search query to be searched for.
7993    ///
7994    /// If this field is empty, the request is considered a category browsing
7995    /// request.
7996    pub query: std::string::String,
7997
7998    /// Optional. The categories associated with a category page. Must be set for
7999    /// category navigation queries to achieve good search quality. The format
8000    /// should be the same as
8001    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
8002    ///
8003    /// To represent full path of category, use '>' sign to separate different
8004    /// hierarchies. If '>' is part of the category name, replace it with
8005    /// other character(s).
8006    ///
8007    /// Category pages include special pages such as sales or promotions. For
8008    /// instance, a special sale page may have the category hierarchy:
8009    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
8010    ///
8011    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
8012    pub page_categories: std::vec::Vec<std::string::String>,
8013
8014    /// Optional. This field specifies the conversation id, which maintains the
8015    /// state of the conversation between client side and server side. Use the
8016    /// value from the previous
8017    /// [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2.ConversationalSearchResponse.conversation_id].
8018    /// For the initial request, this should be empty.
8019    ///
8020    /// [google.cloud.retail.v2.ConversationalSearchResponse.conversation_id]: crate::model::ConversationalSearchResponse::conversation_id
8021    pub conversation_id: std::string::String,
8022
8023    /// Optional. Search parameters.
8024    pub search_params:
8025        std::option::Option<crate::model::conversational_search_request::SearchParams>,
8026
8027    /// Required. A unique identifier for tracking visitors. For example, this
8028    /// could be implemented with an HTTP cookie, which should be able to uniquely
8029    /// identify a visitor on a single device. This unique identifier should not
8030    /// change if the visitor logs in or out of the website.
8031    ///
8032    /// This should be the same identifier as
8033    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
8034    ///
8035    /// The field must be a UTF-8 encoded string with a length limit of 128
8036    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
8037    ///
8038    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
8039    pub visitor_id: std::string::String,
8040
8041    /// Optional. User information.
8042    pub user_info: std::option::Option<crate::model::UserInfo>,
8043
8044    /// Optional. This field specifies all conversational filtering related
8045    /// parameters.
8046    pub conversational_filtering_spec: std::option::Option<
8047        crate::model::conversational_search_request::ConversationalFilteringSpec,
8048    >,
8049
8050    /// Optional. The user labels applied to a resource must meet the following
8051    /// requirements:
8052    ///
8053    /// * Each resource can have multiple labels, up to a maximum of 64.
8054    /// * Each label must be a key-value pair.
8055    /// * Keys have a minimum length of 1 character and a maximum length of 63
8056    ///   characters and cannot be empty. Values can be empty and have a maximum
8057    ///   length of 63 characters.
8058    /// * Keys and values can contain only lowercase letters, numeric characters,
8059    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
8060    ///   international characters are allowed.
8061    /// * The key portion of a label must be unique. However, you can use the same
8062    ///   key with multiple resources.
8063    /// * Keys must start with a lowercase letter or international character.
8064    ///
8065    /// See [Google Cloud
8066    /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
8067    /// for more details.
8068    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8069
8070    /// Optional. The safety settings to be applied to the generated content.
8071    pub safety_settings: std::vec::Vec<crate::model::SafetySetting>,
8072
8073    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8074}
8075
8076impl ConversationalSearchRequest {
8077    pub fn new() -> Self {
8078        std::default::Default::default()
8079    }
8080
8081    /// Sets the value of [placement][crate::model::ConversationalSearchRequest::placement].
8082    ///
8083    /// # Example
8084    /// ```ignore,no_run
8085    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8086    /// let x = ConversationalSearchRequest::new().set_placement("example");
8087    /// ```
8088    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8089        self.placement = v.into();
8090        self
8091    }
8092
8093    /// Sets the value of [branch][crate::model::ConversationalSearchRequest::branch].
8094    ///
8095    /// # Example
8096    /// ```ignore,no_run
8097    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8098    /// let x = ConversationalSearchRequest::new().set_branch("example");
8099    /// ```
8100    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8101        self.branch = v.into();
8102        self
8103    }
8104
8105    /// Sets the value of [query][crate::model::ConversationalSearchRequest::query].
8106    ///
8107    /// # Example
8108    /// ```ignore,no_run
8109    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8110    /// let x = ConversationalSearchRequest::new().set_query("example");
8111    /// ```
8112    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8113        self.query = v.into();
8114        self
8115    }
8116
8117    /// Sets the value of [page_categories][crate::model::ConversationalSearchRequest::page_categories].
8118    ///
8119    /// # Example
8120    /// ```ignore,no_run
8121    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8122    /// let x = ConversationalSearchRequest::new().set_page_categories(["a", "b", "c"]);
8123    /// ```
8124    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
8125    where
8126        T: std::iter::IntoIterator<Item = V>,
8127        V: std::convert::Into<std::string::String>,
8128    {
8129        use std::iter::Iterator;
8130        self.page_categories = v.into_iter().map(|i| i.into()).collect();
8131        self
8132    }
8133
8134    /// Sets the value of [conversation_id][crate::model::ConversationalSearchRequest::conversation_id].
8135    ///
8136    /// # Example
8137    /// ```ignore,no_run
8138    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8139    /// let x = ConversationalSearchRequest::new().set_conversation_id("example");
8140    /// ```
8141    pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8142        self.conversation_id = v.into();
8143        self
8144    }
8145
8146    /// Sets the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8147    ///
8148    /// # Example
8149    /// ```ignore,no_run
8150    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8151    /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8152    /// let x = ConversationalSearchRequest::new().set_search_params(SearchParams::default()/* use setters */);
8153    /// ```
8154    pub fn set_search_params<T>(mut self, v: T) -> Self
8155    where
8156        T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8157    {
8158        self.search_params = std::option::Option::Some(v.into());
8159        self
8160    }
8161
8162    /// Sets or clears the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8163    ///
8164    /// # Example
8165    /// ```ignore,no_run
8166    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8167    /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8168    /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(Some(SearchParams::default()/* use setters */));
8169    /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(None::<SearchParams>);
8170    /// ```
8171    pub fn set_or_clear_search_params<T>(mut self, v: std::option::Option<T>) -> Self
8172    where
8173        T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8174    {
8175        self.search_params = v.map(|x| x.into());
8176        self
8177    }
8178
8179    /// Sets the value of [visitor_id][crate::model::ConversationalSearchRequest::visitor_id].
8180    ///
8181    /// # Example
8182    /// ```ignore,no_run
8183    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8184    /// let x = ConversationalSearchRequest::new().set_visitor_id("example");
8185    /// ```
8186    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8187        self.visitor_id = v.into();
8188        self
8189    }
8190
8191    /// Sets the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8192    ///
8193    /// # Example
8194    /// ```ignore,no_run
8195    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8196    /// use google_cloud_retail_v2::model::UserInfo;
8197    /// let x = ConversationalSearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
8198    /// ```
8199    pub fn set_user_info<T>(mut self, v: T) -> Self
8200    where
8201        T: std::convert::Into<crate::model::UserInfo>,
8202    {
8203        self.user_info = std::option::Option::Some(v.into());
8204        self
8205    }
8206
8207    /// Sets or clears the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8208    ///
8209    /// # Example
8210    /// ```ignore,no_run
8211    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8212    /// use google_cloud_retail_v2::model::UserInfo;
8213    /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
8214    /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
8215    /// ```
8216    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
8217    where
8218        T: std::convert::Into<crate::model::UserInfo>,
8219    {
8220        self.user_info = v.map(|x| x.into());
8221        self
8222    }
8223
8224    /// Sets the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8225    ///
8226    /// # Example
8227    /// ```ignore,no_run
8228    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8229    /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8230    /// let x = ConversationalSearchRequest::new().set_conversational_filtering_spec(ConversationalFilteringSpec::default()/* use setters */);
8231    /// ```
8232    pub fn set_conversational_filtering_spec<T>(mut self, v: T) -> Self
8233    where
8234        T: std::convert::Into<
8235                crate::model::conversational_search_request::ConversationalFilteringSpec,
8236            >,
8237    {
8238        self.conversational_filtering_spec = std::option::Option::Some(v.into());
8239        self
8240    }
8241
8242    /// Sets or clears the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8243    ///
8244    /// # Example
8245    /// ```ignore,no_run
8246    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8247    /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8248    /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(Some(ConversationalFilteringSpec::default()/* use setters */));
8249    /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(None::<ConversationalFilteringSpec>);
8250    /// ```
8251    pub fn set_or_clear_conversational_filtering_spec<T>(
8252        mut self,
8253        v: std::option::Option<T>,
8254    ) -> Self
8255    where
8256        T: std::convert::Into<
8257                crate::model::conversational_search_request::ConversationalFilteringSpec,
8258            >,
8259    {
8260        self.conversational_filtering_spec = v.map(|x| x.into());
8261        self
8262    }
8263
8264    /// Sets the value of [user_labels][crate::model::ConversationalSearchRequest::user_labels].
8265    ///
8266    /// # Example
8267    /// ```ignore,no_run
8268    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8269    /// let x = ConversationalSearchRequest::new().set_user_labels([
8270    ///     ("key0", "abc"),
8271    ///     ("key1", "xyz"),
8272    /// ]);
8273    /// ```
8274    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8275    where
8276        T: std::iter::IntoIterator<Item = (K, V)>,
8277        K: std::convert::Into<std::string::String>,
8278        V: std::convert::Into<std::string::String>,
8279    {
8280        use std::iter::Iterator;
8281        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8282        self
8283    }
8284
8285    /// Sets the value of [safety_settings][crate::model::ConversationalSearchRequest::safety_settings].
8286    ///
8287    /// # Example
8288    /// ```ignore,no_run
8289    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8290    /// use google_cloud_retail_v2::model::SafetySetting;
8291    /// let x = ConversationalSearchRequest::new()
8292    ///     .set_safety_settings([
8293    ///         SafetySetting::default()/* use setters */,
8294    ///         SafetySetting::default()/* use (different) setters */,
8295    ///     ]);
8296    /// ```
8297    pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
8298    where
8299        T: std::iter::IntoIterator<Item = V>,
8300        V: std::convert::Into<crate::model::SafetySetting>,
8301    {
8302        use std::iter::Iterator;
8303        self.safety_settings = v.into_iter().map(|i| i.into()).collect();
8304        self
8305    }
8306}
8307
8308impl wkt::message::Message for ConversationalSearchRequest {
8309    fn typename() -> &'static str {
8310        "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest"
8311    }
8312}
8313
8314/// Defines additional types related to [ConversationalSearchRequest].
8315pub mod conversational_search_request {
8316    #[allow(unused_imports)]
8317    use super::*;
8318
8319    /// Search parameters.
8320    #[derive(Clone, Default, PartialEq)]
8321    #[non_exhaustive]
8322    pub struct SearchParams {
8323        /// Optional. The filter string to restrict search results.
8324        ///
8325        /// The syntax of the filter string is the same as
8326        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
8327        ///
8328        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
8329        pub filter: std::string::String,
8330
8331        /// Optional. The canonical filter string to restrict search results.
8332        ///
8333        /// The syntax of the canonical filter string is the same as
8334        /// [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter].
8335        ///
8336        /// [google.cloud.retail.v2.SearchRequest.canonical_filter]: crate::model::SearchRequest::canonical_filter
8337        pub canonical_filter: std::string::String,
8338
8339        /// Optional. The sort string to specify the sorting of search results.
8340        ///
8341        /// The syntax of the sort string is the same as
8342        /// [SearchRequest.sort][].
8343        pub sort_by: std::string::String,
8344
8345        /// Optional. The boost spec to specify the boosting of search results.
8346        ///
8347        /// The syntax of the boost spec is the same as
8348        /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec].
8349        ///
8350        /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
8351        pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
8352
8353        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8354    }
8355
8356    impl SearchParams {
8357        pub fn new() -> Self {
8358            std::default::Default::default()
8359        }
8360
8361        /// Sets the value of [filter][crate::model::conversational_search_request::SearchParams::filter].
8362        ///
8363        /// # Example
8364        /// ```ignore,no_run
8365        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8366        /// let x = SearchParams::new().set_filter("example");
8367        /// ```
8368        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8369            self.filter = v.into();
8370            self
8371        }
8372
8373        /// Sets the value of [canonical_filter][crate::model::conversational_search_request::SearchParams::canonical_filter].
8374        ///
8375        /// # Example
8376        /// ```ignore,no_run
8377        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8378        /// let x = SearchParams::new().set_canonical_filter("example");
8379        /// ```
8380        pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
8381            mut self,
8382            v: T,
8383        ) -> Self {
8384            self.canonical_filter = v.into();
8385            self
8386        }
8387
8388        /// Sets the value of [sort_by][crate::model::conversational_search_request::SearchParams::sort_by].
8389        ///
8390        /// # Example
8391        /// ```ignore,no_run
8392        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8393        /// let x = SearchParams::new().set_sort_by("example");
8394        /// ```
8395        pub fn set_sort_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8396            self.sort_by = v.into();
8397            self
8398        }
8399
8400        /// Sets the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8401        ///
8402        /// # Example
8403        /// ```ignore,no_run
8404        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8405        /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8406        /// let x = SearchParams::new().set_boost_spec(BoostSpec::default()/* use setters */);
8407        /// ```
8408        pub fn set_boost_spec<T>(mut self, v: T) -> Self
8409        where
8410            T: std::convert::Into<crate::model::search_request::BoostSpec>,
8411        {
8412            self.boost_spec = std::option::Option::Some(v.into());
8413            self
8414        }
8415
8416        /// Sets or clears the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8417        ///
8418        /// # Example
8419        /// ```ignore,no_run
8420        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8421        /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8422        /// let x = SearchParams::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
8423        /// let x = SearchParams::new().set_or_clear_boost_spec(None::<BoostSpec>);
8424        /// ```
8425        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
8426        where
8427            T: std::convert::Into<crate::model::search_request::BoostSpec>,
8428        {
8429            self.boost_spec = v.map(|x| x.into());
8430            self
8431        }
8432    }
8433
8434    impl wkt::message::Message for SearchParams {
8435        fn typename() -> &'static str {
8436            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.SearchParams"
8437        }
8438    }
8439
8440    /// This field specifies the current user answer during the conversational
8441    /// filtering search. This can be either user selected from suggested answers
8442    /// or user input plain text.
8443    #[derive(Clone, Default, PartialEq)]
8444    #[non_exhaustive]
8445    pub struct UserAnswer {
8446        /// This field specifies the type of user answer.
8447        pub r#type:
8448            std::option::Option<crate::model::conversational_search_request::user_answer::Type>,
8449
8450        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8451    }
8452
8453    impl UserAnswer {
8454        pub fn new() -> Self {
8455            std::default::Default::default()
8456        }
8457
8458        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::type].
8459        ///
8460        /// Note that all the setters affecting `r#type` are mutually
8461        /// exclusive.
8462        ///
8463        /// # Example
8464        /// ```ignore,no_run
8465        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8466        /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::Type;
8467        /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
8468        /// ```
8469        pub fn set_type<
8470            T: std::convert::Into<
8471                    std::option::Option<
8472                        crate::model::conversational_search_request::user_answer::Type,
8473                    >,
8474                >,
8475        >(
8476            mut self,
8477            v: T,
8478        ) -> Self {
8479            self.r#type = v.into();
8480            self
8481        }
8482
8483        /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8484        /// if it holds a `TextAnswer`, `None` if the field is not set or
8485        /// holds a different branch.
8486        pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
8487            #[allow(unreachable_patterns)]
8488            self.r#type.as_ref().and_then(|v| match v {
8489                crate::model::conversational_search_request::user_answer::Type::TextAnswer(v) => {
8490                    std::option::Option::Some(v)
8491                }
8492                _ => std::option::Option::None,
8493            })
8494        }
8495
8496        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8497        /// to hold a `TextAnswer`.
8498        ///
8499        /// Note that all the setters affecting `r#type` are
8500        /// mutually exclusive.
8501        ///
8502        /// # Example
8503        /// ```ignore,no_run
8504        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8505        /// let x = UserAnswer::new().set_text_answer("example");
8506        /// assert!(x.text_answer().is_some());
8507        /// assert!(x.selected_answer().is_none());
8508        /// ```
8509        pub fn set_text_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8510            self.r#type = std::option::Option::Some(
8511                crate::model::conversational_search_request::user_answer::Type::TextAnswer(
8512                    v.into(),
8513                ),
8514            );
8515            self
8516        }
8517
8518        /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8519        /// if it holds a `SelectedAnswer`, `None` if the field is not set or
8520        /// holds a different branch.
8521        pub fn selected_answer(
8522            &self,
8523        ) -> std::option::Option<
8524            &std::boxed::Box<
8525                crate::model::conversational_search_request::user_answer::SelectedAnswer,
8526            >,
8527        > {
8528            #[allow(unreachable_patterns)]
8529            self.r#type.as_ref().and_then(|v| match v {
8530                crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8531                    v,
8532                ) => std::option::Option::Some(v),
8533                _ => std::option::Option::None,
8534            })
8535        }
8536
8537        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8538        /// to hold a `SelectedAnswer`.
8539        ///
8540        /// Note that all the setters affecting `r#type` are
8541        /// mutually exclusive.
8542        ///
8543        /// # Example
8544        /// ```ignore,no_run
8545        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8546        /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8547        /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
8548        /// assert!(x.selected_answer().is_some());
8549        /// assert!(x.text_answer().is_none());
8550        /// ```
8551        pub fn set_selected_answer<
8552            T: std::convert::Into<
8553                    std::boxed::Box<
8554                        crate::model::conversational_search_request::user_answer::SelectedAnswer,
8555                    >,
8556                >,
8557        >(
8558            mut self,
8559            v: T,
8560        ) -> Self {
8561            self.r#type = std::option::Option::Some(
8562                crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8563                    v.into(),
8564                ),
8565            );
8566            self
8567        }
8568    }
8569
8570    impl wkt::message::Message for UserAnswer {
8571        fn typename() -> &'static str {
8572            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer"
8573        }
8574    }
8575
8576    /// Defines additional types related to [UserAnswer].
8577    pub mod user_answer {
8578        #[allow(unused_imports)]
8579        use super::*;
8580
8581        /// This field specifies the selected answers during the conversational
8582        /// search.
8583        #[derive(Clone, Default, PartialEq)]
8584        #[non_exhaustive]
8585        pub struct SelectedAnswer {
8586            /// Optional. This field specifies the selected answer which is a attribute
8587            /// key-value.
8588            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
8589
8590            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8591        }
8592
8593        impl SelectedAnswer {
8594            pub fn new() -> Self {
8595                std::default::Default::default()
8596            }
8597
8598            /// Sets the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8599            ///
8600            /// # Example
8601            /// ```ignore,no_run
8602            /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8603            /// use google_cloud_retail_v2::model::ProductAttributeValue;
8604            /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
8605            /// ```
8606            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
8607            where
8608                T: std::convert::Into<crate::model::ProductAttributeValue>,
8609            {
8610                self.product_attribute_value = std::option::Option::Some(v.into());
8611                self
8612            }
8613
8614            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8615            ///
8616            /// # Example
8617            /// ```ignore,no_run
8618            /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8619            /// use google_cloud_retail_v2::model::ProductAttributeValue;
8620            /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
8621            /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
8622            /// ```
8623            pub fn set_or_clear_product_attribute_value<T>(
8624                mut self,
8625                v: std::option::Option<T>,
8626            ) -> Self
8627            where
8628                T: std::convert::Into<crate::model::ProductAttributeValue>,
8629            {
8630                self.product_attribute_value = v.map(|x| x.into());
8631                self
8632            }
8633        }
8634
8635        impl wkt::message::Message for SelectedAnswer {
8636            fn typename() -> &'static str {
8637                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer"
8638            }
8639        }
8640
8641        /// This field specifies the type of user answer.
8642        #[derive(Clone, Debug, PartialEq)]
8643        #[non_exhaustive]
8644        pub enum Type {
8645            /// This field specifies the incremental input text from the user during
8646            /// the conversational search.
8647            TextAnswer(std::string::String),
8648            /// Optional. This field specifies the selected answer during the
8649            /// conversational search. This should be a subset of
8650            /// [ConversationalSearchResponse.followup_question.suggested_answers][].
8651            SelectedAnswer(
8652                std::boxed::Box<
8653                    crate::model::conversational_search_request::user_answer::SelectedAnswer,
8654                >,
8655            ),
8656        }
8657    }
8658
8659    /// This field specifies all conversational filtering related parameters
8660    /// addition to conversational retail search.
8661    #[derive(Clone, Default, PartialEq)]
8662    #[non_exhaustive]
8663    pub struct ConversationalFilteringSpec {
8664        /// Optional. This field is deprecated. Please use
8665        /// [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]
8666        /// instead.
8667        ///
8668        /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]: crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode
8669        #[deprecated]
8670        pub enable_conversational_filtering: bool,
8671
8672        /// Optional. This field specifies the current user answer during the
8673        /// conversational filtering search. It can be either user selected from
8674        /// suggested answers or user input plain text.
8675        pub user_answer:
8676            std::option::Option<crate::model::conversational_search_request::UserAnswer>,
8677
8678        /// Optional. Mode to control Conversational Filtering.
8679        /// Defaults to
8680        /// [Mode.DISABLED][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]
8681        /// if it's unset.
8682        ///
8683        /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]: crate::model::conversational_search_request::conversational_filtering_spec::Mode::Disabled
8684        pub conversational_filtering_mode:
8685            crate::model::conversational_search_request::conversational_filtering_spec::Mode,
8686
8687        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8688    }
8689
8690    impl ConversationalFilteringSpec {
8691        pub fn new() -> Self {
8692            std::default::Default::default()
8693        }
8694
8695        /// Sets the value of [enable_conversational_filtering][crate::model::conversational_search_request::ConversationalFilteringSpec::enable_conversational_filtering].
8696        ///
8697        /// # Example
8698        /// ```ignore,no_run
8699        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8700        /// let x = ConversationalFilteringSpec::new().set_enable_conversational_filtering(true);
8701        /// ```
8702        #[deprecated]
8703        pub fn set_enable_conversational_filtering<T: std::convert::Into<bool>>(
8704            mut self,
8705            v: T,
8706        ) -> Self {
8707            self.enable_conversational_filtering = v.into();
8708            self
8709        }
8710
8711        /// Sets the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8712        ///
8713        /// # Example
8714        /// ```ignore,no_run
8715        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8716        /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8717        /// let x = ConversationalFilteringSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
8718        /// ```
8719        pub fn set_user_answer<T>(mut self, v: T) -> Self
8720        where
8721            T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8722        {
8723            self.user_answer = std::option::Option::Some(v.into());
8724            self
8725        }
8726
8727        /// Sets or clears the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8728        ///
8729        /// # Example
8730        /// ```ignore,no_run
8731        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8732        /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8733        /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
8734        /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
8735        /// ```
8736        pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
8737        where
8738            T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8739        {
8740            self.user_answer = v.map(|x| x.into());
8741            self
8742        }
8743
8744        /// Sets the value of [conversational_filtering_mode][crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode].
8745        ///
8746        /// # Example
8747        /// ```ignore,no_run
8748        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8749        /// use google_cloud_retail_v2::model::conversational_search_request::conversational_filtering_spec::Mode;
8750        /// let x0 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Disabled);
8751        /// let x1 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Enabled);
8752        /// let x2 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::ConversationalFilterOnly);
8753        /// ```
8754        pub fn set_conversational_filtering_mode<T: std::convert::Into<crate::model::conversational_search_request::conversational_filtering_spec::Mode>>(mut self, v: T) -> Self{
8755            self.conversational_filtering_mode = v.into();
8756            self
8757        }
8758    }
8759
8760    impl wkt::message::Message for ConversationalFilteringSpec {
8761        fn typename() -> &'static str {
8762            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec"
8763        }
8764    }
8765
8766    /// Defines additional types related to [ConversationalFilteringSpec].
8767    pub mod conversational_filtering_spec {
8768        #[allow(unused_imports)]
8769        use super::*;
8770
8771        /// Enum to control Conversational Filtering mode.
8772        /// A single conversation session including multiple turns supports modes for
8773        /// Conversational Search OR Conversational Filtering without
8774        /// Conversational Search, but not both.
8775        ///
8776        /// # Working with unknown values
8777        ///
8778        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8779        /// additional enum variants at any time. Adding new variants is not considered
8780        /// a breaking change. Applications should write their code in anticipation of:
8781        ///
8782        /// - New values appearing in future releases of the client library, **and**
8783        /// - New values received dynamically, without application changes.
8784        ///
8785        /// Please consult the [Working with enums] section in the user guide for some
8786        /// guidelines.
8787        ///
8788        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8789        #[derive(Clone, Debug, PartialEq)]
8790        #[non_exhaustive]
8791        pub enum Mode {
8792            /// Default value.
8793            Unspecified,
8794            /// Disables Conversational Filtering when using Conversational Search.
8795            Disabled,
8796            /// Enables Conversational Filtering when using Conversational Search.
8797            Enabled,
8798            /// Enables Conversational Filtering without Conversational Search.
8799            ConversationalFilterOnly,
8800            /// If set, the enum was initialized with an unknown value.
8801            ///
8802            /// Applications can examine the value using [Mode::value] or
8803            /// [Mode::name].
8804            UnknownValue(mode::UnknownValue),
8805        }
8806
8807        #[doc(hidden)]
8808        pub mod mode {
8809            #[allow(unused_imports)]
8810            use super::*;
8811            #[derive(Clone, Debug, PartialEq)]
8812            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8813        }
8814
8815        impl Mode {
8816            /// Gets the enum value.
8817            ///
8818            /// Returns `None` if the enum contains an unknown value deserialized from
8819            /// the string representation of enums.
8820            pub fn value(&self) -> std::option::Option<i32> {
8821                match self {
8822                    Self::Unspecified => std::option::Option::Some(0),
8823                    Self::Disabled => std::option::Option::Some(1),
8824                    Self::Enabled => std::option::Option::Some(2),
8825                    Self::ConversationalFilterOnly => std::option::Option::Some(3),
8826                    Self::UnknownValue(u) => u.0.value(),
8827                }
8828            }
8829
8830            /// Gets the enum value as a string.
8831            ///
8832            /// Returns `None` if the enum contains an unknown value deserialized from
8833            /// the integer representation of enums.
8834            pub fn name(&self) -> std::option::Option<&str> {
8835                match self {
8836                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
8837                    Self::Disabled => std::option::Option::Some("DISABLED"),
8838                    Self::Enabled => std::option::Option::Some("ENABLED"),
8839                    Self::ConversationalFilterOnly => {
8840                        std::option::Option::Some("CONVERSATIONAL_FILTER_ONLY")
8841                    }
8842                    Self::UnknownValue(u) => u.0.name(),
8843                }
8844            }
8845        }
8846
8847        impl std::default::Default for Mode {
8848            fn default() -> Self {
8849                use std::convert::From;
8850                Self::from(0)
8851            }
8852        }
8853
8854        impl std::fmt::Display for Mode {
8855            fn fmt(
8856                &self,
8857                f: &mut std::fmt::Formatter<'_>,
8858            ) -> std::result::Result<(), std::fmt::Error> {
8859                wkt::internal::display_enum(f, self.name(), self.value())
8860            }
8861        }
8862
8863        impl std::convert::From<i32> for Mode {
8864            fn from(value: i32) -> Self {
8865                match value {
8866                    0 => Self::Unspecified,
8867                    1 => Self::Disabled,
8868                    2 => Self::Enabled,
8869                    3 => Self::ConversationalFilterOnly,
8870                    _ => Self::UnknownValue(mode::UnknownValue(
8871                        wkt::internal::UnknownEnumValue::Integer(value),
8872                    )),
8873                }
8874            }
8875        }
8876
8877        impl std::convert::From<&str> for Mode {
8878            fn from(value: &str) -> Self {
8879                use std::string::ToString;
8880                match value {
8881                    "MODE_UNSPECIFIED" => Self::Unspecified,
8882                    "DISABLED" => Self::Disabled,
8883                    "ENABLED" => Self::Enabled,
8884                    "CONVERSATIONAL_FILTER_ONLY" => Self::ConversationalFilterOnly,
8885                    _ => Self::UnknownValue(mode::UnknownValue(
8886                        wkt::internal::UnknownEnumValue::String(value.to_string()),
8887                    )),
8888                }
8889            }
8890        }
8891
8892        impl serde::ser::Serialize for Mode {
8893            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8894            where
8895                S: serde::Serializer,
8896            {
8897                match self {
8898                    Self::Unspecified => serializer.serialize_i32(0),
8899                    Self::Disabled => serializer.serialize_i32(1),
8900                    Self::Enabled => serializer.serialize_i32(2),
8901                    Self::ConversationalFilterOnly => serializer.serialize_i32(3),
8902                    Self::UnknownValue(u) => u.0.serialize(serializer),
8903                }
8904            }
8905        }
8906
8907        impl<'de> serde::de::Deserialize<'de> for Mode {
8908            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8909            where
8910                D: serde::Deserializer<'de>,
8911            {
8912                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
8913                    ".google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode"))
8914            }
8915        }
8916    }
8917}
8918
8919/// Response message for
8920/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
8921/// method.
8922#[derive(Clone, Default, PartialEq)]
8923#[non_exhaustive]
8924pub struct ConversationalSearchResponse {
8925    /// The types Retail classifies the search query as.
8926    ///
8927    /// Supported values are:
8928    ///
8929    /// - "ORDER_SUPPORT"
8930    /// - "SIMPLE_PRODUCT_SEARCH"
8931    /// - "INTENT_REFINEMENT"
8932    /// - "PRODUCT_DETAILS"
8933    /// - "PRODUCT_COMPARISON"
8934    /// - "DEALS_AND_COUPONS"
8935    /// - "STORE_RELEVANT"
8936    /// - "BLOCKLISTED"
8937    /// - "BEST_PRODUCT"
8938    /// - "RETAIL_SUPPORT"
8939    /// - "DISABLED"
8940    pub user_query_types: std::vec::Vec<std::string::String>,
8941
8942    /// The conversational answer-based text response generated by the Server.
8943    pub conversational_text_response: std::string::String,
8944
8945    /// The conversational followup question generated for Intent refinement.
8946    pub followup_question:
8947        std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
8948
8949    /// Conversation UUID. This field will be stored in client side storage to
8950    /// maintain the conversation session with server and will be used for next
8951    /// search request's
8952    /// [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]
8953    /// to restore conversation state in server.
8954    ///
8955    /// [google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]: crate::model::ConversationalSearchRequest::conversation_id
8956    pub conversation_id: std::string::String,
8957
8958    /// The proposed refined search queries. They can be used to fetch the relevant
8959    /// search results. When using CONVERSATIONAL_FILTER_ONLY mode, the
8960    /// refined_query from search response will be populated here.
8961    pub refined_search: std::vec::Vec<crate::model::conversational_search_response::RefinedSearch>,
8962
8963    /// This field specifies all related information that is needed on client
8964    /// side for UI rendering of conversational filtering search.
8965    pub conversational_filtering_result: std::option::Option<
8966        crate::model::conversational_search_response::ConversationalFilteringResult,
8967    >,
8968
8969    /// Output only. The state of the response generation.
8970    pub state: crate::model::conversational_search_response::State,
8971
8972    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8973}
8974
8975impl ConversationalSearchResponse {
8976    pub fn new() -> Self {
8977        std::default::Default::default()
8978    }
8979
8980    /// Sets the value of [user_query_types][crate::model::ConversationalSearchResponse::user_query_types].
8981    ///
8982    /// # Example
8983    /// ```ignore,no_run
8984    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
8985    /// let x = ConversationalSearchResponse::new().set_user_query_types(["a", "b", "c"]);
8986    /// ```
8987    pub fn set_user_query_types<T, V>(mut self, v: T) -> Self
8988    where
8989        T: std::iter::IntoIterator<Item = V>,
8990        V: std::convert::Into<std::string::String>,
8991    {
8992        use std::iter::Iterator;
8993        self.user_query_types = v.into_iter().map(|i| i.into()).collect();
8994        self
8995    }
8996
8997    /// Sets the value of [conversational_text_response][crate::model::ConversationalSearchResponse::conversational_text_response].
8998    ///
8999    /// # Example
9000    /// ```ignore,no_run
9001    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9002    /// let x = ConversationalSearchResponse::new().set_conversational_text_response("example");
9003    /// ```
9004    pub fn set_conversational_text_response<T: std::convert::Into<std::string::String>>(
9005        mut self,
9006        v: T,
9007    ) -> Self {
9008        self.conversational_text_response = v.into();
9009        self
9010    }
9011
9012    /// Sets the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9013    ///
9014    /// # Example
9015    /// ```ignore,no_run
9016    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9017    /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9018    /// let x = ConversationalSearchResponse::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9019    /// ```
9020    pub fn set_followup_question<T>(mut self, v: T) -> Self
9021    where
9022        T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9023    {
9024        self.followup_question = std::option::Option::Some(v.into());
9025        self
9026    }
9027
9028    /// Sets or clears the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9029    ///
9030    /// # Example
9031    /// ```ignore,no_run
9032    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9033    /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9034    /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9035    /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9036    /// ```
9037    pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9038    where
9039        T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9040    {
9041        self.followup_question = v.map(|x| x.into());
9042        self
9043    }
9044
9045    /// Sets the value of [conversation_id][crate::model::ConversationalSearchResponse::conversation_id].
9046    ///
9047    /// # Example
9048    /// ```ignore,no_run
9049    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9050    /// let x = ConversationalSearchResponse::new().set_conversation_id("example");
9051    /// ```
9052    pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9053        self.conversation_id = v.into();
9054        self
9055    }
9056
9057    /// Sets the value of [refined_search][crate::model::ConversationalSearchResponse::refined_search].
9058    ///
9059    /// # Example
9060    /// ```ignore,no_run
9061    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9062    /// use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9063    /// let x = ConversationalSearchResponse::new()
9064    ///     .set_refined_search([
9065    ///         RefinedSearch::default()/* use setters */,
9066    ///         RefinedSearch::default()/* use (different) setters */,
9067    ///     ]);
9068    /// ```
9069    pub fn set_refined_search<T, V>(mut self, v: T) -> Self
9070    where
9071        T: std::iter::IntoIterator<Item = V>,
9072        V: std::convert::Into<crate::model::conversational_search_response::RefinedSearch>,
9073    {
9074        use std::iter::Iterator;
9075        self.refined_search = v.into_iter().map(|i| i.into()).collect();
9076        self
9077    }
9078
9079    /// Sets the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9080    ///
9081    /// # Example
9082    /// ```ignore,no_run
9083    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9084    /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9085    /// let x = ConversationalSearchResponse::new().set_conversational_filtering_result(ConversationalFilteringResult::default()/* use setters */);
9086    /// ```
9087    pub fn set_conversational_filtering_result<T>(mut self, v: T) -> Self
9088    where
9089        T: std::convert::Into<
9090                crate::model::conversational_search_response::ConversationalFilteringResult,
9091            >,
9092    {
9093        self.conversational_filtering_result = std::option::Option::Some(v.into());
9094        self
9095    }
9096
9097    /// Sets or clears the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9098    ///
9099    /// # Example
9100    /// ```ignore,no_run
9101    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9102    /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9103    /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(Some(ConversationalFilteringResult::default()/* use setters */));
9104    /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(None::<ConversationalFilteringResult>);
9105    /// ```
9106    pub fn set_or_clear_conversational_filtering_result<T>(
9107        mut self,
9108        v: std::option::Option<T>,
9109    ) -> Self
9110    where
9111        T: std::convert::Into<
9112                crate::model::conversational_search_response::ConversationalFilteringResult,
9113            >,
9114    {
9115        self.conversational_filtering_result = v.map(|x| x.into());
9116        self
9117    }
9118
9119    /// Sets the value of [state][crate::model::ConversationalSearchResponse::state].
9120    ///
9121    /// # Example
9122    /// ```ignore,no_run
9123    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9124    /// use google_cloud_retail_v2::model::conversational_search_response::State;
9125    /// let x0 = ConversationalSearchResponse::new().set_state(State::Streaming);
9126    /// let x1 = ConversationalSearchResponse::new().set_state(State::Succeeded);
9127    /// ```
9128    pub fn set_state<T: std::convert::Into<crate::model::conversational_search_response::State>>(
9129        mut self,
9130        v: T,
9131    ) -> Self {
9132        self.state = v.into();
9133        self
9134    }
9135}
9136
9137impl wkt::message::Message for ConversationalSearchResponse {
9138    fn typename() -> &'static str {
9139        "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse"
9140    }
9141}
9142
9143/// Defines additional types related to [ConversationalSearchResponse].
9144pub mod conversational_search_response {
9145    #[allow(unused_imports)]
9146    use super::*;
9147
9148    /// The conversational followup question generated for Intent refinement.
9149    #[derive(Clone, Default, PartialEq)]
9150    #[non_exhaustive]
9151    pub struct FollowupQuestion {
9152        /// The conversational followup question generated for Intent refinement.
9153        pub followup_question: std::string::String,
9154
9155        /// The answer options provided to client for the follow-up question.
9156        pub suggested_answers: std::vec::Vec<
9157            crate::model::conversational_search_response::followup_question::SuggestedAnswer,
9158        >,
9159
9160        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9161    }
9162
9163    impl FollowupQuestion {
9164        pub fn new() -> Self {
9165            std::default::Default::default()
9166        }
9167
9168        /// Sets the value of [followup_question][crate::model::conversational_search_response::FollowupQuestion::followup_question].
9169        ///
9170        /// # Example
9171        /// ```ignore,no_run
9172        /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9173        /// let x = FollowupQuestion::new().set_followup_question("example");
9174        /// ```
9175        pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
9176            mut self,
9177            v: T,
9178        ) -> Self {
9179            self.followup_question = v.into();
9180            self
9181        }
9182
9183        /// Sets the value of [suggested_answers][crate::model::conversational_search_response::FollowupQuestion::suggested_answers].
9184        ///
9185        /// # Example
9186        /// ```ignore,no_run
9187        /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9188        /// use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9189        /// let x = FollowupQuestion::new()
9190        ///     .set_suggested_answers([
9191        ///         SuggestedAnswer::default()/* use setters */,
9192        ///         SuggestedAnswer::default()/* use (different) setters */,
9193        ///     ]);
9194        /// ```
9195        pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
9196        where
9197            T: std::iter::IntoIterator<Item = V>,
9198            V: std::convert::Into<crate::model::conversational_search_response::followup_question::SuggestedAnswer>
9199        {
9200            use std::iter::Iterator;
9201            self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
9202            self
9203        }
9204    }
9205
9206    impl wkt::message::Message for FollowupQuestion {
9207        fn typename() -> &'static str {
9208            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion"
9209        }
9210    }
9211
9212    /// Defines additional types related to [FollowupQuestion].
9213    pub mod followup_question {
9214        #[allow(unused_imports)]
9215        use super::*;
9216
9217        /// Suggested answers to the follow-up question.
9218        /// If it's numerical attribute, only ProductAttributeInterval will be set.
9219        /// If it's textual attribute, only productAttributeValue will be set.
9220        #[derive(Clone, Default, PartialEq)]
9221        #[non_exhaustive]
9222        pub struct SuggestedAnswer {
9223            /// Product attribute value, including an attribute key and an
9224            /// attribute value. Other types can be added here in the future.
9225            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9226
9227            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9228        }
9229
9230        impl SuggestedAnswer {
9231            pub fn new() -> Self {
9232                std::default::Default::default()
9233            }
9234
9235            /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9236            ///
9237            /// # Example
9238            /// ```ignore,no_run
9239            /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9240            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9241            /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9242            /// ```
9243            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9244            where
9245                T: std::convert::Into<crate::model::ProductAttributeValue>,
9246            {
9247                self.product_attribute_value = std::option::Option::Some(v.into());
9248                self
9249            }
9250
9251            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9252            ///
9253            /// # Example
9254            /// ```ignore,no_run
9255            /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9256            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9257            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9258            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9259            /// ```
9260            pub fn set_or_clear_product_attribute_value<T>(
9261                mut self,
9262                v: std::option::Option<T>,
9263            ) -> Self
9264            where
9265                T: std::convert::Into<crate::model::ProductAttributeValue>,
9266            {
9267                self.product_attribute_value = v.map(|x| x.into());
9268                self
9269            }
9270        }
9271
9272        impl wkt::message::Message for SuggestedAnswer {
9273            fn typename() -> &'static str {
9274                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer"
9275            }
9276        }
9277    }
9278
9279    /// The proposed refined search for intent-refinement/bundled shopping
9280    /// conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the
9281    /// refined_query from search response will be populated here.
9282    #[derive(Clone, Default, PartialEq)]
9283    #[non_exhaustive]
9284    pub struct RefinedSearch {
9285        /// The query to be used for search.
9286        pub query: std::string::String,
9287
9288        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9289    }
9290
9291    impl RefinedSearch {
9292        pub fn new() -> Self {
9293            std::default::Default::default()
9294        }
9295
9296        /// Sets the value of [query][crate::model::conversational_search_response::RefinedSearch::query].
9297        ///
9298        /// # Example
9299        /// ```ignore,no_run
9300        /// # use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9301        /// let x = RefinedSearch::new().set_query("example");
9302        /// ```
9303        pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9304            self.query = v.into();
9305            self
9306        }
9307    }
9308
9309    impl wkt::message::Message for RefinedSearch {
9310        fn typename() -> &'static str {
9311            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch"
9312        }
9313    }
9314
9315    /// This field specifies all related information that is needed on client
9316    /// side for UI rendering of conversational filtering search.
9317    #[derive(Clone, Default, PartialEq)]
9318    #[non_exhaustive]
9319    pub struct ConversationalFilteringResult {
9320
9321        /// The conversational filtering question.
9322        pub followup_question: std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9323
9324        /// This is the incremental additional filters implied from the current
9325        /// user answer. User should add the suggested addition filters to the
9326        /// previous [ConversationalSearchRequest.search_params.filter][] and
9327        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],  and
9328        /// use the merged filter in the follow up requests.
9329        ///
9330        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
9331        pub additional_filter: std::option::Option<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>,
9332
9333        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9334    }
9335
9336    impl ConversationalFilteringResult {
9337        pub fn new() -> Self {
9338            std::default::Default::default()
9339        }
9340
9341        /// Sets the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9342        ///
9343        /// # Example
9344        /// ```ignore,no_run
9345        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9346        /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9347        /// let x = ConversationalFilteringResult::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9348        /// ```
9349        pub fn set_followup_question<T>(mut self, v: T) -> Self
9350        where
9351            T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9352        {
9353            self.followup_question = std::option::Option::Some(v.into());
9354            self
9355        }
9356
9357        /// Sets or clears the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9358        ///
9359        /// # Example
9360        /// ```ignore,no_run
9361        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9362        /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9363        /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9364        /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9365        /// ```
9366        pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9367        where
9368            T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9369        {
9370            self.followup_question = v.map(|x| x.into());
9371            self
9372        }
9373
9374        /// Sets the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9375        ///
9376        /// # Example
9377        /// ```ignore,no_run
9378        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9379        /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9380        /// let x = ConversationalFilteringResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
9381        /// ```
9382        pub fn set_additional_filter<T>(mut self, v: T) -> Self
9383        where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9384        {
9385            self.additional_filter = std::option::Option::Some(v.into());
9386            self
9387        }
9388
9389        /// Sets or clears the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9390        ///
9391        /// # Example
9392        /// ```ignore,no_run
9393        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9394        /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9395        /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
9396        /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
9397        /// ```
9398        pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
9399        where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9400        {
9401            self.additional_filter = v.map(|x| x.into());
9402            self
9403        }
9404    }
9405
9406    impl wkt::message::Message for ConversationalFilteringResult {
9407        fn typename() -> &'static str {
9408            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult"
9409        }
9410    }
9411
9412    /// Defines additional types related to [ConversationalFilteringResult].
9413    pub mod conversational_filtering_result {
9414        #[allow(unused_imports)]
9415        use super::*;
9416
9417        /// Additional filter that client side need to apply.
9418        #[derive(Clone, Default, PartialEq)]
9419        #[non_exhaustive]
9420        pub struct AdditionalFilter {
9421            /// Product attribute value, including an attribute key and an
9422            /// attribute value. Other types can be added here in the future.
9423            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9424
9425            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9426        }
9427
9428        impl AdditionalFilter {
9429            pub fn new() -> Self {
9430                std::default::Default::default()
9431            }
9432
9433            /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9434            ///
9435            /// # Example
9436            /// ```ignore,no_run
9437            /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9438            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9439            /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9440            /// ```
9441            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9442            where
9443                T: std::convert::Into<crate::model::ProductAttributeValue>,
9444            {
9445                self.product_attribute_value = std::option::Option::Some(v.into());
9446                self
9447            }
9448
9449            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9450            ///
9451            /// # Example
9452            /// ```ignore,no_run
9453            /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9454            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9455            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9456            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9457            /// ```
9458            pub fn set_or_clear_product_attribute_value<T>(
9459                mut self,
9460                v: std::option::Option<T>,
9461            ) -> Self
9462            where
9463                T: std::convert::Into<crate::model::ProductAttributeValue>,
9464            {
9465                self.product_attribute_value = v.map(|x| x.into());
9466                self
9467            }
9468        }
9469
9470        impl wkt::message::Message for AdditionalFilter {
9471            fn typename() -> &'static str {
9472                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter"
9473            }
9474        }
9475    }
9476
9477    /// The state of the response generation.
9478    ///
9479    /// # Working with unknown values
9480    ///
9481    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9482    /// additional enum variants at any time. Adding new variants is not considered
9483    /// a breaking change. Applications should write their code in anticipation of:
9484    ///
9485    /// - New values appearing in future releases of the client library, **and**
9486    /// - New values received dynamically, without application changes.
9487    ///
9488    /// Please consult the [Working with enums] section in the user guide for some
9489    /// guidelines.
9490    ///
9491    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9492    #[derive(Clone, Debug, PartialEq)]
9493    #[non_exhaustive]
9494    pub enum State {
9495        /// Unknown.
9496        Unspecified,
9497        /// Response generation is being streamed.
9498        Streaming,
9499        /// Response generation has succeeded.
9500        Succeeded,
9501        /// If set, the enum was initialized with an unknown value.
9502        ///
9503        /// Applications can examine the value using [State::value] or
9504        /// [State::name].
9505        UnknownValue(state::UnknownValue),
9506    }
9507
9508    #[doc(hidden)]
9509    pub mod state {
9510        #[allow(unused_imports)]
9511        use super::*;
9512        #[derive(Clone, Debug, PartialEq)]
9513        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9514    }
9515
9516    impl State {
9517        /// Gets the enum value.
9518        ///
9519        /// Returns `None` if the enum contains an unknown value deserialized from
9520        /// the string representation of enums.
9521        pub fn value(&self) -> std::option::Option<i32> {
9522            match self {
9523                Self::Unspecified => std::option::Option::Some(0),
9524                Self::Streaming => std::option::Option::Some(1),
9525                Self::Succeeded => std::option::Option::Some(2),
9526                Self::UnknownValue(u) => u.0.value(),
9527            }
9528        }
9529
9530        /// Gets the enum value as a string.
9531        ///
9532        /// Returns `None` if the enum contains an unknown value deserialized from
9533        /// the integer representation of enums.
9534        pub fn name(&self) -> std::option::Option<&str> {
9535            match self {
9536                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9537                Self::Streaming => std::option::Option::Some("STREAMING"),
9538                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9539                Self::UnknownValue(u) => u.0.name(),
9540            }
9541        }
9542    }
9543
9544    impl std::default::Default for State {
9545        fn default() -> Self {
9546            use std::convert::From;
9547            Self::from(0)
9548        }
9549    }
9550
9551    impl std::fmt::Display for State {
9552        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9553            wkt::internal::display_enum(f, self.name(), self.value())
9554        }
9555    }
9556
9557    impl std::convert::From<i32> for State {
9558        fn from(value: i32) -> Self {
9559            match value {
9560                0 => Self::Unspecified,
9561                1 => Self::Streaming,
9562                2 => Self::Succeeded,
9563                _ => Self::UnknownValue(state::UnknownValue(
9564                    wkt::internal::UnknownEnumValue::Integer(value),
9565                )),
9566            }
9567        }
9568    }
9569
9570    impl std::convert::From<&str> for State {
9571        fn from(value: &str) -> Self {
9572            use std::string::ToString;
9573            match value {
9574                "STATE_UNSPECIFIED" => Self::Unspecified,
9575                "STREAMING" => Self::Streaming,
9576                "SUCCEEDED" => Self::Succeeded,
9577                _ => Self::UnknownValue(state::UnknownValue(
9578                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9579                )),
9580            }
9581        }
9582    }
9583
9584    impl serde::ser::Serialize for State {
9585        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9586        where
9587            S: serde::Serializer,
9588        {
9589            match self {
9590                Self::Unspecified => serializer.serialize_i32(0),
9591                Self::Streaming => serializer.serialize_i32(1),
9592                Self::Succeeded => serializer.serialize_i32(2),
9593                Self::UnknownValue(u) => u.0.serialize(serializer),
9594            }
9595        }
9596    }
9597
9598    impl<'de> serde::de::Deserialize<'de> for State {
9599        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9600        where
9601            D: serde::Deserializer<'de>,
9602        {
9603            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9604                ".google.cloud.retail.v2.ConversationalSearchResponse.State",
9605            ))
9606        }
9607    }
9608}
9609
9610/// The output configuration setting.
9611#[derive(Clone, Default, PartialEq)]
9612#[non_exhaustive]
9613pub struct OutputConfig {
9614    /// The configuration of destination for holding output data.
9615    pub destination: std::option::Option<crate::model::output_config::Destination>,
9616
9617    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9618}
9619
9620impl OutputConfig {
9621    pub fn new() -> Self {
9622        std::default::Default::default()
9623    }
9624
9625    /// Sets the value of [destination][crate::model::OutputConfig::destination].
9626    ///
9627    /// Note that all the setters affecting `destination` are mutually
9628    /// exclusive.
9629    ///
9630    /// # Example
9631    /// ```ignore,no_run
9632    /// # use google_cloud_retail_v2::model::OutputConfig;
9633    /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9634    /// let x = OutputConfig::new().set_destination(Some(
9635    ///     google_cloud_retail_v2::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
9636    /// ```
9637    pub fn set_destination<
9638        T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
9639    >(
9640        mut self,
9641        v: T,
9642    ) -> Self {
9643        self.destination = v.into();
9644        self
9645    }
9646
9647    /// The value of [destination][crate::model::OutputConfig::destination]
9648    /// if it holds a `GcsDestination`, `None` if the field is not set or
9649    /// holds a different branch.
9650    pub fn gcs_destination(
9651        &self,
9652    ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::GcsDestination>> {
9653        #[allow(unreachable_patterns)]
9654        self.destination.as_ref().and_then(|v| match v {
9655            crate::model::output_config::Destination::GcsDestination(v) => {
9656                std::option::Option::Some(v)
9657            }
9658            _ => std::option::Option::None,
9659        })
9660    }
9661
9662    /// Sets the value of [destination][crate::model::OutputConfig::destination]
9663    /// to hold a `GcsDestination`.
9664    ///
9665    /// Note that all the setters affecting `destination` are
9666    /// mutually exclusive.
9667    ///
9668    /// # Example
9669    /// ```ignore,no_run
9670    /// # use google_cloud_retail_v2::model::OutputConfig;
9671    /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9672    /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
9673    /// assert!(x.gcs_destination().is_some());
9674    /// assert!(x.bigquery_destination().is_none());
9675    /// ```
9676    pub fn set_gcs_destination<
9677        T: std::convert::Into<std::boxed::Box<crate::model::output_config::GcsDestination>>,
9678    >(
9679        mut self,
9680        v: T,
9681    ) -> Self {
9682        self.destination = std::option::Option::Some(
9683            crate::model::output_config::Destination::GcsDestination(v.into()),
9684        );
9685        self
9686    }
9687
9688    /// The value of [destination][crate::model::OutputConfig::destination]
9689    /// if it holds a `BigqueryDestination`, `None` if the field is not set or
9690    /// holds a different branch.
9691    pub fn bigquery_destination(
9692        &self,
9693    ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::BigQueryDestination>>
9694    {
9695        #[allow(unreachable_patterns)]
9696        self.destination.as_ref().and_then(|v| match v {
9697            crate::model::output_config::Destination::BigqueryDestination(v) => {
9698                std::option::Option::Some(v)
9699            }
9700            _ => std::option::Option::None,
9701        })
9702    }
9703
9704    /// Sets the value of [destination][crate::model::OutputConfig::destination]
9705    /// to hold a `BigqueryDestination`.
9706    ///
9707    /// Note that all the setters affecting `destination` are
9708    /// mutually exclusive.
9709    ///
9710    /// # Example
9711    /// ```ignore,no_run
9712    /// # use google_cloud_retail_v2::model::OutputConfig;
9713    /// use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9714    /// let x = OutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
9715    /// assert!(x.bigquery_destination().is_some());
9716    /// assert!(x.gcs_destination().is_none());
9717    /// ```
9718    pub fn set_bigquery_destination<
9719        T: std::convert::Into<std::boxed::Box<crate::model::output_config::BigQueryDestination>>,
9720    >(
9721        mut self,
9722        v: T,
9723    ) -> Self {
9724        self.destination = std::option::Option::Some(
9725            crate::model::output_config::Destination::BigqueryDestination(v.into()),
9726        );
9727        self
9728    }
9729}
9730
9731impl wkt::message::Message for OutputConfig {
9732    fn typename() -> &'static str {
9733        "type.googleapis.com/google.cloud.retail.v2.OutputConfig"
9734    }
9735}
9736
9737/// Defines additional types related to [OutputConfig].
9738pub mod output_config {
9739    #[allow(unused_imports)]
9740    use super::*;
9741
9742    /// The Google Cloud Storage output destination configuration.
9743    #[derive(Clone, Default, PartialEq)]
9744    #[non_exhaustive]
9745    pub struct GcsDestination {
9746        /// Required. The output uri prefix for saving output data to json files.
9747        /// Some mapping examples are as follows:
9748        /// output_uri_prefix         sample output(assuming the object is foo.json)
9749        /// ========================  =============================================
9750        /// gs://bucket/              gs://bucket/foo.json
9751        /// gs://bucket/folder/       gs://bucket/folder/foo.json
9752        /// gs://bucket/folder/item_  gs://bucket/folder/item_foo.json
9753        pub output_uri_prefix: std::string::String,
9754
9755        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9756    }
9757
9758    impl GcsDestination {
9759        pub fn new() -> Self {
9760            std::default::Default::default()
9761        }
9762
9763        /// Sets the value of [output_uri_prefix][crate::model::output_config::GcsDestination::output_uri_prefix].
9764        ///
9765        /// # Example
9766        /// ```ignore,no_run
9767        /// # use google_cloud_retail_v2::model::output_config::GcsDestination;
9768        /// let x = GcsDestination::new().set_output_uri_prefix("example");
9769        /// ```
9770        pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9771            mut self,
9772            v: T,
9773        ) -> Self {
9774            self.output_uri_prefix = v.into();
9775            self
9776        }
9777    }
9778
9779    impl wkt::message::Message for GcsDestination {
9780        fn typename() -> &'static str {
9781            "type.googleapis.com/google.cloud.retail.v2.OutputConfig.GcsDestination"
9782        }
9783    }
9784
9785    /// The BigQuery output destination configuration.
9786    #[derive(Clone, Default, PartialEq)]
9787    #[non_exhaustive]
9788    pub struct BigQueryDestination {
9789        /// Required. The ID of a BigQuery Dataset.
9790        pub dataset_id: std::string::String,
9791
9792        /// Required. The prefix of exported BigQuery tables.
9793        pub table_id_prefix: std::string::String,
9794
9795        /// Required. Describes the table type. The following values are supported:
9796        ///
9797        /// * `table`: A BigQuery native table.
9798        /// * `view`: A virtual table defined by a SQL query.
9799        pub table_type: std::string::String,
9800
9801        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9802    }
9803
9804    impl BigQueryDestination {
9805        pub fn new() -> Self {
9806            std::default::Default::default()
9807        }
9808
9809        /// Sets the value of [dataset_id][crate::model::output_config::BigQueryDestination::dataset_id].
9810        ///
9811        /// # Example
9812        /// ```ignore,no_run
9813        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9814        /// let x = BigQueryDestination::new().set_dataset_id("example");
9815        /// ```
9816        pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9817            self.dataset_id = v.into();
9818            self
9819        }
9820
9821        /// Sets the value of [table_id_prefix][crate::model::output_config::BigQueryDestination::table_id_prefix].
9822        ///
9823        /// # Example
9824        /// ```ignore,no_run
9825        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9826        /// let x = BigQueryDestination::new().set_table_id_prefix("example");
9827        /// ```
9828        pub fn set_table_id_prefix<T: std::convert::Into<std::string::String>>(
9829            mut self,
9830            v: T,
9831        ) -> Self {
9832            self.table_id_prefix = v.into();
9833            self
9834        }
9835
9836        /// Sets the value of [table_type][crate::model::output_config::BigQueryDestination::table_type].
9837        ///
9838        /// # Example
9839        /// ```ignore,no_run
9840        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9841        /// let x = BigQueryDestination::new().set_table_type("example");
9842        /// ```
9843        pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9844            self.table_type = v.into();
9845            self
9846        }
9847    }
9848
9849    impl wkt::message::Message for BigQueryDestination {
9850        fn typename() -> &'static str {
9851            "type.googleapis.com/google.cloud.retail.v2.OutputConfig.BigQueryDestination"
9852        }
9853    }
9854
9855    /// The configuration of destination for holding output data.
9856    #[derive(Clone, Debug, PartialEq)]
9857    #[non_exhaustive]
9858    pub enum Destination {
9859        /// The Google Cloud Storage location where the output is to be written to.
9860        GcsDestination(std::boxed::Box<crate::model::output_config::GcsDestination>),
9861        /// The BigQuery location where the output is to be written to.
9862        BigqueryDestination(std::boxed::Box<crate::model::output_config::BigQueryDestination>),
9863    }
9864}
9865
9866/// Configuration of destination for Export related errors.
9867#[derive(Clone, Default, PartialEq)]
9868#[non_exhaustive]
9869pub struct ExportErrorsConfig {
9870    /// Required. Errors destination.
9871    pub destination: std::option::Option<crate::model::export_errors_config::Destination>,
9872
9873    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9874}
9875
9876impl ExportErrorsConfig {
9877    pub fn new() -> Self {
9878        std::default::Default::default()
9879    }
9880
9881    /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination].
9882    ///
9883    /// Note that all the setters affecting `destination` are mutually
9884    /// exclusive.
9885    ///
9886    /// # Example
9887    /// ```ignore,no_run
9888    /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
9889    /// use google_cloud_retail_v2::model::export_errors_config::Destination;
9890    /// let x = ExportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
9891    /// ```
9892    pub fn set_destination<
9893        T: std::convert::Into<std::option::Option<crate::model::export_errors_config::Destination>>,
9894    >(
9895        mut self,
9896        v: T,
9897    ) -> Self {
9898        self.destination = v.into();
9899        self
9900    }
9901
9902    /// The value of [destination][crate::model::ExportErrorsConfig::destination]
9903    /// if it holds a `GcsPrefix`, `None` if the field is not set or
9904    /// holds a different branch.
9905    pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
9906        #[allow(unreachable_patterns)]
9907        self.destination.as_ref().and_then(|v| match v {
9908            crate::model::export_errors_config::Destination::GcsPrefix(v) => {
9909                std::option::Option::Some(v)
9910            }
9911            _ => std::option::Option::None,
9912        })
9913    }
9914
9915    /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination]
9916    /// to hold a `GcsPrefix`.
9917    ///
9918    /// Note that all the setters affecting `destination` are
9919    /// mutually exclusive.
9920    ///
9921    /// # Example
9922    /// ```ignore,no_run
9923    /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
9924    /// let x = ExportErrorsConfig::new().set_gcs_prefix("example");
9925    /// assert!(x.gcs_prefix().is_some());
9926    /// ```
9927    pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9928        self.destination = std::option::Option::Some(
9929            crate::model::export_errors_config::Destination::GcsPrefix(v.into()),
9930        );
9931        self
9932    }
9933}
9934
9935impl wkt::message::Message for ExportErrorsConfig {
9936    fn typename() -> &'static str {
9937        "type.googleapis.com/google.cloud.retail.v2.ExportErrorsConfig"
9938    }
9939}
9940
9941/// Defines additional types related to [ExportErrorsConfig].
9942pub mod export_errors_config {
9943    #[allow(unused_imports)]
9944    use super::*;
9945
9946    /// Required. Errors destination.
9947    #[derive(Clone, Debug, PartialEq)]
9948    #[non_exhaustive]
9949    pub enum Destination {
9950        /// Google Cloud Storage path for import errors. This must be an empty,
9951        /// existing Cloud Storage bucket. Export errors will be written to a file in
9952        /// this bucket, one per line, as a JSON-encoded
9953        /// `google.rpc.Status` message.
9954        GcsPrefix(std::string::String),
9955    }
9956}
9957
9958/// Request message for the `ExportAnalyticsMetrics` method.
9959#[derive(Clone, Default, PartialEq)]
9960#[non_exhaustive]
9961pub struct ExportAnalyticsMetricsRequest {
9962    /// Required. Full resource name of the parent catalog.
9963    /// Expected format: `projects/*/locations/*/catalogs/*`
9964    pub catalog: std::string::String,
9965
9966    /// Required. The output location of the data.
9967    pub output_config: std::option::Option<crate::model::OutputConfig>,
9968
9969    /// A filtering expression to specify restrictions on returned metrics.
9970    /// The expression is a sequence of terms. Each term applies a restriction to
9971    /// the returned metrics. Use this expression to restrict results to a
9972    /// specific time range.
9973    ///
9974    /// Currently we expect only one types of fields:
9975    ///
9976    /// * `timestamp`: This can be specified twice, once with a
9977    ///   less than operator and once with a greater than operator. The
9978    ///   `timestamp` restriction should result in one, contiguous, valid,
9979    ///   `timestamp` range.
9980    ///
9981    /// Some examples of valid filters expressions:
9982    ///
9983    /// * Example 1: `timestamp > "2012-04-23T18:25:43.511Z"
9984    ///   timestamp < "2012-04-23T18:30:43.511Z"`
9985    /// * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"`
9986    pub filter: std::string::String,
9987
9988    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9989}
9990
9991impl ExportAnalyticsMetricsRequest {
9992    pub fn new() -> Self {
9993        std::default::Default::default()
9994    }
9995
9996    /// Sets the value of [catalog][crate::model::ExportAnalyticsMetricsRequest::catalog].
9997    ///
9998    /// # Example
9999    /// ```ignore,no_run
10000    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10001    /// let x = ExportAnalyticsMetricsRequest::new().set_catalog("example");
10002    /// ```
10003    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10004        self.catalog = v.into();
10005        self
10006    }
10007
10008    /// Sets the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10009    ///
10010    /// # Example
10011    /// ```ignore,no_run
10012    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10013    /// use google_cloud_retail_v2::model::OutputConfig;
10014    /// let x = ExportAnalyticsMetricsRequest::new().set_output_config(OutputConfig::default()/* use setters */);
10015    /// ```
10016    pub fn set_output_config<T>(mut self, v: T) -> Self
10017    where
10018        T: std::convert::Into<crate::model::OutputConfig>,
10019    {
10020        self.output_config = std::option::Option::Some(v.into());
10021        self
10022    }
10023
10024    /// Sets or clears the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10025    ///
10026    /// # Example
10027    /// ```ignore,no_run
10028    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10029    /// use google_cloud_retail_v2::model::OutputConfig;
10030    /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
10031    /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(None::<OutputConfig>);
10032    /// ```
10033    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10034    where
10035        T: std::convert::Into<crate::model::OutputConfig>,
10036    {
10037        self.output_config = v.map(|x| x.into());
10038        self
10039    }
10040
10041    /// Sets the value of [filter][crate::model::ExportAnalyticsMetricsRequest::filter].
10042    ///
10043    /// # Example
10044    /// ```ignore,no_run
10045    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10046    /// let x = ExportAnalyticsMetricsRequest::new().set_filter("example");
10047    /// ```
10048    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10049        self.filter = v.into();
10050        self
10051    }
10052}
10053
10054impl wkt::message::Message for ExportAnalyticsMetricsRequest {
10055    fn typename() -> &'static str {
10056        "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"
10057    }
10058}
10059
10060/// Metadata related to the progress of the Export operation. This is
10061/// returned by the google.longrunning.Operation.metadata field.
10062#[derive(Clone, Default, PartialEq)]
10063#[non_exhaustive]
10064pub struct ExportMetadata {
10065    /// Operation create time.
10066    pub create_time: std::option::Option<wkt::Timestamp>,
10067
10068    /// Operation last update time. If the operation is done, this is also the
10069    /// finish time.
10070    pub update_time: std::option::Option<wkt::Timestamp>,
10071
10072    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10073}
10074
10075impl ExportMetadata {
10076    pub fn new() -> Self {
10077        std::default::Default::default()
10078    }
10079
10080    /// Sets the value of [create_time][crate::model::ExportMetadata::create_time].
10081    ///
10082    /// # Example
10083    /// ```ignore,no_run
10084    /// # use google_cloud_retail_v2::model::ExportMetadata;
10085    /// use wkt::Timestamp;
10086    /// let x = ExportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10087    /// ```
10088    pub fn set_create_time<T>(mut self, v: T) -> Self
10089    where
10090        T: std::convert::Into<wkt::Timestamp>,
10091    {
10092        self.create_time = std::option::Option::Some(v.into());
10093        self
10094    }
10095
10096    /// Sets or clears the value of [create_time][crate::model::ExportMetadata::create_time].
10097    ///
10098    /// # Example
10099    /// ```ignore,no_run
10100    /// # use google_cloud_retail_v2::model::ExportMetadata;
10101    /// use wkt::Timestamp;
10102    /// let x = ExportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10103    /// let x = ExportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10104    /// ```
10105    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10106    where
10107        T: std::convert::Into<wkt::Timestamp>,
10108    {
10109        self.create_time = v.map(|x| x.into());
10110        self
10111    }
10112
10113    /// Sets the value of [update_time][crate::model::ExportMetadata::update_time].
10114    ///
10115    /// # Example
10116    /// ```ignore,no_run
10117    /// # use google_cloud_retail_v2::model::ExportMetadata;
10118    /// use wkt::Timestamp;
10119    /// let x = ExportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10120    /// ```
10121    pub fn set_update_time<T>(mut self, v: T) -> Self
10122    where
10123        T: std::convert::Into<wkt::Timestamp>,
10124    {
10125        self.update_time = std::option::Option::Some(v.into());
10126        self
10127    }
10128
10129    /// Sets or clears the value of [update_time][crate::model::ExportMetadata::update_time].
10130    ///
10131    /// # Example
10132    /// ```ignore,no_run
10133    /// # use google_cloud_retail_v2::model::ExportMetadata;
10134    /// use wkt::Timestamp;
10135    /// let x = ExportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10136    /// let x = ExportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10137    /// ```
10138    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10139    where
10140        T: std::convert::Into<wkt::Timestamp>,
10141    {
10142        self.update_time = v.map(|x| x.into());
10143        self
10144    }
10145}
10146
10147impl wkt::message::Message for ExportMetadata {
10148    fn typename() -> &'static str {
10149        "type.googleapis.com/google.cloud.retail.v2.ExportMetadata"
10150    }
10151}
10152
10153/// Response of the ExportAnalyticsMetricsRequest. If the long running
10154/// operation was successful, then this message is returned by the
10155/// google.longrunning.Operations.response field if the operation was successful.
10156#[derive(Clone, Default, PartialEq)]
10157#[non_exhaustive]
10158pub struct ExportAnalyticsMetricsResponse {
10159    /// A sample of errors encountered while processing the request.
10160    pub error_samples: std::vec::Vec<rpc::model::Status>,
10161
10162    /// This field is never set.
10163    pub errors_config: std::option::Option<crate::model::ExportErrorsConfig>,
10164
10165    /// Output result indicating where the data were exported to.
10166    pub output_result: std::option::Option<crate::model::OutputResult>,
10167
10168    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10169}
10170
10171impl ExportAnalyticsMetricsResponse {
10172    pub fn new() -> Self {
10173        std::default::Default::default()
10174    }
10175
10176    /// Sets the value of [error_samples][crate::model::ExportAnalyticsMetricsResponse::error_samples].
10177    ///
10178    /// # Example
10179    /// ```ignore,no_run
10180    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10181    /// use rpc::model::Status;
10182    /// let x = ExportAnalyticsMetricsResponse::new()
10183    ///     .set_error_samples([
10184    ///         Status::default()/* use setters */,
10185    ///         Status::default()/* use (different) setters */,
10186    ///     ]);
10187    /// ```
10188    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
10189    where
10190        T: std::iter::IntoIterator<Item = V>,
10191        V: std::convert::Into<rpc::model::Status>,
10192    {
10193        use std::iter::Iterator;
10194        self.error_samples = v.into_iter().map(|i| i.into()).collect();
10195        self
10196    }
10197
10198    /// Sets the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10199    ///
10200    /// # Example
10201    /// ```ignore,no_run
10202    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10203    /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10204    /// let x = ExportAnalyticsMetricsResponse::new().set_errors_config(ExportErrorsConfig::default()/* use setters */);
10205    /// ```
10206    pub fn set_errors_config<T>(mut self, v: T) -> Self
10207    where
10208        T: std::convert::Into<crate::model::ExportErrorsConfig>,
10209    {
10210        self.errors_config = std::option::Option::Some(v.into());
10211        self
10212    }
10213
10214    /// Sets or clears the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10215    ///
10216    /// # Example
10217    /// ```ignore,no_run
10218    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10219    /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10220    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(Some(ExportErrorsConfig::default()/* use setters */));
10221    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(None::<ExportErrorsConfig>);
10222    /// ```
10223    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
10224    where
10225        T: std::convert::Into<crate::model::ExportErrorsConfig>,
10226    {
10227        self.errors_config = v.map(|x| x.into());
10228        self
10229    }
10230
10231    /// Sets the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10232    ///
10233    /// # Example
10234    /// ```ignore,no_run
10235    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10236    /// use google_cloud_retail_v2::model::OutputResult;
10237    /// let x = ExportAnalyticsMetricsResponse::new().set_output_result(OutputResult::default()/* use setters */);
10238    /// ```
10239    pub fn set_output_result<T>(mut self, v: T) -> Self
10240    where
10241        T: std::convert::Into<crate::model::OutputResult>,
10242    {
10243        self.output_result = std::option::Option::Some(v.into());
10244        self
10245    }
10246
10247    /// Sets or clears the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10248    ///
10249    /// # Example
10250    /// ```ignore,no_run
10251    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10252    /// use google_cloud_retail_v2::model::OutputResult;
10253    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(Some(OutputResult::default()/* use setters */));
10254    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(None::<OutputResult>);
10255    /// ```
10256    pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
10257    where
10258        T: std::convert::Into<crate::model::OutputResult>,
10259    {
10260        self.output_result = v.map(|x| x.into());
10261        self
10262    }
10263}
10264
10265impl wkt::message::Message for ExportAnalyticsMetricsResponse {
10266    fn typename() -> &'static str {
10267        "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"
10268    }
10269}
10270
10271/// Output result that stores the information about where the exported data is
10272/// stored.
10273#[derive(Clone, Default, PartialEq)]
10274#[non_exhaustive]
10275pub struct OutputResult {
10276    /// The BigQuery location where the result is stored.
10277    pub bigquery_result: std::vec::Vec<crate::model::BigQueryOutputResult>,
10278
10279    /// The Google Cloud Storage location where the result is stored.
10280    pub gcs_result: std::vec::Vec<crate::model::GcsOutputResult>,
10281
10282    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10283}
10284
10285impl OutputResult {
10286    pub fn new() -> Self {
10287        std::default::Default::default()
10288    }
10289
10290    /// Sets the value of [bigquery_result][crate::model::OutputResult::bigquery_result].
10291    ///
10292    /// # Example
10293    /// ```ignore,no_run
10294    /// # use google_cloud_retail_v2::model::OutputResult;
10295    /// use google_cloud_retail_v2::model::BigQueryOutputResult;
10296    /// let x = OutputResult::new()
10297    ///     .set_bigquery_result([
10298    ///         BigQueryOutputResult::default()/* use setters */,
10299    ///         BigQueryOutputResult::default()/* use (different) setters */,
10300    ///     ]);
10301    /// ```
10302    pub fn set_bigquery_result<T, V>(mut self, v: T) -> Self
10303    where
10304        T: std::iter::IntoIterator<Item = V>,
10305        V: std::convert::Into<crate::model::BigQueryOutputResult>,
10306    {
10307        use std::iter::Iterator;
10308        self.bigquery_result = v.into_iter().map(|i| i.into()).collect();
10309        self
10310    }
10311
10312    /// Sets the value of [gcs_result][crate::model::OutputResult::gcs_result].
10313    ///
10314    /// # Example
10315    /// ```ignore,no_run
10316    /// # use google_cloud_retail_v2::model::OutputResult;
10317    /// use google_cloud_retail_v2::model::GcsOutputResult;
10318    /// let x = OutputResult::new()
10319    ///     .set_gcs_result([
10320    ///         GcsOutputResult::default()/* use setters */,
10321    ///         GcsOutputResult::default()/* use (different) setters */,
10322    ///     ]);
10323    /// ```
10324    pub fn set_gcs_result<T, V>(mut self, v: T) -> Self
10325    where
10326        T: std::iter::IntoIterator<Item = V>,
10327        V: std::convert::Into<crate::model::GcsOutputResult>,
10328    {
10329        use std::iter::Iterator;
10330        self.gcs_result = v.into_iter().map(|i| i.into()).collect();
10331        self
10332    }
10333}
10334
10335impl wkt::message::Message for OutputResult {
10336    fn typename() -> &'static str {
10337        "type.googleapis.com/google.cloud.retail.v2.OutputResult"
10338    }
10339}
10340
10341/// A BigQuery output result.
10342#[derive(Clone, Default, PartialEq)]
10343#[non_exhaustive]
10344pub struct BigQueryOutputResult {
10345    /// The ID of a BigQuery Dataset.
10346    pub dataset_id: std::string::String,
10347
10348    /// The ID of a BigQuery Table.
10349    pub table_id: std::string::String,
10350
10351    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10352}
10353
10354impl BigQueryOutputResult {
10355    pub fn new() -> Self {
10356        std::default::Default::default()
10357    }
10358
10359    /// Sets the value of [dataset_id][crate::model::BigQueryOutputResult::dataset_id].
10360    ///
10361    /// # Example
10362    /// ```ignore,no_run
10363    /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10364    /// let x = BigQueryOutputResult::new().set_dataset_id("example");
10365    /// ```
10366    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10367        self.dataset_id = v.into();
10368        self
10369    }
10370
10371    /// Sets the value of [table_id][crate::model::BigQueryOutputResult::table_id].
10372    ///
10373    /// # Example
10374    /// ```ignore,no_run
10375    /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10376    /// let x = BigQueryOutputResult::new().set_table_id("example");
10377    /// ```
10378    pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10379        self.table_id = v.into();
10380        self
10381    }
10382}
10383
10384impl wkt::message::Message for BigQueryOutputResult {
10385    fn typename() -> &'static str {
10386        "type.googleapis.com/google.cloud.retail.v2.BigQueryOutputResult"
10387    }
10388}
10389
10390/// A Gcs output result.
10391#[derive(Clone, Default, PartialEq)]
10392#[non_exhaustive]
10393pub struct GcsOutputResult {
10394    /// The uri of Gcs output
10395    pub output_uri: std::string::String,
10396
10397    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10398}
10399
10400impl GcsOutputResult {
10401    pub fn new() -> Self {
10402        std::default::Default::default()
10403    }
10404
10405    /// Sets the value of [output_uri][crate::model::GcsOutputResult::output_uri].
10406    ///
10407    /// # Example
10408    /// ```ignore,no_run
10409    /// # use google_cloud_retail_v2::model::GcsOutputResult;
10410    /// let x = GcsOutputResult::new().set_output_uri("example");
10411    /// ```
10412    pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10413        self.output_uri = v.into();
10414        self
10415    }
10416}
10417
10418impl wkt::message::Message for GcsOutputResult {
10419    fn typename() -> &'static str {
10420        "type.googleapis.com/google.cloud.retail.v2.GcsOutputResult"
10421    }
10422}
10423
10424/// Configuration for overall generative question feature state.
10425#[derive(Clone, Default, PartialEq)]
10426#[non_exhaustive]
10427pub struct GenerativeQuestionsFeatureConfig {
10428    /// Required. Resource name of the affected catalog.
10429    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10430    pub catalog: std::string::String,
10431
10432    /// Optional. Determines whether questions will be used at serving time.
10433    /// Note: This feature cannot be enabled until initial data requirements are
10434    /// satisfied.
10435    pub feature_enabled: bool,
10436
10437    /// Optional. Minimum number of products in the response to trigger follow-up
10438    /// questions. Value must be 0 or positive.
10439    pub minimum_products: i32,
10440
10441    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10442}
10443
10444impl GenerativeQuestionsFeatureConfig {
10445    pub fn new() -> Self {
10446        std::default::Default::default()
10447    }
10448
10449    /// Sets the value of [catalog][crate::model::GenerativeQuestionsFeatureConfig::catalog].
10450    ///
10451    /// # Example
10452    /// ```ignore,no_run
10453    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10454    /// let x = GenerativeQuestionsFeatureConfig::new().set_catalog("example");
10455    /// ```
10456    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10457        self.catalog = v.into();
10458        self
10459    }
10460
10461    /// Sets the value of [feature_enabled][crate::model::GenerativeQuestionsFeatureConfig::feature_enabled].
10462    ///
10463    /// # Example
10464    /// ```ignore,no_run
10465    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10466    /// let x = GenerativeQuestionsFeatureConfig::new().set_feature_enabled(true);
10467    /// ```
10468    pub fn set_feature_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10469        self.feature_enabled = v.into();
10470        self
10471    }
10472
10473    /// Sets the value of [minimum_products][crate::model::GenerativeQuestionsFeatureConfig::minimum_products].
10474    ///
10475    /// # Example
10476    /// ```ignore,no_run
10477    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10478    /// let x = GenerativeQuestionsFeatureConfig::new().set_minimum_products(42);
10479    /// ```
10480    pub fn set_minimum_products<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10481        self.minimum_products = v.into();
10482        self
10483    }
10484}
10485
10486impl wkt::message::Message for GenerativeQuestionsFeatureConfig {
10487    fn typename() -> &'static str {
10488        "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionsFeatureConfig"
10489    }
10490}
10491
10492/// Configuration for a single generated question.
10493#[derive(Clone, Default, PartialEq)]
10494#[non_exhaustive]
10495pub struct GenerativeQuestionConfig {
10496    /// Required. Resource name of the catalog.
10497    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10498    pub catalog: std::string::String,
10499
10500    /// Required. The facet to which the question is associated.
10501    pub facet: std::string::String,
10502
10503    /// Output only. The LLM generated question.
10504    pub generated_question: std::string::String,
10505
10506    /// Optional. The question that will be used at serving time.
10507    /// Question can have a max length of 300 bytes.
10508    /// When not populated, generated_question should be used.
10509    pub final_question: std::string::String,
10510
10511    /// Output only. Values that can be used to answer the question.
10512    pub example_values: std::vec::Vec<std::string::String>,
10513
10514    /// Output only. The ratio of how often a question was asked.
10515    pub frequency: f32,
10516
10517    /// Optional. Whether the question is asked at serving time.
10518    pub allowed_in_conversation: bool,
10519
10520    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10521}
10522
10523impl GenerativeQuestionConfig {
10524    pub fn new() -> Self {
10525        std::default::Default::default()
10526    }
10527
10528    /// Sets the value of [catalog][crate::model::GenerativeQuestionConfig::catalog].
10529    ///
10530    /// # Example
10531    /// ```ignore,no_run
10532    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10533    /// let x = GenerativeQuestionConfig::new().set_catalog("example");
10534    /// ```
10535    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10536        self.catalog = v.into();
10537        self
10538    }
10539
10540    /// Sets the value of [facet][crate::model::GenerativeQuestionConfig::facet].
10541    ///
10542    /// # Example
10543    /// ```ignore,no_run
10544    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10545    /// let x = GenerativeQuestionConfig::new().set_facet("example");
10546    /// ```
10547    pub fn set_facet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10548        self.facet = v.into();
10549        self
10550    }
10551
10552    /// Sets the value of [generated_question][crate::model::GenerativeQuestionConfig::generated_question].
10553    ///
10554    /// # Example
10555    /// ```ignore,no_run
10556    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10557    /// let x = GenerativeQuestionConfig::new().set_generated_question("example");
10558    /// ```
10559    pub fn set_generated_question<T: std::convert::Into<std::string::String>>(
10560        mut self,
10561        v: T,
10562    ) -> Self {
10563        self.generated_question = v.into();
10564        self
10565    }
10566
10567    /// Sets the value of [final_question][crate::model::GenerativeQuestionConfig::final_question].
10568    ///
10569    /// # Example
10570    /// ```ignore,no_run
10571    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10572    /// let x = GenerativeQuestionConfig::new().set_final_question("example");
10573    /// ```
10574    pub fn set_final_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10575        self.final_question = v.into();
10576        self
10577    }
10578
10579    /// Sets the value of [example_values][crate::model::GenerativeQuestionConfig::example_values].
10580    ///
10581    /// # Example
10582    /// ```ignore,no_run
10583    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10584    /// let x = GenerativeQuestionConfig::new().set_example_values(["a", "b", "c"]);
10585    /// ```
10586    pub fn set_example_values<T, V>(mut self, v: T) -> Self
10587    where
10588        T: std::iter::IntoIterator<Item = V>,
10589        V: std::convert::Into<std::string::String>,
10590    {
10591        use std::iter::Iterator;
10592        self.example_values = v.into_iter().map(|i| i.into()).collect();
10593        self
10594    }
10595
10596    /// Sets the value of [frequency][crate::model::GenerativeQuestionConfig::frequency].
10597    ///
10598    /// # Example
10599    /// ```ignore,no_run
10600    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10601    /// let x = GenerativeQuestionConfig::new().set_frequency(42.0);
10602    /// ```
10603    pub fn set_frequency<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
10604        self.frequency = v.into();
10605        self
10606    }
10607
10608    /// Sets the value of [allowed_in_conversation][crate::model::GenerativeQuestionConfig::allowed_in_conversation].
10609    ///
10610    /// # Example
10611    /// ```ignore,no_run
10612    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10613    /// let x = GenerativeQuestionConfig::new().set_allowed_in_conversation(true);
10614    /// ```
10615    pub fn set_allowed_in_conversation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10616        self.allowed_in_conversation = v.into();
10617        self
10618    }
10619}
10620
10621impl wkt::message::Message for GenerativeQuestionConfig {
10622    fn typename() -> &'static str {
10623        "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionConfig"
10624    }
10625}
10626
10627/// Request for UpdateGenerativeQuestionsFeatureConfig method.
10628#[derive(Clone, Default, PartialEq)]
10629#[non_exhaustive]
10630pub struct UpdateGenerativeQuestionsFeatureConfigRequest {
10631    /// Required. The configuration managing the feature state.
10632    pub generative_questions_feature_config:
10633        std::option::Option<crate::model::GenerativeQuestionsFeatureConfig>,
10634
10635    /// Optional. Indicates which fields in the provided
10636    /// [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]
10637    /// to update. If not set or empty, all supported fields are updated.
10638    ///
10639    /// [google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]: crate::model::GenerativeQuestionsFeatureConfig
10640    pub update_mask: std::option::Option<wkt::FieldMask>,
10641
10642    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10643}
10644
10645impl UpdateGenerativeQuestionsFeatureConfigRequest {
10646    pub fn new() -> Self {
10647        std::default::Default::default()
10648    }
10649
10650    /// Sets the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10651    ///
10652    /// # Example
10653    /// ```ignore,no_run
10654    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10655    /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10656    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_generative_questions_feature_config(GenerativeQuestionsFeatureConfig::default()/* use setters */);
10657    /// ```
10658    pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
10659    where
10660        T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10661    {
10662        self.generative_questions_feature_config = std::option::Option::Some(v.into());
10663        self
10664    }
10665
10666    /// Sets or clears the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10667    ///
10668    /// # Example
10669    /// ```ignore,no_run
10670    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10671    /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10672    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(Some(GenerativeQuestionsFeatureConfig::default()/* use setters */));
10673    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(None::<GenerativeQuestionsFeatureConfig>);
10674    /// ```
10675    pub fn set_or_clear_generative_questions_feature_config<T>(
10676        mut self,
10677        v: std::option::Option<T>,
10678    ) -> Self
10679    where
10680        T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10681    {
10682        self.generative_questions_feature_config = v.map(|x| x.into());
10683        self
10684    }
10685
10686    /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10687    ///
10688    /// # Example
10689    /// ```ignore,no_run
10690    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10691    /// use wkt::FieldMask;
10692    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10693    /// ```
10694    pub fn set_update_mask<T>(mut self, v: T) -> Self
10695    where
10696        T: std::convert::Into<wkt::FieldMask>,
10697    {
10698        self.update_mask = std::option::Option::Some(v.into());
10699        self
10700    }
10701
10702    /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10703    ///
10704    /// # Example
10705    /// ```ignore,no_run
10706    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10707    /// use wkt::FieldMask;
10708    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10709    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10710    /// ```
10711    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10712    where
10713        T: std::convert::Into<wkt::FieldMask>,
10714    {
10715        self.update_mask = v.map(|x| x.into());
10716        self
10717    }
10718}
10719
10720impl wkt::message::Message for UpdateGenerativeQuestionsFeatureConfigRequest {
10721    fn typename() -> &'static str {
10722        "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest"
10723    }
10724}
10725
10726/// Request for GetGenerativeQuestionsFeatureConfig method.
10727#[derive(Clone, Default, PartialEq)]
10728#[non_exhaustive]
10729pub struct GetGenerativeQuestionsFeatureConfigRequest {
10730    /// Required. Resource name of the parent catalog.
10731    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10732    pub catalog: std::string::String,
10733
10734    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10735}
10736
10737impl GetGenerativeQuestionsFeatureConfigRequest {
10738    pub fn new() -> Self {
10739        std::default::Default::default()
10740    }
10741
10742    /// Sets the value of [catalog][crate::model::GetGenerativeQuestionsFeatureConfigRequest::catalog].
10743    ///
10744    /// # Example
10745    /// ```ignore,no_run
10746    /// # use google_cloud_retail_v2::model::GetGenerativeQuestionsFeatureConfigRequest;
10747    /// let x = GetGenerativeQuestionsFeatureConfigRequest::new().set_catalog("example");
10748    /// ```
10749    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10750        self.catalog = v.into();
10751        self
10752    }
10753}
10754
10755impl wkt::message::Message for GetGenerativeQuestionsFeatureConfigRequest {
10756    fn typename() -> &'static str {
10757        "type.googleapis.com/google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest"
10758    }
10759}
10760
10761/// Request for ListQuestions method.
10762#[derive(Clone, Default, PartialEq)]
10763#[non_exhaustive]
10764pub struct ListGenerativeQuestionConfigsRequest {
10765    /// Required. Resource name of the parent catalog.
10766    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10767    pub parent: std::string::String,
10768
10769    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10770}
10771
10772impl ListGenerativeQuestionConfigsRequest {
10773    pub fn new() -> Self {
10774        std::default::Default::default()
10775    }
10776
10777    /// Sets the value of [parent][crate::model::ListGenerativeQuestionConfigsRequest::parent].
10778    ///
10779    /// # Example
10780    /// ```ignore,no_run
10781    /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsRequest;
10782    /// let x = ListGenerativeQuestionConfigsRequest::new().set_parent("example");
10783    /// ```
10784    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10785        self.parent = v.into();
10786        self
10787    }
10788}
10789
10790impl wkt::message::Message for ListGenerativeQuestionConfigsRequest {
10791    fn typename() -> &'static str {
10792        "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest"
10793    }
10794}
10795
10796/// Response for ListQuestions method.
10797#[derive(Clone, Default, PartialEq)]
10798#[non_exhaustive]
10799pub struct ListGenerativeQuestionConfigsResponse {
10800    /// All the questions for a given catalog.
10801    pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
10802
10803    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10804}
10805
10806impl ListGenerativeQuestionConfigsResponse {
10807    pub fn new() -> Self {
10808        std::default::Default::default()
10809    }
10810
10811    /// Sets the value of [generative_question_configs][crate::model::ListGenerativeQuestionConfigsResponse::generative_question_configs].
10812    ///
10813    /// # Example
10814    /// ```ignore,no_run
10815    /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsResponse;
10816    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10817    /// let x = ListGenerativeQuestionConfigsResponse::new()
10818    ///     .set_generative_question_configs([
10819    ///         GenerativeQuestionConfig::default()/* use setters */,
10820    ///         GenerativeQuestionConfig::default()/* use (different) setters */,
10821    ///     ]);
10822    /// ```
10823    pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
10824    where
10825        T: std::iter::IntoIterator<Item = V>,
10826        V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10827    {
10828        use std::iter::Iterator;
10829        self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
10830        self
10831    }
10832}
10833
10834impl wkt::message::Message for ListGenerativeQuestionConfigsResponse {
10835    fn typename() -> &'static str {
10836        "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse"
10837    }
10838}
10839
10840/// Request for UpdateGenerativeQuestionConfig method.
10841#[derive(Clone, Default, PartialEq)]
10842#[non_exhaustive]
10843pub struct UpdateGenerativeQuestionConfigRequest {
10844    /// Required. The question to update.
10845    pub generative_question_config: std::option::Option<crate::model::GenerativeQuestionConfig>,
10846
10847    /// Optional. Indicates which fields in the provided
10848    /// [GenerativeQuestionConfig][google.cloud.retail.v2.GenerativeQuestionConfig]
10849    /// to update. The following are NOT supported:
10850    ///
10851    /// * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2.GenerativeQuestionConfig.frequency]
10852    ///
10853    /// If not set or empty, all supported fields are updated.
10854    ///
10855    /// [google.cloud.retail.v2.GenerativeQuestionConfig]: crate::model::GenerativeQuestionConfig
10856    /// [google.cloud.retail.v2.GenerativeQuestionConfig.frequency]: crate::model::GenerativeQuestionConfig::frequency
10857    pub update_mask: std::option::Option<wkt::FieldMask>,
10858
10859    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10860}
10861
10862impl UpdateGenerativeQuestionConfigRequest {
10863    pub fn new() -> Self {
10864        std::default::Default::default()
10865    }
10866
10867    /// Sets the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10868    ///
10869    /// # Example
10870    /// ```ignore,no_run
10871    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10872    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10873    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_generative_question_config(GenerativeQuestionConfig::default()/* use setters */);
10874    /// ```
10875    pub fn set_generative_question_config<T>(mut self, v: T) -> Self
10876    where
10877        T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10878    {
10879        self.generative_question_config = std::option::Option::Some(v.into());
10880        self
10881    }
10882
10883    /// Sets or clears the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10884    ///
10885    /// # Example
10886    /// ```ignore,no_run
10887    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10888    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10889    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(Some(GenerativeQuestionConfig::default()/* use setters */));
10890    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(None::<GenerativeQuestionConfig>);
10891    /// ```
10892    pub fn set_or_clear_generative_question_config<T>(mut self, v: std::option::Option<T>) -> Self
10893    where
10894        T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10895    {
10896        self.generative_question_config = v.map(|x| x.into());
10897        self
10898    }
10899
10900    /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
10901    ///
10902    /// # Example
10903    /// ```ignore,no_run
10904    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10905    /// use wkt::FieldMask;
10906    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10907    /// ```
10908    pub fn set_update_mask<T>(mut self, v: T) -> Self
10909    where
10910        T: std::convert::Into<wkt::FieldMask>,
10911    {
10912        self.update_mask = std::option::Option::Some(v.into());
10913        self
10914    }
10915
10916    /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
10917    ///
10918    /// # Example
10919    /// ```ignore,no_run
10920    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10921    /// use wkt::FieldMask;
10922    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10923    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10924    /// ```
10925    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10926    where
10927        T: std::convert::Into<wkt::FieldMask>,
10928    {
10929        self.update_mask = v.map(|x| x.into());
10930        self
10931    }
10932}
10933
10934impl wkt::message::Message for UpdateGenerativeQuestionConfigRequest {
10935    fn typename() -> &'static str {
10936        "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest"
10937    }
10938}
10939
10940/// Request for BatchUpdateGenerativeQuestionConfig method.
10941#[derive(Clone, Default, PartialEq)]
10942#[non_exhaustive]
10943pub struct BatchUpdateGenerativeQuestionConfigsRequest {
10944    /// Optional. Resource name of the parent catalog.
10945    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10946    pub parent: std::string::String,
10947
10948    /// Required. The updates question configs.
10949    pub requests: std::vec::Vec<crate::model::UpdateGenerativeQuestionConfigRequest>,
10950
10951    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10952}
10953
10954impl BatchUpdateGenerativeQuestionConfigsRequest {
10955    pub fn new() -> Self {
10956        std::default::Default::default()
10957    }
10958
10959    /// Sets the value of [parent][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::parent].
10960    ///
10961    /// # Example
10962    /// ```ignore,no_run
10963    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
10964    /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new().set_parent("example");
10965    /// ```
10966    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10967        self.parent = v.into();
10968        self
10969    }
10970
10971    /// Sets the value of [requests][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::requests].
10972    ///
10973    /// # Example
10974    /// ```ignore,no_run
10975    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
10976    /// use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10977    /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new()
10978    ///     .set_requests([
10979    ///         UpdateGenerativeQuestionConfigRequest::default()/* use setters */,
10980    ///         UpdateGenerativeQuestionConfigRequest::default()/* use (different) setters */,
10981    ///     ]);
10982    /// ```
10983    pub fn set_requests<T, V>(mut self, v: T) -> Self
10984    where
10985        T: std::iter::IntoIterator<Item = V>,
10986        V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
10987    {
10988        use std::iter::Iterator;
10989        self.requests = v.into_iter().map(|i| i.into()).collect();
10990        self
10991    }
10992}
10993
10994impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsRequest {
10995    fn typename() -> &'static str {
10996        "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest"
10997    }
10998}
10999
11000/// Aggregated response for UpdateGenerativeQuestionConfig method.
11001#[derive(Clone, Default, PartialEq)]
11002#[non_exhaustive]
11003pub struct BatchUpdateGenerativeQuestionConfigsResponse {
11004    /// Optional. The updates question configs.
11005    pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
11006
11007    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11008}
11009
11010impl BatchUpdateGenerativeQuestionConfigsResponse {
11011    pub fn new() -> Self {
11012        std::default::Default::default()
11013    }
11014
11015    /// Sets the value of [generative_question_configs][crate::model::BatchUpdateGenerativeQuestionConfigsResponse::generative_question_configs].
11016    ///
11017    /// # Example
11018    /// ```ignore,no_run
11019    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsResponse;
11020    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11021    /// let x = BatchUpdateGenerativeQuestionConfigsResponse::new()
11022    ///     .set_generative_question_configs([
11023    ///         GenerativeQuestionConfig::default()/* use setters */,
11024    ///         GenerativeQuestionConfig::default()/* use (different) setters */,
11025    ///     ]);
11026    /// ```
11027    pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
11028    where
11029        T: std::iter::IntoIterator<Item = V>,
11030        V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11031    {
11032        use std::iter::Iterator;
11033        self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
11034        self
11035    }
11036}
11037
11038impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsResponse {
11039    fn typename() -> &'static str {
11040        "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse"
11041    }
11042}
11043
11044/// Google Cloud Storage location for input content.
11045#[derive(Clone, Default, PartialEq)]
11046#[non_exhaustive]
11047pub struct GcsSource {
11048    /// Required. Google Cloud Storage URIs to input files. URI can be up to
11049    /// 2000 characters long. URIs can match the full object path (for example,
11050    /// `gs://bucket/directory/object.json`) or a pattern matching one or more
11051    /// files, such as `gs://bucket/directory/*.json`. A request can
11052    /// contain at most 100 files, and each file can be up to 2 GB. See
11053    /// [Importing product
11054    /// information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
11055    /// for the expected file format and setup instructions.
11056    pub input_uris: std::vec::Vec<std::string::String>,
11057
11058    /// The schema to use when parsing the data from the source.
11059    ///
11060    /// Supported values for product imports:
11061    ///
11062    /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11063    ///   per line. Each product must
11064    ///   have a valid [Product.id][google.cloud.retail.v2.Product.id].
11065    /// * `product_merchant_center`: See [Importing catalog data from Merchant
11066    ///   Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11067    ///
11068    /// Supported values for user events imports:
11069    ///
11070    /// * `user_event` (default): One JSON
11071    ///   [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11072    /// * `user_event_ga360`: Using
11073    ///   <https://support.google.com/analytics/answer/3437719>.
11074    ///
11075    /// Supported values for control imports:
11076    ///
11077    /// * `control` (default): One JSON [Control][google.cloud.retail.v2.Control]
11078    ///   per line.
11079    ///
11080    /// Supported values for catalog attribute imports:
11081    ///
11082    /// * `catalog_attribute` (default): One CSV
11083    ///   [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line.
11084    ///
11085    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
11086    /// [google.cloud.retail.v2.Control]: crate::model::Control
11087    /// [google.cloud.retail.v2.Product]: crate::model::Product
11088    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11089    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11090    pub data_schema: std::string::String,
11091
11092    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11093}
11094
11095impl GcsSource {
11096    pub fn new() -> Self {
11097        std::default::Default::default()
11098    }
11099
11100    /// Sets the value of [input_uris][crate::model::GcsSource::input_uris].
11101    ///
11102    /// # Example
11103    /// ```ignore,no_run
11104    /// # use google_cloud_retail_v2::model::GcsSource;
11105    /// let x = GcsSource::new().set_input_uris(["a", "b", "c"]);
11106    /// ```
11107    pub fn set_input_uris<T, V>(mut self, v: T) -> Self
11108    where
11109        T: std::iter::IntoIterator<Item = V>,
11110        V: std::convert::Into<std::string::String>,
11111    {
11112        use std::iter::Iterator;
11113        self.input_uris = v.into_iter().map(|i| i.into()).collect();
11114        self
11115    }
11116
11117    /// Sets the value of [data_schema][crate::model::GcsSource::data_schema].
11118    ///
11119    /// # Example
11120    /// ```ignore,no_run
11121    /// # use google_cloud_retail_v2::model::GcsSource;
11122    /// let x = GcsSource::new().set_data_schema("example");
11123    /// ```
11124    pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11125        self.data_schema = v.into();
11126        self
11127    }
11128}
11129
11130impl wkt::message::Message for GcsSource {
11131    fn typename() -> &'static str {
11132        "type.googleapis.com/google.cloud.retail.v2.GcsSource"
11133    }
11134}
11135
11136/// BigQuery source import data from.
11137#[derive(Clone, Default, PartialEq)]
11138#[non_exhaustive]
11139pub struct BigQuerySource {
11140    /// The project ID (can be project # or ID) that the BigQuery source is in with
11141    /// a length limit of 128 characters. If not specified, inherits the project
11142    /// ID from the parent request.
11143    pub project_id: std::string::String,
11144
11145    /// Required. The BigQuery data set to copy the data from with a length limit
11146    /// of 1,024 characters.
11147    pub dataset_id: std::string::String,
11148
11149    /// Required. The BigQuery table to copy the data from with a length limit of
11150    /// 1,024 characters.
11151    pub table_id: std::string::String,
11152
11153    /// Intermediate Cloud Storage directory used for the import with a length
11154    /// limit of 2,000 characters. Can be specified if one wants to have the
11155    /// BigQuery export to a specific Cloud Storage directory.
11156    pub gcs_staging_dir: std::string::String,
11157
11158    /// The schema to use when parsing the data from the source.
11159    ///
11160    /// Supported values for product imports:
11161    ///
11162    /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11163    ///   per line. Each product must
11164    ///   have a valid [Product.id][google.cloud.retail.v2.Product.id].
11165    /// * `product_merchant_center`: See [Importing catalog data from Merchant
11166    ///   Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11167    ///
11168    /// Supported values for user events imports:
11169    ///
11170    /// * `user_event` (default): One JSON
11171    ///   [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11172    /// * `user_event_ga360`:
11173    ///   The schema is available here:
11174    ///   <https://support.google.com/analytics/answer/3437719>.
11175    /// * `user_event_ga4`:
11176    ///   The schema is available here:
11177    ///   <https://support.google.com/analytics/answer/7029846>.
11178    ///
11179    /// Supported values for autocomplete imports:
11180    ///
11181    /// * `suggestions` (default): One JSON completion suggestion per line.
11182    /// * `denylist`:  One JSON deny suggestion per line.
11183    /// * `allowlist`:  One JSON allow suggestion per line.
11184    ///
11185    /// [google.cloud.retail.v2.Product]: crate::model::Product
11186    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11187    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11188    pub data_schema: std::string::String,
11189
11190    /// BigQuery table partition info. Leave this empty if the BigQuery table
11191    /// is not partitioned.
11192    pub partition: std::option::Option<crate::model::big_query_source::Partition>,
11193
11194    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11195}
11196
11197impl BigQuerySource {
11198    pub fn new() -> Self {
11199        std::default::Default::default()
11200    }
11201
11202    /// Sets the value of [project_id][crate::model::BigQuerySource::project_id].
11203    ///
11204    /// # Example
11205    /// ```ignore,no_run
11206    /// # use google_cloud_retail_v2::model::BigQuerySource;
11207    /// let x = BigQuerySource::new().set_project_id("example");
11208    /// ```
11209    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11210        self.project_id = v.into();
11211        self
11212    }
11213
11214    /// Sets the value of [dataset_id][crate::model::BigQuerySource::dataset_id].
11215    ///
11216    /// # Example
11217    /// ```ignore,no_run
11218    /// # use google_cloud_retail_v2::model::BigQuerySource;
11219    /// let x = BigQuerySource::new().set_dataset_id("example");
11220    /// ```
11221    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11222        self.dataset_id = v.into();
11223        self
11224    }
11225
11226    /// Sets the value of [table_id][crate::model::BigQuerySource::table_id].
11227    ///
11228    /// # Example
11229    /// ```ignore,no_run
11230    /// # use google_cloud_retail_v2::model::BigQuerySource;
11231    /// let x = BigQuerySource::new().set_table_id("example");
11232    /// ```
11233    pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11234        self.table_id = v.into();
11235        self
11236    }
11237
11238    /// Sets the value of [gcs_staging_dir][crate::model::BigQuerySource::gcs_staging_dir].
11239    ///
11240    /// # Example
11241    /// ```ignore,no_run
11242    /// # use google_cloud_retail_v2::model::BigQuerySource;
11243    /// let x = BigQuerySource::new().set_gcs_staging_dir("example");
11244    /// ```
11245    pub fn set_gcs_staging_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11246        self.gcs_staging_dir = v.into();
11247        self
11248    }
11249
11250    /// Sets the value of [data_schema][crate::model::BigQuerySource::data_schema].
11251    ///
11252    /// # Example
11253    /// ```ignore,no_run
11254    /// # use google_cloud_retail_v2::model::BigQuerySource;
11255    /// let x = BigQuerySource::new().set_data_schema("example");
11256    /// ```
11257    pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11258        self.data_schema = v.into();
11259        self
11260    }
11261
11262    /// Sets the value of [partition][crate::model::BigQuerySource::partition].
11263    ///
11264    /// Note that all the setters affecting `partition` are mutually
11265    /// exclusive.
11266    ///
11267    /// # Example
11268    /// ```ignore,no_run
11269    /// # use google_cloud_retail_v2::model::BigQuerySource;
11270    /// use gtype::model::Date;
11271    /// let x = BigQuerySource::new().set_partition(Some(
11272    ///     google_cloud_retail_v2::model::big_query_source::Partition::PartitionDate(Date::default().into())));
11273    /// ```
11274    pub fn set_partition<
11275        T: std::convert::Into<std::option::Option<crate::model::big_query_source::Partition>>,
11276    >(
11277        mut self,
11278        v: T,
11279    ) -> Self {
11280        self.partition = v.into();
11281        self
11282    }
11283
11284    /// The value of [partition][crate::model::BigQuerySource::partition]
11285    /// if it holds a `PartitionDate`, `None` if the field is not set or
11286    /// holds a different branch.
11287    pub fn partition_date(&self) -> std::option::Option<&std::boxed::Box<gtype::model::Date>> {
11288        #[allow(unreachable_patterns)]
11289        self.partition.as_ref().and_then(|v| match v {
11290            crate::model::big_query_source::Partition::PartitionDate(v) => {
11291                std::option::Option::Some(v)
11292            }
11293            _ => std::option::Option::None,
11294        })
11295    }
11296
11297    /// Sets the value of [partition][crate::model::BigQuerySource::partition]
11298    /// to hold a `PartitionDate`.
11299    ///
11300    /// Note that all the setters affecting `partition` are
11301    /// mutually exclusive.
11302    ///
11303    /// # Example
11304    /// ```ignore,no_run
11305    /// # use google_cloud_retail_v2::model::BigQuerySource;
11306    /// use gtype::model::Date;
11307    /// let x = BigQuerySource::new().set_partition_date(Date::default()/* use setters */);
11308    /// assert!(x.partition_date().is_some());
11309    /// ```
11310    pub fn set_partition_date<T: std::convert::Into<std::boxed::Box<gtype::model::Date>>>(
11311        mut self,
11312        v: T,
11313    ) -> Self {
11314        self.partition = std::option::Option::Some(
11315            crate::model::big_query_source::Partition::PartitionDate(v.into()),
11316        );
11317        self
11318    }
11319}
11320
11321impl wkt::message::Message for BigQuerySource {
11322    fn typename() -> &'static str {
11323        "type.googleapis.com/google.cloud.retail.v2.BigQuerySource"
11324    }
11325}
11326
11327/// Defines additional types related to [BigQuerySource].
11328pub mod big_query_source {
11329    #[allow(unused_imports)]
11330    use super::*;
11331
11332    /// BigQuery table partition info. Leave this empty if the BigQuery table
11333    /// is not partitioned.
11334    #[derive(Clone, Debug, PartialEq)]
11335    #[non_exhaustive]
11336    pub enum Partition {
11337        /// BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
11338        PartitionDate(std::boxed::Box<gtype::model::Date>),
11339    }
11340}
11341
11342/// The inline source for the input config for ImportProducts method.
11343#[derive(Clone, Default, PartialEq)]
11344#[non_exhaustive]
11345pub struct ProductInlineSource {
11346    /// Required. A list of products to update/create. Each product must have a
11347    /// valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
11348    /// 100 items.
11349    ///
11350    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11351    pub products: std::vec::Vec<crate::model::Product>,
11352
11353    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11354}
11355
11356impl ProductInlineSource {
11357    pub fn new() -> Self {
11358        std::default::Default::default()
11359    }
11360
11361    /// Sets the value of [products][crate::model::ProductInlineSource::products].
11362    ///
11363    /// # Example
11364    /// ```ignore,no_run
11365    /// # use google_cloud_retail_v2::model::ProductInlineSource;
11366    /// use google_cloud_retail_v2::model::Product;
11367    /// let x = ProductInlineSource::new()
11368    ///     .set_products([
11369    ///         Product::default()/* use setters */,
11370    ///         Product::default()/* use (different) setters */,
11371    ///     ]);
11372    /// ```
11373    pub fn set_products<T, V>(mut self, v: T) -> Self
11374    where
11375        T: std::iter::IntoIterator<Item = V>,
11376        V: std::convert::Into<crate::model::Product>,
11377    {
11378        use std::iter::Iterator;
11379        self.products = v.into_iter().map(|i| i.into()).collect();
11380        self
11381    }
11382}
11383
11384impl wkt::message::Message for ProductInlineSource {
11385    fn typename() -> &'static str {
11386        "type.googleapis.com/google.cloud.retail.v2.ProductInlineSource"
11387    }
11388}
11389
11390/// The inline source for the input config for ImportUserEvents method.
11391#[derive(Clone, Default, PartialEq)]
11392#[non_exhaustive]
11393pub struct UserEventInlineSource {
11394    /// Required. A list of user events to import. Recommended max of 10k items.
11395    pub user_events: std::vec::Vec<crate::model::UserEvent>,
11396
11397    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11398}
11399
11400impl UserEventInlineSource {
11401    pub fn new() -> Self {
11402        std::default::Default::default()
11403    }
11404
11405    /// Sets the value of [user_events][crate::model::UserEventInlineSource::user_events].
11406    ///
11407    /// # Example
11408    /// ```ignore,no_run
11409    /// # use google_cloud_retail_v2::model::UserEventInlineSource;
11410    /// use google_cloud_retail_v2::model::UserEvent;
11411    /// let x = UserEventInlineSource::new()
11412    ///     .set_user_events([
11413    ///         UserEvent::default()/* use setters */,
11414    ///         UserEvent::default()/* use (different) setters */,
11415    ///     ]);
11416    /// ```
11417    pub fn set_user_events<T, V>(mut self, v: T) -> Self
11418    where
11419        T: std::iter::IntoIterator<Item = V>,
11420        V: std::convert::Into<crate::model::UserEvent>,
11421    {
11422        use std::iter::Iterator;
11423        self.user_events = v.into_iter().map(|i| i.into()).collect();
11424        self
11425    }
11426}
11427
11428impl wkt::message::Message for UserEventInlineSource {
11429    fn typename() -> &'static str {
11430        "type.googleapis.com/google.cloud.retail.v2.UserEventInlineSource"
11431    }
11432}
11433
11434/// Configuration of destination for Import related errors.
11435#[derive(Clone, Default, PartialEq)]
11436#[non_exhaustive]
11437pub struct ImportErrorsConfig {
11438    /// Required. Errors destination.
11439    pub destination: std::option::Option<crate::model::import_errors_config::Destination>,
11440
11441    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11442}
11443
11444impl ImportErrorsConfig {
11445    pub fn new() -> Self {
11446        std::default::Default::default()
11447    }
11448
11449    /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination].
11450    ///
11451    /// Note that all the setters affecting `destination` are mutually
11452    /// exclusive.
11453    ///
11454    /// # Example
11455    /// ```ignore,no_run
11456    /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11457    /// use google_cloud_retail_v2::model::import_errors_config::Destination;
11458    /// let x = ImportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
11459    /// ```
11460    pub fn set_destination<
11461        T: std::convert::Into<std::option::Option<crate::model::import_errors_config::Destination>>,
11462    >(
11463        mut self,
11464        v: T,
11465    ) -> Self {
11466        self.destination = v.into();
11467        self
11468    }
11469
11470    /// The value of [destination][crate::model::ImportErrorsConfig::destination]
11471    /// if it holds a `GcsPrefix`, `None` if the field is not set or
11472    /// holds a different branch.
11473    pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
11474        #[allow(unreachable_patterns)]
11475        self.destination.as_ref().and_then(|v| match v {
11476            crate::model::import_errors_config::Destination::GcsPrefix(v) => {
11477                std::option::Option::Some(v)
11478            }
11479            _ => std::option::Option::None,
11480        })
11481    }
11482
11483    /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination]
11484    /// to hold a `GcsPrefix`.
11485    ///
11486    /// Note that all the setters affecting `destination` are
11487    /// mutually exclusive.
11488    ///
11489    /// # Example
11490    /// ```ignore,no_run
11491    /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11492    /// let x = ImportErrorsConfig::new().set_gcs_prefix("example");
11493    /// assert!(x.gcs_prefix().is_some());
11494    /// ```
11495    pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11496        self.destination = std::option::Option::Some(
11497            crate::model::import_errors_config::Destination::GcsPrefix(v.into()),
11498        );
11499        self
11500    }
11501}
11502
11503impl wkt::message::Message for ImportErrorsConfig {
11504    fn typename() -> &'static str {
11505        "type.googleapis.com/google.cloud.retail.v2.ImportErrorsConfig"
11506    }
11507}
11508
11509/// Defines additional types related to [ImportErrorsConfig].
11510pub mod import_errors_config {
11511    #[allow(unused_imports)]
11512    use super::*;
11513
11514    /// Required. Errors destination.
11515    #[derive(Clone, Debug, PartialEq)]
11516    #[non_exhaustive]
11517    pub enum Destination {
11518        /// Google Cloud Storage prefix for import errors. This must be an empty,
11519        /// existing Cloud Storage directory. Import errors are written to
11520        /// sharded files in this directory, one per line, as a JSON-encoded
11521        /// `google.rpc.Status` message.
11522        GcsPrefix(std::string::String),
11523    }
11524}
11525
11526/// Request message for Import methods.
11527#[derive(Clone, Default, PartialEq)]
11528#[non_exhaustive]
11529pub struct ImportProductsRequest {
11530    /// Required.
11531    /// `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
11532    ///
11533    /// If no updateMask is specified, requires products.create permission.
11534    /// If updateMask is specified, requires products.update permission.
11535    pub parent: std::string::String,
11536
11537    /// Deprecated. This field has no effect.
11538    #[deprecated]
11539    pub request_id: std::string::String,
11540
11541    /// Required. The desired input location of the data.
11542    pub input_config: std::option::Option<crate::model::ProductInputConfig>,
11543
11544    /// The desired location of errors incurred during the Import.
11545    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11546
11547    /// Indicates which fields in the provided imported `products` to update. If
11548    /// not set, all fields are updated. If provided, only the existing product
11549    /// fields are updated. Missing products will not be created.
11550    pub update_mask: std::option::Option<wkt::FieldMask>,
11551
11552    /// The mode of reconciliation between existing products and the products to be
11553    /// imported. Defaults to
11554    /// [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
11555    ///
11556    /// [google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]: crate::model::import_products_request::ReconciliationMode::Incremental
11557    pub reconciliation_mode: crate::model::import_products_request::ReconciliationMode,
11558
11559    /// Full Pub/Sub topic name for receiving notification. If this field is set,
11560    /// when the import is finished, a notification is sent to
11561    /// specified Pub/Sub topic. The message data is JSON string of a
11562    /// [Operation][google.longrunning.Operation].
11563    ///
11564    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
11565    /// to be within the same project as
11566    /// [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
11567    /// Make sure that both
11568    /// `cloud-retail-customer-data-access@system.gserviceaccount.com` and
11569    /// `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
11570    /// have the `pubsub.topics.publish` IAM permission on the topic.
11571    ///
11572    /// Only supported when
11573    /// [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
11574    /// is set to `FULL`.
11575    ///
11576    /// [google.cloud.retail.v2.ImportProductsRequest.parent]: crate::model::ImportProductsRequest::parent
11577    /// [google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]: crate::model::ImportProductsRequest::reconciliation_mode
11578    /// [google.longrunning.Operation]: longrunning::model::Operation
11579    pub notification_pubsub_topic: std::string::String,
11580
11581    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11582}
11583
11584impl ImportProductsRequest {
11585    pub fn new() -> Self {
11586        std::default::Default::default()
11587    }
11588
11589    /// Sets the value of [parent][crate::model::ImportProductsRequest::parent].
11590    ///
11591    /// # Example
11592    /// ```ignore,no_run
11593    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11594    /// let x = ImportProductsRequest::new().set_parent("example");
11595    /// ```
11596    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11597        self.parent = v.into();
11598        self
11599    }
11600
11601    /// Sets the value of [request_id][crate::model::ImportProductsRequest::request_id].
11602    ///
11603    /// # Example
11604    /// ```ignore,no_run
11605    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11606    /// let x = ImportProductsRequest::new().set_request_id("example");
11607    /// ```
11608    #[deprecated]
11609    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11610        self.request_id = v.into();
11611        self
11612    }
11613
11614    /// Sets the value of [input_config][crate::model::ImportProductsRequest::input_config].
11615    ///
11616    /// # Example
11617    /// ```ignore,no_run
11618    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11619    /// use google_cloud_retail_v2::model::ProductInputConfig;
11620    /// let x = ImportProductsRequest::new().set_input_config(ProductInputConfig::default()/* use setters */);
11621    /// ```
11622    pub fn set_input_config<T>(mut self, v: T) -> Self
11623    where
11624        T: std::convert::Into<crate::model::ProductInputConfig>,
11625    {
11626        self.input_config = std::option::Option::Some(v.into());
11627        self
11628    }
11629
11630    /// Sets or clears the value of [input_config][crate::model::ImportProductsRequest::input_config].
11631    ///
11632    /// # Example
11633    /// ```ignore,no_run
11634    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11635    /// use google_cloud_retail_v2::model::ProductInputConfig;
11636    /// let x = ImportProductsRequest::new().set_or_clear_input_config(Some(ProductInputConfig::default()/* use setters */));
11637    /// let x = ImportProductsRequest::new().set_or_clear_input_config(None::<ProductInputConfig>);
11638    /// ```
11639    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11640    where
11641        T: std::convert::Into<crate::model::ProductInputConfig>,
11642    {
11643        self.input_config = v.map(|x| x.into());
11644        self
11645    }
11646
11647    /// Sets the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11648    ///
11649    /// # Example
11650    /// ```ignore,no_run
11651    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11652    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11653    /// let x = ImportProductsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11654    /// ```
11655    pub fn set_errors_config<T>(mut self, v: T) -> Self
11656    where
11657        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11658    {
11659        self.errors_config = std::option::Option::Some(v.into());
11660        self
11661    }
11662
11663    /// Sets or clears the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11664    ///
11665    /// # Example
11666    /// ```ignore,no_run
11667    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11668    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11669    /// let x = ImportProductsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11670    /// let x = ImportProductsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11671    /// ```
11672    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11673    where
11674        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11675    {
11676        self.errors_config = v.map(|x| x.into());
11677        self
11678    }
11679
11680    /// Sets the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11681    ///
11682    /// # Example
11683    /// ```ignore,no_run
11684    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11685    /// use wkt::FieldMask;
11686    /// let x = ImportProductsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11687    /// ```
11688    pub fn set_update_mask<T>(mut self, v: T) -> Self
11689    where
11690        T: std::convert::Into<wkt::FieldMask>,
11691    {
11692        self.update_mask = std::option::Option::Some(v.into());
11693        self
11694    }
11695
11696    /// Sets or clears the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11697    ///
11698    /// # Example
11699    /// ```ignore,no_run
11700    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11701    /// use wkt::FieldMask;
11702    /// let x = ImportProductsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11703    /// let x = ImportProductsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11704    /// ```
11705    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11706    where
11707        T: std::convert::Into<wkt::FieldMask>,
11708    {
11709        self.update_mask = v.map(|x| x.into());
11710        self
11711    }
11712
11713    /// Sets the value of [reconciliation_mode][crate::model::ImportProductsRequest::reconciliation_mode].
11714    ///
11715    /// # Example
11716    /// ```ignore,no_run
11717    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11718    /// use google_cloud_retail_v2::model::import_products_request::ReconciliationMode;
11719    /// let x0 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Incremental);
11720    /// let x1 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Full);
11721    /// ```
11722    pub fn set_reconciliation_mode<
11723        T: std::convert::Into<crate::model::import_products_request::ReconciliationMode>,
11724    >(
11725        mut self,
11726        v: T,
11727    ) -> Self {
11728        self.reconciliation_mode = v.into();
11729        self
11730    }
11731
11732    /// Sets the value of [notification_pubsub_topic][crate::model::ImportProductsRequest::notification_pubsub_topic].
11733    ///
11734    /// # Example
11735    /// ```ignore,no_run
11736    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11737    /// let x = ImportProductsRequest::new().set_notification_pubsub_topic("example");
11738    /// ```
11739    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
11740        mut self,
11741        v: T,
11742    ) -> Self {
11743        self.notification_pubsub_topic = v.into();
11744        self
11745    }
11746}
11747
11748impl wkt::message::Message for ImportProductsRequest {
11749    fn typename() -> &'static str {
11750        "type.googleapis.com/google.cloud.retail.v2.ImportProductsRequest"
11751    }
11752}
11753
11754/// Defines additional types related to [ImportProductsRequest].
11755pub mod import_products_request {
11756    #[allow(unused_imports)]
11757    use super::*;
11758
11759    /// Indicates how imported products are reconciled with the existing products
11760    /// created or imported before.
11761    ///
11762    /// # Working with unknown values
11763    ///
11764    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11765    /// additional enum variants at any time. Adding new variants is not considered
11766    /// a breaking change. Applications should write their code in anticipation of:
11767    ///
11768    /// - New values appearing in future releases of the client library, **and**
11769    /// - New values received dynamically, without application changes.
11770    ///
11771    /// Please consult the [Working with enums] section in the user guide for some
11772    /// guidelines.
11773    ///
11774    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11775    #[derive(Clone, Debug, PartialEq)]
11776    #[non_exhaustive]
11777    pub enum ReconciliationMode {
11778        /// Defaults to INCREMENTAL.
11779        Unspecified,
11780        /// Inserts new products or updates existing products.
11781        Incremental,
11782        /// Calculates diff and replaces the entire product dataset. Existing
11783        /// products may be deleted if they are not present in the source location.
11784        Full,
11785        /// If set, the enum was initialized with an unknown value.
11786        ///
11787        /// Applications can examine the value using [ReconciliationMode::value] or
11788        /// [ReconciliationMode::name].
11789        UnknownValue(reconciliation_mode::UnknownValue),
11790    }
11791
11792    #[doc(hidden)]
11793    pub mod reconciliation_mode {
11794        #[allow(unused_imports)]
11795        use super::*;
11796        #[derive(Clone, Debug, PartialEq)]
11797        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11798    }
11799
11800    impl ReconciliationMode {
11801        /// Gets the enum value.
11802        ///
11803        /// Returns `None` if the enum contains an unknown value deserialized from
11804        /// the string representation of enums.
11805        pub fn value(&self) -> std::option::Option<i32> {
11806            match self {
11807                Self::Unspecified => std::option::Option::Some(0),
11808                Self::Incremental => std::option::Option::Some(1),
11809                Self::Full => std::option::Option::Some(2),
11810                Self::UnknownValue(u) => u.0.value(),
11811            }
11812        }
11813
11814        /// Gets the enum value as a string.
11815        ///
11816        /// Returns `None` if the enum contains an unknown value deserialized from
11817        /// the integer representation of enums.
11818        pub fn name(&self) -> std::option::Option<&str> {
11819            match self {
11820                Self::Unspecified => std::option::Option::Some("RECONCILIATION_MODE_UNSPECIFIED"),
11821                Self::Incremental => std::option::Option::Some("INCREMENTAL"),
11822                Self::Full => std::option::Option::Some("FULL"),
11823                Self::UnknownValue(u) => u.0.name(),
11824            }
11825        }
11826    }
11827
11828    impl std::default::Default for ReconciliationMode {
11829        fn default() -> Self {
11830            use std::convert::From;
11831            Self::from(0)
11832        }
11833    }
11834
11835    impl std::fmt::Display for ReconciliationMode {
11836        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11837            wkt::internal::display_enum(f, self.name(), self.value())
11838        }
11839    }
11840
11841    impl std::convert::From<i32> for ReconciliationMode {
11842        fn from(value: i32) -> Self {
11843            match value {
11844                0 => Self::Unspecified,
11845                1 => Self::Incremental,
11846                2 => Self::Full,
11847                _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11848                    wkt::internal::UnknownEnumValue::Integer(value),
11849                )),
11850            }
11851        }
11852    }
11853
11854    impl std::convert::From<&str> for ReconciliationMode {
11855        fn from(value: &str) -> Self {
11856            use std::string::ToString;
11857            match value {
11858                "RECONCILIATION_MODE_UNSPECIFIED" => Self::Unspecified,
11859                "INCREMENTAL" => Self::Incremental,
11860                "FULL" => Self::Full,
11861                _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11862                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11863                )),
11864            }
11865        }
11866    }
11867
11868    impl serde::ser::Serialize for ReconciliationMode {
11869        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11870        where
11871            S: serde::Serializer,
11872        {
11873            match self {
11874                Self::Unspecified => serializer.serialize_i32(0),
11875                Self::Incremental => serializer.serialize_i32(1),
11876                Self::Full => serializer.serialize_i32(2),
11877                Self::UnknownValue(u) => u.0.serialize(serializer),
11878            }
11879        }
11880    }
11881
11882    impl<'de> serde::de::Deserialize<'de> for ReconciliationMode {
11883        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11884        where
11885            D: serde::Deserializer<'de>,
11886        {
11887            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReconciliationMode>::new(
11888                ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode",
11889            ))
11890        }
11891    }
11892}
11893
11894/// Request message for the ImportUserEvents request.
11895#[derive(Clone, Default, PartialEq)]
11896#[non_exhaustive]
11897pub struct ImportUserEventsRequest {
11898    /// Required. `projects/1234/locations/global/catalogs/default_catalog`
11899    pub parent: std::string::String,
11900
11901    /// Required. The desired input location of the data.
11902    pub input_config: std::option::Option<crate::model::UserEventInputConfig>,
11903
11904    /// The desired location of errors incurred during the Import. Cannot be set
11905    /// for inline user event imports.
11906    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11907
11908    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11909}
11910
11911impl ImportUserEventsRequest {
11912    pub fn new() -> Self {
11913        std::default::Default::default()
11914    }
11915
11916    /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
11917    ///
11918    /// # Example
11919    /// ```ignore,no_run
11920    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11921    /// let x = ImportUserEventsRequest::new().set_parent("example");
11922    /// ```
11923    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11924        self.parent = v.into();
11925        self
11926    }
11927
11928    /// Sets the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
11929    ///
11930    /// # Example
11931    /// ```ignore,no_run
11932    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11933    /// use google_cloud_retail_v2::model::UserEventInputConfig;
11934    /// let x = ImportUserEventsRequest::new().set_input_config(UserEventInputConfig::default()/* use setters */);
11935    /// ```
11936    pub fn set_input_config<T>(mut self, v: T) -> Self
11937    where
11938        T: std::convert::Into<crate::model::UserEventInputConfig>,
11939    {
11940        self.input_config = std::option::Option::Some(v.into());
11941        self
11942    }
11943
11944    /// Sets or clears the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
11945    ///
11946    /// # Example
11947    /// ```ignore,no_run
11948    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11949    /// use google_cloud_retail_v2::model::UserEventInputConfig;
11950    /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(Some(UserEventInputConfig::default()/* use setters */));
11951    /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(None::<UserEventInputConfig>);
11952    /// ```
11953    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11954    where
11955        T: std::convert::Into<crate::model::UserEventInputConfig>,
11956    {
11957        self.input_config = v.map(|x| x.into());
11958        self
11959    }
11960
11961    /// Sets the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
11962    ///
11963    /// # Example
11964    /// ```ignore,no_run
11965    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11966    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11967    /// let x = ImportUserEventsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11968    /// ```
11969    pub fn set_errors_config<T>(mut self, v: T) -> Self
11970    where
11971        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11972    {
11973        self.errors_config = std::option::Option::Some(v.into());
11974        self
11975    }
11976
11977    /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
11978    ///
11979    /// # Example
11980    /// ```ignore,no_run
11981    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11982    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11983    /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11984    /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11985    /// ```
11986    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11987    where
11988        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11989    {
11990        self.errors_config = v.map(|x| x.into());
11991        self
11992    }
11993}
11994
11995impl wkt::message::Message for ImportUserEventsRequest {
11996    fn typename() -> &'static str {
11997        "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsRequest"
11998    }
11999}
12000
12001/// Request message for ImportCompletionData methods.
12002#[derive(Clone, Default, PartialEq)]
12003#[non_exhaustive]
12004pub struct ImportCompletionDataRequest {
12005    /// Required. The catalog which the suggestions dataset belongs to.
12006    ///
12007    /// Format: `projects/1234/locations/global/catalogs/default_catalog`.
12008    pub parent: std::string::String,
12009
12010    /// Required. The desired input location of the data.
12011    pub input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
12012
12013    /// Pub/Sub topic for receiving notification. If this field is set,
12014    /// when the import is finished, a notification is sent to
12015    /// specified Pub/Sub topic. The message data is JSON string of a
12016    /// [Operation][google.longrunning.Operation].
12017    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12018    ///
12019    /// [google.longrunning.Operation]: longrunning::model::Operation
12020    pub notification_pubsub_topic: std::string::String,
12021
12022    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12023}
12024
12025impl ImportCompletionDataRequest {
12026    pub fn new() -> Self {
12027        std::default::Default::default()
12028    }
12029
12030    /// Sets the value of [parent][crate::model::ImportCompletionDataRequest::parent].
12031    ///
12032    /// # Example
12033    /// ```ignore,no_run
12034    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12035    /// let x = ImportCompletionDataRequest::new().set_parent("example");
12036    /// ```
12037    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12038        self.parent = v.into();
12039        self
12040    }
12041
12042    /// Sets the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12043    ///
12044    /// # Example
12045    /// ```ignore,no_run
12046    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12047    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12048    /// let x = ImportCompletionDataRequest::new().set_input_config(CompletionDataInputConfig::default()/* use setters */);
12049    /// ```
12050    pub fn set_input_config<T>(mut self, v: T) -> Self
12051    where
12052        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12053    {
12054        self.input_config = std::option::Option::Some(v.into());
12055        self
12056    }
12057
12058    /// Sets or clears the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12059    ///
12060    /// # Example
12061    /// ```ignore,no_run
12062    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12063    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12064    /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
12065    /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(None::<CompletionDataInputConfig>);
12066    /// ```
12067    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12068    where
12069        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12070    {
12071        self.input_config = v.map(|x| x.into());
12072        self
12073    }
12074
12075    /// Sets the value of [notification_pubsub_topic][crate::model::ImportCompletionDataRequest::notification_pubsub_topic].
12076    ///
12077    /// # Example
12078    /// ```ignore,no_run
12079    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12080    /// let x = ImportCompletionDataRequest::new().set_notification_pubsub_topic("example");
12081    /// ```
12082    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12083        mut self,
12084        v: T,
12085    ) -> Self {
12086        self.notification_pubsub_topic = v.into();
12087        self
12088    }
12089}
12090
12091impl wkt::message::Message for ImportCompletionDataRequest {
12092    fn typename() -> &'static str {
12093        "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataRequest"
12094    }
12095}
12096
12097/// The input config source for products.
12098#[derive(Clone, Default, PartialEq)]
12099#[non_exhaustive]
12100pub struct ProductInputConfig {
12101    /// Required. The source of the input.
12102    pub source: std::option::Option<crate::model::product_input_config::Source>,
12103
12104    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12105}
12106
12107impl ProductInputConfig {
12108    pub fn new() -> Self {
12109        std::default::Default::default()
12110    }
12111
12112    /// Sets the value of [source][crate::model::ProductInputConfig::source].
12113    ///
12114    /// Note that all the setters affecting `source` are mutually
12115    /// exclusive.
12116    ///
12117    /// # Example
12118    /// ```ignore,no_run
12119    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12120    /// use google_cloud_retail_v2::model::ProductInlineSource;
12121    /// let x = ProductInputConfig::new().set_source(Some(
12122    ///     google_cloud_retail_v2::model::product_input_config::Source::ProductInlineSource(ProductInlineSource::default().into())));
12123    /// ```
12124    pub fn set_source<
12125        T: std::convert::Into<std::option::Option<crate::model::product_input_config::Source>>,
12126    >(
12127        mut self,
12128        v: T,
12129    ) -> Self {
12130        self.source = v.into();
12131        self
12132    }
12133
12134    /// The value of [source][crate::model::ProductInputConfig::source]
12135    /// if it holds a `ProductInlineSource`, `None` if the field is not set or
12136    /// holds a different branch.
12137    pub fn product_inline_source(
12138        &self,
12139    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductInlineSource>> {
12140        #[allow(unreachable_patterns)]
12141        self.source.as_ref().and_then(|v| match v {
12142            crate::model::product_input_config::Source::ProductInlineSource(v) => {
12143                std::option::Option::Some(v)
12144            }
12145            _ => std::option::Option::None,
12146        })
12147    }
12148
12149    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12150    /// to hold a `ProductInlineSource`.
12151    ///
12152    /// Note that all the setters affecting `source` are
12153    /// mutually exclusive.
12154    ///
12155    /// # Example
12156    /// ```ignore,no_run
12157    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12158    /// use google_cloud_retail_v2::model::ProductInlineSource;
12159    /// let x = ProductInputConfig::new().set_product_inline_source(ProductInlineSource::default()/* use setters */);
12160    /// assert!(x.product_inline_source().is_some());
12161    /// assert!(x.gcs_source().is_none());
12162    /// assert!(x.big_query_source().is_none());
12163    /// ```
12164    pub fn set_product_inline_source<
12165        T: std::convert::Into<std::boxed::Box<crate::model::ProductInlineSource>>,
12166    >(
12167        mut self,
12168        v: T,
12169    ) -> Self {
12170        self.source = std::option::Option::Some(
12171            crate::model::product_input_config::Source::ProductInlineSource(v.into()),
12172        );
12173        self
12174    }
12175
12176    /// The value of [source][crate::model::ProductInputConfig::source]
12177    /// if it holds a `GcsSource`, `None` if the field is not set or
12178    /// holds a different branch.
12179    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12180        #[allow(unreachable_patterns)]
12181        self.source.as_ref().and_then(|v| match v {
12182            crate::model::product_input_config::Source::GcsSource(v) => {
12183                std::option::Option::Some(v)
12184            }
12185            _ => std::option::Option::None,
12186        })
12187    }
12188
12189    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12190    /// to hold a `GcsSource`.
12191    ///
12192    /// Note that all the setters affecting `source` are
12193    /// mutually exclusive.
12194    ///
12195    /// # Example
12196    /// ```ignore,no_run
12197    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12198    /// use google_cloud_retail_v2::model::GcsSource;
12199    /// let x = ProductInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12200    /// assert!(x.gcs_source().is_some());
12201    /// assert!(x.product_inline_source().is_none());
12202    /// assert!(x.big_query_source().is_none());
12203    /// ```
12204    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12205        mut self,
12206        v: T,
12207    ) -> Self {
12208        self.source = std::option::Option::Some(
12209            crate::model::product_input_config::Source::GcsSource(v.into()),
12210        );
12211        self
12212    }
12213
12214    /// The value of [source][crate::model::ProductInputConfig::source]
12215    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12216    /// holds a different branch.
12217    pub fn big_query_source(
12218        &self,
12219    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12220        #[allow(unreachable_patterns)]
12221        self.source.as_ref().and_then(|v| match v {
12222            crate::model::product_input_config::Source::BigQuerySource(v) => {
12223                std::option::Option::Some(v)
12224            }
12225            _ => std::option::Option::None,
12226        })
12227    }
12228
12229    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12230    /// to hold a `BigQuerySource`.
12231    ///
12232    /// Note that all the setters affecting `source` are
12233    /// mutually exclusive.
12234    ///
12235    /// # Example
12236    /// ```ignore,no_run
12237    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12238    /// use google_cloud_retail_v2::model::BigQuerySource;
12239    /// let x = ProductInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12240    /// assert!(x.big_query_source().is_some());
12241    /// assert!(x.product_inline_source().is_none());
12242    /// assert!(x.gcs_source().is_none());
12243    /// ```
12244    pub fn set_big_query_source<
12245        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12246    >(
12247        mut self,
12248        v: T,
12249    ) -> Self {
12250        self.source = std::option::Option::Some(
12251            crate::model::product_input_config::Source::BigQuerySource(v.into()),
12252        );
12253        self
12254    }
12255}
12256
12257impl wkt::message::Message for ProductInputConfig {
12258    fn typename() -> &'static str {
12259        "type.googleapis.com/google.cloud.retail.v2.ProductInputConfig"
12260    }
12261}
12262
12263/// Defines additional types related to [ProductInputConfig].
12264pub mod product_input_config {
12265    #[allow(unused_imports)]
12266    use super::*;
12267
12268    /// Required. The source of the input.
12269    #[derive(Clone, Debug, PartialEq)]
12270    #[non_exhaustive]
12271    pub enum Source {
12272        /// The Inline source for the input content for products.
12273        ProductInlineSource(std::boxed::Box<crate::model::ProductInlineSource>),
12274        /// Google Cloud Storage location for the input content.
12275        GcsSource(std::boxed::Box<crate::model::GcsSource>),
12276        /// BigQuery input source.
12277        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12278    }
12279}
12280
12281/// The input config source for user events.
12282#[derive(Clone, Default, PartialEq)]
12283#[non_exhaustive]
12284pub struct UserEventInputConfig {
12285    /// The source of the input.
12286    pub source: std::option::Option<crate::model::user_event_input_config::Source>,
12287
12288    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12289}
12290
12291impl UserEventInputConfig {
12292    pub fn new() -> Self {
12293        std::default::Default::default()
12294    }
12295
12296    /// Sets the value of [source][crate::model::UserEventInputConfig::source].
12297    ///
12298    /// Note that all the setters affecting `source` are mutually
12299    /// exclusive.
12300    ///
12301    /// # Example
12302    /// ```ignore,no_run
12303    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12304    /// use google_cloud_retail_v2::model::UserEventInlineSource;
12305    /// let x = UserEventInputConfig::new().set_source(Some(
12306    ///     google_cloud_retail_v2::model::user_event_input_config::Source::UserEventInlineSource(UserEventInlineSource::default().into())));
12307    /// ```
12308    pub fn set_source<
12309        T: std::convert::Into<std::option::Option<crate::model::user_event_input_config::Source>>,
12310    >(
12311        mut self,
12312        v: T,
12313    ) -> Self {
12314        self.source = v.into();
12315        self
12316    }
12317
12318    /// The value of [source][crate::model::UserEventInputConfig::source]
12319    /// if it holds a `UserEventInlineSource`, `None` if the field is not set or
12320    /// holds a different branch.
12321    pub fn user_event_inline_source(
12322        &self,
12323    ) -> std::option::Option<&std::boxed::Box<crate::model::UserEventInlineSource>> {
12324        #[allow(unreachable_patterns)]
12325        self.source.as_ref().and_then(|v| match v {
12326            crate::model::user_event_input_config::Source::UserEventInlineSource(v) => {
12327                std::option::Option::Some(v)
12328            }
12329            _ => std::option::Option::None,
12330        })
12331    }
12332
12333    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12334    /// to hold a `UserEventInlineSource`.
12335    ///
12336    /// Note that all the setters affecting `source` are
12337    /// mutually exclusive.
12338    ///
12339    /// # Example
12340    /// ```ignore,no_run
12341    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12342    /// use google_cloud_retail_v2::model::UserEventInlineSource;
12343    /// let x = UserEventInputConfig::new().set_user_event_inline_source(UserEventInlineSource::default()/* use setters */);
12344    /// assert!(x.user_event_inline_source().is_some());
12345    /// assert!(x.gcs_source().is_none());
12346    /// assert!(x.big_query_source().is_none());
12347    /// ```
12348    pub fn set_user_event_inline_source<
12349        T: std::convert::Into<std::boxed::Box<crate::model::UserEventInlineSource>>,
12350    >(
12351        mut self,
12352        v: T,
12353    ) -> Self {
12354        self.source = std::option::Option::Some(
12355            crate::model::user_event_input_config::Source::UserEventInlineSource(v.into()),
12356        );
12357        self
12358    }
12359
12360    /// The value of [source][crate::model::UserEventInputConfig::source]
12361    /// if it holds a `GcsSource`, `None` if the field is not set or
12362    /// holds a different branch.
12363    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12364        #[allow(unreachable_patterns)]
12365        self.source.as_ref().and_then(|v| match v {
12366            crate::model::user_event_input_config::Source::GcsSource(v) => {
12367                std::option::Option::Some(v)
12368            }
12369            _ => std::option::Option::None,
12370        })
12371    }
12372
12373    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12374    /// to hold a `GcsSource`.
12375    ///
12376    /// Note that all the setters affecting `source` are
12377    /// mutually exclusive.
12378    ///
12379    /// # Example
12380    /// ```ignore,no_run
12381    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12382    /// use google_cloud_retail_v2::model::GcsSource;
12383    /// let x = UserEventInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12384    /// assert!(x.gcs_source().is_some());
12385    /// assert!(x.user_event_inline_source().is_none());
12386    /// assert!(x.big_query_source().is_none());
12387    /// ```
12388    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12389        mut self,
12390        v: T,
12391    ) -> Self {
12392        self.source = std::option::Option::Some(
12393            crate::model::user_event_input_config::Source::GcsSource(v.into()),
12394        );
12395        self
12396    }
12397
12398    /// The value of [source][crate::model::UserEventInputConfig::source]
12399    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12400    /// holds a different branch.
12401    pub fn big_query_source(
12402        &self,
12403    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12404        #[allow(unreachable_patterns)]
12405        self.source.as_ref().and_then(|v| match v {
12406            crate::model::user_event_input_config::Source::BigQuerySource(v) => {
12407                std::option::Option::Some(v)
12408            }
12409            _ => std::option::Option::None,
12410        })
12411    }
12412
12413    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12414    /// to hold a `BigQuerySource`.
12415    ///
12416    /// Note that all the setters affecting `source` are
12417    /// mutually exclusive.
12418    ///
12419    /// # Example
12420    /// ```ignore,no_run
12421    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12422    /// use google_cloud_retail_v2::model::BigQuerySource;
12423    /// let x = UserEventInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12424    /// assert!(x.big_query_source().is_some());
12425    /// assert!(x.user_event_inline_source().is_none());
12426    /// assert!(x.gcs_source().is_none());
12427    /// ```
12428    pub fn set_big_query_source<
12429        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12430    >(
12431        mut self,
12432        v: T,
12433    ) -> Self {
12434        self.source = std::option::Option::Some(
12435            crate::model::user_event_input_config::Source::BigQuerySource(v.into()),
12436        );
12437        self
12438    }
12439}
12440
12441impl wkt::message::Message for UserEventInputConfig {
12442    fn typename() -> &'static str {
12443        "type.googleapis.com/google.cloud.retail.v2.UserEventInputConfig"
12444    }
12445}
12446
12447/// Defines additional types related to [UserEventInputConfig].
12448pub mod user_event_input_config {
12449    #[allow(unused_imports)]
12450    use super::*;
12451
12452    /// The source of the input.
12453    #[derive(Clone, Debug, PartialEq)]
12454    #[non_exhaustive]
12455    pub enum Source {
12456        /// Required. The Inline source for the input content for UserEvents.
12457        UserEventInlineSource(std::boxed::Box<crate::model::UserEventInlineSource>),
12458        /// Required. Google Cloud Storage location for the input content.
12459        GcsSource(std::boxed::Box<crate::model::GcsSource>),
12460        /// Required. BigQuery input source.
12461        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12462    }
12463}
12464
12465/// The input config source for completion data.
12466#[derive(Clone, Default, PartialEq)]
12467#[non_exhaustive]
12468pub struct CompletionDataInputConfig {
12469    /// The source of the input.
12470    ///
12471    /// Supported
12472    /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12473    /// values for suggestions imports:
12474    ///
12475    /// * `suggestions` (default): One JSON completion suggestion per line.
12476    /// * `denylist`:  One JSON deny suggestion per line.
12477    /// * `allowlist`:  One JSON allow suggestion per line.
12478    ///
12479    /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12480    pub source: std::option::Option<crate::model::completion_data_input_config::Source>,
12481
12482    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12483}
12484
12485impl CompletionDataInputConfig {
12486    pub fn new() -> Self {
12487        std::default::Default::default()
12488    }
12489
12490    /// Sets the value of [source][crate::model::CompletionDataInputConfig::source].
12491    ///
12492    /// Note that all the setters affecting `source` are mutually
12493    /// exclusive.
12494    ///
12495    /// # Example
12496    /// ```ignore,no_run
12497    /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12498    /// use google_cloud_retail_v2::model::BigQuerySource;
12499    /// let x = CompletionDataInputConfig::new().set_source(Some(
12500    ///     google_cloud_retail_v2::model::completion_data_input_config::Source::BigQuerySource(BigQuerySource::default().into())));
12501    /// ```
12502    pub fn set_source<
12503        T: std::convert::Into<std::option::Option<crate::model::completion_data_input_config::Source>>,
12504    >(
12505        mut self,
12506        v: T,
12507    ) -> Self {
12508        self.source = v.into();
12509        self
12510    }
12511
12512    /// The value of [source][crate::model::CompletionDataInputConfig::source]
12513    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12514    /// holds a different branch.
12515    pub fn big_query_source(
12516        &self,
12517    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12518        #[allow(unreachable_patterns)]
12519        self.source.as_ref().and_then(|v| match v {
12520            crate::model::completion_data_input_config::Source::BigQuerySource(v) => {
12521                std::option::Option::Some(v)
12522            }
12523            _ => std::option::Option::None,
12524        })
12525    }
12526
12527    /// Sets the value of [source][crate::model::CompletionDataInputConfig::source]
12528    /// to hold a `BigQuerySource`.
12529    ///
12530    /// Note that all the setters affecting `source` are
12531    /// mutually exclusive.
12532    ///
12533    /// # Example
12534    /// ```ignore,no_run
12535    /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12536    /// use google_cloud_retail_v2::model::BigQuerySource;
12537    /// let x = CompletionDataInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12538    /// assert!(x.big_query_source().is_some());
12539    /// ```
12540    pub fn set_big_query_source<
12541        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12542    >(
12543        mut self,
12544        v: T,
12545    ) -> Self {
12546        self.source = std::option::Option::Some(
12547            crate::model::completion_data_input_config::Source::BigQuerySource(v.into()),
12548        );
12549        self
12550    }
12551}
12552
12553impl wkt::message::Message for CompletionDataInputConfig {
12554    fn typename() -> &'static str {
12555        "type.googleapis.com/google.cloud.retail.v2.CompletionDataInputConfig"
12556    }
12557}
12558
12559/// Defines additional types related to [CompletionDataInputConfig].
12560pub mod completion_data_input_config {
12561    #[allow(unused_imports)]
12562    use super::*;
12563
12564    /// The source of the input.
12565    ///
12566    /// Supported
12567    /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12568    /// values for suggestions imports:
12569    ///
12570    /// * `suggestions` (default): One JSON completion suggestion per line.
12571    /// * `denylist`:  One JSON deny suggestion per line.
12572    /// * `allowlist`:  One JSON allow suggestion per line.
12573    ///
12574    /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12575    #[derive(Clone, Debug, PartialEq)]
12576    #[non_exhaustive]
12577    pub enum Source {
12578        /// Required. BigQuery input source.
12579        ///
12580        /// Add the IAM permission "BigQuery Data Viewer" for
12581        /// cloud-retail-customer-data-access@system.gserviceaccount.com before
12582        /// using this feature otherwise an error is thrown.
12583        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12584    }
12585}
12586
12587/// Metadata related to the progress of the Import operation. This is
12588/// returned by the google.longrunning.Operation.metadata field.
12589#[derive(Clone, Default, PartialEq)]
12590#[non_exhaustive]
12591pub struct ImportMetadata {
12592    /// Operation create time.
12593    pub create_time: std::option::Option<wkt::Timestamp>,
12594
12595    /// Operation last update time. If the operation is done, this is also the
12596    /// finish time.
12597    pub update_time: std::option::Option<wkt::Timestamp>,
12598
12599    /// Count of entries that were processed successfully.
12600    pub success_count: i64,
12601
12602    /// Count of entries that encountered errors while processing.
12603    pub failure_count: i64,
12604
12605    /// Deprecated. This field is never set.
12606    #[deprecated]
12607    pub request_id: std::string::String,
12608
12609    /// Pub/Sub topic for receiving notification. If this field is set,
12610    /// when the import is finished, a notification is sent to
12611    /// specified Pub/Sub topic. The message data is JSON string of a
12612    /// [Operation][google.longrunning.Operation].
12613    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12614    ///
12615    /// [google.longrunning.Operation]: longrunning::model::Operation
12616    pub notification_pubsub_topic: std::string::String,
12617
12618    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12619}
12620
12621impl ImportMetadata {
12622    pub fn new() -> Self {
12623        std::default::Default::default()
12624    }
12625
12626    /// Sets the value of [create_time][crate::model::ImportMetadata::create_time].
12627    ///
12628    /// # Example
12629    /// ```ignore,no_run
12630    /// # use google_cloud_retail_v2::model::ImportMetadata;
12631    /// use wkt::Timestamp;
12632    /// let x = ImportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
12633    /// ```
12634    pub fn set_create_time<T>(mut self, v: T) -> Self
12635    where
12636        T: std::convert::Into<wkt::Timestamp>,
12637    {
12638        self.create_time = std::option::Option::Some(v.into());
12639        self
12640    }
12641
12642    /// Sets or clears the value of [create_time][crate::model::ImportMetadata::create_time].
12643    ///
12644    /// # Example
12645    /// ```ignore,no_run
12646    /// # use google_cloud_retail_v2::model::ImportMetadata;
12647    /// use wkt::Timestamp;
12648    /// let x = ImportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12649    /// let x = ImportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
12650    /// ```
12651    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12652    where
12653        T: std::convert::Into<wkt::Timestamp>,
12654    {
12655        self.create_time = v.map(|x| x.into());
12656        self
12657    }
12658
12659    /// Sets the value of [update_time][crate::model::ImportMetadata::update_time].
12660    ///
12661    /// # Example
12662    /// ```ignore,no_run
12663    /// # use google_cloud_retail_v2::model::ImportMetadata;
12664    /// use wkt::Timestamp;
12665    /// let x = ImportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
12666    /// ```
12667    pub fn set_update_time<T>(mut self, v: T) -> Self
12668    where
12669        T: std::convert::Into<wkt::Timestamp>,
12670    {
12671        self.update_time = std::option::Option::Some(v.into());
12672        self
12673    }
12674
12675    /// Sets or clears the value of [update_time][crate::model::ImportMetadata::update_time].
12676    ///
12677    /// # Example
12678    /// ```ignore,no_run
12679    /// # use google_cloud_retail_v2::model::ImportMetadata;
12680    /// use wkt::Timestamp;
12681    /// let x = ImportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12682    /// let x = ImportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
12683    /// ```
12684    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12685    where
12686        T: std::convert::Into<wkt::Timestamp>,
12687    {
12688        self.update_time = v.map(|x| x.into());
12689        self
12690    }
12691
12692    /// Sets the value of [success_count][crate::model::ImportMetadata::success_count].
12693    ///
12694    /// # Example
12695    /// ```ignore,no_run
12696    /// # use google_cloud_retail_v2::model::ImportMetadata;
12697    /// let x = ImportMetadata::new().set_success_count(42);
12698    /// ```
12699    pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12700        self.success_count = v.into();
12701        self
12702    }
12703
12704    /// Sets the value of [failure_count][crate::model::ImportMetadata::failure_count].
12705    ///
12706    /// # Example
12707    /// ```ignore,no_run
12708    /// # use google_cloud_retail_v2::model::ImportMetadata;
12709    /// let x = ImportMetadata::new().set_failure_count(42);
12710    /// ```
12711    pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12712        self.failure_count = v.into();
12713        self
12714    }
12715
12716    /// Sets the value of [request_id][crate::model::ImportMetadata::request_id].
12717    ///
12718    /// # Example
12719    /// ```ignore,no_run
12720    /// # use google_cloud_retail_v2::model::ImportMetadata;
12721    /// let x = ImportMetadata::new().set_request_id("example");
12722    /// ```
12723    #[deprecated]
12724    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12725        self.request_id = v.into();
12726        self
12727    }
12728
12729    /// Sets the value of [notification_pubsub_topic][crate::model::ImportMetadata::notification_pubsub_topic].
12730    ///
12731    /// # Example
12732    /// ```ignore,no_run
12733    /// # use google_cloud_retail_v2::model::ImportMetadata;
12734    /// let x = ImportMetadata::new().set_notification_pubsub_topic("example");
12735    /// ```
12736    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12737        mut self,
12738        v: T,
12739    ) -> Self {
12740        self.notification_pubsub_topic = v.into();
12741        self
12742    }
12743}
12744
12745impl wkt::message::Message for ImportMetadata {
12746    fn typename() -> &'static str {
12747        "type.googleapis.com/google.cloud.retail.v2.ImportMetadata"
12748    }
12749}
12750
12751/// Response of the
12752/// [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
12753/// long running operation is done, then this message is returned by the
12754/// google.longrunning.Operations.response field if the operation was successful.
12755///
12756/// [google.cloud.retail.v2.ImportProductsRequest]: crate::model::ImportProductsRequest
12757#[derive(Clone, Default, PartialEq)]
12758#[non_exhaustive]
12759pub struct ImportProductsResponse {
12760    /// A sample of errors encountered while processing the request.
12761    pub error_samples: std::vec::Vec<rpc::model::Status>,
12762
12763    /// Echoes the destination for the complete errors in the request if set.
12764    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12765
12766    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12767}
12768
12769impl ImportProductsResponse {
12770    pub fn new() -> Self {
12771        std::default::Default::default()
12772    }
12773
12774    /// Sets the value of [error_samples][crate::model::ImportProductsResponse::error_samples].
12775    ///
12776    /// # Example
12777    /// ```ignore,no_run
12778    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12779    /// use rpc::model::Status;
12780    /// let x = ImportProductsResponse::new()
12781    ///     .set_error_samples([
12782    ///         Status::default()/* use setters */,
12783    ///         Status::default()/* use (different) setters */,
12784    ///     ]);
12785    /// ```
12786    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12787    where
12788        T: std::iter::IntoIterator<Item = V>,
12789        V: std::convert::Into<rpc::model::Status>,
12790    {
12791        use std::iter::Iterator;
12792        self.error_samples = v.into_iter().map(|i| i.into()).collect();
12793        self
12794    }
12795
12796    /// Sets the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12797    ///
12798    /// # Example
12799    /// ```ignore,no_run
12800    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12801    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12802    /// let x = ImportProductsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12803    /// ```
12804    pub fn set_errors_config<T>(mut self, v: T) -> Self
12805    where
12806        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12807    {
12808        self.errors_config = std::option::Option::Some(v.into());
12809        self
12810    }
12811
12812    /// Sets or clears the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12813    ///
12814    /// # Example
12815    /// ```ignore,no_run
12816    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12817    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12818    /// let x = ImportProductsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12819    /// let x = ImportProductsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12820    /// ```
12821    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12822    where
12823        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12824    {
12825        self.errors_config = v.map(|x| x.into());
12826        self
12827    }
12828}
12829
12830impl wkt::message::Message for ImportProductsResponse {
12831    fn typename() -> &'static str {
12832        "type.googleapis.com/google.cloud.retail.v2.ImportProductsResponse"
12833    }
12834}
12835
12836/// Response of the ImportUserEventsRequest. If the long running
12837/// operation was successful, then this message is returned by the
12838/// google.longrunning.Operations.response field if the operation was successful.
12839#[derive(Clone, Default, PartialEq)]
12840#[non_exhaustive]
12841pub struct ImportUserEventsResponse {
12842    /// A sample of errors encountered while processing the request.
12843    pub error_samples: std::vec::Vec<rpc::model::Status>,
12844
12845    /// Echoes the destination for the complete errors if this field was set in
12846    /// the request.
12847    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12848
12849    /// Aggregated statistics of user event import status.
12850    pub import_summary: std::option::Option<crate::model::UserEventImportSummary>,
12851
12852    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12853}
12854
12855impl ImportUserEventsResponse {
12856    pub fn new() -> Self {
12857        std::default::Default::default()
12858    }
12859
12860    /// Sets the value of [error_samples][crate::model::ImportUserEventsResponse::error_samples].
12861    ///
12862    /// # Example
12863    /// ```ignore,no_run
12864    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12865    /// use rpc::model::Status;
12866    /// let x = ImportUserEventsResponse::new()
12867    ///     .set_error_samples([
12868    ///         Status::default()/* use setters */,
12869    ///         Status::default()/* use (different) setters */,
12870    ///     ]);
12871    /// ```
12872    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12873    where
12874        T: std::iter::IntoIterator<Item = V>,
12875        V: std::convert::Into<rpc::model::Status>,
12876    {
12877        use std::iter::Iterator;
12878        self.error_samples = v.into_iter().map(|i| i.into()).collect();
12879        self
12880    }
12881
12882    /// Sets the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
12883    ///
12884    /// # Example
12885    /// ```ignore,no_run
12886    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12887    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12888    /// let x = ImportUserEventsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12889    /// ```
12890    pub fn set_errors_config<T>(mut self, v: T) -> Self
12891    where
12892        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12893    {
12894        self.errors_config = std::option::Option::Some(v.into());
12895        self
12896    }
12897
12898    /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
12899    ///
12900    /// # Example
12901    /// ```ignore,no_run
12902    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12903    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12904    /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12905    /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12906    /// ```
12907    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12908    where
12909        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12910    {
12911        self.errors_config = v.map(|x| x.into());
12912        self
12913    }
12914
12915    /// Sets the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
12916    ///
12917    /// # Example
12918    /// ```ignore,no_run
12919    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12920    /// use google_cloud_retail_v2::model::UserEventImportSummary;
12921    /// let x = ImportUserEventsResponse::new().set_import_summary(UserEventImportSummary::default()/* use setters */);
12922    /// ```
12923    pub fn set_import_summary<T>(mut self, v: T) -> Self
12924    where
12925        T: std::convert::Into<crate::model::UserEventImportSummary>,
12926    {
12927        self.import_summary = std::option::Option::Some(v.into());
12928        self
12929    }
12930
12931    /// Sets or clears the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
12932    ///
12933    /// # Example
12934    /// ```ignore,no_run
12935    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12936    /// use google_cloud_retail_v2::model::UserEventImportSummary;
12937    /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(Some(UserEventImportSummary::default()/* use setters */));
12938    /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(None::<UserEventImportSummary>);
12939    /// ```
12940    pub fn set_or_clear_import_summary<T>(mut self, v: std::option::Option<T>) -> Self
12941    where
12942        T: std::convert::Into<crate::model::UserEventImportSummary>,
12943    {
12944        self.import_summary = v.map(|x| x.into());
12945        self
12946    }
12947}
12948
12949impl wkt::message::Message for ImportUserEventsResponse {
12950    fn typename() -> &'static str {
12951        "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsResponse"
12952    }
12953}
12954
12955/// A summary of import result. The UserEventImportSummary summarizes
12956/// the import status for user events.
12957#[derive(Clone, Default, PartialEq)]
12958#[non_exhaustive]
12959pub struct UserEventImportSummary {
12960    /// Count of user events imported with complete existing catalog information.
12961    pub joined_events_count: i64,
12962
12963    /// Count of user events imported, but with catalog information not found
12964    /// in the imported catalog.
12965    pub unjoined_events_count: i64,
12966
12967    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12968}
12969
12970impl UserEventImportSummary {
12971    pub fn new() -> Self {
12972        std::default::Default::default()
12973    }
12974
12975    /// Sets the value of [joined_events_count][crate::model::UserEventImportSummary::joined_events_count].
12976    ///
12977    /// # Example
12978    /// ```ignore,no_run
12979    /// # use google_cloud_retail_v2::model::UserEventImportSummary;
12980    /// let x = UserEventImportSummary::new().set_joined_events_count(42);
12981    /// ```
12982    pub fn set_joined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12983        self.joined_events_count = v.into();
12984        self
12985    }
12986
12987    /// Sets the value of [unjoined_events_count][crate::model::UserEventImportSummary::unjoined_events_count].
12988    ///
12989    /// # Example
12990    /// ```ignore,no_run
12991    /// # use google_cloud_retail_v2::model::UserEventImportSummary;
12992    /// let x = UserEventImportSummary::new().set_unjoined_events_count(42);
12993    /// ```
12994    pub fn set_unjoined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12995        self.unjoined_events_count = v.into();
12996        self
12997    }
12998}
12999
13000impl wkt::message::Message for UserEventImportSummary {
13001    fn typename() -> &'static str {
13002        "type.googleapis.com/google.cloud.retail.v2.UserEventImportSummary"
13003    }
13004}
13005
13006/// Response of the
13007/// [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest].
13008/// If the long running operation is done, this message is returned by the
13009/// google.longrunning.Operations.response field if the operation is successful.
13010///
13011/// [google.cloud.retail.v2.ImportCompletionDataRequest]: crate::model::ImportCompletionDataRequest
13012#[derive(Clone, Default, PartialEq)]
13013#[non_exhaustive]
13014pub struct ImportCompletionDataResponse {
13015    /// A sample of errors encountered while processing the request.
13016    pub error_samples: std::vec::Vec<rpc::model::Status>,
13017
13018    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13019}
13020
13021impl ImportCompletionDataResponse {
13022    pub fn new() -> Self {
13023        std::default::Default::default()
13024    }
13025
13026    /// Sets the value of [error_samples][crate::model::ImportCompletionDataResponse::error_samples].
13027    ///
13028    /// # Example
13029    /// ```ignore,no_run
13030    /// # use google_cloud_retail_v2::model::ImportCompletionDataResponse;
13031    /// use rpc::model::Status;
13032    /// let x = ImportCompletionDataResponse::new()
13033    ///     .set_error_samples([
13034    ///         Status::default()/* use setters */,
13035    ///         Status::default()/* use (different) setters */,
13036    ///     ]);
13037    /// ```
13038    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13039    where
13040        T: std::iter::IntoIterator<Item = V>,
13041        V: std::convert::Into<rpc::model::Status>,
13042    {
13043        use std::iter::Iterator;
13044        self.error_samples = v.into_iter().map(|i| i.into()).collect();
13045        self
13046    }
13047}
13048
13049impl wkt::message::Message for ImportCompletionDataResponse {
13050    fn typename() -> &'static str {
13051        "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataResponse"
13052    }
13053}
13054
13055/// Metadata that describes the training and serving parameters of a
13056/// [Model][google.cloud.retail.v2.Model]. A
13057/// [Model][google.cloud.retail.v2.Model] can be associated with a
13058/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and then queried
13059/// through the Predict API.
13060///
13061/// [google.cloud.retail.v2.Model]: crate::model::Model
13062/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
13063#[derive(Clone, Default, PartialEq)]
13064#[non_exhaustive]
13065pub struct Model {
13066    /// Required. The fully qualified resource name of the model.
13067    ///
13068    /// Format:
13069    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
13070    /// catalog_id has char limit of 50.
13071    /// recommendation_model_id has char limit of 40.
13072    pub name: std::string::String,
13073
13074    /// Required. The display name of the model.
13075    ///
13076    /// Should be human readable, used to display Recommendation Models in the
13077    /// Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024
13078    /// characters.
13079    pub display_name: std::string::String,
13080
13081    /// Optional. The training state that the model is in (e.g.
13082    /// `TRAINING` or `PAUSED`).
13083    ///
13084    /// Since part of the cost of running the service
13085    /// is frequency of training - this can be used to determine when to train
13086    /// model in order to control cost. If not specified: the default value for
13087    /// `CreateModel` method is `TRAINING`. The default value for
13088    /// `UpdateModel` method is to keep the state the same as before.
13089    pub training_state: crate::model::model::TrainingState,
13090
13091    /// Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`.
13092    pub serving_state: crate::model::model::ServingState,
13093
13094    /// Output only. Timestamp the Recommendation Model was created at.
13095    pub create_time: std::option::Option<wkt::Timestamp>,
13096
13097    /// Output only. Timestamp the Recommendation Model was last updated. E.g.
13098    /// if a Recommendation Model was paused - this would be the time the pause was
13099    /// initiated.
13100    pub update_time: std::option::Option<wkt::Timestamp>,
13101
13102    /// Required. The type of model e.g. `home-page`.
13103    ///
13104    /// Currently supported values: `recommended-for-you`, `others-you-may-like`,
13105    /// `frequently-bought-together`, `page-optimization`, `similar-items`,
13106    /// `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value).
13107    ///
13108    /// This field together with
13109    /// [optimization_objective][google.cloud.retail.v2.Model.optimization_objective]
13110    /// describe model metadata to use to control model training and serving.
13111    /// See <https://cloud.google.com/retail/docs/models>
13112    /// for more details on what the model metadata control and which combination
13113    /// of parameters are valid. For invalid combinations of parameters (e.g. type
13114    /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13115    /// receive an error 400 if you try to create/update a recommendation with
13116    /// this set of knobs.
13117    ///
13118    /// [google.cloud.retail.v2.Model.optimization_objective]: crate::model::Model::optimization_objective
13119    pub r#type: std::string::String,
13120
13121    /// Optional. The optimization objective e.g. `cvr`.
13122    ///
13123    /// Currently supported
13124    /// values: `ctr`, `cvr`, `revenue-per-order`.
13125    ///
13126    /// If not specified, we choose default based on model type.
13127    /// Default depends on type of recommendation:
13128    ///
13129    /// `recommended-for-you` => `ctr`
13130    ///
13131    /// `others-you-may-like` => `ctr`
13132    ///
13133    /// `frequently-bought-together` => `revenue_per_order`
13134    ///
13135    /// This field together with
13136    /// [optimization_objective][google.cloud.retail.v2.Model.type]
13137    /// describe model metadata to use to control model training and serving.
13138    /// See <https://cloud.google.com/retail/docs/models>
13139    /// for more details on what the model metadata control and which combination
13140    /// of parameters are valid. For invalid combinations of parameters (e.g. type
13141    /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13142    /// receive an error 400 if you try to create/update a recommendation with
13143    /// this set of knobs.
13144    ///
13145    /// [google.cloud.retail.v2.Model.type]: crate::model::Model::type
13146    pub optimization_objective: std::string::String,
13147
13148    /// Optional. The state of periodic tuning.
13149    ///
13150    /// The period we use is 3 months - to do a
13151    /// one-off tune earlier use the `TuneModel` method. Default value
13152    /// is `PERIODIC_TUNING_ENABLED`.
13153    pub periodic_tuning_state: crate::model::model::PeriodicTuningState,
13154
13155    /// Output only. The timestamp when the latest successful tune finished.
13156    pub last_tune_time: std::option::Option<wkt::Timestamp>,
13157
13158    /// Output only. The tune operation associated with the model.
13159    ///
13160    /// Can be used to determine if there is an ongoing tune for this
13161    /// recommendation. Empty field implies no tune is goig on.
13162    pub tuning_operation: std::string::String,
13163
13164    /// Output only. The state of data requirements for this model: `DATA_OK` and
13165    /// `DATA_ERROR`.
13166    ///
13167    /// Recommendation model cannot be trained if the data is in
13168    /// `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even
13169    /// if serving state is `ACTIVE`: models were trained successfully before, but
13170    /// cannot be refreshed because model no longer has sufficient
13171    /// data for training.
13172    pub data_state: crate::model::model::DataState,
13173
13174    /// Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering
13175    /// by attributes is enabled for the model.
13176    pub filtering_option: crate::model::RecommendationsFilteringOption,
13177
13178    /// Output only. The list of valid serving configs associated with the
13179    /// PageOptimizationConfig.
13180    pub serving_config_lists: std::vec::Vec<crate::model::model::ServingConfigList>,
13181
13182    /// Optional. Additional model features config.
13183    pub model_features_config: std::option::Option<crate::model::model::ModelFeaturesConfig>,
13184
13185    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13186}
13187
13188impl Model {
13189    pub fn new() -> Self {
13190        std::default::Default::default()
13191    }
13192
13193    /// Sets the value of [name][crate::model::Model::name].
13194    ///
13195    /// # Example
13196    /// ```ignore,no_run
13197    /// # use google_cloud_retail_v2::model::Model;
13198    /// let x = Model::new().set_name("example");
13199    /// ```
13200    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13201        self.name = v.into();
13202        self
13203    }
13204
13205    /// Sets the value of [display_name][crate::model::Model::display_name].
13206    ///
13207    /// # Example
13208    /// ```ignore,no_run
13209    /// # use google_cloud_retail_v2::model::Model;
13210    /// let x = Model::new().set_display_name("example");
13211    /// ```
13212    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13213        self.display_name = v.into();
13214        self
13215    }
13216
13217    /// Sets the value of [training_state][crate::model::Model::training_state].
13218    ///
13219    /// # Example
13220    /// ```ignore,no_run
13221    /// # use google_cloud_retail_v2::model::Model;
13222    /// use google_cloud_retail_v2::model::model::TrainingState;
13223    /// let x0 = Model::new().set_training_state(TrainingState::Paused);
13224    /// let x1 = Model::new().set_training_state(TrainingState::Training);
13225    /// ```
13226    pub fn set_training_state<T: std::convert::Into<crate::model::model::TrainingState>>(
13227        mut self,
13228        v: T,
13229    ) -> Self {
13230        self.training_state = v.into();
13231        self
13232    }
13233
13234    /// Sets the value of [serving_state][crate::model::Model::serving_state].
13235    ///
13236    /// # Example
13237    /// ```ignore,no_run
13238    /// # use google_cloud_retail_v2::model::Model;
13239    /// use google_cloud_retail_v2::model::model::ServingState;
13240    /// let x0 = Model::new().set_serving_state(ServingState::Inactive);
13241    /// let x1 = Model::new().set_serving_state(ServingState::Active);
13242    /// let x2 = Model::new().set_serving_state(ServingState::Tuned);
13243    /// ```
13244    pub fn set_serving_state<T: std::convert::Into<crate::model::model::ServingState>>(
13245        mut self,
13246        v: T,
13247    ) -> Self {
13248        self.serving_state = v.into();
13249        self
13250    }
13251
13252    /// Sets the value of [create_time][crate::model::Model::create_time].
13253    ///
13254    /// # Example
13255    /// ```ignore,no_run
13256    /// # use google_cloud_retail_v2::model::Model;
13257    /// use wkt::Timestamp;
13258    /// let x = Model::new().set_create_time(Timestamp::default()/* use setters */);
13259    /// ```
13260    pub fn set_create_time<T>(mut self, v: T) -> Self
13261    where
13262        T: std::convert::Into<wkt::Timestamp>,
13263    {
13264        self.create_time = std::option::Option::Some(v.into());
13265        self
13266    }
13267
13268    /// Sets or clears the value of [create_time][crate::model::Model::create_time].
13269    ///
13270    /// # Example
13271    /// ```ignore,no_run
13272    /// # use google_cloud_retail_v2::model::Model;
13273    /// use wkt::Timestamp;
13274    /// let x = Model::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13275    /// let x = Model::new().set_or_clear_create_time(None::<Timestamp>);
13276    /// ```
13277    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13278    where
13279        T: std::convert::Into<wkt::Timestamp>,
13280    {
13281        self.create_time = v.map(|x| x.into());
13282        self
13283    }
13284
13285    /// Sets the value of [update_time][crate::model::Model::update_time].
13286    ///
13287    /// # Example
13288    /// ```ignore,no_run
13289    /// # use google_cloud_retail_v2::model::Model;
13290    /// use wkt::Timestamp;
13291    /// let x = Model::new().set_update_time(Timestamp::default()/* use setters */);
13292    /// ```
13293    pub fn set_update_time<T>(mut self, v: T) -> Self
13294    where
13295        T: std::convert::Into<wkt::Timestamp>,
13296    {
13297        self.update_time = std::option::Option::Some(v.into());
13298        self
13299    }
13300
13301    /// Sets or clears the value of [update_time][crate::model::Model::update_time].
13302    ///
13303    /// # Example
13304    /// ```ignore,no_run
13305    /// # use google_cloud_retail_v2::model::Model;
13306    /// use wkt::Timestamp;
13307    /// let x = Model::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13308    /// let x = Model::new().set_or_clear_update_time(None::<Timestamp>);
13309    /// ```
13310    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13311    where
13312        T: std::convert::Into<wkt::Timestamp>,
13313    {
13314        self.update_time = v.map(|x| x.into());
13315        self
13316    }
13317
13318    /// Sets the value of [r#type][crate::model::Model::type].
13319    ///
13320    /// # Example
13321    /// ```ignore,no_run
13322    /// # use google_cloud_retail_v2::model::Model;
13323    /// let x = Model::new().set_type("example");
13324    /// ```
13325    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13326        self.r#type = v.into();
13327        self
13328    }
13329
13330    /// Sets the value of [optimization_objective][crate::model::Model::optimization_objective].
13331    ///
13332    /// # Example
13333    /// ```ignore,no_run
13334    /// # use google_cloud_retail_v2::model::Model;
13335    /// let x = Model::new().set_optimization_objective("example");
13336    /// ```
13337    pub fn set_optimization_objective<T: std::convert::Into<std::string::String>>(
13338        mut self,
13339        v: T,
13340    ) -> Self {
13341        self.optimization_objective = v.into();
13342        self
13343    }
13344
13345    /// Sets the value of [periodic_tuning_state][crate::model::Model::periodic_tuning_state].
13346    ///
13347    /// # Example
13348    /// ```ignore,no_run
13349    /// # use google_cloud_retail_v2::model::Model;
13350    /// use google_cloud_retail_v2::model::model::PeriodicTuningState;
13351    /// let x0 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningDisabled);
13352    /// let x1 = Model::new().set_periodic_tuning_state(PeriodicTuningState::AllTuningDisabled);
13353    /// let x2 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningEnabled);
13354    /// ```
13355    pub fn set_periodic_tuning_state<
13356        T: std::convert::Into<crate::model::model::PeriodicTuningState>,
13357    >(
13358        mut self,
13359        v: T,
13360    ) -> Self {
13361        self.periodic_tuning_state = v.into();
13362        self
13363    }
13364
13365    /// Sets the value of [last_tune_time][crate::model::Model::last_tune_time].
13366    ///
13367    /// # Example
13368    /// ```ignore,no_run
13369    /// # use google_cloud_retail_v2::model::Model;
13370    /// use wkt::Timestamp;
13371    /// let x = Model::new().set_last_tune_time(Timestamp::default()/* use setters */);
13372    /// ```
13373    pub fn set_last_tune_time<T>(mut self, v: T) -> Self
13374    where
13375        T: std::convert::Into<wkt::Timestamp>,
13376    {
13377        self.last_tune_time = std::option::Option::Some(v.into());
13378        self
13379    }
13380
13381    /// Sets or clears the value of [last_tune_time][crate::model::Model::last_tune_time].
13382    ///
13383    /// # Example
13384    /// ```ignore,no_run
13385    /// # use google_cloud_retail_v2::model::Model;
13386    /// use wkt::Timestamp;
13387    /// let x = Model::new().set_or_clear_last_tune_time(Some(Timestamp::default()/* use setters */));
13388    /// let x = Model::new().set_or_clear_last_tune_time(None::<Timestamp>);
13389    /// ```
13390    pub fn set_or_clear_last_tune_time<T>(mut self, v: std::option::Option<T>) -> Self
13391    where
13392        T: std::convert::Into<wkt::Timestamp>,
13393    {
13394        self.last_tune_time = v.map(|x| x.into());
13395        self
13396    }
13397
13398    /// Sets the value of [tuning_operation][crate::model::Model::tuning_operation].
13399    ///
13400    /// # Example
13401    /// ```ignore,no_run
13402    /// # use google_cloud_retail_v2::model::Model;
13403    /// let x = Model::new().set_tuning_operation("example");
13404    /// ```
13405    pub fn set_tuning_operation<T: std::convert::Into<std::string::String>>(
13406        mut self,
13407        v: T,
13408    ) -> Self {
13409        self.tuning_operation = v.into();
13410        self
13411    }
13412
13413    /// Sets the value of [data_state][crate::model::Model::data_state].
13414    ///
13415    /// # Example
13416    /// ```ignore,no_run
13417    /// # use google_cloud_retail_v2::model::Model;
13418    /// use google_cloud_retail_v2::model::model::DataState;
13419    /// let x0 = Model::new().set_data_state(DataState::DataOk);
13420    /// let x1 = Model::new().set_data_state(DataState::DataError);
13421    /// ```
13422    pub fn set_data_state<T: std::convert::Into<crate::model::model::DataState>>(
13423        mut self,
13424        v: T,
13425    ) -> Self {
13426        self.data_state = v.into();
13427        self
13428    }
13429
13430    /// Sets the value of [filtering_option][crate::model::Model::filtering_option].
13431    ///
13432    /// # Example
13433    /// ```ignore,no_run
13434    /// # use google_cloud_retail_v2::model::Model;
13435    /// use google_cloud_retail_v2::model::RecommendationsFilteringOption;
13436    /// let x0 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringDisabled);
13437    /// let x1 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringEnabled);
13438    /// ```
13439    pub fn set_filtering_option<
13440        T: std::convert::Into<crate::model::RecommendationsFilteringOption>,
13441    >(
13442        mut self,
13443        v: T,
13444    ) -> Self {
13445        self.filtering_option = v.into();
13446        self
13447    }
13448
13449    /// Sets the value of [serving_config_lists][crate::model::Model::serving_config_lists].
13450    ///
13451    /// # Example
13452    /// ```ignore,no_run
13453    /// # use google_cloud_retail_v2::model::Model;
13454    /// use google_cloud_retail_v2::model::model::ServingConfigList;
13455    /// let x = Model::new()
13456    ///     .set_serving_config_lists([
13457    ///         ServingConfigList::default()/* use setters */,
13458    ///         ServingConfigList::default()/* use (different) setters */,
13459    ///     ]);
13460    /// ```
13461    pub fn set_serving_config_lists<T, V>(mut self, v: T) -> Self
13462    where
13463        T: std::iter::IntoIterator<Item = V>,
13464        V: std::convert::Into<crate::model::model::ServingConfigList>,
13465    {
13466        use std::iter::Iterator;
13467        self.serving_config_lists = v.into_iter().map(|i| i.into()).collect();
13468        self
13469    }
13470
13471    /// Sets the value of [model_features_config][crate::model::Model::model_features_config].
13472    ///
13473    /// # Example
13474    /// ```ignore,no_run
13475    /// # use google_cloud_retail_v2::model::Model;
13476    /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13477    /// let x = Model::new().set_model_features_config(ModelFeaturesConfig::default()/* use setters */);
13478    /// ```
13479    pub fn set_model_features_config<T>(mut self, v: T) -> Self
13480    where
13481        T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13482    {
13483        self.model_features_config = std::option::Option::Some(v.into());
13484        self
13485    }
13486
13487    /// Sets or clears the value of [model_features_config][crate::model::Model::model_features_config].
13488    ///
13489    /// # Example
13490    /// ```ignore,no_run
13491    /// # use google_cloud_retail_v2::model::Model;
13492    /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13493    /// let x = Model::new().set_or_clear_model_features_config(Some(ModelFeaturesConfig::default()/* use setters */));
13494    /// let x = Model::new().set_or_clear_model_features_config(None::<ModelFeaturesConfig>);
13495    /// ```
13496    pub fn set_or_clear_model_features_config<T>(mut self, v: std::option::Option<T>) -> Self
13497    where
13498        T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13499    {
13500        self.model_features_config = v.map(|x| x.into());
13501        self
13502    }
13503}
13504
13505impl wkt::message::Message for Model {
13506    fn typename() -> &'static str {
13507        "type.googleapis.com/google.cloud.retail.v2.Model"
13508    }
13509}
13510
13511/// Defines additional types related to [Model].
13512pub mod model {
13513    #[allow(unused_imports)]
13514    use super::*;
13515
13516    /// Represents an ordered combination of valid serving configs, which
13517    /// can be used for `PAGE_OPTIMIZATION` recommendations.
13518    #[derive(Clone, Default, PartialEq)]
13519    #[non_exhaustive]
13520    pub struct ServingConfigList {
13521        /// Optional. A set of valid serving configs that may be used for
13522        /// `PAGE_OPTIMIZATION`.
13523        pub serving_config_ids: std::vec::Vec<std::string::String>,
13524
13525        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13526    }
13527
13528    impl ServingConfigList {
13529        pub fn new() -> Self {
13530            std::default::Default::default()
13531        }
13532
13533        /// Sets the value of [serving_config_ids][crate::model::model::ServingConfigList::serving_config_ids].
13534        ///
13535        /// # Example
13536        /// ```ignore,no_run
13537        /// # use google_cloud_retail_v2::model::model::ServingConfigList;
13538        /// let x = ServingConfigList::new().set_serving_config_ids(["a", "b", "c"]);
13539        /// ```
13540        pub fn set_serving_config_ids<T, V>(mut self, v: T) -> Self
13541        where
13542            T: std::iter::IntoIterator<Item = V>,
13543            V: std::convert::Into<std::string::String>,
13544        {
13545            use std::iter::Iterator;
13546            self.serving_config_ids = v.into_iter().map(|i| i.into()).collect();
13547            self
13548        }
13549    }
13550
13551    impl wkt::message::Message for ServingConfigList {
13552        fn typename() -> &'static str {
13553            "type.googleapis.com/google.cloud.retail.v2.Model.ServingConfigList"
13554        }
13555    }
13556
13557    /// Additional configs for the frequently-bought-together model type.
13558    #[derive(Clone, Default, PartialEq)]
13559    #[non_exhaustive]
13560    pub struct FrequentlyBoughtTogetherFeaturesConfig {
13561        /// Optional. Specifies the context of the model when it is used in predict
13562        /// requests. Can only be set for the `frequently-bought-together` type. If
13563        /// it isn't specified, it defaults to
13564        /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
13565        ///
13566        /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
13567        pub context_products_type: crate::model::model::ContextProductsType,
13568
13569        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13570    }
13571
13572    impl FrequentlyBoughtTogetherFeaturesConfig {
13573        pub fn new() -> Self {
13574            std::default::Default::default()
13575        }
13576
13577        /// Sets the value of [context_products_type][crate::model::model::FrequentlyBoughtTogetherFeaturesConfig::context_products_type].
13578        ///
13579        /// # Example
13580        /// ```ignore,no_run
13581        /// # use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13582        /// use google_cloud_retail_v2::model::model::ContextProductsType;
13583        /// let x0 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::SingleContextProduct);
13584        /// let x1 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::MultipleContextProducts);
13585        /// ```
13586        pub fn set_context_products_type<
13587            T: std::convert::Into<crate::model::model::ContextProductsType>,
13588        >(
13589            mut self,
13590            v: T,
13591        ) -> Self {
13592            self.context_products_type = v.into();
13593            self
13594        }
13595    }
13596
13597    impl wkt::message::Message for FrequentlyBoughtTogetherFeaturesConfig {
13598        fn typename() -> &'static str {
13599            "type.googleapis.com/google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig"
13600        }
13601    }
13602
13603    /// Additional model features config.
13604    #[derive(Clone, Default, PartialEq)]
13605    #[non_exhaustive]
13606    pub struct ModelFeaturesConfig {
13607        pub type_dedicated_config:
13608            std::option::Option<crate::model::model::model_features_config::TypeDedicatedConfig>,
13609
13610        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13611    }
13612
13613    impl ModelFeaturesConfig {
13614        pub fn new() -> Self {
13615            std::default::Default::default()
13616        }
13617
13618        /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config].
13619        ///
13620        /// Note that all the setters affecting `type_dedicated_config` are mutually
13621        /// exclusive.
13622        ///
13623        /// # Example
13624        /// ```ignore,no_run
13625        /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13626        /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13627        /// let x = ModelFeaturesConfig::new().set_type_dedicated_config(Some(
13628        ///     google_cloud_retail_v2::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(FrequentlyBoughtTogetherFeaturesConfig::default().into())));
13629        /// ```
13630        pub fn set_type_dedicated_config<
13631            T: std::convert::Into<
13632                    std::option::Option<
13633                        crate::model::model::model_features_config::TypeDedicatedConfig,
13634                    >,
13635                >,
13636        >(
13637            mut self,
13638            v: T,
13639        ) -> Self {
13640            self.type_dedicated_config = v.into();
13641            self
13642        }
13643
13644        /// The value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13645        /// if it holds a `FrequentlyBoughtTogetherConfig`, `None` if the field is not set or
13646        /// holds a different branch.
13647        pub fn frequently_bought_together_config(
13648            &self,
13649        ) -> std::option::Option<
13650            &std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13651        > {
13652            #[allow(unreachable_patterns)]
13653            self.type_dedicated_config.as_ref().and_then(|v| match v {
13654                crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(v) => std::option::Option::Some(v),
13655                _ => std::option::Option::None,
13656            })
13657        }
13658
13659        /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13660        /// to hold a `FrequentlyBoughtTogetherConfig`.
13661        ///
13662        /// Note that all the setters affecting `type_dedicated_config` are
13663        /// mutually exclusive.
13664        ///
13665        /// # Example
13666        /// ```ignore,no_run
13667        /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13668        /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13669        /// let x = ModelFeaturesConfig::new().set_frequently_bought_together_config(FrequentlyBoughtTogetherFeaturesConfig::default()/* use setters */);
13670        /// assert!(x.frequently_bought_together_config().is_some());
13671        /// ```
13672        pub fn set_frequently_bought_together_config<
13673            T: std::convert::Into<
13674                    std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13675                >,
13676        >(
13677            mut self,
13678            v: T,
13679        ) -> Self {
13680            self.type_dedicated_config = std::option::Option::Some(
13681                crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(
13682                    v.into()
13683                )
13684            );
13685            self
13686        }
13687    }
13688
13689    impl wkt::message::Message for ModelFeaturesConfig {
13690        fn typename() -> &'static str {
13691            "type.googleapis.com/google.cloud.retail.v2.Model.ModelFeaturesConfig"
13692        }
13693    }
13694
13695    /// Defines additional types related to [ModelFeaturesConfig].
13696    pub mod model_features_config {
13697        #[allow(unused_imports)]
13698        use super::*;
13699
13700        #[derive(Clone, Debug, PartialEq)]
13701        #[non_exhaustive]
13702        pub enum TypeDedicatedConfig {
13703            /// Additional configs for frequently-bought-together models.
13704            FrequentlyBoughtTogetherConfig(
13705                std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13706            ),
13707        }
13708    }
13709
13710    /// The serving state of the model.
13711    ///
13712    /// # Working with unknown values
13713    ///
13714    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13715    /// additional enum variants at any time. Adding new variants is not considered
13716    /// a breaking change. Applications should write their code in anticipation of:
13717    ///
13718    /// - New values appearing in future releases of the client library, **and**
13719    /// - New values received dynamically, without application changes.
13720    ///
13721    /// Please consult the [Working with enums] section in the user guide for some
13722    /// guidelines.
13723    ///
13724    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13725    #[derive(Clone, Debug, PartialEq)]
13726    #[non_exhaustive]
13727    pub enum ServingState {
13728        /// Unspecified serving state.
13729        Unspecified,
13730        /// The model is not serving.
13731        Inactive,
13732        /// The model is serving and can be queried.
13733        Active,
13734        /// The model is trained on tuned hyperparameters and can be
13735        /// queried.
13736        Tuned,
13737        /// If set, the enum was initialized with an unknown value.
13738        ///
13739        /// Applications can examine the value using [ServingState::value] or
13740        /// [ServingState::name].
13741        UnknownValue(serving_state::UnknownValue),
13742    }
13743
13744    #[doc(hidden)]
13745    pub mod serving_state {
13746        #[allow(unused_imports)]
13747        use super::*;
13748        #[derive(Clone, Debug, PartialEq)]
13749        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13750    }
13751
13752    impl ServingState {
13753        /// Gets the enum value.
13754        ///
13755        /// Returns `None` if the enum contains an unknown value deserialized from
13756        /// the string representation of enums.
13757        pub fn value(&self) -> std::option::Option<i32> {
13758            match self {
13759                Self::Unspecified => std::option::Option::Some(0),
13760                Self::Inactive => std::option::Option::Some(1),
13761                Self::Active => std::option::Option::Some(2),
13762                Self::Tuned => std::option::Option::Some(3),
13763                Self::UnknownValue(u) => u.0.value(),
13764            }
13765        }
13766
13767        /// Gets the enum value as a string.
13768        ///
13769        /// Returns `None` if the enum contains an unknown value deserialized from
13770        /// the integer representation of enums.
13771        pub fn name(&self) -> std::option::Option<&str> {
13772            match self {
13773                Self::Unspecified => std::option::Option::Some("SERVING_STATE_UNSPECIFIED"),
13774                Self::Inactive => std::option::Option::Some("INACTIVE"),
13775                Self::Active => std::option::Option::Some("ACTIVE"),
13776                Self::Tuned => std::option::Option::Some("TUNED"),
13777                Self::UnknownValue(u) => u.0.name(),
13778            }
13779        }
13780    }
13781
13782    impl std::default::Default for ServingState {
13783        fn default() -> Self {
13784            use std::convert::From;
13785            Self::from(0)
13786        }
13787    }
13788
13789    impl std::fmt::Display for ServingState {
13790        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13791            wkt::internal::display_enum(f, self.name(), self.value())
13792        }
13793    }
13794
13795    impl std::convert::From<i32> for ServingState {
13796        fn from(value: i32) -> Self {
13797            match value {
13798                0 => Self::Unspecified,
13799                1 => Self::Inactive,
13800                2 => Self::Active,
13801                3 => Self::Tuned,
13802                _ => Self::UnknownValue(serving_state::UnknownValue(
13803                    wkt::internal::UnknownEnumValue::Integer(value),
13804                )),
13805            }
13806        }
13807    }
13808
13809    impl std::convert::From<&str> for ServingState {
13810        fn from(value: &str) -> Self {
13811            use std::string::ToString;
13812            match value {
13813                "SERVING_STATE_UNSPECIFIED" => Self::Unspecified,
13814                "INACTIVE" => Self::Inactive,
13815                "ACTIVE" => Self::Active,
13816                "TUNED" => Self::Tuned,
13817                _ => Self::UnknownValue(serving_state::UnknownValue(
13818                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13819                )),
13820            }
13821        }
13822    }
13823
13824    impl serde::ser::Serialize for ServingState {
13825        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13826        where
13827            S: serde::Serializer,
13828        {
13829            match self {
13830                Self::Unspecified => serializer.serialize_i32(0),
13831                Self::Inactive => serializer.serialize_i32(1),
13832                Self::Active => serializer.serialize_i32(2),
13833                Self::Tuned => serializer.serialize_i32(3),
13834                Self::UnknownValue(u) => u.0.serialize(serializer),
13835            }
13836        }
13837    }
13838
13839    impl<'de> serde::de::Deserialize<'de> for ServingState {
13840        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13841        where
13842            D: serde::Deserializer<'de>,
13843        {
13844            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServingState>::new(
13845                ".google.cloud.retail.v2.Model.ServingState",
13846            ))
13847        }
13848    }
13849
13850    /// The training state of the model.
13851    ///
13852    /// # Working with unknown values
13853    ///
13854    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13855    /// additional enum variants at any time. Adding new variants is not considered
13856    /// a breaking change. Applications should write their code in anticipation of:
13857    ///
13858    /// - New values appearing in future releases of the client library, **and**
13859    /// - New values received dynamically, without application changes.
13860    ///
13861    /// Please consult the [Working with enums] section in the user guide for some
13862    /// guidelines.
13863    ///
13864    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13865    #[derive(Clone, Debug, PartialEq)]
13866    #[non_exhaustive]
13867    pub enum TrainingState {
13868        /// Unspecified training state.
13869        Unspecified,
13870        /// The model training is paused.
13871        Paused,
13872        /// The model is training.
13873        Training,
13874        /// If set, the enum was initialized with an unknown value.
13875        ///
13876        /// Applications can examine the value using [TrainingState::value] or
13877        /// [TrainingState::name].
13878        UnknownValue(training_state::UnknownValue),
13879    }
13880
13881    #[doc(hidden)]
13882    pub mod training_state {
13883        #[allow(unused_imports)]
13884        use super::*;
13885        #[derive(Clone, Debug, PartialEq)]
13886        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13887    }
13888
13889    impl TrainingState {
13890        /// Gets the enum value.
13891        ///
13892        /// Returns `None` if the enum contains an unknown value deserialized from
13893        /// the string representation of enums.
13894        pub fn value(&self) -> std::option::Option<i32> {
13895            match self {
13896                Self::Unspecified => std::option::Option::Some(0),
13897                Self::Paused => std::option::Option::Some(1),
13898                Self::Training => std::option::Option::Some(2),
13899                Self::UnknownValue(u) => u.0.value(),
13900            }
13901        }
13902
13903        /// Gets the enum value as a string.
13904        ///
13905        /// Returns `None` if the enum contains an unknown value deserialized from
13906        /// the integer representation of enums.
13907        pub fn name(&self) -> std::option::Option<&str> {
13908            match self {
13909                Self::Unspecified => std::option::Option::Some("TRAINING_STATE_UNSPECIFIED"),
13910                Self::Paused => std::option::Option::Some("PAUSED"),
13911                Self::Training => std::option::Option::Some("TRAINING"),
13912                Self::UnknownValue(u) => u.0.name(),
13913            }
13914        }
13915    }
13916
13917    impl std::default::Default for TrainingState {
13918        fn default() -> Self {
13919            use std::convert::From;
13920            Self::from(0)
13921        }
13922    }
13923
13924    impl std::fmt::Display for TrainingState {
13925        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13926            wkt::internal::display_enum(f, self.name(), self.value())
13927        }
13928    }
13929
13930    impl std::convert::From<i32> for TrainingState {
13931        fn from(value: i32) -> Self {
13932            match value {
13933                0 => Self::Unspecified,
13934                1 => Self::Paused,
13935                2 => Self::Training,
13936                _ => Self::UnknownValue(training_state::UnknownValue(
13937                    wkt::internal::UnknownEnumValue::Integer(value),
13938                )),
13939            }
13940        }
13941    }
13942
13943    impl std::convert::From<&str> for TrainingState {
13944        fn from(value: &str) -> Self {
13945            use std::string::ToString;
13946            match value {
13947                "TRAINING_STATE_UNSPECIFIED" => Self::Unspecified,
13948                "PAUSED" => Self::Paused,
13949                "TRAINING" => Self::Training,
13950                _ => Self::UnknownValue(training_state::UnknownValue(
13951                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13952                )),
13953            }
13954        }
13955    }
13956
13957    impl serde::ser::Serialize for TrainingState {
13958        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13959        where
13960            S: serde::Serializer,
13961        {
13962            match self {
13963                Self::Unspecified => serializer.serialize_i32(0),
13964                Self::Paused => serializer.serialize_i32(1),
13965                Self::Training => serializer.serialize_i32(2),
13966                Self::UnknownValue(u) => u.0.serialize(serializer),
13967            }
13968        }
13969    }
13970
13971    impl<'de> serde::de::Deserialize<'de> for TrainingState {
13972        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13973        where
13974            D: serde::Deserializer<'de>,
13975        {
13976            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingState>::new(
13977                ".google.cloud.retail.v2.Model.TrainingState",
13978            ))
13979        }
13980    }
13981
13982    /// Describes whether periodic tuning is enabled for this model
13983    /// or not. Periodic tuning is scheduled at most every three months. You can
13984    /// start a tuning process manually by using the `TuneModel`
13985    /// method, which starts a tuning process immediately and resets the quarterly
13986    /// schedule. Enabling or disabling periodic tuning does not affect any
13987    /// current tuning processes.
13988    ///
13989    /// # Working with unknown values
13990    ///
13991    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13992    /// additional enum variants at any time. Adding new variants is not considered
13993    /// a breaking change. Applications should write their code in anticipation of:
13994    ///
13995    /// - New values appearing in future releases of the client library, **and**
13996    /// - New values received dynamically, without application changes.
13997    ///
13998    /// Please consult the [Working with enums] section in the user guide for some
13999    /// guidelines.
14000    ///
14001    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14002    #[derive(Clone, Debug, PartialEq)]
14003    #[non_exhaustive]
14004    pub enum PeriodicTuningState {
14005        /// Unspecified default value, should never be explicitly set.
14006        Unspecified,
14007        /// The model has periodic tuning disabled. Tuning
14008        /// can be reenabled by calling the `EnableModelPeriodicTuning`
14009        /// method or by calling the `TuneModel` method.
14010        PeriodicTuningDisabled,
14011        /// The model cannot be tuned with periodic tuning OR the
14012        /// `TuneModel` method. Hide the options in customer UI and
14013        /// reject any requests through the backend self serve API.
14014        AllTuningDisabled,
14015        /// The model has periodic tuning enabled. Tuning
14016        /// can be disabled by calling the `DisableModelPeriodicTuning`
14017        /// method.
14018        PeriodicTuningEnabled,
14019        /// If set, the enum was initialized with an unknown value.
14020        ///
14021        /// Applications can examine the value using [PeriodicTuningState::value] or
14022        /// [PeriodicTuningState::name].
14023        UnknownValue(periodic_tuning_state::UnknownValue),
14024    }
14025
14026    #[doc(hidden)]
14027    pub mod periodic_tuning_state {
14028        #[allow(unused_imports)]
14029        use super::*;
14030        #[derive(Clone, Debug, PartialEq)]
14031        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14032    }
14033
14034    impl PeriodicTuningState {
14035        /// Gets the enum value.
14036        ///
14037        /// Returns `None` if the enum contains an unknown value deserialized from
14038        /// the string representation of enums.
14039        pub fn value(&self) -> std::option::Option<i32> {
14040            match self {
14041                Self::Unspecified => std::option::Option::Some(0),
14042                Self::PeriodicTuningDisabled => std::option::Option::Some(1),
14043                Self::AllTuningDisabled => std::option::Option::Some(3),
14044                Self::PeriodicTuningEnabled => std::option::Option::Some(2),
14045                Self::UnknownValue(u) => u.0.value(),
14046            }
14047        }
14048
14049        /// Gets the enum value as a string.
14050        ///
14051        /// Returns `None` if the enum contains an unknown value deserialized from
14052        /// the integer representation of enums.
14053        pub fn name(&self) -> std::option::Option<&str> {
14054            match self {
14055                Self::Unspecified => std::option::Option::Some("PERIODIC_TUNING_STATE_UNSPECIFIED"),
14056                Self::PeriodicTuningDisabled => {
14057                    std::option::Option::Some("PERIODIC_TUNING_DISABLED")
14058                }
14059                Self::AllTuningDisabled => std::option::Option::Some("ALL_TUNING_DISABLED"),
14060                Self::PeriodicTuningEnabled => std::option::Option::Some("PERIODIC_TUNING_ENABLED"),
14061                Self::UnknownValue(u) => u.0.name(),
14062            }
14063        }
14064    }
14065
14066    impl std::default::Default for PeriodicTuningState {
14067        fn default() -> Self {
14068            use std::convert::From;
14069            Self::from(0)
14070        }
14071    }
14072
14073    impl std::fmt::Display for PeriodicTuningState {
14074        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14075            wkt::internal::display_enum(f, self.name(), self.value())
14076        }
14077    }
14078
14079    impl std::convert::From<i32> for PeriodicTuningState {
14080        fn from(value: i32) -> Self {
14081            match value {
14082                0 => Self::Unspecified,
14083                1 => Self::PeriodicTuningDisabled,
14084                2 => Self::PeriodicTuningEnabled,
14085                3 => Self::AllTuningDisabled,
14086                _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14087                    wkt::internal::UnknownEnumValue::Integer(value),
14088                )),
14089            }
14090        }
14091    }
14092
14093    impl std::convert::From<&str> for PeriodicTuningState {
14094        fn from(value: &str) -> Self {
14095            use std::string::ToString;
14096            match value {
14097                "PERIODIC_TUNING_STATE_UNSPECIFIED" => Self::Unspecified,
14098                "PERIODIC_TUNING_DISABLED" => Self::PeriodicTuningDisabled,
14099                "ALL_TUNING_DISABLED" => Self::AllTuningDisabled,
14100                "PERIODIC_TUNING_ENABLED" => Self::PeriodicTuningEnabled,
14101                _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14102                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14103                )),
14104            }
14105        }
14106    }
14107
14108    impl serde::ser::Serialize for PeriodicTuningState {
14109        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14110        where
14111            S: serde::Serializer,
14112        {
14113            match self {
14114                Self::Unspecified => serializer.serialize_i32(0),
14115                Self::PeriodicTuningDisabled => serializer.serialize_i32(1),
14116                Self::AllTuningDisabled => serializer.serialize_i32(3),
14117                Self::PeriodicTuningEnabled => serializer.serialize_i32(2),
14118                Self::UnknownValue(u) => u.0.serialize(serializer),
14119            }
14120        }
14121    }
14122
14123    impl<'de> serde::de::Deserialize<'de> for PeriodicTuningState {
14124        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14125        where
14126            D: serde::Deserializer<'de>,
14127        {
14128            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PeriodicTuningState>::new(
14129                ".google.cloud.retail.v2.Model.PeriodicTuningState",
14130            ))
14131        }
14132    }
14133
14134    /// Describes whether this model have sufficient training data
14135    /// to be continuously trained.
14136    ///
14137    /// # Working with unknown values
14138    ///
14139    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14140    /// additional enum variants at any time. Adding new variants is not considered
14141    /// a breaking change. Applications should write their code in anticipation of:
14142    ///
14143    /// - New values appearing in future releases of the client library, **and**
14144    /// - New values received dynamically, without application changes.
14145    ///
14146    /// Please consult the [Working with enums] section in the user guide for some
14147    /// guidelines.
14148    ///
14149    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14150    #[derive(Clone, Debug, PartialEq)]
14151    #[non_exhaustive]
14152    pub enum DataState {
14153        /// Unspecified default value, should never be explicitly set.
14154        Unspecified,
14155        /// The model has sufficient training data.
14156        DataOk,
14157        /// The model does not have sufficient training data. Error
14158        /// messages can be queried via Stackdriver.
14159        DataError,
14160        /// If set, the enum was initialized with an unknown value.
14161        ///
14162        /// Applications can examine the value using [DataState::value] or
14163        /// [DataState::name].
14164        UnknownValue(data_state::UnknownValue),
14165    }
14166
14167    #[doc(hidden)]
14168    pub mod data_state {
14169        #[allow(unused_imports)]
14170        use super::*;
14171        #[derive(Clone, Debug, PartialEq)]
14172        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14173    }
14174
14175    impl DataState {
14176        /// Gets the enum value.
14177        ///
14178        /// Returns `None` if the enum contains an unknown value deserialized from
14179        /// the string representation of enums.
14180        pub fn value(&self) -> std::option::Option<i32> {
14181            match self {
14182                Self::Unspecified => std::option::Option::Some(0),
14183                Self::DataOk => std::option::Option::Some(1),
14184                Self::DataError => std::option::Option::Some(2),
14185                Self::UnknownValue(u) => u.0.value(),
14186            }
14187        }
14188
14189        /// Gets the enum value as a string.
14190        ///
14191        /// Returns `None` if the enum contains an unknown value deserialized from
14192        /// the integer representation of enums.
14193        pub fn name(&self) -> std::option::Option<&str> {
14194            match self {
14195                Self::Unspecified => std::option::Option::Some("DATA_STATE_UNSPECIFIED"),
14196                Self::DataOk => std::option::Option::Some("DATA_OK"),
14197                Self::DataError => std::option::Option::Some("DATA_ERROR"),
14198                Self::UnknownValue(u) => u.0.name(),
14199            }
14200        }
14201    }
14202
14203    impl std::default::Default for DataState {
14204        fn default() -> Self {
14205            use std::convert::From;
14206            Self::from(0)
14207        }
14208    }
14209
14210    impl std::fmt::Display for DataState {
14211        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14212            wkt::internal::display_enum(f, self.name(), self.value())
14213        }
14214    }
14215
14216    impl std::convert::From<i32> for DataState {
14217        fn from(value: i32) -> Self {
14218            match value {
14219                0 => Self::Unspecified,
14220                1 => Self::DataOk,
14221                2 => Self::DataError,
14222                _ => Self::UnknownValue(data_state::UnknownValue(
14223                    wkt::internal::UnknownEnumValue::Integer(value),
14224                )),
14225            }
14226        }
14227    }
14228
14229    impl std::convert::From<&str> for DataState {
14230        fn from(value: &str) -> Self {
14231            use std::string::ToString;
14232            match value {
14233                "DATA_STATE_UNSPECIFIED" => Self::Unspecified,
14234                "DATA_OK" => Self::DataOk,
14235                "DATA_ERROR" => Self::DataError,
14236                _ => Self::UnknownValue(data_state::UnknownValue(
14237                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14238                )),
14239            }
14240        }
14241    }
14242
14243    impl serde::ser::Serialize for DataState {
14244        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14245        where
14246            S: serde::Serializer,
14247        {
14248            match self {
14249                Self::Unspecified => serializer.serialize_i32(0),
14250                Self::DataOk => serializer.serialize_i32(1),
14251                Self::DataError => serializer.serialize_i32(2),
14252                Self::UnknownValue(u) => u.0.serialize(serializer),
14253            }
14254        }
14255    }
14256
14257    impl<'de> serde::de::Deserialize<'de> for DataState {
14258        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14259        where
14260            D: serde::Deserializer<'de>,
14261        {
14262            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataState>::new(
14263                ".google.cloud.retail.v2.Model.DataState",
14264            ))
14265        }
14266    }
14267
14268    /// Use single or multiple context products for recommendations.
14269    ///
14270    /// # Working with unknown values
14271    ///
14272    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14273    /// additional enum variants at any time. Adding new variants is not considered
14274    /// a breaking change. Applications should write their code in anticipation of:
14275    ///
14276    /// - New values appearing in future releases of the client library, **and**
14277    /// - New values received dynamically, without application changes.
14278    ///
14279    /// Please consult the [Working with enums] section in the user guide for some
14280    /// guidelines.
14281    ///
14282    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14283    #[derive(Clone, Debug, PartialEq)]
14284    #[non_exhaustive]
14285    pub enum ContextProductsType {
14286        /// Unspecified default value, should never be explicitly set.
14287        /// Defaults to
14288        /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
14289        ///
14290        /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
14291        Unspecified,
14292        /// Use only a single product as context for the recommendation. Typically
14293        /// used on pages like add-to-cart or product details.
14294        SingleContextProduct,
14295        /// Use one or multiple products as context for the recommendation. Typically
14296        /// used on shopping cart pages.
14297        MultipleContextProducts,
14298        /// If set, the enum was initialized with an unknown value.
14299        ///
14300        /// Applications can examine the value using [ContextProductsType::value] or
14301        /// [ContextProductsType::name].
14302        UnknownValue(context_products_type::UnknownValue),
14303    }
14304
14305    #[doc(hidden)]
14306    pub mod context_products_type {
14307        #[allow(unused_imports)]
14308        use super::*;
14309        #[derive(Clone, Debug, PartialEq)]
14310        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14311    }
14312
14313    impl ContextProductsType {
14314        /// Gets the enum value.
14315        ///
14316        /// Returns `None` if the enum contains an unknown value deserialized from
14317        /// the string representation of enums.
14318        pub fn value(&self) -> std::option::Option<i32> {
14319            match self {
14320                Self::Unspecified => std::option::Option::Some(0),
14321                Self::SingleContextProduct => std::option::Option::Some(1),
14322                Self::MultipleContextProducts => std::option::Option::Some(2),
14323                Self::UnknownValue(u) => u.0.value(),
14324            }
14325        }
14326
14327        /// Gets the enum value as a string.
14328        ///
14329        /// Returns `None` if the enum contains an unknown value deserialized from
14330        /// the integer representation of enums.
14331        pub fn name(&self) -> std::option::Option<&str> {
14332            match self {
14333                Self::Unspecified => std::option::Option::Some("CONTEXT_PRODUCTS_TYPE_UNSPECIFIED"),
14334                Self::SingleContextProduct => std::option::Option::Some("SINGLE_CONTEXT_PRODUCT"),
14335                Self::MultipleContextProducts => {
14336                    std::option::Option::Some("MULTIPLE_CONTEXT_PRODUCTS")
14337                }
14338                Self::UnknownValue(u) => u.0.name(),
14339            }
14340        }
14341    }
14342
14343    impl std::default::Default for ContextProductsType {
14344        fn default() -> Self {
14345            use std::convert::From;
14346            Self::from(0)
14347        }
14348    }
14349
14350    impl std::fmt::Display for ContextProductsType {
14351        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14352            wkt::internal::display_enum(f, self.name(), self.value())
14353        }
14354    }
14355
14356    impl std::convert::From<i32> for ContextProductsType {
14357        fn from(value: i32) -> Self {
14358            match value {
14359                0 => Self::Unspecified,
14360                1 => Self::SingleContextProduct,
14361                2 => Self::MultipleContextProducts,
14362                _ => Self::UnknownValue(context_products_type::UnknownValue(
14363                    wkt::internal::UnknownEnumValue::Integer(value),
14364                )),
14365            }
14366        }
14367    }
14368
14369    impl std::convert::From<&str> for ContextProductsType {
14370        fn from(value: &str) -> Self {
14371            use std::string::ToString;
14372            match value {
14373                "CONTEXT_PRODUCTS_TYPE_UNSPECIFIED" => Self::Unspecified,
14374                "SINGLE_CONTEXT_PRODUCT" => Self::SingleContextProduct,
14375                "MULTIPLE_CONTEXT_PRODUCTS" => Self::MultipleContextProducts,
14376                _ => Self::UnknownValue(context_products_type::UnknownValue(
14377                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14378                )),
14379            }
14380        }
14381    }
14382
14383    impl serde::ser::Serialize for ContextProductsType {
14384        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14385        where
14386            S: serde::Serializer,
14387        {
14388            match self {
14389                Self::Unspecified => serializer.serialize_i32(0),
14390                Self::SingleContextProduct => serializer.serialize_i32(1),
14391                Self::MultipleContextProducts => serializer.serialize_i32(2),
14392                Self::UnknownValue(u) => u.0.serialize(serializer),
14393            }
14394        }
14395    }
14396
14397    impl<'de> serde::de::Deserialize<'de> for ContextProductsType {
14398        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14399        where
14400            D: serde::Deserializer<'de>,
14401        {
14402            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContextProductsType>::new(
14403                ".google.cloud.retail.v2.Model.ContextProductsType",
14404            ))
14405        }
14406    }
14407}
14408
14409/// Request for creating a model.
14410#[derive(Clone, Default, PartialEq)]
14411#[non_exhaustive]
14412pub struct CreateModelRequest {
14413    /// Required. The parent resource under which to create the model. Format:
14414    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14415    pub parent: std::string::String,
14416
14417    /// Required. The payload of the [Model][google.cloud.retail.v2.Model]  to
14418    /// create.
14419    ///
14420    /// [google.cloud.retail.v2.Model]: crate::model::Model
14421    pub model: std::option::Option<crate::model::Model>,
14422
14423    /// Optional. Whether to run a dry run to validate the request (without
14424    /// actually creating the model).
14425    pub dry_run: bool,
14426
14427    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14428}
14429
14430impl CreateModelRequest {
14431    pub fn new() -> Self {
14432        std::default::Default::default()
14433    }
14434
14435    /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
14436    ///
14437    /// # Example
14438    /// ```ignore,no_run
14439    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14440    /// let x = CreateModelRequest::new().set_parent("example");
14441    /// ```
14442    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14443        self.parent = v.into();
14444        self
14445    }
14446
14447    /// Sets the value of [model][crate::model::CreateModelRequest::model].
14448    ///
14449    /// # Example
14450    /// ```ignore,no_run
14451    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14452    /// use google_cloud_retail_v2::model::Model;
14453    /// let x = CreateModelRequest::new().set_model(Model::default()/* use setters */);
14454    /// ```
14455    pub fn set_model<T>(mut self, v: T) -> Self
14456    where
14457        T: std::convert::Into<crate::model::Model>,
14458    {
14459        self.model = std::option::Option::Some(v.into());
14460        self
14461    }
14462
14463    /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
14464    ///
14465    /// # Example
14466    /// ```ignore,no_run
14467    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14468    /// use google_cloud_retail_v2::model::Model;
14469    /// let x = CreateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14470    /// let x = CreateModelRequest::new().set_or_clear_model(None::<Model>);
14471    /// ```
14472    pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14473    where
14474        T: std::convert::Into<crate::model::Model>,
14475    {
14476        self.model = v.map(|x| x.into());
14477        self
14478    }
14479
14480    /// Sets the value of [dry_run][crate::model::CreateModelRequest::dry_run].
14481    ///
14482    /// # Example
14483    /// ```ignore,no_run
14484    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14485    /// let x = CreateModelRequest::new().set_dry_run(true);
14486    /// ```
14487    pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14488        self.dry_run = v.into();
14489        self
14490    }
14491}
14492
14493impl wkt::message::Message for CreateModelRequest {
14494    fn typename() -> &'static str {
14495        "type.googleapis.com/google.cloud.retail.v2.CreateModelRequest"
14496    }
14497}
14498
14499/// Request for updating an existing model.
14500#[derive(Clone, Default, PartialEq)]
14501#[non_exhaustive]
14502pub struct UpdateModelRequest {
14503    /// Required. The body of the updated [Model][google.cloud.retail.v2.Model].
14504    ///
14505    /// [google.cloud.retail.v2.Model]: crate::model::Model
14506    pub model: std::option::Option<crate::model::Model>,
14507
14508    /// Optional. Indicates which fields in the provided 'model' to
14509    /// update. If not set, by default updates all fields.
14510    pub update_mask: std::option::Option<wkt::FieldMask>,
14511
14512    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14513}
14514
14515impl UpdateModelRequest {
14516    pub fn new() -> Self {
14517        std::default::Default::default()
14518    }
14519
14520    /// Sets the value of [model][crate::model::UpdateModelRequest::model].
14521    ///
14522    /// # Example
14523    /// ```ignore,no_run
14524    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14525    /// use google_cloud_retail_v2::model::Model;
14526    /// let x = UpdateModelRequest::new().set_model(Model::default()/* use setters */);
14527    /// ```
14528    pub fn set_model<T>(mut self, v: T) -> Self
14529    where
14530        T: std::convert::Into<crate::model::Model>,
14531    {
14532        self.model = std::option::Option::Some(v.into());
14533        self
14534    }
14535
14536    /// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
14537    ///
14538    /// # Example
14539    /// ```ignore,no_run
14540    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14541    /// use google_cloud_retail_v2::model::Model;
14542    /// let x = UpdateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14543    /// let x = UpdateModelRequest::new().set_or_clear_model(None::<Model>);
14544    /// ```
14545    pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14546    where
14547        T: std::convert::Into<crate::model::Model>,
14548    {
14549        self.model = v.map(|x| x.into());
14550        self
14551    }
14552
14553    /// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14554    ///
14555    /// # Example
14556    /// ```ignore,no_run
14557    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14558    /// use wkt::FieldMask;
14559    /// let x = UpdateModelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14560    /// ```
14561    pub fn set_update_mask<T>(mut self, v: T) -> Self
14562    where
14563        T: std::convert::Into<wkt::FieldMask>,
14564    {
14565        self.update_mask = std::option::Option::Some(v.into());
14566        self
14567    }
14568
14569    /// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14570    ///
14571    /// # Example
14572    /// ```ignore,no_run
14573    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14574    /// use wkt::FieldMask;
14575    /// let x = UpdateModelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14576    /// let x = UpdateModelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14577    /// ```
14578    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14579    where
14580        T: std::convert::Into<wkt::FieldMask>,
14581    {
14582        self.update_mask = v.map(|x| x.into());
14583        self
14584    }
14585}
14586
14587impl wkt::message::Message for UpdateModelRequest {
14588    fn typename() -> &'static str {
14589        "type.googleapis.com/google.cloud.retail.v2.UpdateModelRequest"
14590    }
14591}
14592
14593/// Request for getting a model.
14594#[derive(Clone, Default, PartialEq)]
14595#[non_exhaustive]
14596pub struct GetModelRequest {
14597    /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14598    /// get. Format:
14599    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}`
14600    ///
14601    /// [google.cloud.retail.v2.Model]: crate::model::Model
14602    pub name: std::string::String,
14603
14604    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14605}
14606
14607impl GetModelRequest {
14608    pub fn new() -> Self {
14609        std::default::Default::default()
14610    }
14611
14612    /// Sets the value of [name][crate::model::GetModelRequest::name].
14613    ///
14614    /// # Example
14615    /// ```ignore,no_run
14616    /// # use google_cloud_retail_v2::model::GetModelRequest;
14617    /// let x = GetModelRequest::new().set_name("example");
14618    /// ```
14619    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14620        self.name = v.into();
14621        self
14622    }
14623}
14624
14625impl wkt::message::Message for GetModelRequest {
14626    fn typename() -> &'static str {
14627        "type.googleapis.com/google.cloud.retail.v2.GetModelRequest"
14628    }
14629}
14630
14631/// Request for pausing training of a model.
14632#[derive(Clone, Default, PartialEq)]
14633#[non_exhaustive]
14634pub struct PauseModelRequest {
14635    /// Required. The name of the model to pause.
14636    /// Format:
14637    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14638    pub name: std::string::String,
14639
14640    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14641}
14642
14643impl PauseModelRequest {
14644    pub fn new() -> Self {
14645        std::default::Default::default()
14646    }
14647
14648    /// Sets the value of [name][crate::model::PauseModelRequest::name].
14649    ///
14650    /// # Example
14651    /// ```ignore,no_run
14652    /// # use google_cloud_retail_v2::model::PauseModelRequest;
14653    /// let x = PauseModelRequest::new().set_name("example");
14654    /// ```
14655    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14656        self.name = v.into();
14657        self
14658    }
14659}
14660
14661impl wkt::message::Message for PauseModelRequest {
14662    fn typename() -> &'static str {
14663        "type.googleapis.com/google.cloud.retail.v2.PauseModelRequest"
14664    }
14665}
14666
14667/// Request for resuming training of a model.
14668#[derive(Clone, Default, PartialEq)]
14669#[non_exhaustive]
14670pub struct ResumeModelRequest {
14671    /// Required. The name of the model to resume.
14672    /// Format:
14673    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14674    pub name: std::string::String,
14675
14676    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14677}
14678
14679impl ResumeModelRequest {
14680    pub fn new() -> Self {
14681        std::default::Default::default()
14682    }
14683
14684    /// Sets the value of [name][crate::model::ResumeModelRequest::name].
14685    ///
14686    /// # Example
14687    /// ```ignore,no_run
14688    /// # use google_cloud_retail_v2::model::ResumeModelRequest;
14689    /// let x = ResumeModelRequest::new().set_name("example");
14690    /// ```
14691    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14692        self.name = v.into();
14693        self
14694    }
14695}
14696
14697impl wkt::message::Message for ResumeModelRequest {
14698    fn typename() -> &'static str {
14699        "type.googleapis.com/google.cloud.retail.v2.ResumeModelRequest"
14700    }
14701}
14702
14703/// Request for listing models associated with a resource.
14704#[derive(Clone, Default, PartialEq)]
14705#[non_exhaustive]
14706pub struct ListModelsRequest {
14707    /// Required. The parent for which to list models.
14708    /// Format:
14709    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14710    pub parent: std::string::String,
14711
14712    /// Optional. Maximum number of results to return. If unspecified, defaults
14713    /// to 50. Max allowed value is 1000.
14714    pub page_size: i32,
14715
14716    /// Optional. A page token, received from a previous `ListModels`
14717    /// call. Provide this to retrieve the subsequent page.
14718    pub page_token: std::string::String,
14719
14720    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14721}
14722
14723impl ListModelsRequest {
14724    pub fn new() -> Self {
14725        std::default::Default::default()
14726    }
14727
14728    /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
14729    ///
14730    /// # Example
14731    /// ```ignore,no_run
14732    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14733    /// let x = ListModelsRequest::new().set_parent("example");
14734    /// ```
14735    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14736        self.parent = v.into();
14737        self
14738    }
14739
14740    /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
14741    ///
14742    /// # Example
14743    /// ```ignore,no_run
14744    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14745    /// let x = ListModelsRequest::new().set_page_size(42);
14746    /// ```
14747    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14748        self.page_size = v.into();
14749        self
14750    }
14751
14752    /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
14753    ///
14754    /// # Example
14755    /// ```ignore,no_run
14756    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14757    /// let x = ListModelsRequest::new().set_page_token("example");
14758    /// ```
14759    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14760        self.page_token = v.into();
14761        self
14762    }
14763}
14764
14765impl wkt::message::Message for ListModelsRequest {
14766    fn typename() -> &'static str {
14767        "type.googleapis.com/google.cloud.retail.v2.ListModelsRequest"
14768    }
14769}
14770
14771/// Request for deleting a model.
14772#[derive(Clone, Default, PartialEq)]
14773#[non_exhaustive]
14774pub struct DeleteModelRequest {
14775    /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14776    /// delete. Format:
14777    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14778    ///
14779    /// [google.cloud.retail.v2.Model]: crate::model::Model
14780    pub name: std::string::String,
14781
14782    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14783}
14784
14785impl DeleteModelRequest {
14786    pub fn new() -> Self {
14787        std::default::Default::default()
14788    }
14789
14790    /// Sets the value of [name][crate::model::DeleteModelRequest::name].
14791    ///
14792    /// # Example
14793    /// ```ignore,no_run
14794    /// # use google_cloud_retail_v2::model::DeleteModelRequest;
14795    /// let x = DeleteModelRequest::new().set_name("example");
14796    /// ```
14797    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14798        self.name = v.into();
14799        self
14800    }
14801}
14802
14803impl wkt::message::Message for DeleteModelRequest {
14804    fn typename() -> &'static str {
14805        "type.googleapis.com/google.cloud.retail.v2.DeleteModelRequest"
14806    }
14807}
14808
14809/// Response to a ListModelRequest.
14810#[derive(Clone, Default, PartialEq)]
14811#[non_exhaustive]
14812pub struct ListModelsResponse {
14813    /// List of Models.
14814    pub models: std::vec::Vec<crate::model::Model>,
14815
14816    /// Pagination token, if not returned indicates the last page.
14817    pub next_page_token: std::string::String,
14818
14819    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14820}
14821
14822impl ListModelsResponse {
14823    pub fn new() -> Self {
14824        std::default::Default::default()
14825    }
14826
14827    /// Sets the value of [models][crate::model::ListModelsResponse::models].
14828    ///
14829    /// # Example
14830    /// ```ignore,no_run
14831    /// # use google_cloud_retail_v2::model::ListModelsResponse;
14832    /// use google_cloud_retail_v2::model::Model;
14833    /// let x = ListModelsResponse::new()
14834    ///     .set_models([
14835    ///         Model::default()/* use setters */,
14836    ///         Model::default()/* use (different) setters */,
14837    ///     ]);
14838    /// ```
14839    pub fn set_models<T, V>(mut self, v: T) -> Self
14840    where
14841        T: std::iter::IntoIterator<Item = V>,
14842        V: std::convert::Into<crate::model::Model>,
14843    {
14844        use std::iter::Iterator;
14845        self.models = v.into_iter().map(|i| i.into()).collect();
14846        self
14847    }
14848
14849    /// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
14850    ///
14851    /// # Example
14852    /// ```ignore,no_run
14853    /// # use google_cloud_retail_v2::model::ListModelsResponse;
14854    /// let x = ListModelsResponse::new().set_next_page_token("example");
14855    /// ```
14856    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14857        self.next_page_token = v.into();
14858        self
14859    }
14860}
14861
14862impl wkt::message::Message for ListModelsResponse {
14863    fn typename() -> &'static str {
14864        "type.googleapis.com/google.cloud.retail.v2.ListModelsResponse"
14865    }
14866}
14867
14868#[doc(hidden)]
14869impl gax::paginator::internal::PageableResponse for ListModelsResponse {
14870    type PageItem = crate::model::Model;
14871
14872    fn items(self) -> std::vec::Vec<Self::PageItem> {
14873        self.models
14874    }
14875
14876    fn next_page_token(&self) -> std::string::String {
14877        use std::clone::Clone;
14878        self.next_page_token.clone()
14879    }
14880}
14881
14882/// Request to manually start a tuning process now (instead of waiting for
14883/// the periodically scheduled tuning to happen).
14884#[derive(Clone, Default, PartialEq)]
14885#[non_exhaustive]
14886pub struct TuneModelRequest {
14887    /// Required. The resource name of the model to tune.
14888    /// Format:
14889    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14890    pub name: std::string::String,
14891
14892    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14893}
14894
14895impl TuneModelRequest {
14896    pub fn new() -> Self {
14897        std::default::Default::default()
14898    }
14899
14900    /// Sets the value of [name][crate::model::TuneModelRequest::name].
14901    ///
14902    /// # Example
14903    /// ```ignore,no_run
14904    /// # use google_cloud_retail_v2::model::TuneModelRequest;
14905    /// let x = TuneModelRequest::new().set_name("example");
14906    /// ```
14907    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14908        self.name = v.into();
14909        self
14910    }
14911}
14912
14913impl wkt::message::Message for TuneModelRequest {
14914    fn typename() -> &'static str {
14915        "type.googleapis.com/google.cloud.retail.v2.TuneModelRequest"
14916    }
14917}
14918
14919/// Metadata associated with a create operation.
14920#[derive(Clone, Default, PartialEq)]
14921#[non_exhaustive]
14922pub struct CreateModelMetadata {
14923    /// The resource name of the model that this create applies to.
14924    /// Format:
14925    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14926    pub model: std::string::String,
14927
14928    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14929}
14930
14931impl CreateModelMetadata {
14932    pub fn new() -> Self {
14933        std::default::Default::default()
14934    }
14935
14936    /// Sets the value of [model][crate::model::CreateModelMetadata::model].
14937    ///
14938    /// # Example
14939    /// ```ignore,no_run
14940    /// # use google_cloud_retail_v2::model::CreateModelMetadata;
14941    /// let x = CreateModelMetadata::new().set_model("example");
14942    /// ```
14943    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14944        self.model = v.into();
14945        self
14946    }
14947}
14948
14949impl wkt::message::Message for CreateModelMetadata {
14950    fn typename() -> &'static str {
14951        "type.googleapis.com/google.cloud.retail.v2.CreateModelMetadata"
14952    }
14953}
14954
14955/// Metadata associated with a tune operation.
14956#[derive(Clone, Default, PartialEq)]
14957#[non_exhaustive]
14958pub struct TuneModelMetadata {
14959    /// The resource name of the model that this tune applies to.
14960    /// Format:
14961    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14962    pub model: std::string::String,
14963
14964    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14965}
14966
14967impl TuneModelMetadata {
14968    pub fn new() -> Self {
14969        std::default::Default::default()
14970    }
14971
14972    /// Sets the value of [model][crate::model::TuneModelMetadata::model].
14973    ///
14974    /// # Example
14975    /// ```ignore,no_run
14976    /// # use google_cloud_retail_v2::model::TuneModelMetadata;
14977    /// let x = TuneModelMetadata::new().set_model("example");
14978    /// ```
14979    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14980        self.model = v.into();
14981        self
14982    }
14983}
14984
14985impl wkt::message::Message for TuneModelMetadata {
14986    fn typename() -> &'static str {
14987        "type.googleapis.com/google.cloud.retail.v2.TuneModelMetadata"
14988    }
14989}
14990
14991/// Response associated with a tune operation.
14992#[derive(Clone, Default, PartialEq)]
14993#[non_exhaustive]
14994pub struct TuneModelResponse {
14995    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14996}
14997
14998impl TuneModelResponse {
14999    pub fn new() -> Self {
15000        std::default::Default::default()
15001    }
15002}
15003
15004impl wkt::message::Message for TuneModelResponse {
15005    fn typename() -> &'static str {
15006        "type.googleapis.com/google.cloud.retail.v2.TuneModelResponse"
15007    }
15008}
15009
15010/// Request message for Predict method.
15011#[derive(Clone, Default, PartialEq)]
15012#[non_exhaustive]
15013pub struct PredictRequest {
15014    /// Required. Full resource name of the format:
15015    /// `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}`
15016    /// or
15017    /// `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`.
15018    /// We recommend using the `servingConfigs` resource. `placements` is a legacy
15019    /// resource.
15020    /// The ID of the Recommendations AI serving config or placement.
15021    /// Before you can request predictions from your model, you must create at
15022    /// least one serving config or placement for it. For more information, see
15023    /// [Manage serving configs]
15024    /// (<https://cloud.google.com/retail/docs/manage-configs>).
15025    ///
15026    /// The full list of available serving configs can be seen at
15027    /// <https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs>
15028    pub placement: std::string::String,
15029
15030    /// Required. Context about the user, what they are looking at and what action
15031    /// they took to trigger the predict request. Note that this user event detail
15032    /// won't be ingested to userEvent logs. Thus, a separate userEvent write
15033    /// request is required for event logging.
15034    ///
15035    /// Don't set
15036    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or
15037    /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same
15038    /// fixed ID for different users. If you are trying to receive non-personalized
15039    /// recommendations (not recommended; this can negatively impact model
15040    /// performance), instead set
15041    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a
15042    /// random unique ID and leave
15043    /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset.
15044    ///
15045    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
15046    /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
15047    pub user_event: std::option::Option<crate::model::UserEvent>,
15048
15049    /// Maximum number of results to return. Set this property to the number of
15050    /// prediction results needed. If zero, the service will choose a reasonable
15051    /// default. The maximum allowed value is 100. Values above 100 will be coerced
15052    /// to 100.
15053    pub page_size: i32,
15054
15055    /// This field is not used; leave it unset.
15056    #[deprecated]
15057    pub page_token: std::string::String,
15058
15059    /// Filter for restricting prediction results with a length limit of 5,000
15060    /// characters. Accepts values for tags and the `filterOutOfStockItems` flag.
15061    ///
15062    /// * Tag expressions. Restricts predictions to products that match all of the
15063    ///   specified tags. Boolean operators `OR` and `NOT` are supported if the
15064    ///   expression is enclosed in parentheses, and must be separated from the
15065    ///   tag values by a space. `-"tagA"` is also supported and is equivalent to
15066    ///   `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
15067    ///   with a size limit of 1,000 characters.
15068    ///
15069    ///   Note: "Recently viewed" models don't support tag filtering at the
15070    ///   moment.
15071    ///
15072    /// * filterOutOfStockItems. Restricts predictions to products that do not
15073    ///   have a
15074    ///   stockState value of OUT_OF_STOCK.
15075    ///
15076    ///
15077    /// Examples:
15078    ///
15079    /// * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
15080    /// * filterOutOfStockItems  tag=(-"promotional")
15081    /// * filterOutOfStockItems
15082    ///
15083    /// If your filter blocks all prediction results, the API will return *no*
15084    /// results. If instead you want empty result sets to return generic
15085    /// (unfiltered) popular products, set `strictFiltering` to False in
15086    /// `PredictRequest.params`. Note that the API will never return items with
15087    /// storageStatus of "EXPIRED" or "DELETED" regardless of filter choices.
15088    ///
15089    /// If `filterSyntaxV2` is set to true under the `params` field, then
15090    /// attribute-based expressions are expected instead of the above described
15091    /// tag-based syntax. Examples:
15092    ///
15093    /// * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones"))
15094    /// * (availability: ANY("IN_STOCK")) AND
15095    ///   (colors: ANY("Red") OR categories: ANY("Phones"))
15096    ///
15097    /// For more information, see
15098    /// [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs).
15099    pub filter: std::string::String,
15100
15101    /// Use validate only mode for this prediction query. If set to true, a
15102    /// dummy model will be used that returns arbitrary products.
15103    /// Note that the validate only mode should only be used for testing the API,
15104    /// or if the model is not ready.
15105    pub validate_only: bool,
15106
15107    /// Additional domain specific parameters for the predictions.
15108    ///
15109    /// Allowed values:
15110    ///
15111    /// * `returnProduct`: Boolean. If set to true, the associated product
15112    ///   object will be returned in the `results.metadata` field in the
15113    ///   prediction response.
15114    /// * `returnScore`: Boolean. If set to true, the prediction 'score'
15115    ///   corresponding to each returned product will be set in the
15116    ///   `results.metadata` field in the prediction response. The given
15117    ///   'score' indicates the probability of a product being clicked/purchased
15118    ///   given the user's context and history.
15119    /// * `strictFiltering`: Boolean. True by default. If set to false, the service
15120    ///   will return generic (unfiltered) popular products instead of empty if
15121    ///   your filter blocks all prediction results.
15122    /// * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
15123    ///   it needs to be one of {'no-price-reranking', 'low-price-reranking',
15124    ///   'medium-price-reranking', 'high-price-reranking'}. This gives
15125    ///   request-level control and adjusts prediction results based on product
15126    ///   price.
15127    /// * `diversityLevel`: String. Default empty. If set to be non-empty, then
15128    ///   it needs to be one of {'no-diversity', 'low-diversity',
15129    ///   'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
15130    ///   request-level control and adjusts prediction results based on product
15131    ///   category.
15132    /// * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter`
15133    ///   field is interpreteted according to the new, attribute-based syntax.
15134    pub params: std::collections::HashMap<std::string::String, wkt::Value>,
15135
15136    /// The labels applied to a resource must meet the following requirements:
15137    ///
15138    /// * Each resource can have multiple labels, up to a maximum of 64.
15139    /// * Each label must be a key-value pair.
15140    /// * Keys have a minimum length of 1 character and a maximum length of 63
15141    ///   characters and cannot be empty. Values can be empty and have a maximum
15142    ///   length of 63 characters.
15143    /// * Keys and values can contain only lowercase letters, numeric characters,
15144    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
15145    ///   international characters are allowed.
15146    /// * The key portion of a label must be unique. However, you can use the same
15147    ///   key with multiple resources.
15148    /// * Keys must start with a lowercase letter or international character.
15149    ///
15150    /// See [Google Cloud
15151    /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
15152    /// for more details.
15153    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15154
15155    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15156}
15157
15158impl PredictRequest {
15159    pub fn new() -> Self {
15160        std::default::Default::default()
15161    }
15162
15163    /// Sets the value of [placement][crate::model::PredictRequest::placement].
15164    ///
15165    /// # Example
15166    /// ```ignore,no_run
15167    /// # use google_cloud_retail_v2::model::PredictRequest;
15168    /// let x = PredictRequest::new().set_placement("example");
15169    /// ```
15170    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15171        self.placement = v.into();
15172        self
15173    }
15174
15175    /// Sets the value of [user_event][crate::model::PredictRequest::user_event].
15176    ///
15177    /// # Example
15178    /// ```ignore,no_run
15179    /// # use google_cloud_retail_v2::model::PredictRequest;
15180    /// use google_cloud_retail_v2::model::UserEvent;
15181    /// let x = PredictRequest::new().set_user_event(UserEvent::default()/* use setters */);
15182    /// ```
15183    pub fn set_user_event<T>(mut self, v: T) -> Self
15184    where
15185        T: std::convert::Into<crate::model::UserEvent>,
15186    {
15187        self.user_event = std::option::Option::Some(v.into());
15188        self
15189    }
15190
15191    /// Sets or clears the value of [user_event][crate::model::PredictRequest::user_event].
15192    ///
15193    /// # Example
15194    /// ```ignore,no_run
15195    /// # use google_cloud_retail_v2::model::PredictRequest;
15196    /// use google_cloud_retail_v2::model::UserEvent;
15197    /// let x = PredictRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
15198    /// let x = PredictRequest::new().set_or_clear_user_event(None::<UserEvent>);
15199    /// ```
15200    pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15201    where
15202        T: std::convert::Into<crate::model::UserEvent>,
15203    {
15204        self.user_event = v.map(|x| x.into());
15205        self
15206    }
15207
15208    /// Sets the value of [page_size][crate::model::PredictRequest::page_size].
15209    ///
15210    /// # Example
15211    /// ```ignore,no_run
15212    /// # use google_cloud_retail_v2::model::PredictRequest;
15213    /// let x = PredictRequest::new().set_page_size(42);
15214    /// ```
15215    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15216        self.page_size = v.into();
15217        self
15218    }
15219
15220    /// Sets the value of [page_token][crate::model::PredictRequest::page_token].
15221    ///
15222    /// # Example
15223    /// ```ignore,no_run
15224    /// # use google_cloud_retail_v2::model::PredictRequest;
15225    /// let x = PredictRequest::new().set_page_token("example");
15226    /// ```
15227    #[deprecated]
15228    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15229        self.page_token = v.into();
15230        self
15231    }
15232
15233    /// Sets the value of [filter][crate::model::PredictRequest::filter].
15234    ///
15235    /// # Example
15236    /// ```ignore,no_run
15237    /// # use google_cloud_retail_v2::model::PredictRequest;
15238    /// let x = PredictRequest::new().set_filter("example");
15239    /// ```
15240    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15241        self.filter = v.into();
15242        self
15243    }
15244
15245    /// Sets the value of [validate_only][crate::model::PredictRequest::validate_only].
15246    ///
15247    /// # Example
15248    /// ```ignore,no_run
15249    /// # use google_cloud_retail_v2::model::PredictRequest;
15250    /// let x = PredictRequest::new().set_validate_only(true);
15251    /// ```
15252    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15253        self.validate_only = v.into();
15254        self
15255    }
15256
15257    /// Sets the value of [params][crate::model::PredictRequest::params].
15258    ///
15259    /// # Example
15260    /// ```ignore,no_run
15261    /// # use google_cloud_retail_v2::model::PredictRequest;
15262    /// use wkt::Value;
15263    /// let x = PredictRequest::new().set_params([
15264    ///     ("key0", Value::default()/* use setters */),
15265    ///     ("key1", Value::default()/* use (different) setters */),
15266    /// ]);
15267    /// ```
15268    pub fn set_params<T, K, V>(mut self, v: T) -> Self
15269    where
15270        T: std::iter::IntoIterator<Item = (K, V)>,
15271        K: std::convert::Into<std::string::String>,
15272        V: std::convert::Into<wkt::Value>,
15273    {
15274        use std::iter::Iterator;
15275        self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15276        self
15277    }
15278
15279    /// Sets the value of [labels][crate::model::PredictRequest::labels].
15280    ///
15281    /// # Example
15282    /// ```ignore,no_run
15283    /// # use google_cloud_retail_v2::model::PredictRequest;
15284    /// let x = PredictRequest::new().set_labels([
15285    ///     ("key0", "abc"),
15286    ///     ("key1", "xyz"),
15287    /// ]);
15288    /// ```
15289    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15290    where
15291        T: std::iter::IntoIterator<Item = (K, V)>,
15292        K: std::convert::Into<std::string::String>,
15293        V: std::convert::Into<std::string::String>,
15294    {
15295        use std::iter::Iterator;
15296        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15297        self
15298    }
15299}
15300
15301impl wkt::message::Message for PredictRequest {
15302    fn typename() -> &'static str {
15303        "type.googleapis.com/google.cloud.retail.v2.PredictRequest"
15304    }
15305}
15306
15307/// Response message for predict method.
15308#[derive(Clone, Default, PartialEq)]
15309#[non_exhaustive]
15310pub struct PredictResponse {
15311    /// A list of recommended products. The order represents the ranking (from the
15312    /// most relevant product to the least).
15313    pub results: std::vec::Vec<crate::model::predict_response::PredictionResult>,
15314
15315    /// A unique attribution token. This should be included in the
15316    /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
15317    /// recommendation, which enables accurate attribution of recommendation model
15318    /// performance.
15319    ///
15320    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
15321    pub attribution_token: std::string::String,
15322
15323    /// IDs of products in the request that were missing from the inventory.
15324    pub missing_ids: std::vec::Vec<std::string::String>,
15325
15326    /// True if the validateOnly property was set in the request.
15327    pub validate_only: bool,
15328
15329    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15330}
15331
15332impl PredictResponse {
15333    pub fn new() -> Self {
15334        std::default::Default::default()
15335    }
15336
15337    /// Sets the value of [results][crate::model::PredictResponse::results].
15338    ///
15339    /// # Example
15340    /// ```ignore,no_run
15341    /// # use google_cloud_retail_v2::model::PredictResponse;
15342    /// use google_cloud_retail_v2::model::predict_response::PredictionResult;
15343    /// let x = PredictResponse::new()
15344    ///     .set_results([
15345    ///         PredictionResult::default()/* use setters */,
15346    ///         PredictionResult::default()/* use (different) setters */,
15347    ///     ]);
15348    /// ```
15349    pub fn set_results<T, V>(mut self, v: T) -> Self
15350    where
15351        T: std::iter::IntoIterator<Item = V>,
15352        V: std::convert::Into<crate::model::predict_response::PredictionResult>,
15353    {
15354        use std::iter::Iterator;
15355        self.results = v.into_iter().map(|i| i.into()).collect();
15356        self
15357    }
15358
15359    /// Sets the value of [attribution_token][crate::model::PredictResponse::attribution_token].
15360    ///
15361    /// # Example
15362    /// ```ignore,no_run
15363    /// # use google_cloud_retail_v2::model::PredictResponse;
15364    /// let x = PredictResponse::new().set_attribution_token("example");
15365    /// ```
15366    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
15367        mut self,
15368        v: T,
15369    ) -> Self {
15370        self.attribution_token = v.into();
15371        self
15372    }
15373
15374    /// Sets the value of [missing_ids][crate::model::PredictResponse::missing_ids].
15375    ///
15376    /// # Example
15377    /// ```ignore,no_run
15378    /// # use google_cloud_retail_v2::model::PredictResponse;
15379    /// let x = PredictResponse::new().set_missing_ids(["a", "b", "c"]);
15380    /// ```
15381    pub fn set_missing_ids<T, V>(mut self, v: T) -> Self
15382    where
15383        T: std::iter::IntoIterator<Item = V>,
15384        V: std::convert::Into<std::string::String>,
15385    {
15386        use std::iter::Iterator;
15387        self.missing_ids = v.into_iter().map(|i| i.into()).collect();
15388        self
15389    }
15390
15391    /// Sets the value of [validate_only][crate::model::PredictResponse::validate_only].
15392    ///
15393    /// # Example
15394    /// ```ignore,no_run
15395    /// # use google_cloud_retail_v2::model::PredictResponse;
15396    /// let x = PredictResponse::new().set_validate_only(true);
15397    /// ```
15398    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15399        self.validate_only = v.into();
15400        self
15401    }
15402}
15403
15404impl wkt::message::Message for PredictResponse {
15405    fn typename() -> &'static str {
15406        "type.googleapis.com/google.cloud.retail.v2.PredictResponse"
15407    }
15408}
15409
15410/// Defines additional types related to [PredictResponse].
15411pub mod predict_response {
15412    #[allow(unused_imports)]
15413    use super::*;
15414
15415    /// PredictionResult represents the recommendation prediction results.
15416    #[derive(Clone, Default, PartialEq)]
15417    #[non_exhaustive]
15418    pub struct PredictionResult {
15419        /// ID of the recommended product
15420        pub id: std::string::String,
15421
15422        /// Additional product metadata / annotations.
15423        ///
15424        /// Possible values:
15425        ///
15426        /// * `product`: JSON representation of the product. Is set if
15427        ///   `returnProduct` is set to true in `PredictRequest.params`.
15428        /// * `score`: Prediction score in double value. Is set if
15429        ///   `returnScore` is set to true in `PredictRequest.params`.
15430        pub metadata: std::collections::HashMap<std::string::String, wkt::Value>,
15431
15432        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15433    }
15434
15435    impl PredictionResult {
15436        pub fn new() -> Self {
15437            std::default::Default::default()
15438        }
15439
15440        /// Sets the value of [id][crate::model::predict_response::PredictionResult::id].
15441        ///
15442        /// # Example
15443        /// ```ignore,no_run
15444        /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15445        /// let x = PredictionResult::new().set_id("example");
15446        /// ```
15447        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15448            self.id = v.into();
15449            self
15450        }
15451
15452        /// Sets the value of [metadata][crate::model::predict_response::PredictionResult::metadata].
15453        ///
15454        /// # Example
15455        /// ```ignore,no_run
15456        /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15457        /// use wkt::Value;
15458        /// let x = PredictionResult::new().set_metadata([
15459        ///     ("key0", Value::default()/* use setters */),
15460        ///     ("key1", Value::default()/* use (different) setters */),
15461        /// ]);
15462        /// ```
15463        pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
15464        where
15465            T: std::iter::IntoIterator<Item = (K, V)>,
15466            K: std::convert::Into<std::string::String>,
15467            V: std::convert::Into<wkt::Value>,
15468        {
15469            use std::iter::Iterator;
15470            self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15471            self
15472        }
15473    }
15474
15475    impl wkt::message::Message for PredictionResult {
15476        fn typename() -> &'static str {
15477            "type.googleapis.com/google.cloud.retail.v2.PredictResponse.PredictionResult"
15478        }
15479    }
15480}
15481
15482/// Product captures all metadata information of items to be recommended or
15483/// searched.
15484#[derive(Clone, Default, PartialEq)]
15485#[non_exhaustive]
15486pub struct Product {
15487    /// Immutable. Full resource name of the product, such as
15488    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`.
15489    pub name: std::string::String,
15490
15491    /// Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
15492    /// the final component of [name][google.cloud.retail.v2.Product.name]. For
15493    /// example, this field is "id_1", if
15494    /// [name][google.cloud.retail.v2.Product.name] is
15495    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`.
15496    ///
15497    /// This field must be a UTF-8 encoded string with a length limit of 128
15498    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15499    ///
15500    /// Corresponding properties: Google Merchant Center property
15501    /// [id](https://support.google.com/merchants/answer/6324405). Schema.org
15502    /// property [Product.sku](https://schema.org/sku).
15503    ///
15504    /// [google.cloud.retail.v2.Product]: crate::model::Product
15505    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15506    pub id: std::string::String,
15507
15508    /// Immutable. The type of the product. Default to
15509    /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
15510    /// if unset.
15511    ///
15512    /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
15513    pub r#type: crate::model::product::Type,
15514
15515    /// Variant group identifier. Must be an
15516    /// [id][google.cloud.retail.v2.Product.id], with the same parent branch with
15517    /// this product. Otherwise, an error is thrown.
15518    ///
15519    /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15520    /// [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
15521    /// set to the same value as [id][google.cloud.retail.v2.Product.id].
15522    ///
15523    /// For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
15524    /// be empty. A maximum of 2,000 products are allowed to share the same
15525    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15526    /// [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
15527    /// error is returned.
15528    ///
15529    /// Corresponding properties: Google Merchant Center property
15530    /// [item_group_id](https://support.google.com/merchants/answer/6324507).
15531    /// Schema.org property
15532    /// [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
15533    ///
15534    /// [google.cloud.retail.v2.Product]: crate::model::Product
15535    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15536    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15537    pub primary_product_id: std::string::String,
15538
15539    /// The [id][google.cloud.retail.v2.Product.id] of the collection members when
15540    /// [type][google.cloud.retail.v2.Product.type] is
15541    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION].
15542    ///
15543    /// Non-existent product ids are allowed.
15544    /// The [type][google.cloud.retail.v2.Product.type] of the members must be
15545    /// either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or
15546    /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an
15547    /// INVALID_ARGUMENT error is thrown. Should not set it for other types. A
15548    /// maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is
15549    /// return.
15550    ///
15551    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15552    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15553    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15554    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15555    /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15556    pub collection_member_ids: std::vec::Vec<std::string::String>,
15557
15558    /// The Global Trade Item Number (GTIN) of the product.
15559    ///
15560    /// This field must be a UTF-8 encoded string with a length limit of 128
15561    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15562    ///
15563    /// This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is
15564    /// returned.
15565    ///
15566    /// Corresponding properties: Google Merchant Center property
15567    /// [gtin](https://support.google.com/merchants/answer/6324461).
15568    /// Schema.org property
15569    /// [Product.isbn](https://schema.org/isbn),
15570    /// [Product.gtin8](https://schema.org/gtin8),
15571    /// [Product.gtin12](https://schema.org/gtin12),
15572    /// [Product.gtin13](https://schema.org/gtin13), or
15573    /// [Product.gtin14](https://schema.org/gtin14).
15574    ///
15575    /// If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.
15576    pub gtin: std::string::String,
15577
15578    /// Product categories. This field is repeated for supporting one product
15579    /// belonging to several parallel categories. Strongly recommended using the
15580    /// full path for better search / recommendation quality.
15581    ///
15582    /// To represent full path of category, use '>' sign to separate different
15583    /// hierarchies. If '>' is part of the category name, replace it with
15584    /// other character(s).
15585    ///
15586    /// For example, if a shoes product belongs to both
15587    /// ["Shoes & Accessories" -> "Shoes"] and
15588    /// ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
15589    /// represented as:
15590    ///
15591    /// ```norust
15592    ///  "categories": [
15593    ///    "Shoes & Accessories > Shoes",
15594    ///    "Sports & Fitness > Athletic Clothing > Shoes"
15595    ///  ]
15596    /// ```
15597    ///
15598    /// Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15599    /// [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
15600    /// error is returned.
15601    ///
15602    /// At most 250 values are allowed per
15603    /// [Product][google.cloud.retail.v2.Product] unless overridden through the
15604    /// Google Cloud console. Empty values are not allowed. Each value must be a
15605    /// UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an
15606    /// INVALID_ARGUMENT error is returned.
15607    ///
15608    /// Corresponding properties: Google Merchant Center property
15609    /// [google_product_category][mc_google_product_category]. Schema.org property
15610    /// [Product.category] (<https://schema.org/category>).
15611    ///
15612    /// [google.cloud.retail.v2.Product]: crate::model::Product
15613    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15614    pub categories: std::vec::Vec<std::string::String>,
15615
15616    /// Required. Product title.
15617    ///
15618    /// This field must be a UTF-8 encoded string with a length limit of 1,000
15619    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15620    ///
15621    /// Corresponding properties: Google Merchant Center property
15622    /// [title](https://support.google.com/merchants/answer/6324415). Schema.org
15623    /// property [Product.name](https://schema.org/name).
15624    pub title: std::string::String,
15625
15626    /// The brands of the product.
15627    ///
15628    /// A maximum of 30 brands are allowed unless overridden through the Google
15629    /// Cloud console. Each
15630    /// brand must be a UTF-8 encoded string with a length limit of 1,000
15631    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15632    ///
15633    /// Corresponding properties: Google Merchant Center property
15634    /// [brand](https://support.google.com/merchants/answer/6324351). Schema.org
15635    /// property [Product.brand](https://schema.org/brand).
15636    pub brands: std::vec::Vec<std::string::String>,
15637
15638    /// Product description.
15639    ///
15640    /// This field must be a UTF-8 encoded string with a length limit of 5,000
15641    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15642    ///
15643    /// Corresponding properties: Google Merchant Center property
15644    /// [description](https://support.google.com/merchants/answer/6324468).
15645    /// Schema.org property [Product.description](https://schema.org/description).
15646    pub description: std::string::String,
15647
15648    /// Language of the title/description and other string attributes. Use language
15649    /// tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
15650    ///
15651    /// For product prediction, this field is ignored and the model automatically
15652    /// detects the text language. The [Product][google.cloud.retail.v2.Product]
15653    /// can include text in different languages, but duplicating
15654    /// [Product][google.cloud.retail.v2.Product]s to provide text in multiple
15655    /// languages can result in degraded model performance.
15656    ///
15657    /// For product search this field is in use. It defaults to "en-US" if unset.
15658    ///
15659    /// [google.cloud.retail.v2.Product]: crate::model::Product
15660    pub language_code: std::string::String,
15661
15662    /// Highly encouraged. Extra product attributes to be included. For example,
15663    /// for products, this could include the store name, vendor, style, color, etc.
15664    /// These are very strong signals for recommendation model, thus we highly
15665    /// recommend providing the attributes here.
15666    ///
15667    /// Features that can take on one of a limited number of possible values. Two
15668    /// types of features can be set are:
15669    ///
15670    /// Textual features. some examples would be the brand/maker of a product, or
15671    /// country of a customer. Numerical features. Some examples would be the
15672    /// height/weight of a product, or age of a customer.
15673    ///
15674    /// For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
15675    /// "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
15676    /// }`.
15677    ///
15678    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
15679    /// error is returned:
15680    ///
15681    /// * Max entries count: 200.
15682    /// * The key must be a UTF-8 encoded string with a length limit of 128
15683    ///   characters.
15684    /// * For indexable attribute, the key must match the pattern:
15685    ///   `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or
15686    ///   `KEY_1_LIKE_THIS`.
15687    /// * For text attributes, at most 400 values are allowed. Empty values are not
15688    ///   allowed. Each value must be a non-empty UTF-8 encoded string with a
15689    ///   length limit of 256 characters.
15690    /// * For number attributes, at most 400 values are allowed.
15691    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
15692
15693    /// Custom tags associated with the product.
15694    ///
15695    /// At most 250 values are allowed per
15696    /// [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
15697    /// encoded string with a length limit of 1,000 characters. Otherwise, an
15698    /// INVALID_ARGUMENT error is returned.
15699    ///
15700    /// This tag can be used for filtering recommendation results by passing the
15701    /// tag as part of the
15702    /// [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
15703    ///
15704    /// Corresponding properties: Google Merchant Center property
15705    /// [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
15706    ///
15707    /// [google.cloud.retail.v2.PredictRequest.filter]: crate::model::PredictRequest::filter
15708    /// [google.cloud.retail.v2.Product]: crate::model::Product
15709    pub tags: std::vec::Vec<std::string::String>,
15710
15711    /// Product price and cost information.
15712    ///
15713    /// Corresponding properties: Google Merchant Center property
15714    /// [price](https://support.google.com/merchants/answer/6324371).
15715    pub price_info: std::option::Option<crate::model::PriceInfo>,
15716
15717    /// The rating of this product.
15718    pub rating: std::option::Option<crate::model::Rating>,
15719
15720    /// The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
15721    /// available for
15722    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. Note
15723    /// that this is only applicable to
15724    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15725    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], and
15726    /// ignored for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT].
15727    ///
15728    /// [google.cloud.retail.v2.Product]: crate::model::Product
15729    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15730    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15731    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15732    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
15733    pub available_time: std::option::Option<wkt::Timestamp>,
15734
15735    /// The online availability of the [Product][google.cloud.retail.v2.Product].
15736    /// Default to
15737    /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
15738    ///
15739    /// For primary products with variants set the availability of the primary as
15740    /// [Availability.OUT_OF_STOCK][google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]
15741    /// and set the true availability at the variant level. This way the primary
15742    /// product will be considered "in stock" as long as it has at least one
15743    /// variant in stock.
15744    ///
15745    /// For primary products with no variants set the true availability at the
15746    /// primary level.
15747    ///
15748    /// Corresponding properties: Google Merchant Center property
15749    /// [availability](https://support.google.com/merchants/answer/6324448).
15750    /// Schema.org property [Offer.availability](https://schema.org/availability).
15751    ///
15752    /// [google.cloud.retail.v2.Product]: crate::model::Product
15753    /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
15754    /// [google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]: crate::model::product::Availability::OutOfStock
15755    pub availability: crate::model::product::Availability,
15756
15757    /// The available quantity of the item.
15758    pub available_quantity: std::option::Option<wkt::Int32Value>,
15759
15760    /// Fulfillment information, such as the store IDs for in-store pickup or
15761    /// region IDs for different shipping methods.
15762    ///
15763    /// All the elements must have distinct
15764    /// [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type].
15765    /// Otherwise, an INVALID_ARGUMENT error is returned.
15766    ///
15767    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
15768    pub fulfillment_info: std::vec::Vec<crate::model::FulfillmentInfo>,
15769
15770    /// Canonical URL directly linking to the product detail page.
15771    ///
15772    /// It is strongly recommended to provide a valid uri for the product,
15773    /// otherwise the service performance could be significantly degraded.
15774    ///
15775    /// This field must be a UTF-8 encoded string with a length limit of 5,000
15776    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15777    ///
15778    /// Corresponding properties: Google Merchant Center property
15779    /// [link](https://support.google.com/merchants/answer/6324416). Schema.org
15780    /// property [Offer.url](https://schema.org/url).
15781    pub uri: std::string::String,
15782
15783    /// Product images for the product. We highly recommend putting the main
15784    /// image first.
15785    ///
15786    /// A maximum of 300 images are allowed.
15787    ///
15788    /// Corresponding properties: Google Merchant Center property
15789    /// [image_link](https://support.google.com/merchants/answer/6324350).
15790    /// Schema.org property [Product.image](https://schema.org/image).
15791    pub images: std::vec::Vec<crate::model::Image>,
15792
15793    /// The target group associated with a given audience (e.g. male, veterans,
15794    /// car owners, musicians, etc.) of the product.
15795    pub audience: std::option::Option<crate::model::Audience>,
15796
15797    /// The color of the product.
15798    ///
15799    /// Corresponding properties: Google Merchant Center property
15800    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
15801    /// property [Product.color](https://schema.org/color).
15802    pub color_info: std::option::Option<crate::model::ColorInfo>,
15803
15804    /// The size of the product. To represent different size systems or size types,
15805    /// consider using this format: [[[size_system:]size_type:]size_value].
15806    ///
15807    /// For example, in "US:MENS:M", "US" represents size system; "MENS" represents
15808    /// size type; "M" represents size value. In "GIRLS:27", size system is empty;
15809    /// "GIRLS" represents size type; "27" represents size value. In "32 inches",
15810    /// both size system and size type are empty, while size value is "32 inches".
15811    ///
15812    /// A maximum of 20 values are allowed per
15813    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15814    /// encoded string with a length limit of 128 characters. Otherwise, an
15815    /// INVALID_ARGUMENT error is returned.
15816    ///
15817    /// Corresponding properties: Google Merchant Center property
15818    /// [size](https://support.google.com/merchants/answer/6324492),
15819    /// [size_type](https://support.google.com/merchants/answer/6324497), and
15820    /// [size_system](https://support.google.com/merchants/answer/6324502).
15821    /// Schema.org property [Product.size](https://schema.org/size).
15822    ///
15823    /// [google.cloud.retail.v2.Product]: crate::model::Product
15824    pub sizes: std::vec::Vec<std::string::String>,
15825
15826    /// The material of the product. For example, "leather", "wooden".
15827    ///
15828    /// A maximum of 20 values are allowed. Each value must be a UTF-8 encoded
15829    /// string with a length limit of 200 characters. Otherwise, an
15830    /// INVALID_ARGUMENT error is returned.
15831    ///
15832    /// Corresponding properties: Google Merchant Center property
15833    /// [material](https://support.google.com/merchants/answer/6324410). Schema.org
15834    /// property [Product.material](https://schema.org/material).
15835    pub materials: std::vec::Vec<std::string::String>,
15836
15837    /// The pattern or graphic print of the product. For example, "striped", "polka
15838    /// dot", "paisley".
15839    ///
15840    /// A maximum of 20 values are allowed per
15841    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15842    /// encoded string with a length limit of 128 characters. Otherwise, an
15843    /// INVALID_ARGUMENT error is returned.
15844    ///
15845    /// Corresponding properties: Google Merchant Center property
15846    /// [pattern](https://support.google.com/merchants/answer/6324483). Schema.org
15847    /// property [Product.pattern](https://schema.org/pattern).
15848    ///
15849    /// [google.cloud.retail.v2.Product]: crate::model::Product
15850    pub patterns: std::vec::Vec<std::string::String>,
15851
15852    /// The condition of the product. Strongly encouraged to use the standard
15853    /// values: "new", "refurbished", "used".
15854    ///
15855    /// A maximum of 1 value is allowed per
15856    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15857    /// encoded string with a length limit of 128 characters. Otherwise, an
15858    /// INVALID_ARGUMENT error is returned.
15859    ///
15860    /// Corresponding properties: Google Merchant Center property
15861    /// [condition](https://support.google.com/merchants/answer/6324469).
15862    /// Schema.org property
15863    /// [Offer.itemCondition](https://schema.org/itemCondition).
15864    ///
15865    /// [google.cloud.retail.v2.Product]: crate::model::Product
15866    pub conditions: std::vec::Vec<std::string::String>,
15867
15868    /// The promotions applied to the product. A maximum of 10 values are allowed
15869    /// per [Product][google.cloud.retail.v2.Product]. Only
15870    /// [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id]
15871    /// will be used, other fields will be ignored if set.
15872    ///
15873    /// [google.cloud.retail.v2.Product]: crate::model::Product
15874    /// [google.cloud.retail.v2.Promotion.promotion_id]: crate::model::Promotion::promotion_id
15875    pub promotions: std::vec::Vec<crate::model::Promotion>,
15876
15877    /// The timestamp when the product is published by the retailer for the first
15878    /// time, which indicates the freshness of the products. Note that this field
15879    /// is different from
15880    /// [available_time][google.cloud.retail.v2.Product.available_time], given it
15881    /// purely describes product freshness regardless of when it is available on
15882    /// search and recommendation.
15883    ///
15884    /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
15885    pub publish_time: std::option::Option<wkt::Timestamp>,
15886
15887    /// Indicates which fields in the [Product][google.cloud.retail.v2.Product]s
15888    /// are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse].
15889    ///
15890    /// Supported fields for all [type][google.cloud.retail.v2.Product.type]s:
15891    ///
15892    /// * [audience][google.cloud.retail.v2.Product.audience]
15893    /// * [availability][google.cloud.retail.v2.Product.availability]
15894    /// * [brands][google.cloud.retail.v2.Product.brands]
15895    /// * [color_info][google.cloud.retail.v2.Product.color_info]
15896    /// * [conditions][google.cloud.retail.v2.Product.conditions]
15897    /// * [gtin][google.cloud.retail.v2.Product.gtin]
15898    /// * [materials][google.cloud.retail.v2.Product.materials]
15899    /// * [name][google.cloud.retail.v2.Product.name]
15900    /// * [patterns][google.cloud.retail.v2.Product.patterns]
15901    /// * [price_info][google.cloud.retail.v2.Product.price_info]
15902    /// * [rating][google.cloud.retail.v2.Product.rating]
15903    /// * [sizes][google.cloud.retail.v2.Product.sizes]
15904    /// * [title][google.cloud.retail.v2.Product.title]
15905    /// * [uri][google.cloud.retail.v2.Product.uri]
15906    ///
15907    /// Supported fields only for
15908    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15909    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]:
15910    ///
15911    /// * [categories][google.cloud.retail.v2.Product.categories]
15912    /// * [description][google.cloud.retail.v2.Product.description]
15913    /// * [images][google.cloud.retail.v2.Product.images]
15914    ///
15915    /// Supported fields only for
15916    /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]:
15917    ///
15918    /// * Only the first image in [images][google.cloud.retail.v2.Product.images]
15919    ///
15920    /// To mark [attributes][google.cloud.retail.v2.Product.attributes] as
15921    /// retrievable, include paths of the form "attributes.key" where "key" is the
15922    /// key of a custom attribute, as specified in
15923    /// [attributes][google.cloud.retail.v2.Product.attributes].
15924    ///
15925    /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15926    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the
15927    /// following fields are always returned in
15928    /// [SearchResponse][google.cloud.retail.v2.SearchResponse] by default:
15929    ///
15930    /// * [name][google.cloud.retail.v2.Product.name]
15931    ///
15932    /// For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the
15933    /// following fields are always returned in by default:
15934    ///
15935    /// * [name][google.cloud.retail.v2.Product.name]
15936    /// * [color_info][google.cloud.retail.v2.Product.color_info]
15937    ///
15938    /// Note: Returning more fields in
15939    /// [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase
15940    /// response payload size and serving latency.
15941    ///
15942    /// This field is deprecated. Use the retrievable site-wide control instead.
15943    ///
15944    /// [google.cloud.retail.v2.Product]: crate::model::Product
15945    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15946    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15947    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15948    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
15949    /// [google.cloud.retail.v2.Product.audience]: crate::model::Product::audience
15950    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
15951    /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
15952    /// [google.cloud.retail.v2.Product.categories]: crate::model::Product::categories
15953    /// [google.cloud.retail.v2.Product.color_info]: crate::model::Product::color_info
15954    /// [google.cloud.retail.v2.Product.conditions]: crate::model::Product::conditions
15955    /// [google.cloud.retail.v2.Product.description]: crate::model::Product::description
15956    /// [google.cloud.retail.v2.Product.gtin]: crate::model::Product::gtin
15957    /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
15958    /// [google.cloud.retail.v2.Product.materials]: crate::model::Product::materials
15959    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15960    /// [google.cloud.retail.v2.Product.patterns]: crate::model::Product::patterns
15961    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
15962    /// [google.cloud.retail.v2.Product.rating]: crate::model::Product::rating
15963    /// [google.cloud.retail.v2.Product.sizes]: crate::model::Product::sizes
15964    /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
15965    /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15966    /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
15967    /// [google.cloud.retail.v2.SearchResponse]: crate::model::SearchResponse
15968    #[deprecated]
15969    pub retrievable_fields: std::option::Option<wkt::FieldMask>,
15970
15971    /// Output only. Product variants grouped together on primary product which
15972    /// share similar product attributes. It's automatically grouped by
15973    /// [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for
15974    /// all the product variants. Only populated for
15975    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15976    /// [Product][google.cloud.retail.v2.Product]s.
15977    ///
15978    /// Note: This field is OUTPUT_ONLY for
15979    /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
15980    /// Do not set this field in API requests.
15981    ///
15982    /// [google.cloud.retail.v2.Product]: crate::model::Product
15983    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15984    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
15985    /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
15986    pub variants: std::vec::Vec<crate::model::Product>,
15987
15988    /// Output only. A list of local inventories specific to different places.
15989    ///
15990    /// This field can be managed by
15991    /// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
15992    /// and
15993    /// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
15994    /// APIs if fine-grained, high-volume updates are necessary.
15995    ///
15996    /// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
15997    /// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
15998    pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
15999
16000    pub expiration: std::option::Option<crate::model::product::Expiration>,
16001
16002    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16003}
16004
16005impl Product {
16006    pub fn new() -> Self {
16007        std::default::Default::default()
16008    }
16009
16010    /// Sets the value of [name][crate::model::Product::name].
16011    ///
16012    /// # Example
16013    /// ```ignore,no_run
16014    /// # use google_cloud_retail_v2::model::Product;
16015    /// let x = Product::new().set_name("example");
16016    /// ```
16017    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16018        self.name = v.into();
16019        self
16020    }
16021
16022    /// Sets the value of [id][crate::model::Product::id].
16023    ///
16024    /// # Example
16025    /// ```ignore,no_run
16026    /// # use google_cloud_retail_v2::model::Product;
16027    /// let x = Product::new().set_id("example");
16028    /// ```
16029    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16030        self.id = v.into();
16031        self
16032    }
16033
16034    /// Sets the value of [r#type][crate::model::Product::type].
16035    ///
16036    /// # Example
16037    /// ```ignore,no_run
16038    /// # use google_cloud_retail_v2::model::Product;
16039    /// use google_cloud_retail_v2::model::product::Type;
16040    /// let x0 = Product::new().set_type(Type::Primary);
16041    /// let x1 = Product::new().set_type(Type::Variant);
16042    /// let x2 = Product::new().set_type(Type::Collection);
16043    /// ```
16044    pub fn set_type<T: std::convert::Into<crate::model::product::Type>>(mut self, v: T) -> Self {
16045        self.r#type = v.into();
16046        self
16047    }
16048
16049    /// Sets the value of [primary_product_id][crate::model::Product::primary_product_id].
16050    ///
16051    /// # Example
16052    /// ```ignore,no_run
16053    /// # use google_cloud_retail_v2::model::Product;
16054    /// let x = Product::new().set_primary_product_id("example");
16055    /// ```
16056    pub fn set_primary_product_id<T: std::convert::Into<std::string::String>>(
16057        mut self,
16058        v: T,
16059    ) -> Self {
16060        self.primary_product_id = v.into();
16061        self
16062    }
16063
16064    /// Sets the value of [collection_member_ids][crate::model::Product::collection_member_ids].
16065    ///
16066    /// # Example
16067    /// ```ignore,no_run
16068    /// # use google_cloud_retail_v2::model::Product;
16069    /// let x = Product::new().set_collection_member_ids(["a", "b", "c"]);
16070    /// ```
16071    pub fn set_collection_member_ids<T, V>(mut self, v: T) -> Self
16072    where
16073        T: std::iter::IntoIterator<Item = V>,
16074        V: std::convert::Into<std::string::String>,
16075    {
16076        use std::iter::Iterator;
16077        self.collection_member_ids = v.into_iter().map(|i| i.into()).collect();
16078        self
16079    }
16080
16081    /// Sets the value of [gtin][crate::model::Product::gtin].
16082    ///
16083    /// # Example
16084    /// ```ignore,no_run
16085    /// # use google_cloud_retail_v2::model::Product;
16086    /// let x = Product::new().set_gtin("example");
16087    /// ```
16088    pub fn set_gtin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16089        self.gtin = v.into();
16090        self
16091    }
16092
16093    /// Sets the value of [categories][crate::model::Product::categories].
16094    ///
16095    /// # Example
16096    /// ```ignore,no_run
16097    /// # use google_cloud_retail_v2::model::Product;
16098    /// let x = Product::new().set_categories(["a", "b", "c"]);
16099    /// ```
16100    pub fn set_categories<T, V>(mut self, v: T) -> Self
16101    where
16102        T: std::iter::IntoIterator<Item = V>,
16103        V: std::convert::Into<std::string::String>,
16104    {
16105        use std::iter::Iterator;
16106        self.categories = v.into_iter().map(|i| i.into()).collect();
16107        self
16108    }
16109
16110    /// Sets the value of [title][crate::model::Product::title].
16111    ///
16112    /// # Example
16113    /// ```ignore,no_run
16114    /// # use google_cloud_retail_v2::model::Product;
16115    /// let x = Product::new().set_title("example");
16116    /// ```
16117    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16118        self.title = v.into();
16119        self
16120    }
16121
16122    /// Sets the value of [brands][crate::model::Product::brands].
16123    ///
16124    /// # Example
16125    /// ```ignore,no_run
16126    /// # use google_cloud_retail_v2::model::Product;
16127    /// let x = Product::new().set_brands(["a", "b", "c"]);
16128    /// ```
16129    pub fn set_brands<T, V>(mut self, v: T) -> Self
16130    where
16131        T: std::iter::IntoIterator<Item = V>,
16132        V: std::convert::Into<std::string::String>,
16133    {
16134        use std::iter::Iterator;
16135        self.brands = v.into_iter().map(|i| i.into()).collect();
16136        self
16137    }
16138
16139    /// Sets the value of [description][crate::model::Product::description].
16140    ///
16141    /// # Example
16142    /// ```ignore,no_run
16143    /// # use google_cloud_retail_v2::model::Product;
16144    /// let x = Product::new().set_description("example");
16145    /// ```
16146    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16147        self.description = v.into();
16148        self
16149    }
16150
16151    /// Sets the value of [language_code][crate::model::Product::language_code].
16152    ///
16153    /// # Example
16154    /// ```ignore,no_run
16155    /// # use google_cloud_retail_v2::model::Product;
16156    /// let x = Product::new().set_language_code("example");
16157    /// ```
16158    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16159        self.language_code = v.into();
16160        self
16161    }
16162
16163    /// Sets the value of [attributes][crate::model::Product::attributes].
16164    ///
16165    /// # Example
16166    /// ```ignore,no_run
16167    /// # use google_cloud_retail_v2::model::Product;
16168    /// use google_cloud_retail_v2::model::CustomAttribute;
16169    /// let x = Product::new().set_attributes([
16170    ///     ("key0", CustomAttribute::default()/* use setters */),
16171    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
16172    /// ]);
16173    /// ```
16174    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
16175    where
16176        T: std::iter::IntoIterator<Item = (K, V)>,
16177        K: std::convert::Into<std::string::String>,
16178        V: std::convert::Into<crate::model::CustomAttribute>,
16179    {
16180        use std::iter::Iterator;
16181        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16182        self
16183    }
16184
16185    /// Sets the value of [tags][crate::model::Product::tags].
16186    ///
16187    /// # Example
16188    /// ```ignore,no_run
16189    /// # use google_cloud_retail_v2::model::Product;
16190    /// let x = Product::new().set_tags(["a", "b", "c"]);
16191    /// ```
16192    pub fn set_tags<T, V>(mut self, v: T) -> Self
16193    where
16194        T: std::iter::IntoIterator<Item = V>,
16195        V: std::convert::Into<std::string::String>,
16196    {
16197        use std::iter::Iterator;
16198        self.tags = v.into_iter().map(|i| i.into()).collect();
16199        self
16200    }
16201
16202    /// Sets the value of [price_info][crate::model::Product::price_info].
16203    ///
16204    /// # Example
16205    /// ```ignore,no_run
16206    /// # use google_cloud_retail_v2::model::Product;
16207    /// use google_cloud_retail_v2::model::PriceInfo;
16208    /// let x = Product::new().set_price_info(PriceInfo::default()/* use setters */);
16209    /// ```
16210    pub fn set_price_info<T>(mut self, v: T) -> Self
16211    where
16212        T: std::convert::Into<crate::model::PriceInfo>,
16213    {
16214        self.price_info = std::option::Option::Some(v.into());
16215        self
16216    }
16217
16218    /// Sets or clears the value of [price_info][crate::model::Product::price_info].
16219    ///
16220    /// # Example
16221    /// ```ignore,no_run
16222    /// # use google_cloud_retail_v2::model::Product;
16223    /// use google_cloud_retail_v2::model::PriceInfo;
16224    /// let x = Product::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
16225    /// let x = Product::new().set_or_clear_price_info(None::<PriceInfo>);
16226    /// ```
16227    pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
16228    where
16229        T: std::convert::Into<crate::model::PriceInfo>,
16230    {
16231        self.price_info = v.map(|x| x.into());
16232        self
16233    }
16234
16235    /// Sets the value of [rating][crate::model::Product::rating].
16236    ///
16237    /// # Example
16238    /// ```ignore,no_run
16239    /// # use google_cloud_retail_v2::model::Product;
16240    /// use google_cloud_retail_v2::model::Rating;
16241    /// let x = Product::new().set_rating(Rating::default()/* use setters */);
16242    /// ```
16243    pub fn set_rating<T>(mut self, v: T) -> Self
16244    where
16245        T: std::convert::Into<crate::model::Rating>,
16246    {
16247        self.rating = std::option::Option::Some(v.into());
16248        self
16249    }
16250
16251    /// Sets or clears the value of [rating][crate::model::Product::rating].
16252    ///
16253    /// # Example
16254    /// ```ignore,no_run
16255    /// # use google_cloud_retail_v2::model::Product;
16256    /// use google_cloud_retail_v2::model::Rating;
16257    /// let x = Product::new().set_or_clear_rating(Some(Rating::default()/* use setters */));
16258    /// let x = Product::new().set_or_clear_rating(None::<Rating>);
16259    /// ```
16260    pub fn set_or_clear_rating<T>(mut self, v: std::option::Option<T>) -> Self
16261    where
16262        T: std::convert::Into<crate::model::Rating>,
16263    {
16264        self.rating = v.map(|x| x.into());
16265        self
16266    }
16267
16268    /// Sets the value of [available_time][crate::model::Product::available_time].
16269    ///
16270    /// # Example
16271    /// ```ignore,no_run
16272    /// # use google_cloud_retail_v2::model::Product;
16273    /// use wkt::Timestamp;
16274    /// let x = Product::new().set_available_time(Timestamp::default()/* use setters */);
16275    /// ```
16276    pub fn set_available_time<T>(mut self, v: T) -> Self
16277    where
16278        T: std::convert::Into<wkt::Timestamp>,
16279    {
16280        self.available_time = std::option::Option::Some(v.into());
16281        self
16282    }
16283
16284    /// Sets or clears the value of [available_time][crate::model::Product::available_time].
16285    ///
16286    /// # Example
16287    /// ```ignore,no_run
16288    /// # use google_cloud_retail_v2::model::Product;
16289    /// use wkt::Timestamp;
16290    /// let x = Product::new().set_or_clear_available_time(Some(Timestamp::default()/* use setters */));
16291    /// let x = Product::new().set_or_clear_available_time(None::<Timestamp>);
16292    /// ```
16293    pub fn set_or_clear_available_time<T>(mut self, v: std::option::Option<T>) -> Self
16294    where
16295        T: std::convert::Into<wkt::Timestamp>,
16296    {
16297        self.available_time = v.map(|x| x.into());
16298        self
16299    }
16300
16301    /// Sets the value of [availability][crate::model::Product::availability].
16302    ///
16303    /// # Example
16304    /// ```ignore,no_run
16305    /// # use google_cloud_retail_v2::model::Product;
16306    /// use google_cloud_retail_v2::model::product::Availability;
16307    /// let x0 = Product::new().set_availability(Availability::InStock);
16308    /// let x1 = Product::new().set_availability(Availability::OutOfStock);
16309    /// let x2 = Product::new().set_availability(Availability::Preorder);
16310    /// ```
16311    pub fn set_availability<T: std::convert::Into<crate::model::product::Availability>>(
16312        mut self,
16313        v: T,
16314    ) -> Self {
16315        self.availability = v.into();
16316        self
16317    }
16318
16319    /// Sets the value of [available_quantity][crate::model::Product::available_quantity].
16320    ///
16321    /// # Example
16322    /// ```ignore,no_run
16323    /// # use google_cloud_retail_v2::model::Product;
16324    /// use wkt::Int32Value;
16325    /// let x = Product::new().set_available_quantity(Int32Value::default()/* use setters */);
16326    /// ```
16327    pub fn set_available_quantity<T>(mut self, v: T) -> Self
16328    where
16329        T: std::convert::Into<wkt::Int32Value>,
16330    {
16331        self.available_quantity = std::option::Option::Some(v.into());
16332        self
16333    }
16334
16335    /// Sets or clears the value of [available_quantity][crate::model::Product::available_quantity].
16336    ///
16337    /// # Example
16338    /// ```ignore,no_run
16339    /// # use google_cloud_retail_v2::model::Product;
16340    /// use wkt::Int32Value;
16341    /// let x = Product::new().set_or_clear_available_quantity(Some(Int32Value::default()/* use setters */));
16342    /// let x = Product::new().set_or_clear_available_quantity(None::<Int32Value>);
16343    /// ```
16344    pub fn set_or_clear_available_quantity<T>(mut self, v: std::option::Option<T>) -> Self
16345    where
16346        T: std::convert::Into<wkt::Int32Value>,
16347    {
16348        self.available_quantity = v.map(|x| x.into());
16349        self
16350    }
16351
16352    /// Sets the value of [fulfillment_info][crate::model::Product::fulfillment_info].
16353    ///
16354    /// # Example
16355    /// ```ignore,no_run
16356    /// # use google_cloud_retail_v2::model::Product;
16357    /// use google_cloud_retail_v2::model::FulfillmentInfo;
16358    /// let x = Product::new()
16359    ///     .set_fulfillment_info([
16360    ///         FulfillmentInfo::default()/* use setters */,
16361    ///         FulfillmentInfo::default()/* use (different) setters */,
16362    ///     ]);
16363    /// ```
16364    pub fn set_fulfillment_info<T, V>(mut self, v: T) -> Self
16365    where
16366        T: std::iter::IntoIterator<Item = V>,
16367        V: std::convert::Into<crate::model::FulfillmentInfo>,
16368    {
16369        use std::iter::Iterator;
16370        self.fulfillment_info = v.into_iter().map(|i| i.into()).collect();
16371        self
16372    }
16373
16374    /// Sets the value of [uri][crate::model::Product::uri].
16375    ///
16376    /// # Example
16377    /// ```ignore,no_run
16378    /// # use google_cloud_retail_v2::model::Product;
16379    /// let x = Product::new().set_uri("example");
16380    /// ```
16381    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16382        self.uri = v.into();
16383        self
16384    }
16385
16386    /// Sets the value of [images][crate::model::Product::images].
16387    ///
16388    /// # Example
16389    /// ```ignore,no_run
16390    /// # use google_cloud_retail_v2::model::Product;
16391    /// use google_cloud_retail_v2::model::Image;
16392    /// let x = Product::new()
16393    ///     .set_images([
16394    ///         Image::default()/* use setters */,
16395    ///         Image::default()/* use (different) setters */,
16396    ///     ]);
16397    /// ```
16398    pub fn set_images<T, V>(mut self, v: T) -> Self
16399    where
16400        T: std::iter::IntoIterator<Item = V>,
16401        V: std::convert::Into<crate::model::Image>,
16402    {
16403        use std::iter::Iterator;
16404        self.images = v.into_iter().map(|i| i.into()).collect();
16405        self
16406    }
16407
16408    /// Sets the value of [audience][crate::model::Product::audience].
16409    ///
16410    /// # Example
16411    /// ```ignore,no_run
16412    /// # use google_cloud_retail_v2::model::Product;
16413    /// use google_cloud_retail_v2::model::Audience;
16414    /// let x = Product::new().set_audience(Audience::default()/* use setters */);
16415    /// ```
16416    pub fn set_audience<T>(mut self, v: T) -> Self
16417    where
16418        T: std::convert::Into<crate::model::Audience>,
16419    {
16420        self.audience = std::option::Option::Some(v.into());
16421        self
16422    }
16423
16424    /// Sets or clears the value of [audience][crate::model::Product::audience].
16425    ///
16426    /// # Example
16427    /// ```ignore,no_run
16428    /// # use google_cloud_retail_v2::model::Product;
16429    /// use google_cloud_retail_v2::model::Audience;
16430    /// let x = Product::new().set_or_clear_audience(Some(Audience::default()/* use setters */));
16431    /// let x = Product::new().set_or_clear_audience(None::<Audience>);
16432    /// ```
16433    pub fn set_or_clear_audience<T>(mut self, v: std::option::Option<T>) -> Self
16434    where
16435        T: std::convert::Into<crate::model::Audience>,
16436    {
16437        self.audience = v.map(|x| x.into());
16438        self
16439    }
16440
16441    /// Sets the value of [color_info][crate::model::Product::color_info].
16442    ///
16443    /// # Example
16444    /// ```ignore,no_run
16445    /// # use google_cloud_retail_v2::model::Product;
16446    /// use google_cloud_retail_v2::model::ColorInfo;
16447    /// let x = Product::new().set_color_info(ColorInfo::default()/* use setters */);
16448    /// ```
16449    pub fn set_color_info<T>(mut self, v: T) -> Self
16450    where
16451        T: std::convert::Into<crate::model::ColorInfo>,
16452    {
16453        self.color_info = std::option::Option::Some(v.into());
16454        self
16455    }
16456
16457    /// Sets or clears the value of [color_info][crate::model::Product::color_info].
16458    ///
16459    /// # Example
16460    /// ```ignore,no_run
16461    /// # use google_cloud_retail_v2::model::Product;
16462    /// use google_cloud_retail_v2::model::ColorInfo;
16463    /// let x = Product::new().set_or_clear_color_info(Some(ColorInfo::default()/* use setters */));
16464    /// let x = Product::new().set_or_clear_color_info(None::<ColorInfo>);
16465    /// ```
16466    pub fn set_or_clear_color_info<T>(mut self, v: std::option::Option<T>) -> Self
16467    where
16468        T: std::convert::Into<crate::model::ColorInfo>,
16469    {
16470        self.color_info = v.map(|x| x.into());
16471        self
16472    }
16473
16474    /// Sets the value of [sizes][crate::model::Product::sizes].
16475    ///
16476    /// # Example
16477    /// ```ignore,no_run
16478    /// # use google_cloud_retail_v2::model::Product;
16479    /// let x = Product::new().set_sizes(["a", "b", "c"]);
16480    /// ```
16481    pub fn set_sizes<T, V>(mut self, v: T) -> Self
16482    where
16483        T: std::iter::IntoIterator<Item = V>,
16484        V: std::convert::Into<std::string::String>,
16485    {
16486        use std::iter::Iterator;
16487        self.sizes = v.into_iter().map(|i| i.into()).collect();
16488        self
16489    }
16490
16491    /// Sets the value of [materials][crate::model::Product::materials].
16492    ///
16493    /// # Example
16494    /// ```ignore,no_run
16495    /// # use google_cloud_retail_v2::model::Product;
16496    /// let x = Product::new().set_materials(["a", "b", "c"]);
16497    /// ```
16498    pub fn set_materials<T, V>(mut self, v: T) -> Self
16499    where
16500        T: std::iter::IntoIterator<Item = V>,
16501        V: std::convert::Into<std::string::String>,
16502    {
16503        use std::iter::Iterator;
16504        self.materials = v.into_iter().map(|i| i.into()).collect();
16505        self
16506    }
16507
16508    /// Sets the value of [patterns][crate::model::Product::patterns].
16509    ///
16510    /// # Example
16511    /// ```ignore,no_run
16512    /// # use google_cloud_retail_v2::model::Product;
16513    /// let x = Product::new().set_patterns(["a", "b", "c"]);
16514    /// ```
16515    pub fn set_patterns<T, V>(mut self, v: T) -> Self
16516    where
16517        T: std::iter::IntoIterator<Item = V>,
16518        V: std::convert::Into<std::string::String>,
16519    {
16520        use std::iter::Iterator;
16521        self.patterns = v.into_iter().map(|i| i.into()).collect();
16522        self
16523    }
16524
16525    /// Sets the value of [conditions][crate::model::Product::conditions].
16526    ///
16527    /// # Example
16528    /// ```ignore,no_run
16529    /// # use google_cloud_retail_v2::model::Product;
16530    /// let x = Product::new().set_conditions(["a", "b", "c"]);
16531    /// ```
16532    pub fn set_conditions<T, V>(mut self, v: T) -> Self
16533    where
16534        T: std::iter::IntoIterator<Item = V>,
16535        V: std::convert::Into<std::string::String>,
16536    {
16537        use std::iter::Iterator;
16538        self.conditions = v.into_iter().map(|i| i.into()).collect();
16539        self
16540    }
16541
16542    /// Sets the value of [promotions][crate::model::Product::promotions].
16543    ///
16544    /// # Example
16545    /// ```ignore,no_run
16546    /// # use google_cloud_retail_v2::model::Product;
16547    /// use google_cloud_retail_v2::model::Promotion;
16548    /// let x = Product::new()
16549    ///     .set_promotions([
16550    ///         Promotion::default()/* use setters */,
16551    ///         Promotion::default()/* use (different) setters */,
16552    ///     ]);
16553    /// ```
16554    pub fn set_promotions<T, V>(mut self, v: T) -> Self
16555    where
16556        T: std::iter::IntoIterator<Item = V>,
16557        V: std::convert::Into<crate::model::Promotion>,
16558    {
16559        use std::iter::Iterator;
16560        self.promotions = v.into_iter().map(|i| i.into()).collect();
16561        self
16562    }
16563
16564    /// Sets the value of [publish_time][crate::model::Product::publish_time].
16565    ///
16566    /// # Example
16567    /// ```ignore,no_run
16568    /// # use google_cloud_retail_v2::model::Product;
16569    /// use wkt::Timestamp;
16570    /// let x = Product::new().set_publish_time(Timestamp::default()/* use setters */);
16571    /// ```
16572    pub fn set_publish_time<T>(mut self, v: T) -> Self
16573    where
16574        T: std::convert::Into<wkt::Timestamp>,
16575    {
16576        self.publish_time = std::option::Option::Some(v.into());
16577        self
16578    }
16579
16580    /// Sets or clears the value of [publish_time][crate::model::Product::publish_time].
16581    ///
16582    /// # Example
16583    /// ```ignore,no_run
16584    /// # use google_cloud_retail_v2::model::Product;
16585    /// use wkt::Timestamp;
16586    /// let x = Product::new().set_or_clear_publish_time(Some(Timestamp::default()/* use setters */));
16587    /// let x = Product::new().set_or_clear_publish_time(None::<Timestamp>);
16588    /// ```
16589    pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
16590    where
16591        T: std::convert::Into<wkt::Timestamp>,
16592    {
16593        self.publish_time = v.map(|x| x.into());
16594        self
16595    }
16596
16597    /// Sets the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16598    ///
16599    /// # Example
16600    /// ```ignore,no_run
16601    /// # use google_cloud_retail_v2::model::Product;
16602    /// use wkt::FieldMask;
16603    /// let x = Product::new().set_retrievable_fields(FieldMask::default()/* use setters */);
16604    /// ```
16605    #[deprecated]
16606    pub fn set_retrievable_fields<T>(mut self, v: T) -> Self
16607    where
16608        T: std::convert::Into<wkt::FieldMask>,
16609    {
16610        self.retrievable_fields = std::option::Option::Some(v.into());
16611        self
16612    }
16613
16614    /// Sets or clears the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16615    ///
16616    /// # Example
16617    /// ```ignore,no_run
16618    /// # use google_cloud_retail_v2::model::Product;
16619    /// use wkt::FieldMask;
16620    /// let x = Product::new().set_or_clear_retrievable_fields(Some(FieldMask::default()/* use setters */));
16621    /// let x = Product::new().set_or_clear_retrievable_fields(None::<FieldMask>);
16622    /// ```
16623    #[deprecated]
16624    pub fn set_or_clear_retrievable_fields<T>(mut self, v: std::option::Option<T>) -> Self
16625    where
16626        T: std::convert::Into<wkt::FieldMask>,
16627    {
16628        self.retrievable_fields = v.map(|x| x.into());
16629        self
16630    }
16631
16632    /// Sets the value of [variants][crate::model::Product::variants].
16633    ///
16634    /// # Example
16635    /// ```ignore,no_run
16636    /// # use google_cloud_retail_v2::model::Product;
16637    /// let x = Product::new()
16638    ///     .set_variants([
16639    ///         Product::default()/* use setters */,
16640    ///         Product::default()/* use (different) setters */,
16641    ///     ]);
16642    /// ```
16643    pub fn set_variants<T, V>(mut self, v: T) -> Self
16644    where
16645        T: std::iter::IntoIterator<Item = V>,
16646        V: std::convert::Into<crate::model::Product>,
16647    {
16648        use std::iter::Iterator;
16649        self.variants = v.into_iter().map(|i| i.into()).collect();
16650        self
16651    }
16652
16653    /// Sets the value of [local_inventories][crate::model::Product::local_inventories].
16654    ///
16655    /// # Example
16656    /// ```ignore,no_run
16657    /// # use google_cloud_retail_v2::model::Product;
16658    /// use google_cloud_retail_v2::model::LocalInventory;
16659    /// let x = Product::new()
16660    ///     .set_local_inventories([
16661    ///         LocalInventory::default()/* use setters */,
16662    ///         LocalInventory::default()/* use (different) setters */,
16663    ///     ]);
16664    /// ```
16665    pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
16666    where
16667        T: std::iter::IntoIterator<Item = V>,
16668        V: std::convert::Into<crate::model::LocalInventory>,
16669    {
16670        use std::iter::Iterator;
16671        self.local_inventories = v.into_iter().map(|i| i.into()).collect();
16672        self
16673    }
16674
16675    /// Sets the value of [expiration][crate::model::Product::expiration].
16676    ///
16677    /// Note that all the setters affecting `expiration` are mutually
16678    /// exclusive.
16679    ///
16680    /// # Example
16681    /// ```ignore,no_run
16682    /// # use google_cloud_retail_v2::model::Product;
16683    /// use wkt::Timestamp;
16684    /// let x = Product::new().set_expiration(Some(
16685    ///     google_cloud_retail_v2::model::product::Expiration::ExpireTime(Timestamp::default().into())));
16686    /// ```
16687    pub fn set_expiration<
16688        T: std::convert::Into<std::option::Option<crate::model::product::Expiration>>,
16689    >(
16690        mut self,
16691        v: T,
16692    ) -> Self {
16693        self.expiration = v.into();
16694        self
16695    }
16696
16697    /// The value of [expiration][crate::model::Product::expiration]
16698    /// if it holds a `ExpireTime`, `None` if the field is not set or
16699    /// holds a different branch.
16700    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
16701        #[allow(unreachable_patterns)]
16702        self.expiration.as_ref().and_then(|v| match v {
16703            crate::model::product::Expiration::ExpireTime(v) => std::option::Option::Some(v),
16704            _ => std::option::Option::None,
16705        })
16706    }
16707
16708    /// Sets the value of [expiration][crate::model::Product::expiration]
16709    /// to hold a `ExpireTime`.
16710    ///
16711    /// Note that all the setters affecting `expiration` are
16712    /// mutually exclusive.
16713    ///
16714    /// # Example
16715    /// ```ignore,no_run
16716    /// # use google_cloud_retail_v2::model::Product;
16717    /// use wkt::Timestamp;
16718    /// let x = Product::new().set_expire_time(Timestamp::default()/* use setters */);
16719    /// assert!(x.expire_time().is_some());
16720    /// assert!(x.ttl().is_none());
16721    /// ```
16722    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
16723        mut self,
16724        v: T,
16725    ) -> Self {
16726        self.expiration =
16727            std::option::Option::Some(crate::model::product::Expiration::ExpireTime(v.into()));
16728        self
16729    }
16730
16731    /// The value of [expiration][crate::model::Product::expiration]
16732    /// if it holds a `Ttl`, `None` if the field is not set or
16733    /// holds a different branch.
16734    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
16735        #[allow(unreachable_patterns)]
16736        self.expiration.as_ref().and_then(|v| match v {
16737            crate::model::product::Expiration::Ttl(v) => std::option::Option::Some(v),
16738            _ => std::option::Option::None,
16739        })
16740    }
16741
16742    /// Sets the value of [expiration][crate::model::Product::expiration]
16743    /// to hold a `Ttl`.
16744    ///
16745    /// Note that all the setters affecting `expiration` are
16746    /// mutually exclusive.
16747    ///
16748    /// # Example
16749    /// ```ignore,no_run
16750    /// # use google_cloud_retail_v2::model::Product;
16751    /// use wkt::Duration;
16752    /// let x = Product::new().set_ttl(Duration::default()/* use setters */);
16753    /// assert!(x.ttl().is_some());
16754    /// assert!(x.expire_time().is_none());
16755    /// ```
16756    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
16757        self.expiration =
16758            std::option::Option::Some(crate::model::product::Expiration::Ttl(v.into()));
16759        self
16760    }
16761}
16762
16763impl wkt::message::Message for Product {
16764    fn typename() -> &'static str {
16765        "type.googleapis.com/google.cloud.retail.v2.Product"
16766    }
16767}
16768
16769/// Defines additional types related to [Product].
16770pub mod product {
16771    #[allow(unused_imports)]
16772    use super::*;
16773
16774    /// The type of this product.
16775    ///
16776    /// # Working with unknown values
16777    ///
16778    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16779    /// additional enum variants at any time. Adding new variants is not considered
16780    /// a breaking change. Applications should write their code in anticipation of:
16781    ///
16782    /// - New values appearing in future releases of the client library, **and**
16783    /// - New values received dynamically, without application changes.
16784    ///
16785    /// Please consult the [Working with enums] section in the user guide for some
16786    /// guidelines.
16787    ///
16788    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16789    #[derive(Clone, Debug, PartialEq)]
16790    #[non_exhaustive]
16791    pub enum Type {
16792        /// Default value. Default to
16793        /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
16794        /// if unset.
16795        ///
16796        /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
16797        Unspecified,
16798        /// The primary type.
16799        ///
16800        /// As the primary unit for predicting, indexing and search serving, a
16801        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16802        /// [Product][google.cloud.retail.v2.Product] is grouped with multiple
16803        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16804        /// [Product][google.cloud.retail.v2.Product]s.
16805        ///
16806        /// [google.cloud.retail.v2.Product]: crate::model::Product
16807        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16808        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16809        Primary,
16810        /// The variant type.
16811        ///
16812        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16813        /// [Product][google.cloud.retail.v2.Product]s usually share some common
16814        /// attributes on the same
16815        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16816        /// [Product][google.cloud.retail.v2.Product]s, but they have variant
16817        /// attributes like different colors, sizes and prices, etc.
16818        ///
16819        /// [google.cloud.retail.v2.Product]: crate::model::Product
16820        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16821        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16822        Variant,
16823        /// The collection type. Collection products are bundled
16824        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16825        /// [Product][google.cloud.retail.v2.Product]s or
16826        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16827        /// [Product][google.cloud.retail.v2.Product]s that are sold together, such
16828        /// as a jewelry set with necklaces, earrings and rings, etc.
16829        ///
16830        /// [google.cloud.retail.v2.Product]: crate::model::Product
16831        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16832        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16833        Collection,
16834        /// If set, the enum was initialized with an unknown value.
16835        ///
16836        /// Applications can examine the value using [Type::value] or
16837        /// [Type::name].
16838        UnknownValue(r#type::UnknownValue),
16839    }
16840
16841    #[doc(hidden)]
16842    pub mod r#type {
16843        #[allow(unused_imports)]
16844        use super::*;
16845        #[derive(Clone, Debug, PartialEq)]
16846        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16847    }
16848
16849    impl Type {
16850        /// Gets the enum value.
16851        ///
16852        /// Returns `None` if the enum contains an unknown value deserialized from
16853        /// the string representation of enums.
16854        pub fn value(&self) -> std::option::Option<i32> {
16855            match self {
16856                Self::Unspecified => std::option::Option::Some(0),
16857                Self::Primary => std::option::Option::Some(1),
16858                Self::Variant => std::option::Option::Some(2),
16859                Self::Collection => std::option::Option::Some(3),
16860                Self::UnknownValue(u) => u.0.value(),
16861            }
16862        }
16863
16864        /// Gets the enum value as a string.
16865        ///
16866        /// Returns `None` if the enum contains an unknown value deserialized from
16867        /// the integer representation of enums.
16868        pub fn name(&self) -> std::option::Option<&str> {
16869            match self {
16870                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
16871                Self::Primary => std::option::Option::Some("PRIMARY"),
16872                Self::Variant => std::option::Option::Some("VARIANT"),
16873                Self::Collection => std::option::Option::Some("COLLECTION"),
16874                Self::UnknownValue(u) => u.0.name(),
16875            }
16876        }
16877    }
16878
16879    impl std::default::Default for Type {
16880        fn default() -> Self {
16881            use std::convert::From;
16882            Self::from(0)
16883        }
16884    }
16885
16886    impl std::fmt::Display for Type {
16887        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16888            wkt::internal::display_enum(f, self.name(), self.value())
16889        }
16890    }
16891
16892    impl std::convert::From<i32> for Type {
16893        fn from(value: i32) -> Self {
16894            match value {
16895                0 => Self::Unspecified,
16896                1 => Self::Primary,
16897                2 => Self::Variant,
16898                3 => Self::Collection,
16899                _ => Self::UnknownValue(r#type::UnknownValue(
16900                    wkt::internal::UnknownEnumValue::Integer(value),
16901                )),
16902            }
16903        }
16904    }
16905
16906    impl std::convert::From<&str> for Type {
16907        fn from(value: &str) -> Self {
16908            use std::string::ToString;
16909            match value {
16910                "TYPE_UNSPECIFIED" => Self::Unspecified,
16911                "PRIMARY" => Self::Primary,
16912                "VARIANT" => Self::Variant,
16913                "COLLECTION" => Self::Collection,
16914                _ => Self::UnknownValue(r#type::UnknownValue(
16915                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16916                )),
16917            }
16918        }
16919    }
16920
16921    impl serde::ser::Serialize for Type {
16922        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16923        where
16924            S: serde::Serializer,
16925        {
16926            match self {
16927                Self::Unspecified => serializer.serialize_i32(0),
16928                Self::Primary => serializer.serialize_i32(1),
16929                Self::Variant => serializer.serialize_i32(2),
16930                Self::Collection => serializer.serialize_i32(3),
16931                Self::UnknownValue(u) => u.0.serialize(serializer),
16932            }
16933        }
16934    }
16935
16936    impl<'de> serde::de::Deserialize<'de> for Type {
16937        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16938        where
16939            D: serde::Deserializer<'de>,
16940        {
16941            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
16942                ".google.cloud.retail.v2.Product.Type",
16943            ))
16944        }
16945    }
16946
16947    /// Product availability. If this field is unspecified, the product is
16948    /// assumed to be in stock.
16949    ///
16950    /// # Working with unknown values
16951    ///
16952    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16953    /// additional enum variants at any time. Adding new variants is not considered
16954    /// a breaking change. Applications should write their code in anticipation of:
16955    ///
16956    /// - New values appearing in future releases of the client library, **and**
16957    /// - New values received dynamically, without application changes.
16958    ///
16959    /// Please consult the [Working with enums] section in the user guide for some
16960    /// guidelines.
16961    ///
16962    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16963    #[derive(Clone, Debug, PartialEq)]
16964    #[non_exhaustive]
16965    pub enum Availability {
16966        /// Default product availability. Default to
16967        /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
16968        /// if unset.
16969        ///
16970        /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
16971        Unspecified,
16972        /// Product in stock.
16973        InStock,
16974        /// Product out of stock.
16975        OutOfStock,
16976        /// Product that is in pre-order state.
16977        Preorder,
16978        /// Product that is back-ordered (i.e. temporarily out of stock).
16979        Backorder,
16980        /// If set, the enum was initialized with an unknown value.
16981        ///
16982        /// Applications can examine the value using [Availability::value] or
16983        /// [Availability::name].
16984        UnknownValue(availability::UnknownValue),
16985    }
16986
16987    #[doc(hidden)]
16988    pub mod availability {
16989        #[allow(unused_imports)]
16990        use super::*;
16991        #[derive(Clone, Debug, PartialEq)]
16992        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16993    }
16994
16995    impl Availability {
16996        /// Gets the enum value.
16997        ///
16998        /// Returns `None` if the enum contains an unknown value deserialized from
16999        /// the string representation of enums.
17000        pub fn value(&self) -> std::option::Option<i32> {
17001            match self {
17002                Self::Unspecified => std::option::Option::Some(0),
17003                Self::InStock => std::option::Option::Some(1),
17004                Self::OutOfStock => std::option::Option::Some(2),
17005                Self::Preorder => std::option::Option::Some(3),
17006                Self::Backorder => std::option::Option::Some(4),
17007                Self::UnknownValue(u) => u.0.value(),
17008            }
17009        }
17010
17011        /// Gets the enum value as a string.
17012        ///
17013        /// Returns `None` if the enum contains an unknown value deserialized from
17014        /// the integer representation of enums.
17015        pub fn name(&self) -> std::option::Option<&str> {
17016            match self {
17017                Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
17018                Self::InStock => std::option::Option::Some("IN_STOCK"),
17019                Self::OutOfStock => std::option::Option::Some("OUT_OF_STOCK"),
17020                Self::Preorder => std::option::Option::Some("PREORDER"),
17021                Self::Backorder => std::option::Option::Some("BACKORDER"),
17022                Self::UnknownValue(u) => u.0.name(),
17023            }
17024        }
17025    }
17026
17027    impl std::default::Default for Availability {
17028        fn default() -> Self {
17029            use std::convert::From;
17030            Self::from(0)
17031        }
17032    }
17033
17034    impl std::fmt::Display for Availability {
17035        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17036            wkt::internal::display_enum(f, self.name(), self.value())
17037        }
17038    }
17039
17040    impl std::convert::From<i32> for Availability {
17041        fn from(value: i32) -> Self {
17042            match value {
17043                0 => Self::Unspecified,
17044                1 => Self::InStock,
17045                2 => Self::OutOfStock,
17046                3 => Self::Preorder,
17047                4 => Self::Backorder,
17048                _ => Self::UnknownValue(availability::UnknownValue(
17049                    wkt::internal::UnknownEnumValue::Integer(value),
17050                )),
17051            }
17052        }
17053    }
17054
17055    impl std::convert::From<&str> for Availability {
17056        fn from(value: &str) -> Self {
17057            use std::string::ToString;
17058            match value {
17059                "AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
17060                "IN_STOCK" => Self::InStock,
17061                "OUT_OF_STOCK" => Self::OutOfStock,
17062                "PREORDER" => Self::Preorder,
17063                "BACKORDER" => Self::Backorder,
17064                _ => Self::UnknownValue(availability::UnknownValue(
17065                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17066                )),
17067            }
17068        }
17069    }
17070
17071    impl serde::ser::Serialize for Availability {
17072        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17073        where
17074            S: serde::Serializer,
17075        {
17076            match self {
17077                Self::Unspecified => serializer.serialize_i32(0),
17078                Self::InStock => serializer.serialize_i32(1),
17079                Self::OutOfStock => serializer.serialize_i32(2),
17080                Self::Preorder => serializer.serialize_i32(3),
17081                Self::Backorder => serializer.serialize_i32(4),
17082                Self::UnknownValue(u) => u.0.serialize(serializer),
17083            }
17084        }
17085    }
17086
17087    impl<'de> serde::de::Deserialize<'de> for Availability {
17088        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17089        where
17090            D: serde::Deserializer<'de>,
17091        {
17092            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
17093                ".google.cloud.retail.v2.Product.Availability",
17094            ))
17095        }
17096    }
17097
17098    #[derive(Clone, Debug, PartialEq)]
17099    #[non_exhaustive]
17100    pub enum Expiration {
17101        /// Note that this field is applied in the following ways:
17102        ///
17103        /// * If the [Product][google.cloud.retail.v2.Product] is already expired
17104        ///   when it is uploaded, this product
17105        ///   is not indexed for search.
17106        ///
17107        /// * If the [Product][google.cloud.retail.v2.Product] is not expired when it
17108        ///   is uploaded, only the
17109        ///   [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]'s and
17110        ///   [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]'s
17111        ///   expireTime is respected, and
17112        ///   [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]'s
17113        ///   expireTime is not used.
17114        ///
17115        ///
17116        /// In general, we suggest the users to delete the stale
17117        /// products explicitly, instead of using this field to determine staleness.
17118        ///
17119        /// [expire_time][google.cloud.retail.v2.Product.expire_time] must be later
17120        /// than [available_time][google.cloud.retail.v2.Product.available_time] and
17121        /// [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an
17122        /// INVALID_ARGUMENT error is thrown.
17123        ///
17124        /// Corresponding properties: Google Merchant Center property
17125        /// [expiration_date](https://support.google.com/merchants/answer/6324499).
17126        ///
17127        /// [google.cloud.retail.v2.Product]: crate::model::Product
17128        /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17129        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17130        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17131        /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
17132        /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17133        /// [google.cloud.retail.v2.Product.publish_time]: crate::model::Product::publish_time
17134        ExpireTime(std::boxed::Box<wkt::Timestamp>),
17135        /// Input only. The TTL (time to live) of the product. Note that this is only
17136        /// applicable to [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17137        /// and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION],
17138        /// and ignored for
17139        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. In general,
17140        /// we suggest the users to delete the stale products explicitly, instead of
17141        /// using this field to determine staleness.
17142        ///
17143        /// If it is set, it must be a non-negative value, and
17144        /// [expire_time][google.cloud.retail.v2.Product.expire_time] is set as
17145        /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The
17146        /// derived [expire_time][google.cloud.retail.v2.Product.expire_time] is
17147        /// returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is
17148        /// left blank when retrieving the [Product][google.cloud.retail.v2.Product].
17149        ///
17150        /// If it is set, the product is not available for
17151        /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after
17152        /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl].
17153        /// However, the product can still be retrieved by
17154        /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17155        /// and
17156        /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
17157        ///
17158        /// [google.cloud.retail.v2.Product]: crate::model::Product
17159        /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17160        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17161        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17162        /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17163        /// [google.cloud.retail.v2.Product.ttl]: crate::model::Product::expiration
17164        /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17165        /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17166        /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
17167        Ttl(std::boxed::Box<wkt::Duration>),
17168    }
17169}
17170
17171/// Request message for
17172/// [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
17173/// method.
17174///
17175/// [google.cloud.retail.v2.ProductService.CreateProduct]: crate::client::ProductService::create_product
17176#[derive(Clone, Default, PartialEq)]
17177#[non_exhaustive]
17178pub struct CreateProductRequest {
17179    /// Required. The parent catalog resource name, such as
17180    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
17181    pub parent: std::string::String,
17182
17183    /// Required. The [Product][google.cloud.retail.v2.Product] to create.
17184    ///
17185    /// [google.cloud.retail.v2.Product]: crate::model::Product
17186    pub product: std::option::Option<crate::model::Product>,
17187
17188    /// Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
17189    /// which will become the final component of the
17190    /// [Product.name][google.cloud.retail.v2.Product.name].
17191    ///
17192    /// If the caller does not have permission to create the
17193    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17194    /// exists, a PERMISSION_DENIED error is returned.
17195    ///
17196    /// This field must be unique among all
17197    /// [Product][google.cloud.retail.v2.Product]s with the same
17198    /// [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
17199    /// ALREADY_EXISTS error is returned.
17200    ///
17201    /// This field must be a UTF-8 encoded string with a length limit of 128
17202    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
17203    ///
17204    /// [google.cloud.retail.v2.CreateProductRequest.parent]: crate::model::CreateProductRequest::parent
17205    /// [google.cloud.retail.v2.Product]: crate::model::Product
17206    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17207    pub product_id: std::string::String,
17208
17209    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17210}
17211
17212impl CreateProductRequest {
17213    pub fn new() -> Self {
17214        std::default::Default::default()
17215    }
17216
17217    /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
17218    ///
17219    /// # Example
17220    /// ```ignore,no_run
17221    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17222    /// let x = CreateProductRequest::new().set_parent("example");
17223    /// ```
17224    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17225        self.parent = v.into();
17226        self
17227    }
17228
17229    /// Sets the value of [product][crate::model::CreateProductRequest::product].
17230    ///
17231    /// # Example
17232    /// ```ignore,no_run
17233    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17234    /// use google_cloud_retail_v2::model::Product;
17235    /// let x = CreateProductRequest::new().set_product(Product::default()/* use setters */);
17236    /// ```
17237    pub fn set_product<T>(mut self, v: T) -> Self
17238    where
17239        T: std::convert::Into<crate::model::Product>,
17240    {
17241        self.product = std::option::Option::Some(v.into());
17242        self
17243    }
17244
17245    /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
17246    ///
17247    /// # Example
17248    /// ```ignore,no_run
17249    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17250    /// use google_cloud_retail_v2::model::Product;
17251    /// let x = CreateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17252    /// let x = CreateProductRequest::new().set_or_clear_product(None::<Product>);
17253    /// ```
17254    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17255    where
17256        T: std::convert::Into<crate::model::Product>,
17257    {
17258        self.product = v.map(|x| x.into());
17259        self
17260    }
17261
17262    /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
17263    ///
17264    /// # Example
17265    /// ```ignore,no_run
17266    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17267    /// let x = CreateProductRequest::new().set_product_id("example");
17268    /// ```
17269    pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17270        self.product_id = v.into();
17271        self
17272    }
17273}
17274
17275impl wkt::message::Message for CreateProductRequest {
17276    fn typename() -> &'static str {
17277        "type.googleapis.com/google.cloud.retail.v2.CreateProductRequest"
17278    }
17279}
17280
17281/// Request message for
17282/// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17283/// method.
17284///
17285/// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17286#[derive(Clone, Default, PartialEq)]
17287#[non_exhaustive]
17288pub struct GetProductRequest {
17289    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17290    /// such as
17291    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17292    ///
17293    /// If the caller does not have permission to access the
17294    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17295    /// exists, a PERMISSION_DENIED error is returned.
17296    ///
17297    /// If the requested [Product][google.cloud.retail.v2.Product] does not exist,
17298    /// a NOT_FOUND error is returned.
17299    ///
17300    /// [google.cloud.retail.v2.Product]: crate::model::Product
17301    pub name: std::string::String,
17302
17303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17304}
17305
17306impl GetProductRequest {
17307    pub fn new() -> Self {
17308        std::default::Default::default()
17309    }
17310
17311    /// Sets the value of [name][crate::model::GetProductRequest::name].
17312    ///
17313    /// # Example
17314    /// ```ignore,no_run
17315    /// # use google_cloud_retail_v2::model::GetProductRequest;
17316    /// let x = GetProductRequest::new().set_name("example");
17317    /// ```
17318    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17319        self.name = v.into();
17320        self
17321    }
17322}
17323
17324impl wkt::message::Message for GetProductRequest {
17325    fn typename() -> &'static str {
17326        "type.googleapis.com/google.cloud.retail.v2.GetProductRequest"
17327    }
17328}
17329
17330/// Request message for
17331/// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17332/// method.
17333///
17334/// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17335#[derive(Clone, Default, PartialEq)]
17336#[non_exhaustive]
17337pub struct UpdateProductRequest {
17338    /// Required. The product to update/create.
17339    ///
17340    /// If the caller does not have permission to update the
17341    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17342    /// exists, a PERMISSION_DENIED error is returned.
17343    ///
17344    /// If the [Product][google.cloud.retail.v2.Product] to update does not exist
17345    /// and
17346    /// [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing]
17347    /// is not set, a NOT_FOUND error is returned.
17348    ///
17349    /// [google.cloud.retail.v2.Product]: crate::model::Product
17350    /// [google.cloud.retail.v2.UpdateProductRequest.allow_missing]: crate::model::UpdateProductRequest::allow_missing
17351    pub product: std::option::Option<crate::model::Product>,
17352
17353    /// Indicates which fields in the provided
17354    /// [Product][google.cloud.retail.v2.Product] to update. The immutable and
17355    /// output only fields are NOT supported. If not set, all supported fields (the
17356    /// fields that are neither immutable nor output only) are updated.
17357    ///
17358    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17359    /// is returned.
17360    ///
17361    /// The attribute key can be updated by setting the mask path as
17362    /// "attributes.${key_name}". If a key name is present in the mask but not in
17363    /// the patching product from the request, this key will be deleted after the
17364    /// update.
17365    ///
17366    /// [google.cloud.retail.v2.Product]: crate::model::Product
17367    pub update_mask: std::option::Option<wkt::FieldMask>,
17368
17369    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
17370    /// found, a new [Product][google.cloud.retail.v2.Product] will be created. In
17371    /// this situation, `update_mask` is ignored.
17372    ///
17373    /// [google.cloud.retail.v2.Product]: crate::model::Product
17374    pub allow_missing: bool,
17375
17376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17377}
17378
17379impl UpdateProductRequest {
17380    pub fn new() -> Self {
17381        std::default::Default::default()
17382    }
17383
17384    /// Sets the value of [product][crate::model::UpdateProductRequest::product].
17385    ///
17386    /// # Example
17387    /// ```ignore,no_run
17388    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17389    /// use google_cloud_retail_v2::model::Product;
17390    /// let x = UpdateProductRequest::new().set_product(Product::default()/* use setters */);
17391    /// ```
17392    pub fn set_product<T>(mut self, v: T) -> Self
17393    where
17394        T: std::convert::Into<crate::model::Product>,
17395    {
17396        self.product = std::option::Option::Some(v.into());
17397        self
17398    }
17399
17400    /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
17401    ///
17402    /// # Example
17403    /// ```ignore,no_run
17404    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17405    /// use google_cloud_retail_v2::model::Product;
17406    /// let x = UpdateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17407    /// let x = UpdateProductRequest::new().set_or_clear_product(None::<Product>);
17408    /// ```
17409    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17410    where
17411        T: std::convert::Into<crate::model::Product>,
17412    {
17413        self.product = v.map(|x| x.into());
17414        self
17415    }
17416
17417    /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17418    ///
17419    /// # Example
17420    /// ```ignore,no_run
17421    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17422    /// use wkt::FieldMask;
17423    /// let x = UpdateProductRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17424    /// ```
17425    pub fn set_update_mask<T>(mut self, v: T) -> Self
17426    where
17427        T: std::convert::Into<wkt::FieldMask>,
17428    {
17429        self.update_mask = std::option::Option::Some(v.into());
17430        self
17431    }
17432
17433    /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17434    ///
17435    /// # Example
17436    /// ```ignore,no_run
17437    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17438    /// use wkt::FieldMask;
17439    /// let x = UpdateProductRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17440    /// let x = UpdateProductRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17441    /// ```
17442    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17443    where
17444        T: std::convert::Into<wkt::FieldMask>,
17445    {
17446        self.update_mask = v.map(|x| x.into());
17447        self
17448    }
17449
17450    /// Sets the value of [allow_missing][crate::model::UpdateProductRequest::allow_missing].
17451    ///
17452    /// # Example
17453    /// ```ignore,no_run
17454    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17455    /// let x = UpdateProductRequest::new().set_allow_missing(true);
17456    /// ```
17457    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17458        self.allow_missing = v.into();
17459        self
17460    }
17461}
17462
17463impl wkt::message::Message for UpdateProductRequest {
17464    fn typename() -> &'static str {
17465        "type.googleapis.com/google.cloud.retail.v2.UpdateProductRequest"
17466    }
17467}
17468
17469/// Request message for
17470/// [ProductService.DeleteProduct][google.cloud.retail.v2.ProductService.DeleteProduct]
17471/// method.
17472///
17473/// [google.cloud.retail.v2.ProductService.DeleteProduct]: crate::client::ProductService::delete_product
17474#[derive(Clone, Default, PartialEq)]
17475#[non_exhaustive]
17476pub struct DeleteProductRequest {
17477    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17478    /// such as
17479    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17480    ///
17481    /// If the caller does not have permission to delete the
17482    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17483    /// exists, a PERMISSION_DENIED error is returned.
17484    ///
17485    /// If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
17486    /// a NOT_FOUND error is returned.
17487    ///
17488    /// The [Product][google.cloud.retail.v2.Product] to delete can neither be a
17489    /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17490    /// [Product][google.cloud.retail.v2.Product] member nor a
17491    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17492    /// [Product][google.cloud.retail.v2.Product] with more than one
17493    /// [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an
17494    /// INVALID_ARGUMENT error is returned.
17495    ///
17496    /// All inventory information for the named
17497    /// [Product][google.cloud.retail.v2.Product] will be deleted.
17498    ///
17499    /// [google.cloud.retail.v2.Product]: crate::model::Product
17500    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17501    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17502    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17503    pub name: std::string::String,
17504
17505    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17506}
17507
17508impl DeleteProductRequest {
17509    pub fn new() -> Self {
17510        std::default::Default::default()
17511    }
17512
17513    /// Sets the value of [name][crate::model::DeleteProductRequest::name].
17514    ///
17515    /// # Example
17516    /// ```ignore,no_run
17517    /// # use google_cloud_retail_v2::model::DeleteProductRequest;
17518    /// let x = DeleteProductRequest::new().set_name("example");
17519    /// ```
17520    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17521        self.name = v.into();
17522        self
17523    }
17524}
17525
17526impl wkt::message::Message for DeleteProductRequest {
17527    fn typename() -> &'static str {
17528        "type.googleapis.com/google.cloud.retail.v2.DeleteProductRequest"
17529    }
17530}
17531
17532/// Request message for
17533/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17534/// method.
17535///
17536/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17537#[derive(Clone, Default, PartialEq)]
17538#[non_exhaustive]
17539pub struct ListProductsRequest {
17540    /// Required. The parent branch resource name, such as
17541    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
17542    /// `default_branch` as the branch ID, to list products under the default
17543    /// branch.
17544    ///
17545    /// If the caller does not have permission to list
17546    /// [Product][google.cloud.retail.v2.Product]s under this branch, regardless of
17547    /// whether or not this branch exists, a PERMISSION_DENIED error is returned.
17548    ///
17549    /// [google.cloud.retail.v2.Product]: crate::model::Product
17550    pub parent: std::string::String,
17551
17552    /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
17553    /// unspecified, defaults to 100. The maximum allowed value is 1000. Values
17554    /// above 1000 will be coerced to 1000.
17555    ///
17556    /// If this field is negative, an INVALID_ARGUMENT error is returned.
17557    ///
17558    /// [google.cloud.retail.v2.Product]: crate::model::Product
17559    pub page_size: i32,
17560
17561    /// A page token
17562    /// [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token],
17563    /// received from a previous
17564    /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17565    /// call. Provide this to retrieve the subsequent page.
17566    ///
17567    /// When paginating, all other parameters provided to
17568    /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17569    /// must match the call that provided the page token. Otherwise, an
17570    /// INVALID_ARGUMENT error is returned.
17571    ///
17572    /// [google.cloud.retail.v2.ListProductsResponse.next_page_token]: crate::model::ListProductsResponse::next_page_token
17573    /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17574    pub page_token: std::string::String,
17575
17576    /// A filter to apply on the list results. Supported features:
17577    ///
17578    /// * List all the products under the parent branch if
17579    ///   [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset.
17580    /// * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17581    ///   [Product][google.cloud.retail.v2.Product]s sharing the same
17582    ///   [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17583    ///   [Product][google.cloud.retail.v2.Product]. For example:
17584    ///   `primary_product_id = "some_product_id"`
17585    /// * List [Product][google.cloud.retail.v2.Product]s bundled in a
17586    ///   [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17587    ///   [Product][google.cloud.retail.v2.Product].
17588    ///   For example:
17589    ///   `collection_product_id = "some_product_id"`
17590    /// * List [Product][google.cloud.retail.v2.Product]s with a partibular type.
17591    ///   For example:
17592    ///   `type = "PRIMARY"`
17593    ///   `type = "VARIANT"`
17594    ///   `type = "COLLECTION"`
17595    ///
17596    /// If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
17597    ///
17598    /// If the specified
17599    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17600    /// [Product][google.cloud.retail.v2.Product] or
17601    /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17602    /// [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error
17603    /// is returned.
17604    ///
17605    /// [google.cloud.retail.v2.ListProductsRequest.filter]: crate::model::ListProductsRequest::filter
17606    /// [google.cloud.retail.v2.Product]: crate::model::Product
17607    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17608    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17609    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17610    pub filter: std::string::String,
17611
17612    /// The fields of [Product][google.cloud.retail.v2.Product] to return in the
17613    /// responses. If not set or empty, the following fields are returned:
17614    ///
17615    /// * [Product.name][google.cloud.retail.v2.Product.name]
17616    /// * [Product.id][google.cloud.retail.v2.Product.id]
17617    /// * [Product.title][google.cloud.retail.v2.Product.title]
17618    /// * [Product.uri][google.cloud.retail.v2.Product.uri]
17619    /// * [Product.images][google.cloud.retail.v2.Product.images]
17620    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17621    /// * [Product.brands][google.cloud.retail.v2.Product.brands]
17622    ///
17623    /// If "*" is provided, all fields are returned.
17624    /// [Product.name][google.cloud.retail.v2.Product.name] is always returned no
17625    /// matter what mask is set.
17626    ///
17627    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17628    /// is returned.
17629    ///
17630    /// [google.cloud.retail.v2.Product]: crate::model::Product
17631    /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
17632    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
17633    /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
17634    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17635    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17636    /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
17637    /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
17638    pub read_mask: std::option::Option<wkt::FieldMask>,
17639
17640    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17641}
17642
17643impl ListProductsRequest {
17644    pub fn new() -> Self {
17645        std::default::Default::default()
17646    }
17647
17648    /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
17649    ///
17650    /// # Example
17651    /// ```ignore,no_run
17652    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17653    /// let x = ListProductsRequest::new().set_parent("example");
17654    /// ```
17655    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17656        self.parent = v.into();
17657        self
17658    }
17659
17660    /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
17661    ///
17662    /// # Example
17663    /// ```ignore,no_run
17664    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17665    /// let x = ListProductsRequest::new().set_page_size(42);
17666    /// ```
17667    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17668        self.page_size = v.into();
17669        self
17670    }
17671
17672    /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
17673    ///
17674    /// # Example
17675    /// ```ignore,no_run
17676    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17677    /// let x = ListProductsRequest::new().set_page_token("example");
17678    /// ```
17679    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17680        self.page_token = v.into();
17681        self
17682    }
17683
17684    /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
17685    ///
17686    /// # Example
17687    /// ```ignore,no_run
17688    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17689    /// let x = ListProductsRequest::new().set_filter("example");
17690    /// ```
17691    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17692        self.filter = v.into();
17693        self
17694    }
17695
17696    /// Sets the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17697    ///
17698    /// # Example
17699    /// ```ignore,no_run
17700    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17701    /// use wkt::FieldMask;
17702    /// let x = ListProductsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
17703    /// ```
17704    pub fn set_read_mask<T>(mut self, v: T) -> Self
17705    where
17706        T: std::convert::Into<wkt::FieldMask>,
17707    {
17708        self.read_mask = std::option::Option::Some(v.into());
17709        self
17710    }
17711
17712    /// Sets or clears the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17713    ///
17714    /// # Example
17715    /// ```ignore,no_run
17716    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17717    /// use wkt::FieldMask;
17718    /// let x = ListProductsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
17719    /// let x = ListProductsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
17720    /// ```
17721    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
17722    where
17723        T: std::convert::Into<wkt::FieldMask>,
17724    {
17725        self.read_mask = v.map(|x| x.into());
17726        self
17727    }
17728}
17729
17730impl wkt::message::Message for ListProductsRequest {
17731    fn typename() -> &'static str {
17732        "type.googleapis.com/google.cloud.retail.v2.ListProductsRequest"
17733    }
17734}
17735
17736/// Response message for
17737/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17738/// method.
17739///
17740/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17741#[derive(Clone, Default, PartialEq)]
17742#[non_exhaustive]
17743pub struct ListProductsResponse {
17744    /// The [Product][google.cloud.retail.v2.Product]s.
17745    ///
17746    /// [google.cloud.retail.v2.Product]: crate::model::Product
17747    pub products: std::vec::Vec<crate::model::Product>,
17748
17749    /// A token that can be sent as
17750    /// [ListProductsRequest.page_token][google.cloud.retail.v2.ListProductsRequest.page_token]
17751    /// to retrieve the next page. If this field is omitted, there are no
17752    /// subsequent pages.
17753    ///
17754    /// [google.cloud.retail.v2.ListProductsRequest.page_token]: crate::model::ListProductsRequest::page_token
17755    pub next_page_token: std::string::String,
17756
17757    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17758}
17759
17760impl ListProductsResponse {
17761    pub fn new() -> Self {
17762        std::default::Default::default()
17763    }
17764
17765    /// Sets the value of [products][crate::model::ListProductsResponse::products].
17766    ///
17767    /// # Example
17768    /// ```ignore,no_run
17769    /// # use google_cloud_retail_v2::model::ListProductsResponse;
17770    /// use google_cloud_retail_v2::model::Product;
17771    /// let x = ListProductsResponse::new()
17772    ///     .set_products([
17773    ///         Product::default()/* use setters */,
17774    ///         Product::default()/* use (different) setters */,
17775    ///     ]);
17776    /// ```
17777    pub fn set_products<T, V>(mut self, v: T) -> Self
17778    where
17779        T: std::iter::IntoIterator<Item = V>,
17780        V: std::convert::Into<crate::model::Product>,
17781    {
17782        use std::iter::Iterator;
17783        self.products = v.into_iter().map(|i| i.into()).collect();
17784        self
17785    }
17786
17787    /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
17788    ///
17789    /// # Example
17790    /// ```ignore,no_run
17791    /// # use google_cloud_retail_v2::model::ListProductsResponse;
17792    /// let x = ListProductsResponse::new().set_next_page_token("example");
17793    /// ```
17794    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17795        self.next_page_token = v.into();
17796        self
17797    }
17798}
17799
17800impl wkt::message::Message for ListProductsResponse {
17801    fn typename() -> &'static str {
17802        "type.googleapis.com/google.cloud.retail.v2.ListProductsResponse"
17803    }
17804}
17805
17806#[doc(hidden)]
17807impl gax::paginator::internal::PageableResponse for ListProductsResponse {
17808    type PageItem = crate::model::Product;
17809
17810    fn items(self) -> std::vec::Vec<Self::PageItem> {
17811        self.products
17812    }
17813
17814    fn next_page_token(&self) -> std::string::String {
17815        use std::clone::Clone;
17816        self.next_page_token.clone()
17817    }
17818}
17819
17820/// Request message for
17821/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
17822/// method.
17823///
17824/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
17825#[derive(Clone, Default, PartialEq)]
17826#[non_exhaustive]
17827pub struct SetInventoryRequest {
17828    /// Required. The inventory information to update. The allowable fields to
17829    /// update are:
17830    ///
17831    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17832    /// * [Product.availability][google.cloud.retail.v2.Product.availability]
17833    /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
17834    /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17835    ///   The updated inventory fields must be specified in
17836    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask].
17837    ///
17838    /// If
17839    /// [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name]
17840    /// is empty or invalid, an INVALID_ARGUMENT error is returned.
17841    ///
17842    /// If the caller does not have permission to update the
17843    /// [Product][google.cloud.retail.v2.Product] named in
17844    /// [Product.name][google.cloud.retail.v2.Product.name], regardless of whether
17845    /// or not it exists, a PERMISSION_DENIED error is returned.
17846    ///
17847    /// If the [Product][google.cloud.retail.v2.Product] to update does not have
17848    /// existing inventory information, the provided inventory information will be
17849    /// inserted.
17850    ///
17851    /// If the [Product][google.cloud.retail.v2.Product] to update has existing
17852    /// inventory information, the provided inventory information will be merged
17853    /// while respecting the last update time for each inventory field, using the
17854    /// provided or default value for
17855    /// [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time].
17856    ///
17857    /// The caller can replace place IDs for a subset of fulfillment types in the
17858    /// following ways:
17859    ///
17860    /// * Adds "fulfillment_info" in
17861    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
17862    /// * Specifies only the desired fulfillment types and corresponding place IDs
17863    ///   to update in
17864    ///   [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17865    ///
17866    /// The caller can clear all place IDs from a subset of fulfillment types in
17867    /// the following ways:
17868    ///
17869    /// * Adds "fulfillment_info" in
17870    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
17871    /// * Specifies only the desired fulfillment types to clear in
17872    ///   [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17873    /// * Checks that only the desired fulfillment info types have empty
17874    ///   [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
17875    ///
17876    /// The last update time is recorded for the following inventory fields:
17877    ///
17878    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17879    /// * [Product.availability][google.cloud.retail.v2.Product.availability]
17880    /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
17881    /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17882    ///
17883    /// If a full overwrite of inventory information while ignoring timestamps is
17884    /// needed,
17885    /// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17886    /// should be invoked instead.
17887    ///
17888    /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
17889    /// [google.cloud.retail.v2.Product]: crate::model::Product
17890    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
17891    /// [google.cloud.retail.v2.Product.available_quantity]: crate::model::Product::available_quantity
17892    /// [google.cloud.retail.v2.Product.fulfillment_info]: crate::model::Product::fulfillment_info
17893    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17894    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17895    /// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17896    /// [google.cloud.retail.v2.SetInventoryRequest.set_mask]: crate::model::SetInventoryRequest::set_mask
17897    /// [google.cloud.retail.v2.SetInventoryRequest.set_time]: crate::model::SetInventoryRequest::set_time
17898    pub inventory: std::option::Option<crate::model::Product>,
17899
17900    /// Indicates which inventory fields in the provided
17901    /// [Product][google.cloud.retail.v2.Product] to update.
17902    ///
17903    /// At least one field must be provided.
17904    ///
17905    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17906    /// is returned and the entire update will be ignored.
17907    ///
17908    /// [google.cloud.retail.v2.Product]: crate::model::Product
17909    pub set_mask: std::option::Option<wkt::FieldMask>,
17910
17911    /// The time when the request is issued, used to prevent
17912    /// out-of-order updates on inventory fields with the last update time
17913    /// recorded. If not provided, the internal system time will be used.
17914    pub set_time: std::option::Option<wkt::Timestamp>,
17915
17916    /// If set to true, and the [Product][google.cloud.retail.v2.Product] with name
17917    /// [Product.name][google.cloud.retail.v2.Product.name] is not found, the
17918    /// inventory update will still be processed and retained for at most 1 day
17919    /// until the [Product][google.cloud.retail.v2.Product] is created. If set to
17920    /// false, a NOT_FOUND error is returned if the
17921    /// [Product][google.cloud.retail.v2.Product] is not found.
17922    ///
17923    /// [google.cloud.retail.v2.Product]: crate::model::Product
17924    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17925    pub allow_missing: bool,
17926
17927    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17928}
17929
17930impl SetInventoryRequest {
17931    pub fn new() -> Self {
17932        std::default::Default::default()
17933    }
17934
17935    /// Sets the value of [inventory][crate::model::SetInventoryRequest::inventory].
17936    ///
17937    /// # Example
17938    /// ```ignore,no_run
17939    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17940    /// use google_cloud_retail_v2::model::Product;
17941    /// let x = SetInventoryRequest::new().set_inventory(Product::default()/* use setters */);
17942    /// ```
17943    pub fn set_inventory<T>(mut self, v: T) -> Self
17944    where
17945        T: std::convert::Into<crate::model::Product>,
17946    {
17947        self.inventory = std::option::Option::Some(v.into());
17948        self
17949    }
17950
17951    /// Sets or clears the value of [inventory][crate::model::SetInventoryRequest::inventory].
17952    ///
17953    /// # Example
17954    /// ```ignore,no_run
17955    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17956    /// use google_cloud_retail_v2::model::Product;
17957    /// let x = SetInventoryRequest::new().set_or_clear_inventory(Some(Product::default()/* use setters */));
17958    /// let x = SetInventoryRequest::new().set_or_clear_inventory(None::<Product>);
17959    /// ```
17960    pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
17961    where
17962        T: std::convert::Into<crate::model::Product>,
17963    {
17964        self.inventory = v.map(|x| x.into());
17965        self
17966    }
17967
17968    /// Sets the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
17969    ///
17970    /// # Example
17971    /// ```ignore,no_run
17972    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17973    /// use wkt::FieldMask;
17974    /// let x = SetInventoryRequest::new().set_set_mask(FieldMask::default()/* use setters */);
17975    /// ```
17976    pub fn set_set_mask<T>(mut self, v: T) -> Self
17977    where
17978        T: std::convert::Into<wkt::FieldMask>,
17979    {
17980        self.set_mask = std::option::Option::Some(v.into());
17981        self
17982    }
17983
17984    /// Sets or clears the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
17985    ///
17986    /// # Example
17987    /// ```ignore,no_run
17988    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17989    /// use wkt::FieldMask;
17990    /// let x = SetInventoryRequest::new().set_or_clear_set_mask(Some(FieldMask::default()/* use setters */));
17991    /// let x = SetInventoryRequest::new().set_or_clear_set_mask(None::<FieldMask>);
17992    /// ```
17993    pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
17994    where
17995        T: std::convert::Into<wkt::FieldMask>,
17996    {
17997        self.set_mask = v.map(|x| x.into());
17998        self
17999    }
18000
18001    /// Sets the value of [set_time][crate::model::SetInventoryRequest::set_time].
18002    ///
18003    /// # Example
18004    /// ```ignore,no_run
18005    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18006    /// use wkt::Timestamp;
18007    /// let x = SetInventoryRequest::new().set_set_time(Timestamp::default()/* use setters */);
18008    /// ```
18009    pub fn set_set_time<T>(mut self, v: T) -> Self
18010    where
18011        T: std::convert::Into<wkt::Timestamp>,
18012    {
18013        self.set_time = std::option::Option::Some(v.into());
18014        self
18015    }
18016
18017    /// Sets or clears the value of [set_time][crate::model::SetInventoryRequest::set_time].
18018    ///
18019    /// # Example
18020    /// ```ignore,no_run
18021    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18022    /// use wkt::Timestamp;
18023    /// let x = SetInventoryRequest::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
18024    /// let x = SetInventoryRequest::new().set_or_clear_set_time(None::<Timestamp>);
18025    /// ```
18026    pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
18027    where
18028        T: std::convert::Into<wkt::Timestamp>,
18029    {
18030        self.set_time = v.map(|x| x.into());
18031        self
18032    }
18033
18034    /// Sets the value of [allow_missing][crate::model::SetInventoryRequest::allow_missing].
18035    ///
18036    /// # Example
18037    /// ```ignore,no_run
18038    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18039    /// let x = SetInventoryRequest::new().set_allow_missing(true);
18040    /// ```
18041    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18042        self.allow_missing = v.into();
18043        self
18044    }
18045}
18046
18047impl wkt::message::Message for SetInventoryRequest {
18048    fn typename() -> &'static str {
18049        "type.googleapis.com/google.cloud.retail.v2.SetInventoryRequest"
18050    }
18051}
18052
18053/// Metadata related to the progress of the SetInventory operation.
18054/// Currently empty because there is no meaningful metadata populated from the
18055/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18056/// method.
18057///
18058/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18059#[derive(Clone, Default, PartialEq)]
18060#[non_exhaustive]
18061pub struct SetInventoryMetadata {
18062    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18063}
18064
18065impl SetInventoryMetadata {
18066    pub fn new() -> Self {
18067        std::default::Default::default()
18068    }
18069}
18070
18071impl wkt::message::Message for SetInventoryMetadata {
18072    fn typename() -> &'static str {
18073        "type.googleapis.com/google.cloud.retail.v2.SetInventoryMetadata"
18074    }
18075}
18076
18077/// Response of the SetInventoryRequest.  Currently empty because
18078/// there is no meaningful response populated from the
18079/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18080/// method.
18081///
18082/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18083#[derive(Clone, Default, PartialEq)]
18084#[non_exhaustive]
18085pub struct SetInventoryResponse {
18086    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18087}
18088
18089impl SetInventoryResponse {
18090    pub fn new() -> Self {
18091        std::default::Default::default()
18092    }
18093}
18094
18095impl wkt::message::Message for SetInventoryResponse {
18096    fn typename() -> &'static str {
18097        "type.googleapis.com/google.cloud.retail.v2.SetInventoryResponse"
18098    }
18099}
18100
18101/// Request message for
18102/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18103/// method.
18104///
18105/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18106#[derive(Clone, Default, PartialEq)]
18107#[non_exhaustive]
18108pub struct AddFulfillmentPlacesRequest {
18109    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18110    /// such as
18111    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18112    ///
18113    /// If the caller does not have permission to access the
18114    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18115    /// exists, a PERMISSION_DENIED error is returned.
18116    ///
18117    /// [google.cloud.retail.v2.Product]: crate::model::Product
18118    pub product: std::string::String,
18119
18120    /// Required. The fulfillment type, including commonly used types (such as
18121    /// pickup in store and same day delivery), and custom types.
18122    ///
18123    /// Supported values:
18124    ///
18125    /// * "pickup-in-store"
18126    /// * "ship-to-store"
18127    /// * "same-day-delivery"
18128    /// * "next-day-delivery"
18129    /// * "custom-type-1"
18130    /// * "custom-type-2"
18131    /// * "custom-type-3"
18132    /// * "custom-type-4"
18133    /// * "custom-type-5"
18134    ///
18135    /// If this field is set to an invalid value other than these, an
18136    /// INVALID_ARGUMENT error is returned.
18137    ///
18138    /// This field directly corresponds to
18139    /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18140    ///
18141    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18142    pub r#type: std::string::String,
18143
18144    /// Required. The IDs for this
18145    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as
18146    /// the store IDs for "pickup-in-store" or the region IDs for
18147    /// "same-day-delivery" to be added for this
18148    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate
18149    /// IDs will be automatically ignored.
18150    ///
18151    /// At least 1 value is required, and a maximum of 2000 values are allowed.
18152    /// Each value must be a string with a length limit of 10 characters, matching
18153    /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18154    /// INVALID_ARGUMENT error is returned.
18155    ///
18156    /// If the total number of place IDs exceeds 2000 for this
18157    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after
18158    /// adding, then the update will be rejected.
18159    ///
18160    /// [google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]: crate::model::AddFulfillmentPlacesRequest::type
18161    pub place_ids: std::vec::Vec<std::string::String>,
18162
18163    /// The time when the fulfillment updates are issued, used to prevent
18164    /// out-of-order updates on fulfillment information. If not provided, the
18165    /// internal system time will be used.
18166    pub add_time: std::option::Option<wkt::Timestamp>,
18167
18168    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18169    /// found, the fulfillment information will still be processed and retained for
18170    /// at most 1 day and processed once the
18171    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18172    /// NOT_FOUND error is returned if the
18173    /// [Product][google.cloud.retail.v2.Product] is not found.
18174    ///
18175    /// [google.cloud.retail.v2.Product]: crate::model::Product
18176    pub allow_missing: bool,
18177
18178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18179}
18180
18181impl AddFulfillmentPlacesRequest {
18182    pub fn new() -> Self {
18183        std::default::Default::default()
18184    }
18185
18186    /// Sets the value of [product][crate::model::AddFulfillmentPlacesRequest::product].
18187    ///
18188    /// # Example
18189    /// ```ignore,no_run
18190    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18191    /// let x = AddFulfillmentPlacesRequest::new().set_product("example");
18192    /// ```
18193    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18194        self.product = v.into();
18195        self
18196    }
18197
18198    /// Sets the value of [r#type][crate::model::AddFulfillmentPlacesRequest::type].
18199    ///
18200    /// # Example
18201    /// ```ignore,no_run
18202    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18203    /// let x = AddFulfillmentPlacesRequest::new().set_type("example");
18204    /// ```
18205    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18206        self.r#type = v.into();
18207        self
18208    }
18209
18210    /// Sets the value of [place_ids][crate::model::AddFulfillmentPlacesRequest::place_ids].
18211    ///
18212    /// # Example
18213    /// ```ignore,no_run
18214    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18215    /// let x = AddFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18216    /// ```
18217    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18218    where
18219        T: std::iter::IntoIterator<Item = V>,
18220        V: std::convert::Into<std::string::String>,
18221    {
18222        use std::iter::Iterator;
18223        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18224        self
18225    }
18226
18227    /// Sets the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18228    ///
18229    /// # Example
18230    /// ```ignore,no_run
18231    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18232    /// use wkt::Timestamp;
18233    /// let x = AddFulfillmentPlacesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18234    /// ```
18235    pub fn set_add_time<T>(mut self, v: T) -> Self
18236    where
18237        T: std::convert::Into<wkt::Timestamp>,
18238    {
18239        self.add_time = std::option::Option::Some(v.into());
18240        self
18241    }
18242
18243    /// Sets or clears the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18244    ///
18245    /// # Example
18246    /// ```ignore,no_run
18247    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18248    /// use wkt::Timestamp;
18249    /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18250    /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18251    /// ```
18252    pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18253    where
18254        T: std::convert::Into<wkt::Timestamp>,
18255    {
18256        self.add_time = v.map(|x| x.into());
18257        self
18258    }
18259
18260    /// Sets the value of [allow_missing][crate::model::AddFulfillmentPlacesRequest::allow_missing].
18261    ///
18262    /// # Example
18263    /// ```ignore,no_run
18264    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18265    /// let x = AddFulfillmentPlacesRequest::new().set_allow_missing(true);
18266    /// ```
18267    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18268        self.allow_missing = v.into();
18269        self
18270    }
18271}
18272
18273impl wkt::message::Message for AddFulfillmentPlacesRequest {
18274    fn typename() -> &'static str {
18275        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesRequest"
18276    }
18277}
18278
18279/// Metadata related to the progress of the AddFulfillmentPlaces operation.
18280/// Currently empty because there is no meaningful metadata populated from the
18281/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18282/// method.
18283///
18284/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18285#[derive(Clone, Default, PartialEq)]
18286#[non_exhaustive]
18287pub struct AddFulfillmentPlacesMetadata {
18288    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18289}
18290
18291impl AddFulfillmentPlacesMetadata {
18292    pub fn new() -> Self {
18293        std::default::Default::default()
18294    }
18295}
18296
18297impl wkt::message::Message for AddFulfillmentPlacesMetadata {
18298    fn typename() -> &'static str {
18299        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"
18300    }
18301}
18302
18303/// Response of the AddFulfillmentPlacesRequest.  Currently empty because
18304/// there is no meaningful response populated from the
18305/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18306/// method.
18307///
18308/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18309#[derive(Clone, Default, PartialEq)]
18310#[non_exhaustive]
18311pub struct AddFulfillmentPlacesResponse {
18312    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18313}
18314
18315impl AddFulfillmentPlacesResponse {
18316    pub fn new() -> Self {
18317        std::default::Default::default()
18318    }
18319}
18320
18321impl wkt::message::Message for AddFulfillmentPlacesResponse {
18322    fn typename() -> &'static str {
18323        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesResponse"
18324    }
18325}
18326
18327/// Request message for
18328/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18329/// method.
18330///
18331/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18332#[derive(Clone, Default, PartialEq)]
18333#[non_exhaustive]
18334pub struct AddLocalInventoriesRequest {
18335    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18336    /// such as
18337    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18338    ///
18339    /// If the caller does not have permission to access the
18340    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18341    /// exists, a PERMISSION_DENIED error is returned.
18342    ///
18343    /// [google.cloud.retail.v2.Product]: crate::model::Product
18344    pub product: std::string::String,
18345
18346    /// Required. A list of inventory information at difference places. Each place
18347    /// is identified by its place ID. At most 3000 inventories are allowed per
18348    /// request.
18349    pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
18350
18351    /// Indicates which inventory fields in the provided list of
18352    /// [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The
18353    /// field is updated to the provided value.
18354    ///
18355    /// If a field is set while the place does not have a previous local inventory,
18356    /// the local inventory at that store is created.
18357    ///
18358    /// If a field is set while the value of that field is not provided, the
18359    /// original field value, if it exists, is deleted.
18360    ///
18361    /// If the mask is not set or set with empty paths, all inventory fields will
18362    /// be updated.
18363    ///
18364    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18365    /// is returned and the entire update will be ignored.
18366    ///
18367    /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
18368    pub add_mask: std::option::Option<wkt::FieldMask>,
18369
18370    /// The time when the inventory updates are issued. Used to prevent
18371    /// out-of-order updates on local inventory fields. If not provided, the
18372    /// internal system time will be used.
18373    pub add_time: std::option::Option<wkt::Timestamp>,
18374
18375    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18376    /// found, the local inventory will still be processed and retained for at most
18377    /// 1 day and processed once the [Product][google.cloud.retail.v2.Product] is
18378    /// created. If set to false, a NOT_FOUND error is returned if the
18379    /// [Product][google.cloud.retail.v2.Product] is not found.
18380    ///
18381    /// [google.cloud.retail.v2.Product]: crate::model::Product
18382    pub allow_missing: bool,
18383
18384    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18385}
18386
18387impl AddLocalInventoriesRequest {
18388    pub fn new() -> Self {
18389        std::default::Default::default()
18390    }
18391
18392    /// Sets the value of [product][crate::model::AddLocalInventoriesRequest::product].
18393    ///
18394    /// # Example
18395    /// ```ignore,no_run
18396    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18397    /// let x = AddLocalInventoriesRequest::new().set_product("example");
18398    /// ```
18399    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18400        self.product = v.into();
18401        self
18402    }
18403
18404    /// Sets the value of [local_inventories][crate::model::AddLocalInventoriesRequest::local_inventories].
18405    ///
18406    /// # Example
18407    /// ```ignore,no_run
18408    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18409    /// use google_cloud_retail_v2::model::LocalInventory;
18410    /// let x = AddLocalInventoriesRequest::new()
18411    ///     .set_local_inventories([
18412    ///         LocalInventory::default()/* use setters */,
18413    ///         LocalInventory::default()/* use (different) setters */,
18414    ///     ]);
18415    /// ```
18416    pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
18417    where
18418        T: std::iter::IntoIterator<Item = V>,
18419        V: std::convert::Into<crate::model::LocalInventory>,
18420    {
18421        use std::iter::Iterator;
18422        self.local_inventories = v.into_iter().map(|i| i.into()).collect();
18423        self
18424    }
18425
18426    /// Sets the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18427    ///
18428    /// # Example
18429    /// ```ignore,no_run
18430    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18431    /// use wkt::FieldMask;
18432    /// let x = AddLocalInventoriesRequest::new().set_add_mask(FieldMask::default()/* use setters */);
18433    /// ```
18434    pub fn set_add_mask<T>(mut self, v: T) -> Self
18435    where
18436        T: std::convert::Into<wkt::FieldMask>,
18437    {
18438        self.add_mask = std::option::Option::Some(v.into());
18439        self
18440    }
18441
18442    /// Sets or clears the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18443    ///
18444    /// # Example
18445    /// ```ignore,no_run
18446    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18447    /// use wkt::FieldMask;
18448    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(Some(FieldMask::default()/* use setters */));
18449    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(None::<FieldMask>);
18450    /// ```
18451    pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
18452    where
18453        T: std::convert::Into<wkt::FieldMask>,
18454    {
18455        self.add_mask = v.map(|x| x.into());
18456        self
18457    }
18458
18459    /// Sets the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18460    ///
18461    /// # Example
18462    /// ```ignore,no_run
18463    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18464    /// use wkt::Timestamp;
18465    /// let x = AddLocalInventoriesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18466    /// ```
18467    pub fn set_add_time<T>(mut self, v: T) -> Self
18468    where
18469        T: std::convert::Into<wkt::Timestamp>,
18470    {
18471        self.add_time = std::option::Option::Some(v.into());
18472        self
18473    }
18474
18475    /// Sets or clears the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18476    ///
18477    /// # Example
18478    /// ```ignore,no_run
18479    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18480    /// use wkt::Timestamp;
18481    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18482    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18483    /// ```
18484    pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18485    where
18486        T: std::convert::Into<wkt::Timestamp>,
18487    {
18488        self.add_time = v.map(|x| x.into());
18489        self
18490    }
18491
18492    /// Sets the value of [allow_missing][crate::model::AddLocalInventoriesRequest::allow_missing].
18493    ///
18494    /// # Example
18495    /// ```ignore,no_run
18496    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18497    /// let x = AddLocalInventoriesRequest::new().set_allow_missing(true);
18498    /// ```
18499    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18500        self.allow_missing = v.into();
18501        self
18502    }
18503}
18504
18505impl wkt::message::Message for AddLocalInventoriesRequest {
18506    fn typename() -> &'static str {
18507        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
18508    }
18509}
18510
18511/// Metadata related to the progress of the AddLocalInventories operation.
18512/// Currently empty because there is no meaningful metadata populated from the
18513/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18514/// method.
18515///
18516/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18517#[derive(Clone, Default, PartialEq)]
18518#[non_exhaustive]
18519pub struct AddLocalInventoriesMetadata {
18520    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18521}
18522
18523impl AddLocalInventoriesMetadata {
18524    pub fn new() -> Self {
18525        std::default::Default::default()
18526    }
18527}
18528
18529impl wkt::message::Message for AddLocalInventoriesMetadata {
18530    fn typename() -> &'static str {
18531        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesMetadata"
18532    }
18533}
18534
18535/// Response of the
18536/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18537/// API.  Currently empty because there is no meaningful response populated from
18538/// the
18539/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18540/// method.
18541///
18542/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18543#[derive(Clone, Default, PartialEq)]
18544#[non_exhaustive]
18545pub struct AddLocalInventoriesResponse {
18546    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18547}
18548
18549impl AddLocalInventoriesResponse {
18550    pub fn new() -> Self {
18551        std::default::Default::default()
18552    }
18553}
18554
18555impl wkt::message::Message for AddLocalInventoriesResponse {
18556    fn typename() -> &'static str {
18557        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesResponse"
18558    }
18559}
18560
18561/// Request message for
18562/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18563/// method.
18564///
18565/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18566#[derive(Clone, Default, PartialEq)]
18567#[non_exhaustive]
18568pub struct RemoveLocalInventoriesRequest {
18569    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18570    /// such as
18571    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18572    ///
18573    /// If the caller does not have permission to access the
18574    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18575    /// exists, a PERMISSION_DENIED error is returned.
18576    ///
18577    /// [google.cloud.retail.v2.Product]: crate::model::Product
18578    pub product: std::string::String,
18579
18580    /// Required. A list of place IDs to have their inventory deleted.
18581    /// At most 3000 place IDs are allowed per request.
18582    pub place_ids: std::vec::Vec<std::string::String>,
18583
18584    /// The time when the inventory deletions are issued. Used to prevent
18585    /// out-of-order updates and deletions on local inventory fields. If not
18586    /// provided, the internal system time will be used.
18587    pub remove_time: std::option::Option<wkt::Timestamp>,
18588
18589    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18590    /// found, the local inventory removal request will still be processed and
18591    /// retained for at most 1 day and processed once the
18592    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18593    /// NOT_FOUND error is returned if the
18594    /// [Product][google.cloud.retail.v2.Product] is not found.
18595    ///
18596    /// [google.cloud.retail.v2.Product]: crate::model::Product
18597    pub allow_missing: bool,
18598
18599    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18600}
18601
18602impl RemoveLocalInventoriesRequest {
18603    pub fn new() -> Self {
18604        std::default::Default::default()
18605    }
18606
18607    /// Sets the value of [product][crate::model::RemoveLocalInventoriesRequest::product].
18608    ///
18609    /// # Example
18610    /// ```ignore,no_run
18611    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18612    /// let x = RemoveLocalInventoriesRequest::new().set_product("example");
18613    /// ```
18614    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18615        self.product = v.into();
18616        self
18617    }
18618
18619    /// Sets the value of [place_ids][crate::model::RemoveLocalInventoriesRequest::place_ids].
18620    ///
18621    /// # Example
18622    /// ```ignore,no_run
18623    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18624    /// let x = RemoveLocalInventoriesRequest::new().set_place_ids(["a", "b", "c"]);
18625    /// ```
18626    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18627    where
18628        T: std::iter::IntoIterator<Item = V>,
18629        V: std::convert::Into<std::string::String>,
18630    {
18631        use std::iter::Iterator;
18632        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18633        self
18634    }
18635
18636    /// Sets the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18637    ///
18638    /// # Example
18639    /// ```ignore,no_run
18640    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18641    /// use wkt::Timestamp;
18642    /// let x = RemoveLocalInventoriesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18643    /// ```
18644    pub fn set_remove_time<T>(mut self, v: T) -> Self
18645    where
18646        T: std::convert::Into<wkt::Timestamp>,
18647    {
18648        self.remove_time = std::option::Option::Some(v.into());
18649        self
18650    }
18651
18652    /// Sets or clears the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18653    ///
18654    /// # Example
18655    /// ```ignore,no_run
18656    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18657    /// use wkt::Timestamp;
18658    /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18659    /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18660    /// ```
18661    pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18662    where
18663        T: std::convert::Into<wkt::Timestamp>,
18664    {
18665        self.remove_time = v.map(|x| x.into());
18666        self
18667    }
18668
18669    /// Sets the value of [allow_missing][crate::model::RemoveLocalInventoriesRequest::allow_missing].
18670    ///
18671    /// # Example
18672    /// ```ignore,no_run
18673    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18674    /// let x = RemoveLocalInventoriesRequest::new().set_allow_missing(true);
18675    /// ```
18676    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18677        self.allow_missing = v.into();
18678        self
18679    }
18680}
18681
18682impl wkt::message::Message for RemoveLocalInventoriesRequest {
18683    fn typename() -> &'static str {
18684        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesRequest"
18685    }
18686}
18687
18688/// Metadata related to the progress of the RemoveLocalInventories operation.
18689/// Currently empty because there is no meaningful metadata populated from the
18690/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18691/// method.
18692///
18693/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18694#[derive(Clone, Default, PartialEq)]
18695#[non_exhaustive]
18696pub struct RemoveLocalInventoriesMetadata {
18697    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18698}
18699
18700impl RemoveLocalInventoriesMetadata {
18701    pub fn new() -> Self {
18702        std::default::Default::default()
18703    }
18704}
18705
18706impl wkt::message::Message for RemoveLocalInventoriesMetadata {
18707    fn typename() -> &'static str {
18708        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"
18709    }
18710}
18711
18712/// Response of the
18713/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18714/// API.  Currently empty because there is no meaningful response populated from
18715/// the
18716/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18717/// method.
18718///
18719/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18720#[derive(Clone, Default, PartialEq)]
18721#[non_exhaustive]
18722pub struct RemoveLocalInventoriesResponse {
18723    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18724}
18725
18726impl RemoveLocalInventoriesResponse {
18727    pub fn new() -> Self {
18728        std::default::Default::default()
18729    }
18730}
18731
18732impl wkt::message::Message for RemoveLocalInventoriesResponse {
18733    fn typename() -> &'static str {
18734        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesResponse"
18735    }
18736}
18737
18738/// Request message for
18739/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18740/// method.
18741///
18742/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18743#[derive(Clone, Default, PartialEq)]
18744#[non_exhaustive]
18745pub struct RemoveFulfillmentPlacesRequest {
18746    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18747    /// such as
18748    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18749    ///
18750    /// If the caller does not have permission to access the
18751    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18752    /// exists, a PERMISSION_DENIED error is returned.
18753    ///
18754    /// [google.cloud.retail.v2.Product]: crate::model::Product
18755    pub product: std::string::String,
18756
18757    /// Required. The fulfillment type, including commonly used types (such as
18758    /// pickup in store and same day delivery), and custom types.
18759    ///
18760    /// Supported values:
18761    ///
18762    /// * "pickup-in-store"
18763    /// * "ship-to-store"
18764    /// * "same-day-delivery"
18765    /// * "next-day-delivery"
18766    /// * "custom-type-1"
18767    /// * "custom-type-2"
18768    /// * "custom-type-3"
18769    /// * "custom-type-4"
18770    /// * "custom-type-5"
18771    ///
18772    /// If this field is set to an invalid value other than these, an
18773    /// INVALID_ARGUMENT error is returned.
18774    ///
18775    /// This field directly corresponds to
18776    /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18777    ///
18778    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18779    pub r#type: std::string::String,
18780
18781    /// Required. The IDs for this
18782    /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as
18783    /// the store IDs for "pickup-in-store" or the region IDs for
18784    /// "same-day-delivery", to be removed for this
18785    /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type].
18786    ///
18787    /// At least 1 value is required, and a maximum of 2000 values are allowed.
18788    /// Each value must be a string with a length limit of 10 characters, matching
18789    /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18790    /// INVALID_ARGUMENT error is returned.
18791    ///
18792    /// [google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]: crate::model::RemoveFulfillmentPlacesRequest::type
18793    pub place_ids: std::vec::Vec<std::string::String>,
18794
18795    /// The time when the fulfillment updates are issued, used to prevent
18796    /// out-of-order updates on fulfillment information. If not provided, the
18797    /// internal system time will be used.
18798    pub remove_time: std::option::Option<wkt::Timestamp>,
18799
18800    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18801    /// found, the fulfillment information will still be processed and retained for
18802    /// at most 1 day and processed once the
18803    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18804    /// NOT_FOUND error is returned if the
18805    /// [Product][google.cloud.retail.v2.Product] is not found.
18806    ///
18807    /// [google.cloud.retail.v2.Product]: crate::model::Product
18808    pub allow_missing: bool,
18809
18810    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18811}
18812
18813impl RemoveFulfillmentPlacesRequest {
18814    pub fn new() -> Self {
18815        std::default::Default::default()
18816    }
18817
18818    /// Sets the value of [product][crate::model::RemoveFulfillmentPlacesRequest::product].
18819    ///
18820    /// # Example
18821    /// ```ignore,no_run
18822    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18823    /// let x = RemoveFulfillmentPlacesRequest::new().set_product("example");
18824    /// ```
18825    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18826        self.product = v.into();
18827        self
18828    }
18829
18830    /// Sets the value of [r#type][crate::model::RemoveFulfillmentPlacesRequest::type].
18831    ///
18832    /// # Example
18833    /// ```ignore,no_run
18834    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18835    /// let x = RemoveFulfillmentPlacesRequest::new().set_type("example");
18836    /// ```
18837    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18838        self.r#type = v.into();
18839        self
18840    }
18841
18842    /// Sets the value of [place_ids][crate::model::RemoveFulfillmentPlacesRequest::place_ids].
18843    ///
18844    /// # Example
18845    /// ```ignore,no_run
18846    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18847    /// let x = RemoveFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18848    /// ```
18849    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18850    where
18851        T: std::iter::IntoIterator<Item = V>,
18852        V: std::convert::Into<std::string::String>,
18853    {
18854        use std::iter::Iterator;
18855        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18856        self
18857    }
18858
18859    /// Sets the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
18860    ///
18861    /// # Example
18862    /// ```ignore,no_run
18863    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18864    /// use wkt::Timestamp;
18865    /// let x = RemoveFulfillmentPlacesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18866    /// ```
18867    pub fn set_remove_time<T>(mut self, v: T) -> Self
18868    where
18869        T: std::convert::Into<wkt::Timestamp>,
18870    {
18871        self.remove_time = std::option::Option::Some(v.into());
18872        self
18873    }
18874
18875    /// Sets or clears the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
18876    ///
18877    /// # Example
18878    /// ```ignore,no_run
18879    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18880    /// use wkt::Timestamp;
18881    /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18882    /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18883    /// ```
18884    pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18885    where
18886        T: std::convert::Into<wkt::Timestamp>,
18887    {
18888        self.remove_time = v.map(|x| x.into());
18889        self
18890    }
18891
18892    /// Sets the value of [allow_missing][crate::model::RemoveFulfillmentPlacesRequest::allow_missing].
18893    ///
18894    /// # Example
18895    /// ```ignore,no_run
18896    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18897    /// let x = RemoveFulfillmentPlacesRequest::new().set_allow_missing(true);
18898    /// ```
18899    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18900        self.allow_missing = v.into();
18901        self
18902    }
18903}
18904
18905impl wkt::message::Message for RemoveFulfillmentPlacesRequest {
18906    fn typename() -> &'static str {
18907        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"
18908    }
18909}
18910
18911/// Metadata related to the progress of the RemoveFulfillmentPlaces operation.
18912/// Currently empty because there is no meaningful metadata populated from the
18913/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18914/// method.
18915///
18916/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18917#[derive(Clone, Default, PartialEq)]
18918#[non_exhaustive]
18919pub struct RemoveFulfillmentPlacesMetadata {
18920    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18921}
18922
18923impl RemoveFulfillmentPlacesMetadata {
18924    pub fn new() -> Self {
18925        std::default::Default::default()
18926    }
18927}
18928
18929impl wkt::message::Message for RemoveFulfillmentPlacesMetadata {
18930    fn typename() -> &'static str {
18931        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"
18932    }
18933}
18934
18935/// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there
18936/// is no meaningful response populated from the
18937/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18938/// method.
18939///
18940/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18941#[derive(Clone, Default, PartialEq)]
18942#[non_exhaustive]
18943pub struct RemoveFulfillmentPlacesResponse {
18944    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18945}
18946
18947impl RemoveFulfillmentPlacesResponse {
18948    pub fn new() -> Self {
18949        std::default::Default::default()
18950    }
18951}
18952
18953impl wkt::message::Message for RemoveFulfillmentPlacesResponse {
18954    fn typename() -> &'static str {
18955        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"
18956    }
18957}
18958
18959/// Promotion information.
18960#[derive(Clone, Default, PartialEq)]
18961#[non_exhaustive]
18962pub struct Promotion {
18963    /// ID of the promotion. For example, "free gift".
18964    ///
18965    /// The value must be a UTF-8 encoded string with a length limit of 128
18966    /// characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example,
18967    /// id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
18968    /// returned.
18969    ///
18970    /// Corresponds to Google Merchant Center property
18971    /// [promotion_id](https://support.google.com/merchants/answer/7050148).
18972    pub promotion_id: std::string::String,
18973
18974    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18975}
18976
18977impl Promotion {
18978    pub fn new() -> Self {
18979        std::default::Default::default()
18980    }
18981
18982    /// Sets the value of [promotion_id][crate::model::Promotion::promotion_id].
18983    ///
18984    /// # Example
18985    /// ```ignore,no_run
18986    /// # use google_cloud_retail_v2::model::Promotion;
18987    /// let x = Promotion::new().set_promotion_id("example");
18988    /// ```
18989    pub fn set_promotion_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18990        self.promotion_id = v.into();
18991        self
18992    }
18993}
18994
18995impl wkt::message::Message for Promotion {
18996    fn typename() -> &'static str {
18997        "type.googleapis.com/google.cloud.retail.v2.Promotion"
18998    }
18999}
19000
19001/// Metadata related to the progress of the Purge operation.
19002/// This will be returned by the google.longrunning.Operation.metadata field.
19003#[derive(Clone, Default, PartialEq)]
19004#[non_exhaustive]
19005pub struct PurgeMetadata {
19006    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19007}
19008
19009impl PurgeMetadata {
19010    pub fn new() -> Self {
19011        std::default::Default::default()
19012    }
19013}
19014
19015impl wkt::message::Message for PurgeMetadata {
19016    fn typename() -> &'static str {
19017        "type.googleapis.com/google.cloud.retail.v2.PurgeMetadata"
19018    }
19019}
19020
19021/// Metadata related to the progress of the PurgeProducts operation.
19022/// This will be returned by the google.longrunning.Operation.metadata field.
19023#[derive(Clone, Default, PartialEq)]
19024#[non_exhaustive]
19025pub struct PurgeProductsMetadata {
19026    /// Operation create time.
19027    pub create_time: std::option::Option<wkt::Timestamp>,
19028
19029    /// Operation last update time. If the operation is done, this is also the
19030    /// finish time.
19031    pub update_time: std::option::Option<wkt::Timestamp>,
19032
19033    /// Count of entries that were deleted successfully.
19034    pub success_count: i64,
19035
19036    /// Count of entries that encountered errors while processing.
19037    pub failure_count: i64,
19038
19039    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19040}
19041
19042impl PurgeProductsMetadata {
19043    pub fn new() -> Self {
19044        std::default::Default::default()
19045    }
19046
19047    /// Sets the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19048    ///
19049    /// # Example
19050    /// ```ignore,no_run
19051    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19052    /// use wkt::Timestamp;
19053    /// let x = PurgeProductsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
19054    /// ```
19055    pub fn set_create_time<T>(mut self, v: T) -> Self
19056    where
19057        T: std::convert::Into<wkt::Timestamp>,
19058    {
19059        self.create_time = std::option::Option::Some(v.into());
19060        self
19061    }
19062
19063    /// Sets or clears the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19064    ///
19065    /// # Example
19066    /// ```ignore,no_run
19067    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19068    /// use wkt::Timestamp;
19069    /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19070    /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
19071    /// ```
19072    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19073    where
19074        T: std::convert::Into<wkt::Timestamp>,
19075    {
19076        self.create_time = v.map(|x| x.into());
19077        self
19078    }
19079
19080    /// Sets the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19081    ///
19082    /// # Example
19083    /// ```ignore,no_run
19084    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19085    /// use wkt::Timestamp;
19086    /// let x = PurgeProductsMetadata::new().set_update_time(Timestamp::default()/* use setters */);
19087    /// ```
19088    pub fn set_update_time<T>(mut self, v: T) -> Self
19089    where
19090        T: std::convert::Into<wkt::Timestamp>,
19091    {
19092        self.update_time = std::option::Option::Some(v.into());
19093        self
19094    }
19095
19096    /// Sets or clears the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19097    ///
19098    /// # Example
19099    /// ```ignore,no_run
19100    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19101    /// use wkt::Timestamp;
19102    /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19103    /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(None::<Timestamp>);
19104    /// ```
19105    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19106    where
19107        T: std::convert::Into<wkt::Timestamp>,
19108    {
19109        self.update_time = v.map(|x| x.into());
19110        self
19111    }
19112
19113    /// Sets the value of [success_count][crate::model::PurgeProductsMetadata::success_count].
19114    ///
19115    /// # Example
19116    /// ```ignore,no_run
19117    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19118    /// let x = PurgeProductsMetadata::new().set_success_count(42);
19119    /// ```
19120    pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19121        self.success_count = v.into();
19122        self
19123    }
19124
19125    /// Sets the value of [failure_count][crate::model::PurgeProductsMetadata::failure_count].
19126    ///
19127    /// # Example
19128    /// ```ignore,no_run
19129    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19130    /// let x = PurgeProductsMetadata::new().set_failure_count(42);
19131    /// ```
19132    pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19133        self.failure_count = v.into();
19134        self
19135    }
19136}
19137
19138impl wkt::message::Message for PurgeProductsMetadata {
19139    fn typename() -> &'static str {
19140        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsMetadata"
19141    }
19142}
19143
19144/// Request message for PurgeProducts method.
19145#[derive(Clone, Default, PartialEq)]
19146#[non_exhaustive]
19147pub struct PurgeProductsRequest {
19148    /// Required. The resource name of the branch under which the products are
19149    /// created. The format is
19150    /// `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
19151    pub parent: std::string::String,
19152
19153    /// Required. The filter string to specify the products to be deleted with a
19154    /// length limit of 5,000 characters.
19155    ///
19156    /// Empty string filter is not allowed. "*" implies delete all items in a
19157    /// branch.
19158    ///
19159    /// The eligible fields for filtering are:
19160    ///
19161    /// * `availability`: Double quoted
19162    ///   [Product.availability][google.cloud.retail.v2.Product.availability] string.
19163    /// * `create_time` : in ISO 8601 "zulu" format.
19164    ///
19165    /// Supported syntax:
19166    ///
19167    /// * Comparators (">", "<", ">=", "<=", "=").
19168    ///   Examples:
19169    ///
19170    ///   * create_time <= "2015-02-13T17:05:46Z"
19171    ///   * availability = "IN_STOCK"
19172    /// * Conjunctions ("AND")
19173    ///   Examples:
19174    ///
19175    ///   * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
19176    /// * Disjunctions ("OR")
19177    ///   Examples:
19178    ///
19179    ///   * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
19180    /// * Can support nested queries.
19181    ///   Examples:
19182    ///
19183    ///   * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
19184    ///     OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
19185    /// * Filter Limits:
19186    ///
19187    ///   * Filter should not contain more than 6 conditions.
19188    ///   * Max nesting depth should not exceed 2 levels.
19189    ///
19190    /// Examples queries:
19191    ///
19192    /// * Delete back order products created before a timestamp.
19193    ///   create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
19194    ///
19195    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
19196    pub filter: std::string::String,
19197
19198    /// Actually perform the purge.
19199    /// If `force` is set to false, the method will return the expected purge count
19200    /// without deleting any products.
19201    pub force: bool,
19202
19203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19204}
19205
19206impl PurgeProductsRequest {
19207    pub fn new() -> Self {
19208        std::default::Default::default()
19209    }
19210
19211    /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
19212    ///
19213    /// # Example
19214    /// ```ignore,no_run
19215    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19216    /// let x = PurgeProductsRequest::new().set_parent("example");
19217    /// ```
19218    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19219        self.parent = v.into();
19220        self
19221    }
19222
19223    /// Sets the value of [filter][crate::model::PurgeProductsRequest::filter].
19224    ///
19225    /// # Example
19226    /// ```ignore,no_run
19227    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19228    /// let x = PurgeProductsRequest::new().set_filter("example");
19229    /// ```
19230    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19231        self.filter = v.into();
19232        self
19233    }
19234
19235    /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
19236    ///
19237    /// # Example
19238    /// ```ignore,no_run
19239    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19240    /// let x = PurgeProductsRequest::new().set_force(true);
19241    /// ```
19242    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19243        self.force = v.into();
19244        self
19245    }
19246}
19247
19248impl wkt::message::Message for PurgeProductsRequest {
19249    fn typename() -> &'static str {
19250        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsRequest"
19251    }
19252}
19253
19254/// Response of the PurgeProductsRequest. If the long running operation is
19255/// successfully done, then this message is returned by the
19256/// google.longrunning.Operations.response field.
19257#[derive(Clone, Default, PartialEq)]
19258#[non_exhaustive]
19259pub struct PurgeProductsResponse {
19260    /// The total count of products purged as a result of the operation.
19261    pub purge_count: i64,
19262
19263    /// A sample of the product names that will be deleted.
19264    /// Only populated if `force` is set to false. A max of 100 names will be
19265    /// returned and the names are chosen at random.
19266    pub purge_sample: std::vec::Vec<std::string::String>,
19267
19268    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19269}
19270
19271impl PurgeProductsResponse {
19272    pub fn new() -> Self {
19273        std::default::Default::default()
19274    }
19275
19276    /// Sets the value of [purge_count][crate::model::PurgeProductsResponse::purge_count].
19277    ///
19278    /// # Example
19279    /// ```ignore,no_run
19280    /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19281    /// let x = PurgeProductsResponse::new().set_purge_count(42);
19282    /// ```
19283    pub fn set_purge_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19284        self.purge_count = v.into();
19285        self
19286    }
19287
19288    /// Sets the value of [purge_sample][crate::model::PurgeProductsResponse::purge_sample].
19289    ///
19290    /// # Example
19291    /// ```ignore,no_run
19292    /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19293    /// let x = PurgeProductsResponse::new().set_purge_sample(["a", "b", "c"]);
19294    /// ```
19295    pub fn set_purge_sample<T, V>(mut self, v: T) -> Self
19296    where
19297        T: std::iter::IntoIterator<Item = V>,
19298        V: std::convert::Into<std::string::String>,
19299    {
19300        use std::iter::Iterator;
19301        self.purge_sample = v.into_iter().map(|i| i.into()).collect();
19302        self
19303    }
19304}
19305
19306impl wkt::message::Message for PurgeProductsResponse {
19307    fn typename() -> &'static str {
19308        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsResponse"
19309    }
19310}
19311
19312/// Request message for PurgeUserEvents method.
19313#[derive(Clone, Default, PartialEq)]
19314#[non_exhaustive]
19315pub struct PurgeUserEventsRequest {
19316    /// Required. The resource name of the catalog under which the events are
19317    /// created. The format is
19318    /// `projects/${projectId}/locations/global/catalogs/${catalogId}`
19319    pub parent: std::string::String,
19320
19321    /// Required. The filter string to specify the events to be deleted with a
19322    /// length limit of 5,000 characters. Empty string filter is not allowed. The
19323    /// eligible fields for filtering are:
19324    ///
19325    /// * `eventType`: Double quoted
19326    ///   [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
19327    /// * `eventTime`: in ISO 8601 "zulu" format.
19328    /// * `visitorId`: Double quoted string. Specifying this will delete all
19329    ///   events associated with a visitor.
19330    /// * `userId`: Double quoted string. Specifying this will delete all events
19331    ///   associated with a user.
19332    ///
19333    /// Examples:
19334    ///
19335    /// * Deleting all events in a time range:
19336    ///   `eventTime > "2012-04-23T18:25:43.511Z"
19337    ///   eventTime < "2012-04-23T18:30:43.511Z"`
19338    /// * Deleting specific eventType in time range:
19339    ///   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
19340    /// * Deleting all events for a specific visitor:
19341    ///   `visitorId = "visitor1024"`
19342    ///
19343    /// The filtering fields are assumed to have an implicit AND.
19344    ///
19345    /// [google.cloud.retail.v2.UserEvent.event_type]: crate::model::UserEvent::event_type
19346    pub filter: std::string::String,
19347
19348    /// Actually perform the purge.
19349    /// If `force` is set to false, the method will return the expected purge count
19350    /// without deleting any user events.
19351    pub force: bool,
19352
19353    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19354}
19355
19356impl PurgeUserEventsRequest {
19357    pub fn new() -> Self {
19358        std::default::Default::default()
19359    }
19360
19361    /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
19362    ///
19363    /// # Example
19364    /// ```ignore,no_run
19365    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19366    /// let x = PurgeUserEventsRequest::new().set_parent("example");
19367    /// ```
19368    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19369        self.parent = v.into();
19370        self
19371    }
19372
19373    /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
19374    ///
19375    /// # Example
19376    /// ```ignore,no_run
19377    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19378    /// let x = PurgeUserEventsRequest::new().set_filter("example");
19379    /// ```
19380    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19381        self.filter = v.into();
19382        self
19383    }
19384
19385    /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
19386    ///
19387    /// # Example
19388    /// ```ignore,no_run
19389    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19390    /// let x = PurgeUserEventsRequest::new().set_force(true);
19391    /// ```
19392    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19393        self.force = v.into();
19394        self
19395    }
19396}
19397
19398impl wkt::message::Message for PurgeUserEventsRequest {
19399    fn typename() -> &'static str {
19400        "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsRequest"
19401    }
19402}
19403
19404/// Response of the PurgeUserEventsRequest. If the long running operation is
19405/// successfully done, then this message is returned by the
19406/// google.longrunning.Operations.response field.
19407#[derive(Clone, Default, PartialEq)]
19408#[non_exhaustive]
19409pub struct PurgeUserEventsResponse {
19410    /// The total count of events purged as a result of the operation.
19411    pub purged_events_count: i64,
19412
19413    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19414}
19415
19416impl PurgeUserEventsResponse {
19417    pub fn new() -> Self {
19418        std::default::Default::default()
19419    }
19420
19421    /// Sets the value of [purged_events_count][crate::model::PurgeUserEventsResponse::purged_events_count].
19422    ///
19423    /// # Example
19424    /// ```ignore,no_run
19425    /// # use google_cloud_retail_v2::model::PurgeUserEventsResponse;
19426    /// let x = PurgeUserEventsResponse::new().set_purged_events_count(42);
19427    /// ```
19428    pub fn set_purged_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19429        self.purged_events_count = v.into();
19430        self
19431    }
19432}
19433
19434impl wkt::message::Message for PurgeUserEventsResponse {
19435    fn typename() -> &'static str {
19436        "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsResponse"
19437    }
19438}
19439
19440/// Safety settings.
19441#[derive(Clone, Default, PartialEq)]
19442#[non_exhaustive]
19443pub struct SafetySetting {
19444    /// Harm category.
19445    pub category: crate::model::HarmCategory,
19446
19447    /// The harm block threshold.
19448    pub threshold: crate::model::safety_setting::HarmBlockThreshold,
19449
19450    /// Optional. Specify if the threshold is used for probability or severity
19451    /// score. If not specified, the threshold is used for probability score.
19452    pub method: crate::model::safety_setting::HarmBlockMethod,
19453
19454    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19455}
19456
19457impl SafetySetting {
19458    pub fn new() -> Self {
19459        std::default::Default::default()
19460    }
19461
19462    /// Sets the value of [category][crate::model::SafetySetting::category].
19463    ///
19464    /// # Example
19465    /// ```ignore,no_run
19466    /// # use google_cloud_retail_v2::model::SafetySetting;
19467    /// use google_cloud_retail_v2::model::HarmCategory;
19468    /// let x0 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
19469    /// let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
19470    /// let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);
19471    /// ```
19472    pub fn set_category<T: std::convert::Into<crate::model::HarmCategory>>(mut self, v: T) -> Self {
19473        self.category = v.into();
19474        self
19475    }
19476
19477    /// Sets the value of [threshold][crate::model::SafetySetting::threshold].
19478    ///
19479    /// # Example
19480    /// ```ignore,no_run
19481    /// # use google_cloud_retail_v2::model::SafetySetting;
19482    /// use google_cloud_retail_v2::model::safety_setting::HarmBlockThreshold;
19483    /// let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
19484    /// let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
19485    /// let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);
19486    /// ```
19487    pub fn set_threshold<
19488        T: std::convert::Into<crate::model::safety_setting::HarmBlockThreshold>,
19489    >(
19490        mut self,
19491        v: T,
19492    ) -> Self {
19493        self.threshold = v.into();
19494        self
19495    }
19496
19497    /// Sets the value of [method][crate::model::SafetySetting::method].
19498    ///
19499    /// # Example
19500    /// ```ignore,no_run
19501    /// # use google_cloud_retail_v2::model::SafetySetting;
19502    /// use google_cloud_retail_v2::model::safety_setting::HarmBlockMethod;
19503    /// let x0 = SafetySetting::new().set_method(HarmBlockMethod::Severity);
19504    /// let x1 = SafetySetting::new().set_method(HarmBlockMethod::Probability);
19505    /// ```
19506    pub fn set_method<T: std::convert::Into<crate::model::safety_setting::HarmBlockMethod>>(
19507        mut self,
19508        v: T,
19509    ) -> Self {
19510        self.method = v.into();
19511        self
19512    }
19513}
19514
19515impl wkt::message::Message for SafetySetting {
19516    fn typename() -> &'static str {
19517        "type.googleapis.com/google.cloud.retail.v2.SafetySetting"
19518    }
19519}
19520
19521/// Defines additional types related to [SafetySetting].
19522pub mod safety_setting {
19523    #[allow(unused_imports)]
19524    use super::*;
19525
19526    /// Probability based thresholds levels for blocking.
19527    ///
19528    /// # Working with unknown values
19529    ///
19530    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19531    /// additional enum variants at any time. Adding new variants is not considered
19532    /// a breaking change. Applications should write their code in anticipation of:
19533    ///
19534    /// - New values appearing in future releases of the client library, **and**
19535    /// - New values received dynamically, without application changes.
19536    ///
19537    /// Please consult the [Working with enums] section in the user guide for some
19538    /// guidelines.
19539    ///
19540    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19541    #[derive(Clone, Debug, PartialEq)]
19542    #[non_exhaustive]
19543    pub enum HarmBlockThreshold {
19544        /// Unspecified harm block threshold.
19545        Unspecified,
19546        /// Block low threshold and above (i.e. block more).
19547        BlockLowAndAbove,
19548        /// Block medium threshold and above.
19549        BlockMediumAndAbove,
19550        /// Block only high threshold (i.e. block less).
19551        BlockOnlyHigh,
19552        /// Block none.
19553        BlockNone,
19554        /// Turn off the safety filter.
19555        Off,
19556        /// If set, the enum was initialized with an unknown value.
19557        ///
19558        /// Applications can examine the value using [HarmBlockThreshold::value] or
19559        /// [HarmBlockThreshold::name].
19560        UnknownValue(harm_block_threshold::UnknownValue),
19561    }
19562
19563    #[doc(hidden)]
19564    pub mod harm_block_threshold {
19565        #[allow(unused_imports)]
19566        use super::*;
19567        #[derive(Clone, Debug, PartialEq)]
19568        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19569    }
19570
19571    impl HarmBlockThreshold {
19572        /// Gets the enum value.
19573        ///
19574        /// Returns `None` if the enum contains an unknown value deserialized from
19575        /// the string representation of enums.
19576        pub fn value(&self) -> std::option::Option<i32> {
19577            match self {
19578                Self::Unspecified => std::option::Option::Some(0),
19579                Self::BlockLowAndAbove => std::option::Option::Some(1),
19580                Self::BlockMediumAndAbove => std::option::Option::Some(2),
19581                Self::BlockOnlyHigh => std::option::Option::Some(3),
19582                Self::BlockNone => std::option::Option::Some(4),
19583                Self::Off => std::option::Option::Some(5),
19584                Self::UnknownValue(u) => u.0.value(),
19585            }
19586        }
19587
19588        /// Gets the enum value as a string.
19589        ///
19590        /// Returns `None` if the enum contains an unknown value deserialized from
19591        /// the integer representation of enums.
19592        pub fn name(&self) -> std::option::Option<&str> {
19593            match self {
19594                Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
19595                Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
19596                Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
19597                Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
19598                Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
19599                Self::Off => std::option::Option::Some("OFF"),
19600                Self::UnknownValue(u) => u.0.name(),
19601            }
19602        }
19603    }
19604
19605    impl std::default::Default for HarmBlockThreshold {
19606        fn default() -> Self {
19607            use std::convert::From;
19608            Self::from(0)
19609        }
19610    }
19611
19612    impl std::fmt::Display for HarmBlockThreshold {
19613        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19614            wkt::internal::display_enum(f, self.name(), self.value())
19615        }
19616    }
19617
19618    impl std::convert::From<i32> for HarmBlockThreshold {
19619        fn from(value: i32) -> Self {
19620            match value {
19621                0 => Self::Unspecified,
19622                1 => Self::BlockLowAndAbove,
19623                2 => Self::BlockMediumAndAbove,
19624                3 => Self::BlockOnlyHigh,
19625                4 => Self::BlockNone,
19626                5 => Self::Off,
19627                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19628                    wkt::internal::UnknownEnumValue::Integer(value),
19629                )),
19630            }
19631        }
19632    }
19633
19634    impl std::convert::From<&str> for HarmBlockThreshold {
19635        fn from(value: &str) -> Self {
19636            use std::string::ToString;
19637            match value {
19638                "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
19639                "BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
19640                "BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
19641                "BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
19642                "BLOCK_NONE" => Self::BlockNone,
19643                "OFF" => Self::Off,
19644                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19645                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19646                )),
19647            }
19648        }
19649    }
19650
19651    impl serde::ser::Serialize for HarmBlockThreshold {
19652        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19653        where
19654            S: serde::Serializer,
19655        {
19656            match self {
19657                Self::Unspecified => serializer.serialize_i32(0),
19658                Self::BlockLowAndAbove => serializer.serialize_i32(1),
19659                Self::BlockMediumAndAbove => serializer.serialize_i32(2),
19660                Self::BlockOnlyHigh => serializer.serialize_i32(3),
19661                Self::BlockNone => serializer.serialize_i32(4),
19662                Self::Off => serializer.serialize_i32(5),
19663                Self::UnknownValue(u) => u.0.serialize(serializer),
19664            }
19665        }
19666    }
19667
19668    impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
19669        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19670        where
19671            D: serde::Deserializer<'de>,
19672        {
19673            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
19674                ".google.cloud.retail.v2.SafetySetting.HarmBlockThreshold",
19675            ))
19676        }
19677    }
19678
19679    /// Probability vs severity.
19680    ///
19681    /// # Working with unknown values
19682    ///
19683    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19684    /// additional enum variants at any time. Adding new variants is not considered
19685    /// a breaking change. Applications should write their code in anticipation of:
19686    ///
19687    /// - New values appearing in future releases of the client library, **and**
19688    /// - New values received dynamically, without application changes.
19689    ///
19690    /// Please consult the [Working with enums] section in the user guide for some
19691    /// guidelines.
19692    ///
19693    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19694    #[derive(Clone, Debug, PartialEq)]
19695    #[non_exhaustive]
19696    pub enum HarmBlockMethod {
19697        /// The harm block method is unspecified.
19698        Unspecified,
19699        /// The harm block method uses both probability and severity scores.
19700        Severity,
19701        /// The harm block method uses the probability score.
19702        Probability,
19703        /// If set, the enum was initialized with an unknown value.
19704        ///
19705        /// Applications can examine the value using [HarmBlockMethod::value] or
19706        /// [HarmBlockMethod::name].
19707        UnknownValue(harm_block_method::UnknownValue),
19708    }
19709
19710    #[doc(hidden)]
19711    pub mod harm_block_method {
19712        #[allow(unused_imports)]
19713        use super::*;
19714        #[derive(Clone, Debug, PartialEq)]
19715        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19716    }
19717
19718    impl HarmBlockMethod {
19719        /// Gets the enum value.
19720        ///
19721        /// Returns `None` if the enum contains an unknown value deserialized from
19722        /// the string representation of enums.
19723        pub fn value(&self) -> std::option::Option<i32> {
19724            match self {
19725                Self::Unspecified => std::option::Option::Some(0),
19726                Self::Severity => std::option::Option::Some(1),
19727                Self::Probability => std::option::Option::Some(2),
19728                Self::UnknownValue(u) => u.0.value(),
19729            }
19730        }
19731
19732        /// Gets the enum value as a string.
19733        ///
19734        /// Returns `None` if the enum contains an unknown value deserialized from
19735        /// the integer representation of enums.
19736        pub fn name(&self) -> std::option::Option<&str> {
19737            match self {
19738                Self::Unspecified => std::option::Option::Some("HARM_BLOCK_METHOD_UNSPECIFIED"),
19739                Self::Severity => std::option::Option::Some("SEVERITY"),
19740                Self::Probability => std::option::Option::Some("PROBABILITY"),
19741                Self::UnknownValue(u) => u.0.name(),
19742            }
19743        }
19744    }
19745
19746    impl std::default::Default for HarmBlockMethod {
19747        fn default() -> Self {
19748            use std::convert::From;
19749            Self::from(0)
19750        }
19751    }
19752
19753    impl std::fmt::Display for HarmBlockMethod {
19754        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19755            wkt::internal::display_enum(f, self.name(), self.value())
19756        }
19757    }
19758
19759    impl std::convert::From<i32> for HarmBlockMethod {
19760        fn from(value: i32) -> Self {
19761            match value {
19762                0 => Self::Unspecified,
19763                1 => Self::Severity,
19764                2 => Self::Probability,
19765                _ => Self::UnknownValue(harm_block_method::UnknownValue(
19766                    wkt::internal::UnknownEnumValue::Integer(value),
19767                )),
19768            }
19769        }
19770    }
19771
19772    impl std::convert::From<&str> for HarmBlockMethod {
19773        fn from(value: &str) -> Self {
19774            use std::string::ToString;
19775            match value {
19776                "HARM_BLOCK_METHOD_UNSPECIFIED" => Self::Unspecified,
19777                "SEVERITY" => Self::Severity,
19778                "PROBABILITY" => Self::Probability,
19779                _ => Self::UnknownValue(harm_block_method::UnknownValue(
19780                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19781                )),
19782            }
19783        }
19784    }
19785
19786    impl serde::ser::Serialize for HarmBlockMethod {
19787        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19788        where
19789            S: serde::Serializer,
19790        {
19791            match self {
19792                Self::Unspecified => serializer.serialize_i32(0),
19793                Self::Severity => serializer.serialize_i32(1),
19794                Self::Probability => serializer.serialize_i32(2),
19795                Self::UnknownValue(u) => u.0.serialize(serializer),
19796            }
19797        }
19798    }
19799
19800    impl<'de> serde::de::Deserialize<'de> for HarmBlockMethod {
19801        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19802        where
19803            D: serde::Deserializer<'de>,
19804        {
19805            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockMethod>::new(
19806                ".google.cloud.retail.v2.SafetySetting.HarmBlockMethod",
19807            ))
19808        }
19809    }
19810}
19811
19812/// Product attribute which structured by an attribute name and value. This
19813/// structure is used in conversational search filters and answers. For example,
19814/// if we have `name=color` and `value=red`, this means that the color is `red`.
19815#[derive(Clone, Default, PartialEq)]
19816#[non_exhaustive]
19817pub struct ProductAttributeValue {
19818    /// The attribute name.
19819    pub name: std::string::String,
19820
19821    /// The attribute value.
19822    pub value: std::string::String,
19823
19824    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19825}
19826
19827impl ProductAttributeValue {
19828    pub fn new() -> Self {
19829        std::default::Default::default()
19830    }
19831
19832    /// Sets the value of [name][crate::model::ProductAttributeValue::name].
19833    ///
19834    /// # Example
19835    /// ```ignore,no_run
19836    /// # use google_cloud_retail_v2::model::ProductAttributeValue;
19837    /// let x = ProductAttributeValue::new().set_name("example");
19838    /// ```
19839    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19840        self.name = v.into();
19841        self
19842    }
19843
19844    /// Sets the value of [value][crate::model::ProductAttributeValue::value].
19845    ///
19846    /// # Example
19847    /// ```ignore,no_run
19848    /// # use google_cloud_retail_v2::model::ProductAttributeValue;
19849    /// let x = ProductAttributeValue::new().set_value("example");
19850    /// ```
19851    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19852        self.value = v.into();
19853        self
19854    }
19855}
19856
19857impl wkt::message::Message for ProductAttributeValue {
19858    fn typename() -> &'static str {
19859        "type.googleapis.com/google.cloud.retail.v2.ProductAttributeValue"
19860    }
19861}
19862
19863/// Product attribute name and numeric interval.
19864#[derive(Clone, Default, PartialEq)]
19865#[non_exhaustive]
19866pub struct ProductAttributeInterval {
19867    /// The attribute name (e.g. "length")
19868    pub name: std::string::String,
19869
19870    /// The numeric interval (e.g. [10, 20))
19871    pub interval: std::option::Option<crate::model::Interval>,
19872
19873    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19874}
19875
19876impl ProductAttributeInterval {
19877    pub fn new() -> Self {
19878        std::default::Default::default()
19879    }
19880
19881    /// Sets the value of [name][crate::model::ProductAttributeInterval::name].
19882    ///
19883    /// # Example
19884    /// ```ignore,no_run
19885    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19886    /// let x = ProductAttributeInterval::new().set_name("example");
19887    /// ```
19888    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19889        self.name = v.into();
19890        self
19891    }
19892
19893    /// Sets the value of [interval][crate::model::ProductAttributeInterval::interval].
19894    ///
19895    /// # Example
19896    /// ```ignore,no_run
19897    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19898    /// use google_cloud_retail_v2::model::Interval;
19899    /// let x = ProductAttributeInterval::new().set_interval(Interval::default()/* use setters */);
19900    /// ```
19901    pub fn set_interval<T>(mut self, v: T) -> Self
19902    where
19903        T: std::convert::Into<crate::model::Interval>,
19904    {
19905        self.interval = std::option::Option::Some(v.into());
19906        self
19907    }
19908
19909    /// Sets or clears the value of [interval][crate::model::ProductAttributeInterval::interval].
19910    ///
19911    /// # Example
19912    /// ```ignore,no_run
19913    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19914    /// use google_cloud_retail_v2::model::Interval;
19915    /// let x = ProductAttributeInterval::new().set_or_clear_interval(Some(Interval::default()/* use setters */));
19916    /// let x = ProductAttributeInterval::new().set_or_clear_interval(None::<Interval>);
19917    /// ```
19918    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
19919    where
19920        T: std::convert::Into<crate::model::Interval>,
19921    {
19922        self.interval = v.map(|x| x.into());
19923        self
19924    }
19925}
19926
19927impl wkt::message::Message for ProductAttributeInterval {
19928    fn typename() -> &'static str {
19929        "type.googleapis.com/google.cloud.retail.v2.ProductAttributeInterval"
19930    }
19931}
19932
19933/// This field specifies the tile information including an attribute key,
19934/// attribute value. More fields will be added in the future, eg: product id
19935/// or product counts, etc.
19936#[derive(Clone, Default, PartialEq)]
19937#[non_exhaustive]
19938pub struct Tile {
19939    /// The representative product id for this tile.
19940    pub representative_product_id: std::string::String,
19941
19942    /// The attribute key and value for the tile.
19943    pub product_attribute: std::option::Option<crate::model::tile::ProductAttribute>,
19944
19945    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19946}
19947
19948impl Tile {
19949    pub fn new() -> Self {
19950        std::default::Default::default()
19951    }
19952
19953    /// Sets the value of [representative_product_id][crate::model::Tile::representative_product_id].
19954    ///
19955    /// # Example
19956    /// ```ignore,no_run
19957    /// # use google_cloud_retail_v2::model::Tile;
19958    /// let x = Tile::new().set_representative_product_id("example");
19959    /// ```
19960    pub fn set_representative_product_id<T: std::convert::Into<std::string::String>>(
19961        mut self,
19962        v: T,
19963    ) -> Self {
19964        self.representative_product_id = v.into();
19965        self
19966    }
19967
19968    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute].
19969    ///
19970    /// Note that all the setters affecting `product_attribute` are mutually
19971    /// exclusive.
19972    ///
19973    /// # Example
19974    /// ```ignore,no_run
19975    /// # use google_cloud_retail_v2::model::Tile;
19976    /// use google_cloud_retail_v2::model::ProductAttributeValue;
19977    /// let x = Tile::new().set_product_attribute(Some(
19978    ///     google_cloud_retail_v2::model::tile::ProductAttribute::ProductAttributeValue(ProductAttributeValue::default().into())));
19979    /// ```
19980    pub fn set_product_attribute<
19981        T: std::convert::Into<std::option::Option<crate::model::tile::ProductAttribute>>,
19982    >(
19983        mut self,
19984        v: T,
19985    ) -> Self {
19986        self.product_attribute = v.into();
19987        self
19988    }
19989
19990    /// The value of [product_attribute][crate::model::Tile::product_attribute]
19991    /// if it holds a `ProductAttributeValue`, `None` if the field is not set or
19992    /// holds a different branch.
19993    pub fn product_attribute_value(
19994        &self,
19995    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeValue>> {
19996        #[allow(unreachable_patterns)]
19997        self.product_attribute.as_ref().and_then(|v| match v {
19998            crate::model::tile::ProductAttribute::ProductAttributeValue(v) => {
19999                std::option::Option::Some(v)
20000            }
20001            _ => std::option::Option::None,
20002        })
20003    }
20004
20005    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20006    /// to hold a `ProductAttributeValue`.
20007    ///
20008    /// Note that all the setters affecting `product_attribute` are
20009    /// mutually exclusive.
20010    ///
20011    /// # Example
20012    /// ```ignore,no_run
20013    /// # use google_cloud_retail_v2::model::Tile;
20014    /// use google_cloud_retail_v2::model::ProductAttributeValue;
20015    /// let x = Tile::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
20016    /// assert!(x.product_attribute_value().is_some());
20017    /// assert!(x.product_attribute_interval().is_none());
20018    /// ```
20019    pub fn set_product_attribute_value<
20020        T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeValue>>,
20021    >(
20022        mut self,
20023        v: T,
20024    ) -> Self {
20025        self.product_attribute = std::option::Option::Some(
20026            crate::model::tile::ProductAttribute::ProductAttributeValue(v.into()),
20027        );
20028        self
20029    }
20030
20031    /// The value of [product_attribute][crate::model::Tile::product_attribute]
20032    /// if it holds a `ProductAttributeInterval`, `None` if the field is not set or
20033    /// holds a different branch.
20034    pub fn product_attribute_interval(
20035        &self,
20036    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeInterval>> {
20037        #[allow(unreachable_patterns)]
20038        self.product_attribute.as_ref().and_then(|v| match v {
20039            crate::model::tile::ProductAttribute::ProductAttributeInterval(v) => {
20040                std::option::Option::Some(v)
20041            }
20042            _ => std::option::Option::None,
20043        })
20044    }
20045
20046    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20047    /// to hold a `ProductAttributeInterval`.
20048    ///
20049    /// Note that all the setters affecting `product_attribute` are
20050    /// mutually exclusive.
20051    ///
20052    /// # Example
20053    /// ```ignore,no_run
20054    /// # use google_cloud_retail_v2::model::Tile;
20055    /// use google_cloud_retail_v2::model::ProductAttributeInterval;
20056    /// let x = Tile::new().set_product_attribute_interval(ProductAttributeInterval::default()/* use setters */);
20057    /// assert!(x.product_attribute_interval().is_some());
20058    /// assert!(x.product_attribute_value().is_none());
20059    /// ```
20060    pub fn set_product_attribute_interval<
20061        T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeInterval>>,
20062    >(
20063        mut self,
20064        v: T,
20065    ) -> Self {
20066        self.product_attribute = std::option::Option::Some(
20067            crate::model::tile::ProductAttribute::ProductAttributeInterval(v.into()),
20068        );
20069        self
20070    }
20071}
20072
20073impl wkt::message::Message for Tile {
20074    fn typename() -> &'static str {
20075        "type.googleapis.com/google.cloud.retail.v2.Tile"
20076    }
20077}
20078
20079/// Defines additional types related to [Tile].
20080pub mod tile {
20081    #[allow(unused_imports)]
20082    use super::*;
20083
20084    /// The attribute key and value for the tile.
20085    #[derive(Clone, Debug, PartialEq)]
20086    #[non_exhaustive]
20087    pub enum ProductAttribute {
20088        /// The product attribute key-value.
20089        ProductAttributeValue(std::boxed::Box<crate::model::ProductAttributeValue>),
20090        /// The product attribute key-numeric interval.
20091        ProductAttributeInterval(std::boxed::Box<crate::model::ProductAttributeInterval>),
20092    }
20093}
20094
20095/// Request message for
20096/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
20097///
20098/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20099#[derive(Clone, Default, PartialEq)]
20100#[non_exhaustive]
20101pub struct SearchRequest {
20102    /// Required. The resource name of the Retail Search serving config, such as
20103    /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
20104    /// or the name of the legacy placement resource, such as
20105    /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
20106    /// This field is used to identify the serving config name and the set
20107    /// of models that are used to make the search.
20108    pub placement: std::string::String,
20109
20110    /// The branch resource name, such as
20111    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
20112    ///
20113    /// Use "default_branch" as the branch ID or leave this field empty, to search
20114    /// products under the default branch.
20115    pub branch: std::string::String,
20116
20117    /// Raw search query.
20118    ///
20119    /// If this field is empty, the request is considered a category browsing
20120    /// request and returned results are based on
20121    /// [filter][google.cloud.retail.v2.SearchRequest.filter] and
20122    /// [page_categories][google.cloud.retail.v2.SearchRequest.page_categories].
20123    ///
20124    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20125    /// [google.cloud.retail.v2.SearchRequest.page_categories]: crate::model::SearchRequest::page_categories
20126    pub query: std::string::String,
20127
20128    /// Required. A unique identifier for tracking visitors. For example, this
20129    /// could be implemented with an HTTP cookie, which should be able to uniquely
20130    /// identify a visitor on a single device. This unique identifier should not
20131    /// change if the visitor logs in or out of the website.
20132    ///
20133    /// This should be the same identifier as
20134    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
20135    ///
20136    /// The field must be a UTF-8 encoded string with a length limit of 128
20137    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
20138    ///
20139    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
20140    pub visitor_id: std::string::String,
20141
20142    /// User information.
20143    pub user_info: std::option::Option<crate::model::UserInfo>,
20144
20145    /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
20146    /// unspecified, defaults to a reasonable value. The maximum allowed value is
20147    /// 120. Values above 120 will be coerced to 120.
20148    ///
20149    /// If this field is negative, an INVALID_ARGUMENT is returned.
20150    ///
20151    /// [google.cloud.retail.v2.Product]: crate::model::Product
20152    pub page_size: i32,
20153
20154    /// A page token
20155    /// [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token],
20156    /// received from a previous
20157    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call.
20158    /// Provide this to retrieve the subsequent page.
20159    ///
20160    /// When paginating, all other parameters provided to
20161    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must
20162    /// match the call that provided the page token. Otherwise, an INVALID_ARGUMENT
20163    /// error is returned.
20164    ///
20165    /// [google.cloud.retail.v2.SearchResponse.next_page_token]: crate::model::SearchResponse::next_page_token
20166    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20167    pub page_token: std::string::String,
20168
20169    /// A 0-indexed integer that specifies the current offset (that is, starting
20170    /// result location, amongst the [Product][google.cloud.retail.v2.Product]s
20171    /// deemed by the API as relevant) in search results. This field is only
20172    /// considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token]
20173    /// is unset.
20174    ///
20175    /// If this field is negative, an INVALID_ARGUMENT is returned.
20176    ///
20177    /// [google.cloud.retail.v2.Product]: crate::model::Product
20178    /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
20179    pub offset: i32,
20180
20181    /// The filter syntax consists of an expression language for constructing a
20182    /// predicate from one or more fields of the products being filtered. Filter
20183    /// expression is case-sensitive. For more information, see
20184    /// [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter).
20185    ///
20186    /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20187    pub filter: std::string::String,
20188
20189    /// The default filter that is applied when a user performs a search without
20190    /// checking any filters on the search page.
20191    ///
20192    /// The filter applied to every search request when quality improvement such as
20193    /// query expansion is needed. In the case a query does not have a sufficient
20194    /// amount of results this filter will be used to determine whether or not to
20195    /// enable the query expansion flow. The original filter will still be used for
20196    /// the query expanded search.
20197    /// This field is strongly recommended to achieve high search quality.
20198    ///
20199    /// For more information about filter syntax, see
20200    /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
20201    ///
20202    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20203    pub canonical_filter: std::string::String,
20204
20205    /// The order in which products are returned. Products can be ordered by
20206    /// a field in an [Product][google.cloud.retail.v2.Product] object. Leave it
20207    /// unset if ordered by relevance. OrderBy expression is case-sensitive. For
20208    /// more information, see
20209    /// [Order](https://cloud.google.com/retail/docs/filter-and-order#order).
20210    ///
20211    /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20212    ///
20213    /// [google.cloud.retail.v2.Product]: crate::model::Product
20214    pub order_by: std::string::String,
20215
20216    /// Facet specifications for faceted search. If empty, no facets are returned.
20217    ///
20218    /// A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error
20219    /// is returned.
20220    pub facet_specs: std::vec::Vec<crate::model::search_request::FacetSpec>,
20221
20222    /// Deprecated. Refer to <https://cloud.google.com/retail/docs/configs#dynamic>
20223    /// to enable dynamic facets. Do not set this field.
20224    ///
20225    /// The specification for dynamically generated facets. Notice that only
20226    /// textual facets can be dynamically generated.
20227    #[deprecated]
20228    pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
20229
20230    /// Boost specification to boost certain products. For more information, see
20231    /// [Boost results](https://cloud.google.com/retail/docs/boosting).
20232    ///
20233    /// Notice that if both
20234    /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
20235    /// and
20236    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
20237    /// are set, the boost conditions from both places are evaluated. If a search
20238    /// request matches multiple boost conditions, the final boost score is equal
20239    /// to the sum of the boost scores from all matched boost conditions.
20240    ///
20241    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
20242    /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
20243    pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
20244
20245    /// The query expansion specification that specifies the conditions under which
20246    /// query expansion occurs. For more information, see [Query
20247    /// expansion](https://cloud.google.com/retail/docs/result-size#query_expansion).
20248    pub query_expansion_spec: std::option::Option<crate::model::search_request::QueryExpansionSpec>,
20249
20250    /// The keys to fetch and rollup the matching
20251    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20252    /// [Product][google.cloud.retail.v2.Product]s attributes,
20253    /// [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo] or
20254    /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s attributes. The
20255    /// attributes from all the matching
20256    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20257    /// [Product][google.cloud.retail.v2.Product]s or
20258    /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s are merged and
20259    /// de-duplicated. Notice that rollup attributes will lead to extra query
20260    /// latency. Maximum number of keys is 30.
20261    ///
20262    /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a
20263    /// fulfillment type and a fulfillment ID must be provided in the format of
20264    /// "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123",
20265    /// "pickupInStore" is fulfillment type and "store123" is the store ID.
20266    ///
20267    /// Supported keys are:
20268    ///
20269    /// * colorFamilies
20270    /// * price
20271    /// * originalPrice
20272    /// * discount
20273    /// * variantId
20274    /// * inventory(place_id,price)
20275    /// * inventory(place_id,original_price)
20276    /// * inventory(place_id,attributes.key), where key is any key in the
20277    ///   [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes]
20278    ///   map.
20279    /// * attributes.key, where key is any key in the
20280    ///   [Product.attributes][google.cloud.retail.v2.Product.attributes] map.
20281    /// * pickupInStore.id, where id is any
20282    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20283    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20284    ///   "pickup-in-store".
20285    /// * shipToStore.id, where id is any
20286    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20287    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20288    ///   "ship-to-store".
20289    /// * sameDayDelivery.id, where id is any
20290    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20291    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20292    ///   "same-day-delivery".
20293    /// * nextDayDelivery.id, where id is any
20294    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20295    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20296    ///   "next-day-delivery".
20297    /// * customFulfillment1.id, where id is any
20298    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20299    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20300    ///   "custom-type-1".
20301    /// * customFulfillment2.id, where id is any
20302    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20303    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20304    ///   "custom-type-2".
20305    /// * customFulfillment3.id, where id is any
20306    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20307    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20308    ///   "custom-type-3".
20309    /// * customFulfillment4.id, where id is any
20310    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20311    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20312    ///   "custom-type-4".
20313    /// * customFulfillment5.id, where id is any
20314    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20315    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20316    ///   "custom-type-5".
20317    ///
20318    /// If this field is set to an invalid value other than these, an
20319    /// INVALID_ARGUMENT error is returned.
20320    ///
20321    /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
20322    /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
20323    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
20324    /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
20325    /// [google.cloud.retail.v2.LocalInventory.attributes]: crate::model::LocalInventory::attributes
20326    /// [google.cloud.retail.v2.Product]: crate::model::Product
20327    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
20328    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
20329    pub variant_rollup_keys: std::vec::Vec<std::string::String>,
20330
20331    /// The categories associated with a category page. Must be set for category
20332    /// navigation queries to achieve good search quality. The format should be
20333    /// the same as
20334    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
20335    ///
20336    /// To represent full path of category, use '>' sign to separate different
20337    /// hierarchies. If '>' is part of the category name, replace it with
20338    /// other character(s).
20339    ///
20340    /// Category pages include special pages such as sales or promotions. For
20341    /// instance, a special sale page may have the category hierarchy:
20342    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
20343    ///
20344    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
20345    pub page_categories: std::vec::Vec<std::string::String>,
20346
20347    /// The search mode of the search request. If not specified, a single search
20348    /// request triggers both product search and faceted search.
20349    pub search_mode: crate::model::search_request::SearchMode,
20350
20351    /// The specification for personalization.
20352    ///
20353    /// Notice that if both
20354    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
20355    /// and
20356    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20357    /// are set.
20358    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20359    /// will override
20360    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
20361    ///
20362    /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
20363    /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
20364    pub personalization_spec:
20365        std::option::Option<crate::model::search_request::PersonalizationSpec>,
20366
20367    /// The labels applied to a resource must meet the following requirements:
20368    ///
20369    /// * Each resource can have multiple labels, up to a maximum of 64.
20370    /// * Each label must be a key-value pair.
20371    /// * Keys have a minimum length of 1 character and a maximum length of 63
20372    ///   characters and cannot be empty. Values can be empty and have a maximum
20373    ///   length of 63 characters.
20374    /// * Keys and values can contain only lowercase letters, numeric characters,
20375    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
20376    ///   international characters are allowed.
20377    /// * The key portion of a label must be unique. However, you can use the same
20378    ///   key with multiple resources.
20379    /// * Keys must start with a lowercase letter or international character.
20380    ///
20381    /// For more information, see [Requirements for
20382    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
20383    /// in the Resource Manager documentation.
20384    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
20385
20386    /// The spell correction specification that specifies the mode under
20387    /// which spell correction will take effect.
20388    pub spell_correction_spec:
20389        std::option::Option<crate::model::search_request::SpellCorrectionSpec>,
20390
20391    /// The entity for customers that may run multiple different entities, domains,
20392    /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
20393    /// `google.com`, `youtube.com`, etc.
20394    /// If this is set, it should be exactly matched with
20395    /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get search
20396    /// results boosted by entity.
20397    ///
20398    /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
20399    pub entity: std::string::String,
20400
20401    /// Optional. This field specifies all conversational related parameters
20402    /// addition to traditional retail search.
20403    pub conversational_search_spec:
20404        std::option::Option<crate::model::search_request::ConversationalSearchSpec>,
20405
20406    /// Optional. This field specifies tile navigation related parameters.
20407    pub tile_navigation_spec: std::option::Option<crate::model::search_request::TileNavigationSpec>,
20408
20409    /// Optional. The BCP-47 language code, such as "en-US" or "sr-Latn"
20410    /// [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more
20411    /// information, see [Standardized codes](https://google.aip.dev/143). This
20412    /// field helps to better interpret the query. If a value isn't specified, the
20413    /// query language code is automatically detected, which may not be accurate.
20414    pub language_code: std::string::String,
20415
20416    /// Optional. The Unicode country/region code (CLDR) of a location, such as
20417    /// "US" and "419"
20418    /// [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html).
20419    /// For more information, see [Standardized codes](https://google.aip.dev/143).
20420    /// If set, then results will be boosted based on the region_code provided.
20421    pub region_code: std::string::String,
20422
20423    /// Optional. An id corresponding to a place, such as a store id or region id.
20424    /// When specified, we use the price from the local inventory with the matching
20425    /// product's
20426    /// [LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
20427    /// for revenue optimization.
20428    ///
20429    /// [google.cloud.retail.v2.LocalInventory.place_id]: crate::model::LocalInventory::place_id
20430    pub place_id: std::string::String,
20431
20432    /// Optional. The user attributes that could be used for personalization of
20433    /// search results.
20434    ///
20435    /// * Populate at most 100 key-value pairs per query.
20436    /// * Only supports string keys and repeated string values.
20437    /// * Duplicate keys are not allowed within a single query.
20438    ///
20439    /// Example:
20440    /// user_attributes: [
20441    /// { key: "pets"
20442    /// value {
20443    /// values: "dog"
20444    /// values: "cat"
20445    /// }
20446    /// },
20447    /// { key: "state"
20448    /// value {
20449    /// values: "CA"
20450    /// }
20451    /// }
20452    /// ]
20453    pub user_attributes: std::collections::HashMap<std::string::String, crate::model::StringList>,
20454
20455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20456}
20457
20458impl SearchRequest {
20459    pub fn new() -> Self {
20460        std::default::Default::default()
20461    }
20462
20463    /// Sets the value of [placement][crate::model::SearchRequest::placement].
20464    ///
20465    /// # Example
20466    /// ```ignore,no_run
20467    /// # use google_cloud_retail_v2::model::SearchRequest;
20468    /// let x = SearchRequest::new().set_placement("example");
20469    /// ```
20470    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20471        self.placement = v.into();
20472        self
20473    }
20474
20475    /// Sets the value of [branch][crate::model::SearchRequest::branch].
20476    ///
20477    /// # Example
20478    /// ```ignore,no_run
20479    /// # use google_cloud_retail_v2::model::SearchRequest;
20480    /// let x = SearchRequest::new().set_branch("example");
20481    /// ```
20482    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20483        self.branch = v.into();
20484        self
20485    }
20486
20487    /// Sets the value of [query][crate::model::SearchRequest::query].
20488    ///
20489    /// # Example
20490    /// ```ignore,no_run
20491    /// # use google_cloud_retail_v2::model::SearchRequest;
20492    /// let x = SearchRequest::new().set_query("example");
20493    /// ```
20494    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20495        self.query = v.into();
20496        self
20497    }
20498
20499    /// Sets the value of [visitor_id][crate::model::SearchRequest::visitor_id].
20500    ///
20501    /// # Example
20502    /// ```ignore,no_run
20503    /// # use google_cloud_retail_v2::model::SearchRequest;
20504    /// let x = SearchRequest::new().set_visitor_id("example");
20505    /// ```
20506    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20507        self.visitor_id = v.into();
20508        self
20509    }
20510
20511    /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
20512    ///
20513    /// # Example
20514    /// ```ignore,no_run
20515    /// # use google_cloud_retail_v2::model::SearchRequest;
20516    /// use google_cloud_retail_v2::model::UserInfo;
20517    /// let x = SearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
20518    /// ```
20519    pub fn set_user_info<T>(mut self, v: T) -> Self
20520    where
20521        T: std::convert::Into<crate::model::UserInfo>,
20522    {
20523        self.user_info = std::option::Option::Some(v.into());
20524        self
20525    }
20526
20527    /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
20528    ///
20529    /// # Example
20530    /// ```ignore,no_run
20531    /// # use google_cloud_retail_v2::model::SearchRequest;
20532    /// use google_cloud_retail_v2::model::UserInfo;
20533    /// let x = SearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
20534    /// let x = SearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
20535    /// ```
20536    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
20537    where
20538        T: std::convert::Into<crate::model::UserInfo>,
20539    {
20540        self.user_info = v.map(|x| x.into());
20541        self
20542    }
20543
20544    /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
20545    ///
20546    /// # Example
20547    /// ```ignore,no_run
20548    /// # use google_cloud_retail_v2::model::SearchRequest;
20549    /// let x = SearchRequest::new().set_page_size(42);
20550    /// ```
20551    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20552        self.page_size = v.into();
20553        self
20554    }
20555
20556    /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
20557    ///
20558    /// # Example
20559    /// ```ignore,no_run
20560    /// # use google_cloud_retail_v2::model::SearchRequest;
20561    /// let x = SearchRequest::new().set_page_token("example");
20562    /// ```
20563    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20564        self.page_token = v.into();
20565        self
20566    }
20567
20568    /// Sets the value of [offset][crate::model::SearchRequest::offset].
20569    ///
20570    /// # Example
20571    /// ```ignore,no_run
20572    /// # use google_cloud_retail_v2::model::SearchRequest;
20573    /// let x = SearchRequest::new().set_offset(42);
20574    /// ```
20575    pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20576        self.offset = v.into();
20577        self
20578    }
20579
20580    /// Sets the value of [filter][crate::model::SearchRequest::filter].
20581    ///
20582    /// # Example
20583    /// ```ignore,no_run
20584    /// # use google_cloud_retail_v2::model::SearchRequest;
20585    /// let x = SearchRequest::new().set_filter("example");
20586    /// ```
20587    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20588        self.filter = v.into();
20589        self
20590    }
20591
20592    /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
20593    ///
20594    /// # Example
20595    /// ```ignore,no_run
20596    /// # use google_cloud_retail_v2::model::SearchRequest;
20597    /// let x = SearchRequest::new().set_canonical_filter("example");
20598    /// ```
20599    pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
20600        mut self,
20601        v: T,
20602    ) -> Self {
20603        self.canonical_filter = v.into();
20604        self
20605    }
20606
20607    /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
20608    ///
20609    /// # Example
20610    /// ```ignore,no_run
20611    /// # use google_cloud_retail_v2::model::SearchRequest;
20612    /// let x = SearchRequest::new().set_order_by("example");
20613    /// ```
20614    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20615        self.order_by = v.into();
20616        self
20617    }
20618
20619    /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
20620    ///
20621    /// # Example
20622    /// ```ignore,no_run
20623    /// # use google_cloud_retail_v2::model::SearchRequest;
20624    /// use google_cloud_retail_v2::model::search_request::FacetSpec;
20625    /// let x = SearchRequest::new()
20626    ///     .set_facet_specs([
20627    ///         FacetSpec::default()/* use setters */,
20628    ///         FacetSpec::default()/* use (different) setters */,
20629    ///     ]);
20630    /// ```
20631    pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
20632    where
20633        T: std::iter::IntoIterator<Item = V>,
20634        V: std::convert::Into<crate::model::search_request::FacetSpec>,
20635    {
20636        use std::iter::Iterator;
20637        self.facet_specs = v.into_iter().map(|i| i.into()).collect();
20638        self
20639    }
20640
20641    /// Sets the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20642    ///
20643    /// # Example
20644    /// ```ignore,no_run
20645    /// # use google_cloud_retail_v2::model::SearchRequest;
20646    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20647    /// let x = SearchRequest::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
20648    /// ```
20649    #[deprecated]
20650    pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
20651    where
20652        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20653    {
20654        self.dynamic_facet_spec = std::option::Option::Some(v.into());
20655        self
20656    }
20657
20658    /// Sets or clears the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20659    ///
20660    /// # Example
20661    /// ```ignore,no_run
20662    /// # use google_cloud_retail_v2::model::SearchRequest;
20663    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20664    /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
20665    /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
20666    /// ```
20667    #[deprecated]
20668    pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
20669    where
20670        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20671    {
20672        self.dynamic_facet_spec = v.map(|x| x.into());
20673        self
20674    }
20675
20676    /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20677    ///
20678    /// # Example
20679    /// ```ignore,no_run
20680    /// # use google_cloud_retail_v2::model::SearchRequest;
20681    /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20682    /// let x = SearchRequest::new().set_boost_spec(BoostSpec::default()/* use setters */);
20683    /// ```
20684    pub fn set_boost_spec<T>(mut self, v: T) -> Self
20685    where
20686        T: std::convert::Into<crate::model::search_request::BoostSpec>,
20687    {
20688        self.boost_spec = std::option::Option::Some(v.into());
20689        self
20690    }
20691
20692    /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20693    ///
20694    /// # Example
20695    /// ```ignore,no_run
20696    /// # use google_cloud_retail_v2::model::SearchRequest;
20697    /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20698    /// let x = SearchRequest::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
20699    /// let x = SearchRequest::new().set_or_clear_boost_spec(None::<BoostSpec>);
20700    /// ```
20701    pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
20702    where
20703        T: std::convert::Into<crate::model::search_request::BoostSpec>,
20704    {
20705        self.boost_spec = v.map(|x| x.into());
20706        self
20707    }
20708
20709    /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20710    ///
20711    /// # Example
20712    /// ```ignore,no_run
20713    /// # use google_cloud_retail_v2::model::SearchRequest;
20714    /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20715    /// let x = SearchRequest::new().set_query_expansion_spec(QueryExpansionSpec::default()/* use setters */);
20716    /// ```
20717    pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
20718    where
20719        T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20720    {
20721        self.query_expansion_spec = std::option::Option::Some(v.into());
20722        self
20723    }
20724
20725    /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20726    ///
20727    /// # Example
20728    /// ```ignore,no_run
20729    /// # use google_cloud_retail_v2::model::SearchRequest;
20730    /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20731    /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(Some(QueryExpansionSpec::default()/* use setters */));
20732    /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(None::<QueryExpansionSpec>);
20733    /// ```
20734    pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
20735    where
20736        T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20737    {
20738        self.query_expansion_spec = v.map(|x| x.into());
20739        self
20740    }
20741
20742    /// Sets the value of [variant_rollup_keys][crate::model::SearchRequest::variant_rollup_keys].
20743    ///
20744    /// # Example
20745    /// ```ignore,no_run
20746    /// # use google_cloud_retail_v2::model::SearchRequest;
20747    /// let x = SearchRequest::new().set_variant_rollup_keys(["a", "b", "c"]);
20748    /// ```
20749    pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
20750    where
20751        T: std::iter::IntoIterator<Item = V>,
20752        V: std::convert::Into<std::string::String>,
20753    {
20754        use std::iter::Iterator;
20755        self.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
20756        self
20757    }
20758
20759    /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
20760    ///
20761    /// # Example
20762    /// ```ignore,no_run
20763    /// # use google_cloud_retail_v2::model::SearchRequest;
20764    /// let x = SearchRequest::new().set_page_categories(["a", "b", "c"]);
20765    /// ```
20766    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
20767    where
20768        T: std::iter::IntoIterator<Item = V>,
20769        V: std::convert::Into<std::string::String>,
20770    {
20771        use std::iter::Iterator;
20772        self.page_categories = v.into_iter().map(|i| i.into()).collect();
20773        self
20774    }
20775
20776    /// Sets the value of [search_mode][crate::model::SearchRequest::search_mode].
20777    ///
20778    /// # Example
20779    /// ```ignore,no_run
20780    /// # use google_cloud_retail_v2::model::SearchRequest;
20781    /// use google_cloud_retail_v2::model::search_request::SearchMode;
20782    /// let x0 = SearchRequest::new().set_search_mode(SearchMode::ProductSearchOnly);
20783    /// let x1 = SearchRequest::new().set_search_mode(SearchMode::FacetedSearchOnly);
20784    /// ```
20785    pub fn set_search_mode<T: std::convert::Into<crate::model::search_request::SearchMode>>(
20786        mut self,
20787        v: T,
20788    ) -> Self {
20789        self.search_mode = v.into();
20790        self
20791    }
20792
20793    /// Sets the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20794    ///
20795    /// # Example
20796    /// ```ignore,no_run
20797    /// # use google_cloud_retail_v2::model::SearchRequest;
20798    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20799    /// let x = SearchRequest::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
20800    /// ```
20801    pub fn set_personalization_spec<T>(mut self, v: T) -> Self
20802    where
20803        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20804    {
20805        self.personalization_spec = std::option::Option::Some(v.into());
20806        self
20807    }
20808
20809    /// Sets or clears the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20810    ///
20811    /// # Example
20812    /// ```ignore,no_run
20813    /// # use google_cloud_retail_v2::model::SearchRequest;
20814    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20815    /// let x = SearchRequest::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
20816    /// let x = SearchRequest::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
20817    /// ```
20818    pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
20819    where
20820        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20821    {
20822        self.personalization_spec = v.map(|x| x.into());
20823        self
20824    }
20825
20826    /// Sets the value of [labels][crate::model::SearchRequest::labels].
20827    ///
20828    /// # Example
20829    /// ```ignore,no_run
20830    /// # use google_cloud_retail_v2::model::SearchRequest;
20831    /// let x = SearchRequest::new().set_labels([
20832    ///     ("key0", "abc"),
20833    ///     ("key1", "xyz"),
20834    /// ]);
20835    /// ```
20836    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
20837    where
20838        T: std::iter::IntoIterator<Item = (K, V)>,
20839        K: std::convert::Into<std::string::String>,
20840        V: std::convert::Into<std::string::String>,
20841    {
20842        use std::iter::Iterator;
20843        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20844        self
20845    }
20846
20847    /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
20848    ///
20849    /// # Example
20850    /// ```ignore,no_run
20851    /// # use google_cloud_retail_v2::model::SearchRequest;
20852    /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
20853    /// let x = SearchRequest::new().set_spell_correction_spec(SpellCorrectionSpec::default()/* use setters */);
20854    /// ```
20855    pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
20856    where
20857        T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
20858    {
20859        self.spell_correction_spec = std::option::Option::Some(v.into());
20860        self
20861    }
20862
20863    /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
20864    ///
20865    /// # Example
20866    /// ```ignore,no_run
20867    /// # use google_cloud_retail_v2::model::SearchRequest;
20868    /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
20869    /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(Some(SpellCorrectionSpec::default()/* use setters */));
20870    /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(None::<SpellCorrectionSpec>);
20871    /// ```
20872    pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
20873    where
20874        T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
20875    {
20876        self.spell_correction_spec = v.map(|x| x.into());
20877        self
20878    }
20879
20880    /// Sets the value of [entity][crate::model::SearchRequest::entity].
20881    ///
20882    /// # Example
20883    /// ```ignore,no_run
20884    /// # use google_cloud_retail_v2::model::SearchRequest;
20885    /// let x = SearchRequest::new().set_entity("example");
20886    /// ```
20887    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20888        self.entity = v.into();
20889        self
20890    }
20891
20892    /// Sets the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
20893    ///
20894    /// # Example
20895    /// ```ignore,no_run
20896    /// # use google_cloud_retail_v2::model::SearchRequest;
20897    /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
20898    /// let x = SearchRequest::new().set_conversational_search_spec(ConversationalSearchSpec::default()/* use setters */);
20899    /// ```
20900    pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
20901    where
20902        T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
20903    {
20904        self.conversational_search_spec = std::option::Option::Some(v.into());
20905        self
20906    }
20907
20908    /// Sets or clears the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
20909    ///
20910    /// # Example
20911    /// ```ignore,no_run
20912    /// # use google_cloud_retail_v2::model::SearchRequest;
20913    /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
20914    /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(Some(ConversationalSearchSpec::default()/* use setters */));
20915    /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(None::<ConversationalSearchSpec>);
20916    /// ```
20917    pub fn set_or_clear_conversational_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
20918    where
20919        T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
20920    {
20921        self.conversational_search_spec = v.map(|x| x.into());
20922        self
20923    }
20924
20925    /// Sets the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
20926    ///
20927    /// # Example
20928    /// ```ignore,no_run
20929    /// # use google_cloud_retail_v2::model::SearchRequest;
20930    /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
20931    /// let x = SearchRequest::new().set_tile_navigation_spec(TileNavigationSpec::default()/* use setters */);
20932    /// ```
20933    pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
20934    where
20935        T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
20936    {
20937        self.tile_navigation_spec = std::option::Option::Some(v.into());
20938        self
20939    }
20940
20941    /// Sets or clears the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
20942    ///
20943    /// # Example
20944    /// ```ignore,no_run
20945    /// # use google_cloud_retail_v2::model::SearchRequest;
20946    /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
20947    /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(Some(TileNavigationSpec::default()/* use setters */));
20948    /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(None::<TileNavigationSpec>);
20949    /// ```
20950    pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
20951    where
20952        T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
20953    {
20954        self.tile_navigation_spec = v.map(|x| x.into());
20955        self
20956    }
20957
20958    /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
20959    ///
20960    /// # Example
20961    /// ```ignore,no_run
20962    /// # use google_cloud_retail_v2::model::SearchRequest;
20963    /// let x = SearchRequest::new().set_language_code("example");
20964    /// ```
20965    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20966        self.language_code = v.into();
20967        self
20968    }
20969
20970    /// Sets the value of [region_code][crate::model::SearchRequest::region_code].
20971    ///
20972    /// # Example
20973    /// ```ignore,no_run
20974    /// # use google_cloud_retail_v2::model::SearchRequest;
20975    /// let x = SearchRequest::new().set_region_code("example");
20976    /// ```
20977    pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20978        self.region_code = v.into();
20979        self
20980    }
20981
20982    /// Sets the value of [place_id][crate::model::SearchRequest::place_id].
20983    ///
20984    /// # Example
20985    /// ```ignore,no_run
20986    /// # use google_cloud_retail_v2::model::SearchRequest;
20987    /// let x = SearchRequest::new().set_place_id("example");
20988    /// ```
20989    pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20990        self.place_id = v.into();
20991        self
20992    }
20993
20994    /// Sets the value of [user_attributes][crate::model::SearchRequest::user_attributes].
20995    ///
20996    /// # Example
20997    /// ```ignore,no_run
20998    /// # use google_cloud_retail_v2::model::SearchRequest;
20999    /// use google_cloud_retail_v2::model::StringList;
21000    /// let x = SearchRequest::new().set_user_attributes([
21001    ///     ("key0", StringList::default()/* use setters */),
21002    ///     ("key1", StringList::default()/* use (different) setters */),
21003    /// ]);
21004    /// ```
21005    pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
21006    where
21007        T: std::iter::IntoIterator<Item = (K, V)>,
21008        K: std::convert::Into<std::string::String>,
21009        V: std::convert::Into<crate::model::StringList>,
21010    {
21011        use std::iter::Iterator;
21012        self.user_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21013        self
21014    }
21015}
21016
21017impl wkt::message::Message for SearchRequest {
21018    fn typename() -> &'static str {
21019        "type.googleapis.com/google.cloud.retail.v2.SearchRequest"
21020    }
21021}
21022
21023/// Defines additional types related to [SearchRequest].
21024pub mod search_request {
21025    #[allow(unused_imports)]
21026    use super::*;
21027
21028    /// A facet specification to perform faceted search.
21029    #[derive(Clone, Default, PartialEq)]
21030    #[non_exhaustive]
21031    pub struct FacetSpec {
21032        /// Required. The facet key specification.
21033        pub facet_key: std::option::Option<crate::model::search_request::facet_spec::FacetKey>,
21034
21035        /// Maximum of facet values that should be returned for this facet. If
21036        /// unspecified, defaults to 50. The maximum allowed value is 300. Values
21037        /// above 300 will be coerced to 300.
21038        ///
21039        /// If this field is negative, an INVALID_ARGUMENT is returned.
21040        pub limit: i32,
21041
21042        /// List of keys to exclude when faceting.
21043        ///
21044        /// By default,
21045        /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21046        /// is not excluded from the filter unless it is listed in this field.
21047        ///
21048        /// Listing a facet key in this field allows its values to appear as facet
21049        /// results, even when they are filtered out of search results. Using this
21050        /// field does not affect what search results are returned.
21051        ///
21052        /// For example, suppose there are 100 products with the color facet "Red"
21053        /// and 200 products with the color facet "Blue". A query containing the
21054        /// filter "colorFamilies:ANY("Red")" and having "colorFamilies" as
21055        /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21056        /// would by default return only "Red" products in the search results, and
21057        /// also return "Red" with count 100 as the only color facet. Although there
21058        /// are also blue products available, "Blue" would not be shown as an
21059        /// available facet value.
21060        ///
21061        /// If "colorFamilies" is listed in "excludedFilterKeys", then the query
21062        /// returns the facet values "Red" with count 100 and "Blue" with count
21063        /// 200, because the "colorFamilies" key is now excluded from the filter.
21064        /// Because this field doesn't affect search results, the search results
21065        /// are still correctly filtered to return only "Red" products.
21066        ///
21067        /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
21068        /// is returned.
21069        ///
21070        /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21071        pub excluded_filter_keys: std::vec::Vec<std::string::String>,
21072
21073        /// Enables dynamic position for this facet. If set to true, the position of
21074        /// this facet among all facets in the response is determined by Google
21075        /// Retail Search. It is ordered together with dynamic facets if dynamic
21076        /// facets is enabled. If set to false, the position of this facet in the
21077        /// response is the same as in the request, and it is ranked before
21078        /// the facets with dynamic position enable and all dynamic facets.
21079        ///
21080        /// For example, you may always want to have rating facet returned in
21081        /// the response, but it's not necessarily to always display the rating facet
21082        /// at the top. In that case, you can set enable_dynamic_position to true so
21083        /// that the position of rating facet in response is determined by
21084        /// Google Retail Search.
21085        ///
21086        /// Another example, assuming you have the following facets in the request:
21087        ///
21088        /// * "rating", enable_dynamic_position = true
21089        ///
21090        /// * "price", enable_dynamic_position = false
21091        ///
21092        /// * "brands", enable_dynamic_position = false
21093        ///
21094        ///
21095        /// And also you have a dynamic facets enable, which generates a facet
21096        /// "gender". Then, the final order of the facets in the response can be
21097        /// ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
21098        /// "rating") depends on how Google Retail Search orders "gender" and
21099        /// "rating" facets. However, notice that "price" and "brands" are always
21100        /// ranked at first and second position because their enable_dynamic_position
21101        /// values are false.
21102        pub enable_dynamic_position: bool,
21103
21104        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21105    }
21106
21107    impl FacetSpec {
21108        pub fn new() -> Self {
21109            std::default::Default::default()
21110        }
21111
21112        /// Sets the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21113        ///
21114        /// # Example
21115        /// ```ignore,no_run
21116        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21117        /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21118        /// let x = FacetSpec::new().set_facet_key(FacetKey::default()/* use setters */);
21119        /// ```
21120        pub fn set_facet_key<T>(mut self, v: T) -> Self
21121        where
21122            T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21123        {
21124            self.facet_key = std::option::Option::Some(v.into());
21125            self
21126        }
21127
21128        /// Sets or clears the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21129        ///
21130        /// # Example
21131        /// ```ignore,no_run
21132        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21133        /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21134        /// let x = FacetSpec::new().set_or_clear_facet_key(Some(FacetKey::default()/* use setters */));
21135        /// let x = FacetSpec::new().set_or_clear_facet_key(None::<FacetKey>);
21136        /// ```
21137        pub fn set_or_clear_facet_key<T>(mut self, v: std::option::Option<T>) -> Self
21138        where
21139            T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21140        {
21141            self.facet_key = v.map(|x| x.into());
21142            self
21143        }
21144
21145        /// Sets the value of [limit][crate::model::search_request::FacetSpec::limit].
21146        ///
21147        /// # Example
21148        /// ```ignore,no_run
21149        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21150        /// let x = FacetSpec::new().set_limit(42);
21151        /// ```
21152        pub fn set_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21153            self.limit = v.into();
21154            self
21155        }
21156
21157        /// Sets the value of [excluded_filter_keys][crate::model::search_request::FacetSpec::excluded_filter_keys].
21158        ///
21159        /// # Example
21160        /// ```ignore,no_run
21161        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21162        /// let x = FacetSpec::new().set_excluded_filter_keys(["a", "b", "c"]);
21163        /// ```
21164        pub fn set_excluded_filter_keys<T, V>(mut self, v: T) -> Self
21165        where
21166            T: std::iter::IntoIterator<Item = V>,
21167            V: std::convert::Into<std::string::String>,
21168        {
21169            use std::iter::Iterator;
21170            self.excluded_filter_keys = v.into_iter().map(|i| i.into()).collect();
21171            self
21172        }
21173
21174        /// Sets the value of [enable_dynamic_position][crate::model::search_request::FacetSpec::enable_dynamic_position].
21175        ///
21176        /// # Example
21177        /// ```ignore,no_run
21178        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21179        /// let x = FacetSpec::new().set_enable_dynamic_position(true);
21180        /// ```
21181        pub fn set_enable_dynamic_position<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21182            self.enable_dynamic_position = v.into();
21183            self
21184        }
21185    }
21186
21187    impl wkt::message::Message for FacetSpec {
21188        fn typename() -> &'static str {
21189            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec"
21190        }
21191    }
21192
21193    /// Defines additional types related to [FacetSpec].
21194    pub mod facet_spec {
21195        #[allow(unused_imports)]
21196        use super::*;
21197
21198        /// Specifies how a facet is computed.
21199        #[derive(Clone, Default, PartialEq)]
21200        #[non_exhaustive]
21201        pub struct FacetKey {
21202            /// Required. Supported textual and numerical facet keys in
21203            /// [Product][google.cloud.retail.v2.Product] object, over which the facet
21204            /// values are computed. Facet key is case-sensitive.
21205            ///
21206            /// Allowed facet keys when
21207            /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21208            /// is not specified:
21209            ///
21210            /// * textual_field =
21211            ///
21212            ///   * "brands"
21213            ///   * "categories"
21214            ///   * "genders"
21215            ///   * "ageGroups"
21216            ///   * "availability"
21217            ///   * "colorFamilies"
21218            ///   * "colors"
21219            ///   * "sizes"
21220            ///   * "materials"
21221            ///   * "patterns"
21222            ///   * "conditions"
21223            ///   * "attributes.key"
21224            ///   * "pickupInStore"
21225            ///   * "shipToStore"
21226            ///   * "sameDayDelivery"
21227            ///   * "nextDayDelivery"
21228            ///   * "customFulfillment1"
21229            ///   * "customFulfillment2"
21230            ///   * "customFulfillment3"
21231            ///   * "customFulfillment4"
21232            ///   * "customFulfillment5"
21233            ///   * "inventory(place_id,attributes.key)"
21234            /// * numerical_field =
21235            ///
21236            ///   * "price"
21237            ///   * "discount"
21238            ///   * "rating"
21239            ///   * "ratingCount"
21240            ///   * "attributes.key"
21241            ///   * "inventory(place_id,price)"
21242            ///   * "inventory(place_id,original_price)"
21243            ///   * "inventory(place_id,attributes.key)"
21244            ///
21245            /// [google.cloud.retail.v2.Product]: crate::model::Product
21246            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21247            pub key: std::string::String,
21248
21249            /// Set only if values should be bucketized into intervals. Must be set
21250            /// for facets with numerical values. Must not be set for facet with text
21251            /// values. Maximum number of intervals is 40.
21252            ///
21253            /// For all numerical facet keys that appear in the list of products from
21254            /// the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
21255            /// computed from their distribution weekly. If the model assigns a high
21256            /// score to a numerical facet key and its intervals are not specified in
21257            /// the search request, these percentiles become the bounds
21258            /// for its intervals and are returned in the response. If the
21259            /// facet key intervals are specified in the request, then the specified
21260            /// intervals are returned instead.
21261            pub intervals: std::vec::Vec<crate::model::Interval>,
21262
21263            /// Only get facet for the given restricted values. For example, when using
21264            /// "pickupInStore" as key and set restricted values to
21265            /// ["store123", "store456"], only facets for "store123" and "store456" are
21266            /// returned. Only supported on predefined textual fields, custom textual
21267            /// attributes and fulfillments. Maximum is 20.
21268            ///
21269            /// Must be set for the fulfillment facet keys:
21270            ///
21271            /// * pickupInStore
21272            ///
21273            /// * shipToStore
21274            ///
21275            /// * sameDayDelivery
21276            ///
21277            /// * nextDayDelivery
21278            ///
21279            /// * customFulfillment1
21280            ///
21281            /// * customFulfillment2
21282            ///
21283            /// * customFulfillment3
21284            ///
21285            /// * customFulfillment4
21286            ///
21287            /// * customFulfillment5
21288            ///
21289            pub restricted_values: std::vec::Vec<std::string::String>,
21290
21291            /// Only get facet values that start with the given string prefix. For
21292            /// example, suppose "categories" has three values "Women > Shoe",
21293            /// "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
21294            /// "categories" facet gives only "Women > Shoe" and "Women > Dress".
21295            /// Only supported on textual fields. Maximum is 10.
21296            pub prefixes: std::vec::Vec<std::string::String>,
21297
21298            /// Only get facet values that contains the given strings. For example,
21299            /// suppose "categories" has three values "Women > Shoe",
21300            /// "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
21301            /// "categories" facet gives only "Women > Shoe" and "Men > Shoe".
21302            /// Only supported on textual fields. Maximum is 10.
21303            pub contains: std::vec::Vec<std::string::String>,
21304
21305            /// True to make facet keys case insensitive when getting faceting
21306            /// values with prefixes or contains; false otherwise.
21307            pub case_insensitive: bool,
21308
21309            /// The order in which
21310            /// [SearchResponse.Facet.values][google.cloud.retail.v2.SearchResponse.Facet.values]
21311            /// are returned.
21312            ///
21313            /// Allowed values are:
21314            ///
21315            /// * "count desc", which means order by
21316            ///   [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21317            ///   descending.
21318            ///
21319            /// * "value desc", which means order by
21320            ///   [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21321            ///   descending.
21322            ///   Only applies to textual facets.
21323            ///
21324            ///
21325            /// If not set, textual values are sorted in [natural
21326            /// order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
21327            /// intervals are sorted in the order given by
21328            /// [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals];
21329            /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
21330            /// are sorted in the order given by
21331            /// [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values].
21332            ///
21333            /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
21334            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
21335            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]: crate::model::search_request::facet_spec::FacetKey::restricted_values
21336            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21337            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21338            /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
21339            pub order_by: std::string::String,
21340
21341            /// The query that is used to compute facet for the given facet key.
21342            /// When provided, it overrides the default behavior of facet
21343            /// computation. The query syntax is the same as a filter expression. See
21344            /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21345            /// detail syntax and limitations. Notice that there is no limitation on
21346            /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21347            /// when query is specified.
21348            ///
21349            /// In the response,
21350            /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21351            /// is always "1" and
21352            /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21353            /// is the number of results that match the query.
21354            ///
21355            /// For example, you can set a customized facet for "shipToStore",
21356            /// where
21357            /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21358            /// is "customizedShipToStore", and
21359            /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21360            /// is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
21361            /// Then the facet counts the products that are both in stock and ship
21362            /// to store "123".
21363            ///
21364            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21365            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21366            /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21367            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21368            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21369            pub query: std::string::String,
21370
21371            /// Returns the min and max value for each numerical facet intervals.
21372            /// Ignored for textual facets.
21373            pub return_min_max: bool,
21374
21375            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21376        }
21377
21378        impl FacetKey {
21379            pub fn new() -> Self {
21380                std::default::Default::default()
21381            }
21382
21383            /// Sets the value of [key][crate::model::search_request::facet_spec::FacetKey::key].
21384            ///
21385            /// # Example
21386            /// ```ignore,no_run
21387            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21388            /// let x = FacetKey::new().set_key("example");
21389            /// ```
21390            pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21391                self.key = v.into();
21392                self
21393            }
21394
21395            /// Sets the value of [intervals][crate::model::search_request::facet_spec::FacetKey::intervals].
21396            ///
21397            /// # Example
21398            /// ```ignore,no_run
21399            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21400            /// use google_cloud_retail_v2::model::Interval;
21401            /// let x = FacetKey::new()
21402            ///     .set_intervals([
21403            ///         Interval::default()/* use setters */,
21404            ///         Interval::default()/* use (different) setters */,
21405            ///     ]);
21406            /// ```
21407            pub fn set_intervals<T, V>(mut self, v: T) -> Self
21408            where
21409                T: std::iter::IntoIterator<Item = V>,
21410                V: std::convert::Into<crate::model::Interval>,
21411            {
21412                use std::iter::Iterator;
21413                self.intervals = v.into_iter().map(|i| i.into()).collect();
21414                self
21415            }
21416
21417            /// Sets the value of [restricted_values][crate::model::search_request::facet_spec::FacetKey::restricted_values].
21418            ///
21419            /// # Example
21420            /// ```ignore,no_run
21421            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21422            /// let x = FacetKey::new().set_restricted_values(["a", "b", "c"]);
21423            /// ```
21424            pub fn set_restricted_values<T, V>(mut self, v: T) -> Self
21425            where
21426                T: std::iter::IntoIterator<Item = V>,
21427                V: std::convert::Into<std::string::String>,
21428            {
21429                use std::iter::Iterator;
21430                self.restricted_values = v.into_iter().map(|i| i.into()).collect();
21431                self
21432            }
21433
21434            /// Sets the value of [prefixes][crate::model::search_request::facet_spec::FacetKey::prefixes].
21435            ///
21436            /// # Example
21437            /// ```ignore,no_run
21438            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21439            /// let x = FacetKey::new().set_prefixes(["a", "b", "c"]);
21440            /// ```
21441            pub fn set_prefixes<T, V>(mut self, v: T) -> Self
21442            where
21443                T: std::iter::IntoIterator<Item = V>,
21444                V: std::convert::Into<std::string::String>,
21445            {
21446                use std::iter::Iterator;
21447                self.prefixes = v.into_iter().map(|i| i.into()).collect();
21448                self
21449            }
21450
21451            /// Sets the value of [contains][crate::model::search_request::facet_spec::FacetKey::contains].
21452            ///
21453            /// # Example
21454            /// ```ignore,no_run
21455            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21456            /// let x = FacetKey::new().set_contains(["a", "b", "c"]);
21457            /// ```
21458            pub fn set_contains<T, V>(mut self, v: T) -> Self
21459            where
21460                T: std::iter::IntoIterator<Item = V>,
21461                V: std::convert::Into<std::string::String>,
21462            {
21463                use std::iter::Iterator;
21464                self.contains = v.into_iter().map(|i| i.into()).collect();
21465                self
21466            }
21467
21468            /// Sets the value of [case_insensitive][crate::model::search_request::facet_spec::FacetKey::case_insensitive].
21469            ///
21470            /// # Example
21471            /// ```ignore,no_run
21472            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21473            /// let x = FacetKey::new().set_case_insensitive(true);
21474            /// ```
21475            pub fn set_case_insensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21476                self.case_insensitive = v.into();
21477                self
21478            }
21479
21480            /// Sets the value of [order_by][crate::model::search_request::facet_spec::FacetKey::order_by].
21481            ///
21482            /// # Example
21483            /// ```ignore,no_run
21484            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21485            /// let x = FacetKey::new().set_order_by("example");
21486            /// ```
21487            pub fn set_order_by<T: std::convert::Into<std::string::String>>(
21488                mut self,
21489                v: T,
21490            ) -> Self {
21491                self.order_by = v.into();
21492                self
21493            }
21494
21495            /// Sets the value of [query][crate::model::search_request::facet_spec::FacetKey::query].
21496            ///
21497            /// # Example
21498            /// ```ignore,no_run
21499            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21500            /// let x = FacetKey::new().set_query("example");
21501            /// ```
21502            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21503                self.query = v.into();
21504                self
21505            }
21506
21507            /// Sets the value of [return_min_max][crate::model::search_request::facet_spec::FacetKey::return_min_max].
21508            ///
21509            /// # Example
21510            /// ```ignore,no_run
21511            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21512            /// let x = FacetKey::new().set_return_min_max(true);
21513            /// ```
21514            pub fn set_return_min_max<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21515                self.return_min_max = v.into();
21516                self
21517            }
21518        }
21519
21520        impl wkt::message::Message for FacetKey {
21521            fn typename() -> &'static str {
21522                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"
21523            }
21524        }
21525    }
21526
21527    /// The specifications of dynamically generated facets.
21528    #[derive(Clone, Default, PartialEq)]
21529    #[non_exhaustive]
21530    pub struct DynamicFacetSpec {
21531        /// Mode of the DynamicFacet feature.
21532        /// Defaults to
21533        /// [Mode.DISABLED][google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]
21534        /// if it's unset.
21535        ///
21536        /// [google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]: crate::model::search_request::dynamic_facet_spec::Mode::Disabled
21537        pub mode: crate::model::search_request::dynamic_facet_spec::Mode,
21538
21539        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21540    }
21541
21542    impl DynamicFacetSpec {
21543        pub fn new() -> Self {
21544            std::default::Default::default()
21545        }
21546
21547        /// Sets the value of [mode][crate::model::search_request::DynamicFacetSpec::mode].
21548        ///
21549        /// # Example
21550        /// ```ignore,no_run
21551        /// # use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
21552        /// use google_cloud_retail_v2::model::search_request::dynamic_facet_spec::Mode;
21553        /// let x0 = DynamicFacetSpec::new().set_mode(Mode::Disabled);
21554        /// let x1 = DynamicFacetSpec::new().set_mode(Mode::Enabled);
21555        /// ```
21556        pub fn set_mode<
21557            T: std::convert::Into<crate::model::search_request::dynamic_facet_spec::Mode>,
21558        >(
21559            mut self,
21560            v: T,
21561        ) -> Self {
21562            self.mode = v.into();
21563            self
21564        }
21565    }
21566
21567    impl wkt::message::Message for DynamicFacetSpec {
21568        fn typename() -> &'static str {
21569            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"
21570        }
21571    }
21572
21573    /// Defines additional types related to [DynamicFacetSpec].
21574    pub mod dynamic_facet_spec {
21575        #[allow(unused_imports)]
21576        use super::*;
21577
21578        /// Enum to control DynamicFacet mode
21579        ///
21580        /// # Working with unknown values
21581        ///
21582        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21583        /// additional enum variants at any time. Adding new variants is not considered
21584        /// a breaking change. Applications should write their code in anticipation of:
21585        ///
21586        /// - New values appearing in future releases of the client library, **and**
21587        /// - New values received dynamically, without application changes.
21588        ///
21589        /// Please consult the [Working with enums] section in the user guide for some
21590        /// guidelines.
21591        ///
21592        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21593        #[derive(Clone, Debug, PartialEq)]
21594        #[non_exhaustive]
21595        pub enum Mode {
21596            /// Default value.
21597            Unspecified,
21598            /// Disable Dynamic Facet.
21599            Disabled,
21600            /// Automatic mode built by Google Retail Search.
21601            Enabled,
21602            /// If set, the enum was initialized with an unknown value.
21603            ///
21604            /// Applications can examine the value using [Mode::value] or
21605            /// [Mode::name].
21606            UnknownValue(mode::UnknownValue),
21607        }
21608
21609        #[doc(hidden)]
21610        pub mod mode {
21611            #[allow(unused_imports)]
21612            use super::*;
21613            #[derive(Clone, Debug, PartialEq)]
21614            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21615        }
21616
21617        impl Mode {
21618            /// Gets the enum value.
21619            ///
21620            /// Returns `None` if the enum contains an unknown value deserialized from
21621            /// the string representation of enums.
21622            pub fn value(&self) -> std::option::Option<i32> {
21623                match self {
21624                    Self::Unspecified => std::option::Option::Some(0),
21625                    Self::Disabled => std::option::Option::Some(1),
21626                    Self::Enabled => std::option::Option::Some(2),
21627                    Self::UnknownValue(u) => u.0.value(),
21628                }
21629            }
21630
21631            /// Gets the enum value as a string.
21632            ///
21633            /// Returns `None` if the enum contains an unknown value deserialized from
21634            /// the integer representation of enums.
21635            pub fn name(&self) -> std::option::Option<&str> {
21636                match self {
21637                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
21638                    Self::Disabled => std::option::Option::Some("DISABLED"),
21639                    Self::Enabled => std::option::Option::Some("ENABLED"),
21640                    Self::UnknownValue(u) => u.0.name(),
21641                }
21642            }
21643        }
21644
21645        impl std::default::Default for Mode {
21646            fn default() -> Self {
21647                use std::convert::From;
21648                Self::from(0)
21649            }
21650        }
21651
21652        impl std::fmt::Display for Mode {
21653            fn fmt(
21654                &self,
21655                f: &mut std::fmt::Formatter<'_>,
21656            ) -> std::result::Result<(), std::fmt::Error> {
21657                wkt::internal::display_enum(f, self.name(), self.value())
21658            }
21659        }
21660
21661        impl std::convert::From<i32> for Mode {
21662            fn from(value: i32) -> Self {
21663                match value {
21664                    0 => Self::Unspecified,
21665                    1 => Self::Disabled,
21666                    2 => Self::Enabled,
21667                    _ => Self::UnknownValue(mode::UnknownValue(
21668                        wkt::internal::UnknownEnumValue::Integer(value),
21669                    )),
21670                }
21671            }
21672        }
21673
21674        impl std::convert::From<&str> for Mode {
21675            fn from(value: &str) -> Self {
21676                use std::string::ToString;
21677                match value {
21678                    "MODE_UNSPECIFIED" => Self::Unspecified,
21679                    "DISABLED" => Self::Disabled,
21680                    "ENABLED" => Self::Enabled,
21681                    _ => Self::UnknownValue(mode::UnknownValue(
21682                        wkt::internal::UnknownEnumValue::String(value.to_string()),
21683                    )),
21684                }
21685            }
21686        }
21687
21688        impl serde::ser::Serialize for Mode {
21689            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21690            where
21691                S: serde::Serializer,
21692            {
21693                match self {
21694                    Self::Unspecified => serializer.serialize_i32(0),
21695                    Self::Disabled => serializer.serialize_i32(1),
21696                    Self::Enabled => serializer.serialize_i32(2),
21697                    Self::UnknownValue(u) => u.0.serialize(serializer),
21698                }
21699            }
21700        }
21701
21702        impl<'de> serde::de::Deserialize<'de> for Mode {
21703            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21704            where
21705                D: serde::Deserializer<'de>,
21706            {
21707                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
21708                    ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode",
21709                ))
21710            }
21711        }
21712    }
21713
21714    /// Boost specification to boost certain items.
21715    #[derive(Clone, Default, PartialEq)]
21716    #[non_exhaustive]
21717    pub struct BoostSpec {
21718        /// Condition boost specifications. If a product matches multiple conditions
21719        /// in the specifications, boost scores from these specifications are all
21720        /// applied and combined in a non-linear way. Maximum number of
21721        /// specifications is 20.
21722        pub condition_boost_specs:
21723            std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21724
21725        /// Whether to skip boostspec validation. If this field is set to true,
21726        /// invalid
21727        /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21728        /// will be ignored and valid
21729        /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21730        /// will still be applied.
21731        ///
21732        /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
21733        pub skip_boost_spec_validation: std::option::Option<bool>,
21734
21735        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21736    }
21737
21738    impl BoostSpec {
21739        pub fn new() -> Self {
21740            std::default::Default::default()
21741        }
21742
21743        /// Sets the value of [condition_boost_specs][crate::model::search_request::BoostSpec::condition_boost_specs].
21744        ///
21745        /// # Example
21746        /// ```ignore,no_run
21747        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21748        /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21749        /// let x = BoostSpec::new()
21750        ///     .set_condition_boost_specs([
21751        ///         ConditionBoostSpec::default()/* use setters */,
21752        ///         ConditionBoostSpec::default()/* use (different) setters */,
21753        ///     ]);
21754        /// ```
21755        pub fn set_condition_boost_specs<T, V>(mut self, v: T) -> Self
21756        where
21757            T: std::iter::IntoIterator<Item = V>,
21758            V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21759        {
21760            use std::iter::Iterator;
21761            self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
21762            self
21763        }
21764
21765        /// Sets the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21766        ///
21767        /// # Example
21768        /// ```ignore,no_run
21769        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21770        /// let x = BoostSpec::new().set_skip_boost_spec_validation(true);
21771        /// ```
21772        pub fn set_skip_boost_spec_validation<T>(mut self, v: T) -> Self
21773        where
21774            T: std::convert::Into<bool>,
21775        {
21776            self.skip_boost_spec_validation = std::option::Option::Some(v.into());
21777            self
21778        }
21779
21780        /// Sets or clears the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21781        ///
21782        /// # Example
21783        /// ```ignore,no_run
21784        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21785        /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(Some(false));
21786        /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(None::<bool>);
21787        /// ```
21788        pub fn set_or_clear_skip_boost_spec_validation<T>(
21789            mut self,
21790            v: std::option::Option<T>,
21791        ) -> Self
21792        where
21793            T: std::convert::Into<bool>,
21794        {
21795            self.skip_boost_spec_validation = v.map(|x| x.into());
21796            self
21797        }
21798    }
21799
21800    impl wkt::message::Message for BoostSpec {
21801        fn typename() -> &'static str {
21802            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec"
21803        }
21804    }
21805
21806    /// Defines additional types related to [BoostSpec].
21807    pub mod boost_spec {
21808        #[allow(unused_imports)]
21809        use super::*;
21810
21811        /// Boost applies to products which match a condition.
21812        #[derive(Clone, Default, PartialEq)]
21813        #[non_exhaustive]
21814        pub struct ConditionBoostSpec {
21815            /// An expression which specifies a boost condition. The syntax and
21816            /// supported fields are the same as a filter expression. See
21817            /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21818            /// detail syntax and limitations.
21819            ///
21820            /// Examples:
21821            ///
21822            /// * To boost products with product ID "product_1" or "product_2", and
21823            ///   color
21824            ///   "Red" or "Blue":
21825            ///   * (id: ANY("product_1", "product_2")) AND (colorFamilies:
21826            ///     ANY("Red","Blue"))
21827            ///
21828            /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21829            pub condition: std::string::String,
21830
21831            /// Strength of the condition boost, which should be in [-1, 1]. Negative
21832            /// boost means demotion. Default is 0.0.
21833            ///
21834            /// Setting to 1.0 gives the item a big promotion. However, it does not
21835            /// necessarily mean that the boosted item will be the top result at all
21836            /// times, nor that other items will be excluded. Results could still be
21837            /// shown even when none of them matches the condition. And results that
21838            /// are significantly more relevant to the search query can still trump
21839            /// your heavily favored but irrelevant items.
21840            ///
21841            /// Setting to -1.0 gives the item a big demotion. However, results that
21842            /// are deeply relevant might still be shown. The item will have an
21843            /// upstream battle to get a fairly high ranking, but it is not blocked out
21844            /// completely.
21845            ///
21846            /// Setting to 0.0 means no boost applied. The boosting condition is
21847            /// ignored.
21848            pub boost: f32,
21849
21850            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21851        }
21852
21853        impl ConditionBoostSpec {
21854            pub fn new() -> Self {
21855                std::default::Default::default()
21856            }
21857
21858            /// Sets the value of [condition][crate::model::search_request::boost_spec::ConditionBoostSpec::condition].
21859            ///
21860            /// # Example
21861            /// ```ignore,no_run
21862            /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21863            /// let x = ConditionBoostSpec::new().set_condition("example");
21864            /// ```
21865            pub fn set_condition<T: std::convert::Into<std::string::String>>(
21866                mut self,
21867                v: T,
21868            ) -> Self {
21869                self.condition = v.into();
21870                self
21871            }
21872
21873            /// Sets the value of [boost][crate::model::search_request::boost_spec::ConditionBoostSpec::boost].
21874            ///
21875            /// # Example
21876            /// ```ignore,no_run
21877            /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21878            /// let x = ConditionBoostSpec::new().set_boost(42.0);
21879            /// ```
21880            pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
21881                self.boost = v.into();
21882                self
21883            }
21884        }
21885
21886        impl wkt::message::Message for ConditionBoostSpec {
21887            fn typename() -> &'static str {
21888                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"
21889            }
21890        }
21891    }
21892
21893    /// Specification to determine under which conditions query expansion should
21894    /// occur.
21895    #[derive(Clone, Default, PartialEq)]
21896    #[non_exhaustive]
21897    pub struct QueryExpansionSpec {
21898        /// The condition under which query expansion should occur. Default to
21899        /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
21900        ///
21901        /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
21902        pub condition: crate::model::search_request::query_expansion_spec::Condition,
21903
21904        /// Whether to pin unexpanded results. The default value is false. If this
21905        /// field is set to true,
21906        /// unexpanded products are always at the top of the search results, followed
21907        /// by the expanded results.
21908        pub pin_unexpanded_results: bool,
21909
21910        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21911    }
21912
21913    impl QueryExpansionSpec {
21914        pub fn new() -> Self {
21915            std::default::Default::default()
21916        }
21917
21918        /// Sets the value of [condition][crate::model::search_request::QueryExpansionSpec::condition].
21919        ///
21920        /// # Example
21921        /// ```ignore,no_run
21922        /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21923        /// use google_cloud_retail_v2::model::search_request::query_expansion_spec::Condition;
21924        /// let x0 = QueryExpansionSpec::new().set_condition(Condition::Disabled);
21925        /// let x1 = QueryExpansionSpec::new().set_condition(Condition::Auto);
21926        /// ```
21927        pub fn set_condition<
21928            T: std::convert::Into<crate::model::search_request::query_expansion_spec::Condition>,
21929        >(
21930            mut self,
21931            v: T,
21932        ) -> Self {
21933            self.condition = v.into();
21934            self
21935        }
21936
21937        /// Sets the value of [pin_unexpanded_results][crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results].
21938        ///
21939        /// # Example
21940        /// ```ignore,no_run
21941        /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21942        /// let x = QueryExpansionSpec::new().set_pin_unexpanded_results(true);
21943        /// ```
21944        pub fn set_pin_unexpanded_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21945            self.pin_unexpanded_results = v.into();
21946            self
21947        }
21948    }
21949
21950    impl wkt::message::Message for QueryExpansionSpec {
21951        fn typename() -> &'static str {
21952            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"
21953        }
21954    }
21955
21956    /// Defines additional types related to [QueryExpansionSpec].
21957    pub mod query_expansion_spec {
21958        #[allow(unused_imports)]
21959        use super::*;
21960
21961        /// Enum describing under which condition query expansion should occur.
21962        ///
21963        /// # Working with unknown values
21964        ///
21965        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21966        /// additional enum variants at any time. Adding new variants is not considered
21967        /// a breaking change. Applications should write their code in anticipation of:
21968        ///
21969        /// - New values appearing in future releases of the client library, **and**
21970        /// - New values received dynamically, without application changes.
21971        ///
21972        /// Please consult the [Working with enums] section in the user guide for some
21973        /// guidelines.
21974        ///
21975        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21976        #[derive(Clone, Debug, PartialEq)]
21977        #[non_exhaustive]
21978        pub enum Condition {
21979            /// Unspecified query expansion condition. In this case, server behavior
21980            /// defaults to
21981            /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
21982            ///
21983            /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
21984            Unspecified,
21985            /// Disabled query expansion. Only the exact search query is used, even if
21986            /// [SearchResponse.total_size][google.cloud.retail.v2.SearchResponse.total_size]
21987            /// is zero.
21988            ///
21989            /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
21990            Disabled,
21991            /// Automatic query expansion built by Google Retail Search.
21992            Auto,
21993            /// If set, the enum was initialized with an unknown value.
21994            ///
21995            /// Applications can examine the value using [Condition::value] or
21996            /// [Condition::name].
21997            UnknownValue(condition::UnknownValue),
21998        }
21999
22000        #[doc(hidden)]
22001        pub mod condition {
22002            #[allow(unused_imports)]
22003            use super::*;
22004            #[derive(Clone, Debug, PartialEq)]
22005            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22006        }
22007
22008        impl Condition {
22009            /// Gets the enum value.
22010            ///
22011            /// Returns `None` if the enum contains an unknown value deserialized from
22012            /// the string representation of enums.
22013            pub fn value(&self) -> std::option::Option<i32> {
22014                match self {
22015                    Self::Unspecified => std::option::Option::Some(0),
22016                    Self::Disabled => std::option::Option::Some(1),
22017                    Self::Auto => std::option::Option::Some(3),
22018                    Self::UnknownValue(u) => u.0.value(),
22019                }
22020            }
22021
22022            /// Gets the enum value as a string.
22023            ///
22024            /// Returns `None` if the enum contains an unknown value deserialized from
22025            /// the integer representation of enums.
22026            pub fn name(&self) -> std::option::Option<&str> {
22027                match self {
22028                    Self::Unspecified => std::option::Option::Some("CONDITION_UNSPECIFIED"),
22029                    Self::Disabled => std::option::Option::Some("DISABLED"),
22030                    Self::Auto => std::option::Option::Some("AUTO"),
22031                    Self::UnknownValue(u) => u.0.name(),
22032                }
22033            }
22034        }
22035
22036        impl std::default::Default for Condition {
22037            fn default() -> Self {
22038                use std::convert::From;
22039                Self::from(0)
22040            }
22041        }
22042
22043        impl std::fmt::Display for Condition {
22044            fn fmt(
22045                &self,
22046                f: &mut std::fmt::Formatter<'_>,
22047            ) -> std::result::Result<(), std::fmt::Error> {
22048                wkt::internal::display_enum(f, self.name(), self.value())
22049            }
22050        }
22051
22052        impl std::convert::From<i32> for Condition {
22053            fn from(value: i32) -> Self {
22054                match value {
22055                    0 => Self::Unspecified,
22056                    1 => Self::Disabled,
22057                    3 => Self::Auto,
22058                    _ => Self::UnknownValue(condition::UnknownValue(
22059                        wkt::internal::UnknownEnumValue::Integer(value),
22060                    )),
22061                }
22062            }
22063        }
22064
22065        impl std::convert::From<&str> for Condition {
22066            fn from(value: &str) -> Self {
22067                use std::string::ToString;
22068                match value {
22069                    "CONDITION_UNSPECIFIED" => Self::Unspecified,
22070                    "DISABLED" => Self::Disabled,
22071                    "AUTO" => Self::Auto,
22072                    _ => Self::UnknownValue(condition::UnknownValue(
22073                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22074                    )),
22075                }
22076            }
22077        }
22078
22079        impl serde::ser::Serialize for Condition {
22080            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22081            where
22082                S: serde::Serializer,
22083            {
22084                match self {
22085                    Self::Unspecified => serializer.serialize_i32(0),
22086                    Self::Disabled => serializer.serialize_i32(1),
22087                    Self::Auto => serializer.serialize_i32(3),
22088                    Self::UnknownValue(u) => u.0.serialize(serializer),
22089                }
22090            }
22091        }
22092
22093        impl<'de> serde::de::Deserialize<'de> for Condition {
22094            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22095            where
22096                D: serde::Deserializer<'de>,
22097            {
22098                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Condition>::new(
22099                    ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition",
22100                ))
22101            }
22102        }
22103    }
22104
22105    /// The specification for personalization.
22106    #[derive(Clone, Default, PartialEq)]
22107    #[non_exhaustive]
22108    pub struct PersonalizationSpec {
22109        /// Defaults to
22110        /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22111        ///
22112        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22113        pub mode: crate::model::search_request::personalization_spec::Mode,
22114
22115        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22116    }
22117
22118    impl PersonalizationSpec {
22119        pub fn new() -> Self {
22120            std::default::Default::default()
22121        }
22122
22123        /// Sets the value of [mode][crate::model::search_request::PersonalizationSpec::mode].
22124        ///
22125        /// # Example
22126        /// ```ignore,no_run
22127        /// # use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
22128        /// use google_cloud_retail_v2::model::search_request::personalization_spec::Mode;
22129        /// let x0 = PersonalizationSpec::new().set_mode(Mode::Auto);
22130        /// let x1 = PersonalizationSpec::new().set_mode(Mode::Disabled);
22131        /// ```
22132        pub fn set_mode<
22133            T: std::convert::Into<crate::model::search_request::personalization_spec::Mode>,
22134        >(
22135            mut self,
22136            v: T,
22137        ) -> Self {
22138            self.mode = v.into();
22139            self
22140        }
22141    }
22142
22143    impl wkt::message::Message for PersonalizationSpec {
22144        fn typename() -> &'static str {
22145            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"
22146        }
22147    }
22148
22149    /// Defines additional types related to [PersonalizationSpec].
22150    pub mod personalization_spec {
22151        #[allow(unused_imports)]
22152        use super::*;
22153
22154        /// The personalization mode of each search request.
22155        ///
22156        /// # Working with unknown values
22157        ///
22158        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22159        /// additional enum variants at any time. Adding new variants is not considered
22160        /// a breaking change. Applications should write their code in anticipation of:
22161        ///
22162        /// - New values appearing in future releases of the client library, **and**
22163        /// - New values received dynamically, without application changes.
22164        ///
22165        /// Please consult the [Working with enums] section in the user guide for some
22166        /// guidelines.
22167        ///
22168        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22169        #[derive(Clone, Debug, PartialEq)]
22170        #[non_exhaustive]
22171        pub enum Mode {
22172            /// Default value. In this case, server behavior defaults to
22173            /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22174            ///
22175            /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22176            Unspecified,
22177            /// Let CRS decide whether to use personalization based on quality of user
22178            /// event data.
22179            Auto,
22180            /// Disable personalization.
22181            Disabled,
22182            /// If set, the enum was initialized with an unknown value.
22183            ///
22184            /// Applications can examine the value using [Mode::value] or
22185            /// [Mode::name].
22186            UnknownValue(mode::UnknownValue),
22187        }
22188
22189        #[doc(hidden)]
22190        pub mod mode {
22191            #[allow(unused_imports)]
22192            use super::*;
22193            #[derive(Clone, Debug, PartialEq)]
22194            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22195        }
22196
22197        impl Mode {
22198            /// Gets the enum value.
22199            ///
22200            /// Returns `None` if the enum contains an unknown value deserialized from
22201            /// the string representation of enums.
22202            pub fn value(&self) -> std::option::Option<i32> {
22203                match self {
22204                    Self::Unspecified => std::option::Option::Some(0),
22205                    Self::Auto => std::option::Option::Some(1),
22206                    Self::Disabled => std::option::Option::Some(2),
22207                    Self::UnknownValue(u) => u.0.value(),
22208                }
22209            }
22210
22211            /// Gets the enum value as a string.
22212            ///
22213            /// Returns `None` if the enum contains an unknown value deserialized from
22214            /// the integer representation of enums.
22215            pub fn name(&self) -> std::option::Option<&str> {
22216                match self {
22217                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22218                    Self::Auto => std::option::Option::Some("AUTO"),
22219                    Self::Disabled => std::option::Option::Some("DISABLED"),
22220                    Self::UnknownValue(u) => u.0.name(),
22221                }
22222            }
22223        }
22224
22225        impl std::default::Default for Mode {
22226            fn default() -> Self {
22227                use std::convert::From;
22228                Self::from(0)
22229            }
22230        }
22231
22232        impl std::fmt::Display for Mode {
22233            fn fmt(
22234                &self,
22235                f: &mut std::fmt::Formatter<'_>,
22236            ) -> std::result::Result<(), std::fmt::Error> {
22237                wkt::internal::display_enum(f, self.name(), self.value())
22238            }
22239        }
22240
22241        impl std::convert::From<i32> for Mode {
22242            fn from(value: i32) -> Self {
22243                match value {
22244                    0 => Self::Unspecified,
22245                    1 => Self::Auto,
22246                    2 => Self::Disabled,
22247                    _ => Self::UnknownValue(mode::UnknownValue(
22248                        wkt::internal::UnknownEnumValue::Integer(value),
22249                    )),
22250                }
22251            }
22252        }
22253
22254        impl std::convert::From<&str> for Mode {
22255            fn from(value: &str) -> Self {
22256                use std::string::ToString;
22257                match value {
22258                    "MODE_UNSPECIFIED" => Self::Unspecified,
22259                    "AUTO" => Self::Auto,
22260                    "DISABLED" => Self::Disabled,
22261                    _ => Self::UnknownValue(mode::UnknownValue(
22262                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22263                    )),
22264                }
22265            }
22266        }
22267
22268        impl serde::ser::Serialize for Mode {
22269            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22270            where
22271                S: serde::Serializer,
22272            {
22273                match self {
22274                    Self::Unspecified => serializer.serialize_i32(0),
22275                    Self::Auto => serializer.serialize_i32(1),
22276                    Self::Disabled => serializer.serialize_i32(2),
22277                    Self::UnknownValue(u) => u.0.serialize(serializer),
22278                }
22279            }
22280        }
22281
22282        impl<'de> serde::de::Deserialize<'de> for Mode {
22283            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22284            where
22285                D: serde::Deserializer<'de>,
22286            {
22287                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22288                    ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode",
22289                ))
22290            }
22291        }
22292    }
22293
22294    /// The specification for query spell correction.
22295    #[derive(Clone, Default, PartialEq)]
22296    #[non_exhaustive]
22297    pub struct SpellCorrectionSpec {
22298        /// The mode under which spell correction should take effect to
22299        /// replace the original search query. Default to
22300        /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22301        ///
22302        /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22303        pub mode: crate::model::search_request::spell_correction_spec::Mode,
22304
22305        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22306    }
22307
22308    impl SpellCorrectionSpec {
22309        pub fn new() -> Self {
22310            std::default::Default::default()
22311        }
22312
22313        /// Sets the value of [mode][crate::model::search_request::SpellCorrectionSpec::mode].
22314        ///
22315        /// # Example
22316        /// ```ignore,no_run
22317        /// # use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
22318        /// use google_cloud_retail_v2::model::search_request::spell_correction_spec::Mode;
22319        /// let x0 = SpellCorrectionSpec::new().set_mode(Mode::SuggestionOnly);
22320        /// let x1 = SpellCorrectionSpec::new().set_mode(Mode::Auto);
22321        /// ```
22322        pub fn set_mode<
22323            T: std::convert::Into<crate::model::search_request::spell_correction_spec::Mode>,
22324        >(
22325            mut self,
22326            v: T,
22327        ) -> Self {
22328            self.mode = v.into();
22329            self
22330        }
22331    }
22332
22333    impl wkt::message::Message for SpellCorrectionSpec {
22334        fn typename() -> &'static str {
22335            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"
22336        }
22337    }
22338
22339    /// Defines additional types related to [SpellCorrectionSpec].
22340    pub mod spell_correction_spec {
22341        #[allow(unused_imports)]
22342        use super::*;
22343
22344        /// Enum describing under which mode spell correction should occur.
22345        ///
22346        /// # Working with unknown values
22347        ///
22348        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22349        /// additional enum variants at any time. Adding new variants is not considered
22350        /// a breaking change. Applications should write their code in anticipation of:
22351        ///
22352        /// - New values appearing in future releases of the client library, **and**
22353        /// - New values received dynamically, without application changes.
22354        ///
22355        /// Please consult the [Working with enums] section in the user guide for some
22356        /// guidelines.
22357        ///
22358        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22359        #[derive(Clone, Debug, PartialEq)]
22360        #[non_exhaustive]
22361        pub enum Mode {
22362            /// Unspecified spell correction mode. In this case, server behavior
22363            /// defaults to
22364            /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22365            ///
22366            /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22367            Unspecified,
22368            /// Google Retail Search will try to find a spell suggestion if there
22369            /// is any and put in the
22370            /// [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query].
22371            /// The spell suggestion will not be used as the search query.
22372            ///
22373            /// [google.cloud.retail.v2.SearchResponse.corrected_query]: crate::model::SearchResponse::corrected_query
22374            SuggestionOnly,
22375            /// Automatic spell correction built by Google Retail Search. Search will
22376            /// be based on the corrected query if found.
22377            Auto,
22378            /// If set, the enum was initialized with an unknown value.
22379            ///
22380            /// Applications can examine the value using [Mode::value] or
22381            /// [Mode::name].
22382            UnknownValue(mode::UnknownValue),
22383        }
22384
22385        #[doc(hidden)]
22386        pub mod mode {
22387            #[allow(unused_imports)]
22388            use super::*;
22389            #[derive(Clone, Debug, PartialEq)]
22390            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22391        }
22392
22393        impl Mode {
22394            /// Gets the enum value.
22395            ///
22396            /// Returns `None` if the enum contains an unknown value deserialized from
22397            /// the string representation of enums.
22398            pub fn value(&self) -> std::option::Option<i32> {
22399                match self {
22400                    Self::Unspecified => std::option::Option::Some(0),
22401                    Self::SuggestionOnly => std::option::Option::Some(1),
22402                    Self::Auto => std::option::Option::Some(2),
22403                    Self::UnknownValue(u) => u.0.value(),
22404                }
22405            }
22406
22407            /// Gets the enum value as a string.
22408            ///
22409            /// Returns `None` if the enum contains an unknown value deserialized from
22410            /// the integer representation of enums.
22411            pub fn name(&self) -> std::option::Option<&str> {
22412                match self {
22413                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22414                    Self::SuggestionOnly => std::option::Option::Some("SUGGESTION_ONLY"),
22415                    Self::Auto => std::option::Option::Some("AUTO"),
22416                    Self::UnknownValue(u) => u.0.name(),
22417                }
22418            }
22419        }
22420
22421        impl std::default::Default for Mode {
22422            fn default() -> Self {
22423                use std::convert::From;
22424                Self::from(0)
22425            }
22426        }
22427
22428        impl std::fmt::Display for Mode {
22429            fn fmt(
22430                &self,
22431                f: &mut std::fmt::Formatter<'_>,
22432            ) -> std::result::Result<(), std::fmt::Error> {
22433                wkt::internal::display_enum(f, self.name(), self.value())
22434            }
22435        }
22436
22437        impl std::convert::From<i32> for Mode {
22438            fn from(value: i32) -> Self {
22439                match value {
22440                    0 => Self::Unspecified,
22441                    1 => Self::SuggestionOnly,
22442                    2 => Self::Auto,
22443                    _ => Self::UnknownValue(mode::UnknownValue(
22444                        wkt::internal::UnknownEnumValue::Integer(value),
22445                    )),
22446                }
22447            }
22448        }
22449
22450        impl std::convert::From<&str> for Mode {
22451            fn from(value: &str) -> Self {
22452                use std::string::ToString;
22453                match value {
22454                    "MODE_UNSPECIFIED" => Self::Unspecified,
22455                    "SUGGESTION_ONLY" => Self::SuggestionOnly,
22456                    "AUTO" => Self::Auto,
22457                    _ => Self::UnknownValue(mode::UnknownValue(
22458                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22459                    )),
22460                }
22461            }
22462        }
22463
22464        impl serde::ser::Serialize for Mode {
22465            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22466            where
22467                S: serde::Serializer,
22468            {
22469                match self {
22470                    Self::Unspecified => serializer.serialize_i32(0),
22471                    Self::SuggestionOnly => serializer.serialize_i32(1),
22472                    Self::Auto => serializer.serialize_i32(2),
22473                    Self::UnknownValue(u) => u.0.serialize(serializer),
22474                }
22475            }
22476        }
22477
22478        impl<'de> serde::de::Deserialize<'de> for Mode {
22479            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22480            where
22481                D: serde::Deserializer<'de>,
22482            {
22483                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22484                    ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode",
22485                ))
22486            }
22487        }
22488    }
22489
22490    /// This field specifies all conversational related parameters addition to
22491    /// traditional retail search.
22492    #[derive(Clone, Default, PartialEq)]
22493    #[non_exhaustive]
22494    pub struct ConversationalSearchSpec {
22495        /// This field specifies whether the customer would like to do conversational
22496        /// search. If this field is set to true, conversational related extra
22497        /// information will be returned from server side, including follow-up
22498        /// question, answer options, etc.
22499        pub followup_conversation_requested: bool,
22500
22501        /// This field specifies the conversation id, which maintains the state of
22502        /// the conversation between client side and server side. Use the value from
22503        /// the previous [ConversationalSearchResult.conversation_id][]. For the
22504        /// initial request, this should be empty.
22505        pub conversation_id: std::string::String,
22506
22507        /// This field specifies the current user answer during the conversational
22508        /// search. This can be either user selected from suggested answers or user
22509        /// input plain text.
22510        pub user_answer: std::option::Option<
22511            crate::model::search_request::conversational_search_spec::UserAnswer,
22512        >,
22513
22514        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22515    }
22516
22517    impl ConversationalSearchSpec {
22518        pub fn new() -> Self {
22519            std::default::Default::default()
22520        }
22521
22522        /// Sets the value of [followup_conversation_requested][crate::model::search_request::ConversationalSearchSpec::followup_conversation_requested].
22523        ///
22524        /// # Example
22525        /// ```ignore,no_run
22526        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22527        /// let x = ConversationalSearchSpec::new().set_followup_conversation_requested(true);
22528        /// ```
22529        pub fn set_followup_conversation_requested<T: std::convert::Into<bool>>(
22530            mut self,
22531            v: T,
22532        ) -> Self {
22533            self.followup_conversation_requested = v.into();
22534            self
22535        }
22536
22537        /// Sets the value of [conversation_id][crate::model::search_request::ConversationalSearchSpec::conversation_id].
22538        ///
22539        /// # Example
22540        /// ```ignore,no_run
22541        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22542        /// let x = ConversationalSearchSpec::new().set_conversation_id("example");
22543        /// ```
22544        pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
22545            mut self,
22546            v: T,
22547        ) -> Self {
22548            self.conversation_id = v.into();
22549            self
22550        }
22551
22552        /// Sets the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22553        ///
22554        /// # Example
22555        /// ```ignore,no_run
22556        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22557        /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22558        /// let x = ConversationalSearchSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
22559        /// ```
22560        pub fn set_user_answer<T>(mut self, v: T) -> Self
22561        where
22562            T: std::convert::Into<
22563                    crate::model::search_request::conversational_search_spec::UserAnswer,
22564                >,
22565        {
22566            self.user_answer = std::option::Option::Some(v.into());
22567            self
22568        }
22569
22570        /// Sets or clears the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22571        ///
22572        /// # Example
22573        /// ```ignore,no_run
22574        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22575        /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22576        /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
22577        /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
22578        /// ```
22579        pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
22580        where
22581            T: std::convert::Into<
22582                    crate::model::search_request::conversational_search_spec::UserAnswer,
22583                >,
22584        {
22585            self.user_answer = v.map(|x| x.into());
22586            self
22587        }
22588    }
22589
22590    impl wkt::message::Message for ConversationalSearchSpec {
22591        fn typename() -> &'static str {
22592            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec"
22593        }
22594    }
22595
22596    /// Defines additional types related to [ConversationalSearchSpec].
22597    pub mod conversational_search_spec {
22598        #[allow(unused_imports)]
22599        use super::*;
22600
22601        /// This field specifies the current user answer during the conversational
22602        /// search. This can be either user selected from suggested answers or user
22603        /// input plain text.
22604        #[derive(Clone, Default, PartialEq)]
22605        #[non_exhaustive]
22606        pub struct UserAnswer {
22607            /// This field specifies the type of user answer.
22608            pub r#type: std::option::Option<
22609                crate::model::search_request::conversational_search_spec::user_answer::Type,
22610            >,
22611
22612            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22613        }
22614
22615        impl UserAnswer {
22616            pub fn new() -> Self {
22617                std::default::Default::default()
22618            }
22619
22620            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::type].
22621            ///
22622            /// Note that all the setters affecting `r#type` are mutually
22623            /// exclusive.
22624            ///
22625            /// # Example
22626            /// ```ignore,no_run
22627            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22628            /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::Type;
22629            /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
22630            /// ```
22631            pub fn set_type<T: std::convert::Into<std::option::Option<crate::model::search_request::conversational_search_spec::user_answer::Type>>>(mut self, v: T) -> Self
22632            {
22633                self.r#type = v.into();
22634                self
22635            }
22636
22637            /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22638            /// if it holds a `TextAnswer`, `None` if the field is not set or
22639            /// holds a different branch.
22640            pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
22641                #[allow(unreachable_patterns)]
22642                self.r#type.as_ref().and_then(|v| match v {
22643                    crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(v) => std::option::Option::Some(v),
22644                    _ => std::option::Option::None,
22645                })
22646            }
22647
22648            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22649            /// to hold a `TextAnswer`.
22650            ///
22651            /// Note that all the setters affecting `r#type` are
22652            /// mutually exclusive.
22653            ///
22654            /// # Example
22655            /// ```ignore,no_run
22656            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22657            /// let x = UserAnswer::new().set_text_answer("example");
22658            /// assert!(x.text_answer().is_some());
22659            /// assert!(x.selected_answer().is_none());
22660            /// ```
22661            pub fn set_text_answer<T: std::convert::Into<std::string::String>>(
22662                mut self,
22663                v: T,
22664            ) -> Self {
22665                self.r#type = std::option::Option::Some(
22666                    crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(
22667                        v.into()
22668                    )
22669                );
22670                self
22671            }
22672
22673            /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22674            /// if it holds a `SelectedAnswer`, `None` if the field is not set or
22675            /// holds a different branch.
22676            pub fn selected_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>{
22677                #[allow(unreachable_patterns)]
22678                self.r#type.as_ref().and_then(|v| match v {
22679                    crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(v) => std::option::Option::Some(v),
22680                    _ => std::option::Option::None,
22681                })
22682            }
22683
22684            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22685            /// to hold a `SelectedAnswer`.
22686            ///
22687            /// Note that all the setters affecting `r#type` are
22688            /// mutually exclusive.
22689            ///
22690            /// # Example
22691            /// ```ignore,no_run
22692            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22693            /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22694            /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
22695            /// assert!(x.selected_answer().is_some());
22696            /// assert!(x.text_answer().is_none());
22697            /// ```
22698            pub fn set_selected_answer<T: std::convert::Into<std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>>(mut self, v: T) -> Self{
22699                self.r#type = std::option::Option::Some(
22700                    crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(
22701                        v.into()
22702                    )
22703                );
22704                self
22705            }
22706        }
22707
22708        impl wkt::message::Message for UserAnswer {
22709            fn typename() -> &'static str {
22710                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer"
22711            }
22712        }
22713
22714        /// Defines additional types related to [UserAnswer].
22715        pub mod user_answer {
22716            #[allow(unused_imports)]
22717            use super::*;
22718
22719            /// This field specifies the selected answers during the conversational
22720            /// search.
22721            #[derive(Clone, Default, PartialEq)]
22722            #[non_exhaustive]
22723            pub struct SelectedAnswer {
22724                /// This field is deprecated and should not be set.
22725                #[deprecated]
22726                pub product_attribute_values: std::vec::Vec<crate::model::ProductAttributeValue>,
22727
22728                /// This field specifies the selected answer which is a attribute
22729                /// key-value.
22730                pub product_attribute_value:
22731                    std::option::Option<crate::model::ProductAttributeValue>,
22732
22733                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22734            }
22735
22736            impl SelectedAnswer {
22737                pub fn new() -> Self {
22738                    std::default::Default::default()
22739                }
22740
22741                /// Sets the value of [product_attribute_values][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_values].
22742                ///
22743                /// # Example
22744                /// ```ignore,no_run
22745                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22746                /// use google_cloud_retail_v2::model::ProductAttributeValue;
22747                /// let x = SelectedAnswer::new()
22748                ///     .set_product_attribute_values([
22749                ///         ProductAttributeValue::default()/* use setters */,
22750                ///         ProductAttributeValue::default()/* use (different) setters */,
22751                ///     ]);
22752                /// ```
22753                #[deprecated]
22754                pub fn set_product_attribute_values<T, V>(mut self, v: T) -> Self
22755                where
22756                    T: std::iter::IntoIterator<Item = V>,
22757                    V: std::convert::Into<crate::model::ProductAttributeValue>,
22758                {
22759                    use std::iter::Iterator;
22760                    self.product_attribute_values = v.into_iter().map(|i| i.into()).collect();
22761                    self
22762                }
22763
22764                /// Sets the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22765                ///
22766                /// # Example
22767                /// ```ignore,no_run
22768                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22769                /// use google_cloud_retail_v2::model::ProductAttributeValue;
22770                /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
22771                /// ```
22772                pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
22773                where
22774                    T: std::convert::Into<crate::model::ProductAttributeValue>,
22775                {
22776                    self.product_attribute_value = std::option::Option::Some(v.into());
22777                    self
22778                }
22779
22780                /// Sets or clears the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22781                ///
22782                /// # Example
22783                /// ```ignore,no_run
22784                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22785                /// use google_cloud_retail_v2::model::ProductAttributeValue;
22786                /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
22787                /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
22788                /// ```
22789                pub fn set_or_clear_product_attribute_value<T>(
22790                    mut self,
22791                    v: std::option::Option<T>,
22792                ) -> Self
22793                where
22794                    T: std::convert::Into<crate::model::ProductAttributeValue>,
22795                {
22796                    self.product_attribute_value = v.map(|x| x.into());
22797                    self
22798                }
22799            }
22800
22801            impl wkt::message::Message for SelectedAnswer {
22802                fn typename() -> &'static str {
22803                    "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer"
22804                }
22805            }
22806
22807            /// This field specifies the type of user answer.
22808            #[derive(Clone, Debug, PartialEq)]
22809            #[non_exhaustive]
22810            pub enum Type {
22811                /// This field specifies the incremental input text from the user during
22812                /// the conversational search.
22813                TextAnswer(std::string::String),
22814                /// This field specifies the selected attributes during the
22815                /// conversational search. This should be a subset of
22816                /// [ConversationalSearchResult.suggested_answers][].
22817                SelectedAnswer(std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>),
22818            }
22819        }
22820    }
22821
22822    /// This field specifies tile navigation related parameters.
22823    #[derive(Clone, Default, PartialEq)]
22824    #[non_exhaustive]
22825    pub struct TileNavigationSpec {
22826        /// This field specifies whether the customer would like to request tile
22827        /// navigation.
22828        pub tile_navigation_requested: bool,
22829
22830        /// This optional field specifies the tiles which are already clicked in
22831        /// client side. While the feature works without this field set, particularly
22832        /// for an initial query, it is highly recommended to set this field because
22833        /// it can improve the quality of the search response and removes possible
22834        /// duplicate tiles.
22835        ///
22836        /// NOTE: This field is not being used for filtering search
22837        /// products. Client side should also put all the applied tiles in
22838        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
22839        ///
22840        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
22841        pub applied_tiles: std::vec::Vec<crate::model::Tile>,
22842
22843        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22844    }
22845
22846    impl TileNavigationSpec {
22847        pub fn new() -> Self {
22848            std::default::Default::default()
22849        }
22850
22851        /// Sets the value of [tile_navigation_requested][crate::model::search_request::TileNavigationSpec::tile_navigation_requested].
22852        ///
22853        /// # Example
22854        /// ```ignore,no_run
22855        /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
22856        /// let x = TileNavigationSpec::new().set_tile_navigation_requested(true);
22857        /// ```
22858        pub fn set_tile_navigation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22859            self.tile_navigation_requested = v.into();
22860            self
22861        }
22862
22863        /// Sets the value of [applied_tiles][crate::model::search_request::TileNavigationSpec::applied_tiles].
22864        ///
22865        /// # Example
22866        /// ```ignore,no_run
22867        /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
22868        /// use google_cloud_retail_v2::model::Tile;
22869        /// let x = TileNavigationSpec::new()
22870        ///     .set_applied_tiles([
22871        ///         Tile::default()/* use setters */,
22872        ///         Tile::default()/* use (different) setters */,
22873        ///     ]);
22874        /// ```
22875        pub fn set_applied_tiles<T, V>(mut self, v: T) -> Self
22876        where
22877            T: std::iter::IntoIterator<Item = V>,
22878            V: std::convert::Into<crate::model::Tile>,
22879        {
22880            use std::iter::Iterator;
22881            self.applied_tiles = v.into_iter().map(|i| i.into()).collect();
22882            self
22883        }
22884    }
22885
22886    impl wkt::message::Message for TileNavigationSpec {
22887        fn typename() -> &'static str {
22888            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.TileNavigationSpec"
22889        }
22890    }
22891
22892    /// The search mode of each search request.
22893    ///
22894    /// # Working with unknown values
22895    ///
22896    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22897    /// additional enum variants at any time. Adding new variants is not considered
22898    /// a breaking change. Applications should write their code in anticipation of:
22899    ///
22900    /// - New values appearing in future releases of the client library, **and**
22901    /// - New values received dynamically, without application changes.
22902    ///
22903    /// Please consult the [Working with enums] section in the user guide for some
22904    /// guidelines.
22905    ///
22906    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22907    #[derive(Clone, Debug, PartialEq)]
22908    #[non_exhaustive]
22909    pub enum SearchMode {
22910        /// Default value. In this case both product search and faceted search will
22911        /// be performed. Both
22912        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22913        /// and [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet]
22914        /// will be returned.
22915        ///
22916        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22917        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22918        Unspecified,
22919        /// Only product search will be performed. The faceted search will be
22920        /// disabled.
22921        ///
22922        /// Only
22923        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22924        /// will be returned.
22925        /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
22926        /// not be returned, even if
22927        /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
22928        /// or
22929        /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
22930        /// is set.
22931        ///
22932        /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
22933        /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
22934        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22935        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22936        ProductSearchOnly,
22937        /// Only faceted search will be performed. The product search will be
22938        /// disabled.
22939        ///
22940        /// When in this mode, one or both of
22941        /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
22942        /// and
22943        /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
22944        /// should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
22945        /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
22946        /// be returned.
22947        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22948        /// will not be returned.
22949        ///
22950        /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
22951        /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
22952        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22953        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22954        FacetedSearchOnly,
22955        /// If set, the enum was initialized with an unknown value.
22956        ///
22957        /// Applications can examine the value using [SearchMode::value] or
22958        /// [SearchMode::name].
22959        UnknownValue(search_mode::UnknownValue),
22960    }
22961
22962    #[doc(hidden)]
22963    pub mod search_mode {
22964        #[allow(unused_imports)]
22965        use super::*;
22966        #[derive(Clone, Debug, PartialEq)]
22967        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22968    }
22969
22970    impl SearchMode {
22971        /// Gets the enum value.
22972        ///
22973        /// Returns `None` if the enum contains an unknown value deserialized from
22974        /// the string representation of enums.
22975        pub fn value(&self) -> std::option::Option<i32> {
22976            match self {
22977                Self::Unspecified => std::option::Option::Some(0),
22978                Self::ProductSearchOnly => std::option::Option::Some(1),
22979                Self::FacetedSearchOnly => std::option::Option::Some(2),
22980                Self::UnknownValue(u) => u.0.value(),
22981            }
22982        }
22983
22984        /// Gets the enum value as a string.
22985        ///
22986        /// Returns `None` if the enum contains an unknown value deserialized from
22987        /// the integer representation of enums.
22988        pub fn name(&self) -> std::option::Option<&str> {
22989            match self {
22990                Self::Unspecified => std::option::Option::Some("SEARCH_MODE_UNSPECIFIED"),
22991                Self::ProductSearchOnly => std::option::Option::Some("PRODUCT_SEARCH_ONLY"),
22992                Self::FacetedSearchOnly => std::option::Option::Some("FACETED_SEARCH_ONLY"),
22993                Self::UnknownValue(u) => u.0.name(),
22994            }
22995        }
22996    }
22997
22998    impl std::default::Default for SearchMode {
22999        fn default() -> Self {
23000            use std::convert::From;
23001            Self::from(0)
23002        }
23003    }
23004
23005    impl std::fmt::Display for SearchMode {
23006        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23007            wkt::internal::display_enum(f, self.name(), self.value())
23008        }
23009    }
23010
23011    impl std::convert::From<i32> for SearchMode {
23012        fn from(value: i32) -> Self {
23013            match value {
23014                0 => Self::Unspecified,
23015                1 => Self::ProductSearchOnly,
23016                2 => Self::FacetedSearchOnly,
23017                _ => Self::UnknownValue(search_mode::UnknownValue(
23018                    wkt::internal::UnknownEnumValue::Integer(value),
23019                )),
23020            }
23021        }
23022    }
23023
23024    impl std::convert::From<&str> for SearchMode {
23025        fn from(value: &str) -> Self {
23026            use std::string::ToString;
23027            match value {
23028                "SEARCH_MODE_UNSPECIFIED" => Self::Unspecified,
23029                "PRODUCT_SEARCH_ONLY" => Self::ProductSearchOnly,
23030                "FACETED_SEARCH_ONLY" => Self::FacetedSearchOnly,
23031                _ => Self::UnknownValue(search_mode::UnknownValue(
23032                    wkt::internal::UnknownEnumValue::String(value.to_string()),
23033                )),
23034            }
23035        }
23036    }
23037
23038    impl serde::ser::Serialize for SearchMode {
23039        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23040        where
23041            S: serde::Serializer,
23042        {
23043            match self {
23044                Self::Unspecified => serializer.serialize_i32(0),
23045                Self::ProductSearchOnly => serializer.serialize_i32(1),
23046                Self::FacetedSearchOnly => serializer.serialize_i32(2),
23047                Self::UnknownValue(u) => u.0.serialize(serializer),
23048            }
23049        }
23050    }
23051
23052    impl<'de> serde::de::Deserialize<'de> for SearchMode {
23053        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23054        where
23055            D: serde::Deserializer<'de>,
23056        {
23057            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMode>::new(
23058                ".google.cloud.retail.v2.SearchRequest.SearchMode",
23059            ))
23060        }
23061    }
23062}
23063
23064/// Response message for
23065/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
23066///
23067/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
23068#[derive(Clone, Default, PartialEq)]
23069#[non_exhaustive]
23070pub struct SearchResponse {
23071    /// A list of matched items. The order represents the ranking.
23072    pub results: std::vec::Vec<crate::model::search_response::SearchResult>,
23073
23074    /// Results of facets requested by user.
23075    pub facets: std::vec::Vec<crate::model::search_response::Facet>,
23076
23077    /// The estimated total count of matched items irrespective of pagination. The
23078    /// count of [results][google.cloud.retail.v2.SearchResponse.results] returned
23079    /// by pagination may be less than the
23080    /// [total_size][google.cloud.retail.v2.SearchResponse.total_size] that
23081    /// matches.
23082    ///
23083    /// [google.cloud.retail.v2.SearchResponse.results]: crate::model::SearchResponse::results
23084    /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
23085    pub total_size: i32,
23086
23087    /// Contains the spell corrected query, if found. If the spell correction type
23088    /// is AUTOMATIC, then the search results are based on corrected_query.
23089    /// Otherwise the original query is used for search.
23090    pub corrected_query: std::string::String,
23091
23092    /// A unique search token. This should be included in the
23093    /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
23094    /// search, which enables accurate attribution of search model performance.
23095    ///
23096    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23097    pub attribution_token: std::string::String,
23098
23099    /// A token that can be sent as
23100    /// [SearchRequest.page_token][google.cloud.retail.v2.SearchRequest.page_token]
23101    /// to retrieve the next page. If this field is omitted, there are no
23102    /// subsequent pages.
23103    ///
23104    /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
23105    pub next_page_token: std::string::String,
23106
23107    /// Query expansion information for the returned results.
23108    pub query_expansion_info:
23109        std::option::Option<crate::model::search_response::QueryExpansionInfo>,
23110
23111    /// The URI of a customer-defined redirect page. If redirect action is
23112    /// triggered, no search is performed, and only
23113    /// [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and
23114    /// [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
23115    /// are set in the response.
23116    ///
23117    /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
23118    /// [google.cloud.retail.v2.SearchResponse.redirect_uri]: crate::model::SearchResponse::redirect_uri
23119    pub redirect_uri: std::string::String,
23120
23121    /// The fully qualified resource name of applied
23122    /// [controls](https://cloud.google.com/retail/docs/serving-control-rules).
23123    pub applied_controls: std::vec::Vec<std::string::String>,
23124
23125    /// Metadata for pin controls which were applicable to the request.
23126    /// This contains two map fields, one for all matched pins and one for pins
23127    /// which were matched but not applied.
23128    ///
23129    /// The two maps are keyed by pin position, and the values are the product ids
23130    /// which were matched to that pin.
23131    pub pin_control_metadata: std::option::Option<crate::model::PinControlMetadata>,
23132
23133    /// The invalid
23134    /// [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
23135    /// that are not applied during serving.
23136    ///
23137    /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
23138    pub invalid_condition_boost_specs:
23139        std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23140
23141    /// Metadata related to A/B testing experiment associated with this
23142    /// response. Only exists when an experiment is triggered.
23143    pub experiment_info: std::vec::Vec<crate::model::ExperimentInfo>,
23144
23145    /// This field specifies all related information that is needed on client
23146    /// side for UI rendering of conversational retail search.
23147    pub conversational_search_result:
23148        std::option::Option<crate::model::search_response::ConversationalSearchResult>,
23149
23150    /// This field specifies all related information for tile navigation that will
23151    /// be used in client side.
23152    pub tile_navigation_result:
23153        std::option::Option<crate::model::search_response::TileNavigationResult>,
23154
23155    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23156}
23157
23158impl SearchResponse {
23159    pub fn new() -> Self {
23160        std::default::Default::default()
23161    }
23162
23163    /// Sets the value of [results][crate::model::SearchResponse::results].
23164    ///
23165    /// # Example
23166    /// ```ignore,no_run
23167    /// # use google_cloud_retail_v2::model::SearchResponse;
23168    /// use google_cloud_retail_v2::model::search_response::SearchResult;
23169    /// let x = SearchResponse::new()
23170    ///     .set_results([
23171    ///         SearchResult::default()/* use setters */,
23172    ///         SearchResult::default()/* use (different) setters */,
23173    ///     ]);
23174    /// ```
23175    pub fn set_results<T, V>(mut self, v: T) -> Self
23176    where
23177        T: std::iter::IntoIterator<Item = V>,
23178        V: std::convert::Into<crate::model::search_response::SearchResult>,
23179    {
23180        use std::iter::Iterator;
23181        self.results = v.into_iter().map(|i| i.into()).collect();
23182        self
23183    }
23184
23185    /// Sets the value of [facets][crate::model::SearchResponse::facets].
23186    ///
23187    /// # Example
23188    /// ```ignore,no_run
23189    /// # use google_cloud_retail_v2::model::SearchResponse;
23190    /// use google_cloud_retail_v2::model::search_response::Facet;
23191    /// let x = SearchResponse::new()
23192    ///     .set_facets([
23193    ///         Facet::default()/* use setters */,
23194    ///         Facet::default()/* use (different) setters */,
23195    ///     ]);
23196    /// ```
23197    pub fn set_facets<T, V>(mut self, v: T) -> Self
23198    where
23199        T: std::iter::IntoIterator<Item = V>,
23200        V: std::convert::Into<crate::model::search_response::Facet>,
23201    {
23202        use std::iter::Iterator;
23203        self.facets = v.into_iter().map(|i| i.into()).collect();
23204        self
23205    }
23206
23207    /// Sets the value of [total_size][crate::model::SearchResponse::total_size].
23208    ///
23209    /// # Example
23210    /// ```ignore,no_run
23211    /// # use google_cloud_retail_v2::model::SearchResponse;
23212    /// let x = SearchResponse::new().set_total_size(42);
23213    /// ```
23214    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23215        self.total_size = v.into();
23216        self
23217    }
23218
23219    /// Sets the value of [corrected_query][crate::model::SearchResponse::corrected_query].
23220    ///
23221    /// # Example
23222    /// ```ignore,no_run
23223    /// # use google_cloud_retail_v2::model::SearchResponse;
23224    /// let x = SearchResponse::new().set_corrected_query("example");
23225    /// ```
23226    pub fn set_corrected_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23227        self.corrected_query = v.into();
23228        self
23229    }
23230
23231    /// Sets the value of [attribution_token][crate::model::SearchResponse::attribution_token].
23232    ///
23233    /// # Example
23234    /// ```ignore,no_run
23235    /// # use google_cloud_retail_v2::model::SearchResponse;
23236    /// let x = SearchResponse::new().set_attribution_token("example");
23237    /// ```
23238    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
23239        mut self,
23240        v: T,
23241    ) -> Self {
23242        self.attribution_token = v.into();
23243        self
23244    }
23245
23246    /// Sets the value of [next_page_token][crate::model::SearchResponse::next_page_token].
23247    ///
23248    /// # Example
23249    /// ```ignore,no_run
23250    /// # use google_cloud_retail_v2::model::SearchResponse;
23251    /// let x = SearchResponse::new().set_next_page_token("example");
23252    /// ```
23253    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23254        self.next_page_token = v.into();
23255        self
23256    }
23257
23258    /// Sets the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23259    ///
23260    /// # Example
23261    /// ```ignore,no_run
23262    /// # use google_cloud_retail_v2::model::SearchResponse;
23263    /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23264    /// let x = SearchResponse::new().set_query_expansion_info(QueryExpansionInfo::default()/* use setters */);
23265    /// ```
23266    pub fn set_query_expansion_info<T>(mut self, v: T) -> Self
23267    where
23268        T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23269    {
23270        self.query_expansion_info = std::option::Option::Some(v.into());
23271        self
23272    }
23273
23274    /// Sets or clears the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23275    ///
23276    /// # Example
23277    /// ```ignore,no_run
23278    /// # use google_cloud_retail_v2::model::SearchResponse;
23279    /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23280    /// let x = SearchResponse::new().set_or_clear_query_expansion_info(Some(QueryExpansionInfo::default()/* use setters */));
23281    /// let x = SearchResponse::new().set_or_clear_query_expansion_info(None::<QueryExpansionInfo>);
23282    /// ```
23283    pub fn set_or_clear_query_expansion_info<T>(mut self, v: std::option::Option<T>) -> Self
23284    where
23285        T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23286    {
23287        self.query_expansion_info = v.map(|x| x.into());
23288        self
23289    }
23290
23291    /// Sets the value of [redirect_uri][crate::model::SearchResponse::redirect_uri].
23292    ///
23293    /// # Example
23294    /// ```ignore,no_run
23295    /// # use google_cloud_retail_v2::model::SearchResponse;
23296    /// let x = SearchResponse::new().set_redirect_uri("example");
23297    /// ```
23298    pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23299        self.redirect_uri = v.into();
23300        self
23301    }
23302
23303    /// Sets the value of [applied_controls][crate::model::SearchResponse::applied_controls].
23304    ///
23305    /// # Example
23306    /// ```ignore,no_run
23307    /// # use google_cloud_retail_v2::model::SearchResponse;
23308    /// let x = SearchResponse::new().set_applied_controls(["a", "b", "c"]);
23309    /// ```
23310    pub fn set_applied_controls<T, V>(mut self, v: T) -> Self
23311    where
23312        T: std::iter::IntoIterator<Item = V>,
23313        V: std::convert::Into<std::string::String>,
23314    {
23315        use std::iter::Iterator;
23316        self.applied_controls = v.into_iter().map(|i| i.into()).collect();
23317        self
23318    }
23319
23320    /// Sets the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23321    ///
23322    /// # Example
23323    /// ```ignore,no_run
23324    /// # use google_cloud_retail_v2::model::SearchResponse;
23325    /// use google_cloud_retail_v2::model::PinControlMetadata;
23326    /// let x = SearchResponse::new().set_pin_control_metadata(PinControlMetadata::default()/* use setters */);
23327    /// ```
23328    pub fn set_pin_control_metadata<T>(mut self, v: T) -> Self
23329    where
23330        T: std::convert::Into<crate::model::PinControlMetadata>,
23331    {
23332        self.pin_control_metadata = std::option::Option::Some(v.into());
23333        self
23334    }
23335
23336    /// Sets or clears the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23337    ///
23338    /// # Example
23339    /// ```ignore,no_run
23340    /// # use google_cloud_retail_v2::model::SearchResponse;
23341    /// use google_cloud_retail_v2::model::PinControlMetadata;
23342    /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(Some(PinControlMetadata::default()/* use setters */));
23343    /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(None::<PinControlMetadata>);
23344    /// ```
23345    pub fn set_or_clear_pin_control_metadata<T>(mut self, v: std::option::Option<T>) -> Self
23346    where
23347        T: std::convert::Into<crate::model::PinControlMetadata>,
23348    {
23349        self.pin_control_metadata = v.map(|x| x.into());
23350        self
23351    }
23352
23353    /// Sets the value of [invalid_condition_boost_specs][crate::model::SearchResponse::invalid_condition_boost_specs].
23354    ///
23355    /// # Example
23356    /// ```ignore,no_run
23357    /// # use google_cloud_retail_v2::model::SearchResponse;
23358    /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
23359    /// let x = SearchResponse::new()
23360    ///     .set_invalid_condition_boost_specs([
23361    ///         ConditionBoostSpec::default()/* use setters */,
23362    ///         ConditionBoostSpec::default()/* use (different) setters */,
23363    ///     ]);
23364    /// ```
23365    pub fn set_invalid_condition_boost_specs<T, V>(mut self, v: T) -> Self
23366    where
23367        T: std::iter::IntoIterator<Item = V>,
23368        V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23369    {
23370        use std::iter::Iterator;
23371        self.invalid_condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
23372        self
23373    }
23374
23375    /// Sets the value of [experiment_info][crate::model::SearchResponse::experiment_info].
23376    ///
23377    /// # Example
23378    /// ```ignore,no_run
23379    /// # use google_cloud_retail_v2::model::SearchResponse;
23380    /// use google_cloud_retail_v2::model::ExperimentInfo;
23381    /// let x = SearchResponse::new()
23382    ///     .set_experiment_info([
23383    ///         ExperimentInfo::default()/* use setters */,
23384    ///         ExperimentInfo::default()/* use (different) setters */,
23385    ///     ]);
23386    /// ```
23387    pub fn set_experiment_info<T, V>(mut self, v: T) -> Self
23388    where
23389        T: std::iter::IntoIterator<Item = V>,
23390        V: std::convert::Into<crate::model::ExperimentInfo>,
23391    {
23392        use std::iter::Iterator;
23393        self.experiment_info = v.into_iter().map(|i| i.into()).collect();
23394        self
23395    }
23396
23397    /// Sets the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23398    ///
23399    /// # Example
23400    /// ```ignore,no_run
23401    /// # use google_cloud_retail_v2::model::SearchResponse;
23402    /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23403    /// let x = SearchResponse::new().set_conversational_search_result(ConversationalSearchResult::default()/* use setters */);
23404    /// ```
23405    pub fn set_conversational_search_result<T>(mut self, v: T) -> Self
23406    where
23407        T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23408    {
23409        self.conversational_search_result = std::option::Option::Some(v.into());
23410        self
23411    }
23412
23413    /// Sets or clears the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23414    ///
23415    /// # Example
23416    /// ```ignore,no_run
23417    /// # use google_cloud_retail_v2::model::SearchResponse;
23418    /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23419    /// let x = SearchResponse::new().set_or_clear_conversational_search_result(Some(ConversationalSearchResult::default()/* use setters */));
23420    /// let x = SearchResponse::new().set_or_clear_conversational_search_result(None::<ConversationalSearchResult>);
23421    /// ```
23422    pub fn set_or_clear_conversational_search_result<T>(mut self, v: std::option::Option<T>) -> Self
23423    where
23424        T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23425    {
23426        self.conversational_search_result = v.map(|x| x.into());
23427        self
23428    }
23429
23430    /// Sets the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23431    ///
23432    /// # Example
23433    /// ```ignore,no_run
23434    /// # use google_cloud_retail_v2::model::SearchResponse;
23435    /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23436    /// let x = SearchResponse::new().set_tile_navigation_result(TileNavigationResult::default()/* use setters */);
23437    /// ```
23438    pub fn set_tile_navigation_result<T>(mut self, v: T) -> Self
23439    where
23440        T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23441    {
23442        self.tile_navigation_result = std::option::Option::Some(v.into());
23443        self
23444    }
23445
23446    /// Sets or clears the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23447    ///
23448    /// # Example
23449    /// ```ignore,no_run
23450    /// # use google_cloud_retail_v2::model::SearchResponse;
23451    /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23452    /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(Some(TileNavigationResult::default()/* use setters */));
23453    /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(None::<TileNavigationResult>);
23454    /// ```
23455    pub fn set_or_clear_tile_navigation_result<T>(mut self, v: std::option::Option<T>) -> Self
23456    where
23457        T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23458    {
23459        self.tile_navigation_result = v.map(|x| x.into());
23460        self
23461    }
23462}
23463
23464impl wkt::message::Message for SearchResponse {
23465    fn typename() -> &'static str {
23466        "type.googleapis.com/google.cloud.retail.v2.SearchResponse"
23467    }
23468}
23469
23470#[doc(hidden)]
23471impl gax::paginator::internal::PageableResponse for SearchResponse {
23472    type PageItem = crate::model::search_response::SearchResult;
23473
23474    fn items(self) -> std::vec::Vec<Self::PageItem> {
23475        self.results
23476    }
23477
23478    fn next_page_token(&self) -> std::string::String {
23479        use std::clone::Clone;
23480        self.next_page_token.clone()
23481    }
23482}
23483
23484/// Defines additional types related to [SearchResponse].
23485pub mod search_response {
23486    #[allow(unused_imports)]
23487    use super::*;
23488
23489    /// Represents the search results.
23490    #[derive(Clone, Default, PartialEq)]
23491    #[non_exhaustive]
23492    pub struct SearchResult {
23493        /// [Product.id][google.cloud.retail.v2.Product.id] of the searched
23494        /// [Product][google.cloud.retail.v2.Product].
23495        ///
23496        /// [google.cloud.retail.v2.Product]: crate::model::Product
23497        /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
23498        pub id: std::string::String,
23499
23500        /// The product data snippet in the search response. Only
23501        /// [Product.name][google.cloud.retail.v2.Product.name] is guaranteed to be
23502        /// populated.
23503        ///
23504        /// [Product.variants][google.cloud.retail.v2.Product.variants] contains the
23505        /// product variants that match the search query. If there are multiple
23506        /// product variants matching the query, top 5 most relevant product variants
23507        /// are returned and ordered by relevancy.
23508        ///
23509        /// If relevancy can be deternmined, use
23510        /// [matching_variant_fields][google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]
23511        /// to look up matched product variants fields. If relevancy cannot be
23512        /// determined, e.g. when searching "shoe" all products in a shoe product can
23513        /// be a match, 5 product variants are returned but order is meaningless.
23514        ///
23515        /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23516        /// [google.cloud.retail.v2.Product.variants]: crate::model::Product::variants
23517        /// [google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]: crate::model::search_response::SearchResult::matching_variant_fields
23518        pub product: std::option::Option<crate::model::Product>,
23519
23520        /// The count of matched
23521        /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23522        /// [Product][google.cloud.retail.v2.Product]s.
23523        ///
23524        /// [google.cloud.retail.v2.Product]: crate::model::Product
23525        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23526        pub matching_variant_count: i32,
23527
23528        /// If a [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23529        /// [Product][google.cloud.retail.v2.Product] matches the search query, this
23530        /// map indicates which [Product][google.cloud.retail.v2.Product] fields are
23531        /// matched. The key is the
23532        /// [Product.name][google.cloud.retail.v2.Product.name], the value is a field
23533        /// mask of the matched [Product][google.cloud.retail.v2.Product] fields. If
23534        /// matched attributes cannot be determined, this map will be empty.
23535        ///
23536        /// For example, a key "sku1" with field mask
23537        /// "products.color_info" indicates there is a match between
23538        /// "sku1" [ColorInfo][google.cloud.retail.v2.ColorInfo] and the query.
23539        ///
23540        /// [google.cloud.retail.v2.ColorInfo]: crate::model::ColorInfo
23541        /// [google.cloud.retail.v2.Product]: crate::model::Product
23542        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23543        /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23544        pub matching_variant_fields: std::collections::HashMap<std::string::String, wkt::FieldMask>,
23545
23546        /// The rollup matching
23547        /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23548        /// [Product][google.cloud.retail.v2.Product] attributes. The key is one of
23549        /// the
23550        /// [SearchRequest.variant_rollup_keys][google.cloud.retail.v2.SearchRequest.variant_rollup_keys].
23551        /// The values are the merged and de-duplicated
23552        /// [Product][google.cloud.retail.v2.Product] attributes. Notice that the
23553        /// rollup values are respect filter. For example, when filtering by
23554        /// "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is
23555        /// returned.
23556        ///
23557        /// For textual and numerical attributes, the rollup values is a list of
23558        /// string or double values with type
23559        /// [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if
23560        /// there are two variants with colors "red" and "blue", the rollup values
23561        /// are
23562        ///
23563        /// ```norust
23564        /// { key: "colorFamilies"
23565        ///   value {
23566        ///     list_value {
23567        ///       values { string_value: "red" }
23568        ///       values { string_value: "blue" }
23569        ///      }
23570        ///   }
23571        /// }
23572        /// ```
23573        ///
23574        /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], the rollup
23575        /// values is a double value with type
23576        /// [google.protobuf.Value][google.protobuf.Value]. For example,
23577        /// `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there
23578        /// are 10 variants in this product are available in the store "store1".
23579        ///
23580        /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
23581        /// [google.cloud.retail.v2.Product]: crate::model::Product
23582        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23583        /// [google.cloud.retail.v2.SearchRequest.variant_rollup_keys]: crate::model::SearchRequest::variant_rollup_keys
23584        /// [google.protobuf.ListValue]: wkt::ListValue
23585        /// [google.protobuf.Value]: wkt::Value
23586        pub variant_rollup_values: std::collections::HashMap<std::string::String, wkt::Value>,
23587
23588        /// Specifies previous events related to this product for this user based on
23589        /// [UserEvent][google.cloud.retail.v2.UserEvent] with same
23590        /// [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
23591        /// or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
23592        ///
23593        /// This is set only when
23594        /// [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
23595        /// is
23596        /// [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
23597        ///
23598        /// Possible values:
23599        ///
23600        /// * `purchased`: Indicates that this product has been purchased before.
23601        ///
23602        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
23603        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]: crate::model::search_request::PersonalizationSpec::mode
23604        /// [google.cloud.retail.v2.SearchRequest.visitor_id]: crate::model::SearchRequest::visitor_id
23605        /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23606        /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
23607        pub personal_labels: std::vec::Vec<std::string::String>,
23608
23609        /// Google provided available scores.
23610        pub model_scores: std::collections::HashMap<std::string::String, crate::model::DoubleList>,
23611
23612        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23613    }
23614
23615    impl SearchResult {
23616        pub fn new() -> Self {
23617            std::default::Default::default()
23618        }
23619
23620        /// Sets the value of [id][crate::model::search_response::SearchResult::id].
23621        ///
23622        /// # Example
23623        /// ```ignore,no_run
23624        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23625        /// let x = SearchResult::new().set_id("example");
23626        /// ```
23627        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23628            self.id = v.into();
23629            self
23630        }
23631
23632        /// Sets the value of [product][crate::model::search_response::SearchResult::product].
23633        ///
23634        /// # Example
23635        /// ```ignore,no_run
23636        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23637        /// use google_cloud_retail_v2::model::Product;
23638        /// let x = SearchResult::new().set_product(Product::default()/* use setters */);
23639        /// ```
23640        pub fn set_product<T>(mut self, v: T) -> Self
23641        where
23642            T: std::convert::Into<crate::model::Product>,
23643        {
23644            self.product = std::option::Option::Some(v.into());
23645            self
23646        }
23647
23648        /// Sets or clears the value of [product][crate::model::search_response::SearchResult::product].
23649        ///
23650        /// # Example
23651        /// ```ignore,no_run
23652        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23653        /// use google_cloud_retail_v2::model::Product;
23654        /// let x = SearchResult::new().set_or_clear_product(Some(Product::default()/* use setters */));
23655        /// let x = SearchResult::new().set_or_clear_product(None::<Product>);
23656        /// ```
23657        pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
23658        where
23659            T: std::convert::Into<crate::model::Product>,
23660        {
23661            self.product = v.map(|x| x.into());
23662            self
23663        }
23664
23665        /// Sets the value of [matching_variant_count][crate::model::search_response::SearchResult::matching_variant_count].
23666        ///
23667        /// # Example
23668        /// ```ignore,no_run
23669        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23670        /// let x = SearchResult::new().set_matching_variant_count(42);
23671        /// ```
23672        pub fn set_matching_variant_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23673            self.matching_variant_count = v.into();
23674            self
23675        }
23676
23677        /// Sets the value of [matching_variant_fields][crate::model::search_response::SearchResult::matching_variant_fields].
23678        ///
23679        /// # Example
23680        /// ```ignore,no_run
23681        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23682        /// use wkt::FieldMask;
23683        /// let x = SearchResult::new().set_matching_variant_fields([
23684        ///     ("key0", FieldMask::default()/* use setters */),
23685        ///     ("key1", FieldMask::default()/* use (different) setters */),
23686        /// ]);
23687        /// ```
23688        pub fn set_matching_variant_fields<T, K, V>(mut self, v: T) -> Self
23689        where
23690            T: std::iter::IntoIterator<Item = (K, V)>,
23691            K: std::convert::Into<std::string::String>,
23692            V: std::convert::Into<wkt::FieldMask>,
23693        {
23694            use std::iter::Iterator;
23695            self.matching_variant_fields =
23696                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23697            self
23698        }
23699
23700        /// Sets the value of [variant_rollup_values][crate::model::search_response::SearchResult::variant_rollup_values].
23701        ///
23702        /// # Example
23703        /// ```ignore,no_run
23704        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23705        /// use wkt::Value;
23706        /// let x = SearchResult::new().set_variant_rollup_values([
23707        ///     ("key0", Value::default()/* use setters */),
23708        ///     ("key1", Value::default()/* use (different) setters */),
23709        /// ]);
23710        /// ```
23711        pub fn set_variant_rollup_values<T, K, V>(mut self, v: T) -> Self
23712        where
23713            T: std::iter::IntoIterator<Item = (K, V)>,
23714            K: std::convert::Into<std::string::String>,
23715            V: std::convert::Into<wkt::Value>,
23716        {
23717            use std::iter::Iterator;
23718            self.variant_rollup_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23719            self
23720        }
23721
23722        /// Sets the value of [personal_labels][crate::model::search_response::SearchResult::personal_labels].
23723        ///
23724        /// # Example
23725        /// ```ignore,no_run
23726        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23727        /// let x = SearchResult::new().set_personal_labels(["a", "b", "c"]);
23728        /// ```
23729        pub fn set_personal_labels<T, V>(mut self, v: T) -> Self
23730        where
23731            T: std::iter::IntoIterator<Item = V>,
23732            V: std::convert::Into<std::string::String>,
23733        {
23734            use std::iter::Iterator;
23735            self.personal_labels = v.into_iter().map(|i| i.into()).collect();
23736            self
23737        }
23738
23739        /// Sets the value of [model_scores][crate::model::search_response::SearchResult::model_scores].
23740        ///
23741        /// # Example
23742        /// ```ignore,no_run
23743        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23744        /// use google_cloud_retail_v2::model::DoubleList;
23745        /// let x = SearchResult::new().set_model_scores([
23746        ///     ("key0", DoubleList::default()/* use setters */),
23747        ///     ("key1", DoubleList::default()/* use (different) setters */),
23748        /// ]);
23749        /// ```
23750        pub fn set_model_scores<T, K, V>(mut self, v: T) -> Self
23751        where
23752            T: std::iter::IntoIterator<Item = (K, V)>,
23753            K: std::convert::Into<std::string::String>,
23754            V: std::convert::Into<crate::model::DoubleList>,
23755        {
23756            use std::iter::Iterator;
23757            self.model_scores = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23758            self
23759        }
23760    }
23761
23762    impl wkt::message::Message for SearchResult {
23763        fn typename() -> &'static str {
23764            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.SearchResult"
23765        }
23766    }
23767
23768    /// A facet result.
23769    #[derive(Clone, Default, PartialEq)]
23770    #[non_exhaustive]
23771    pub struct Facet {
23772        /// The key for this facet. E.g., "colorFamilies" or "price" or
23773        /// "attributes.attr1".
23774        pub key: std::string::String,
23775
23776        /// The facet values for this field.
23777        pub values: std::vec::Vec<crate::model::search_response::facet::FacetValue>,
23778
23779        /// Whether the facet is dynamically generated.
23780        pub dynamic_facet: bool,
23781
23782        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23783    }
23784
23785    impl Facet {
23786        pub fn new() -> Self {
23787            std::default::Default::default()
23788        }
23789
23790        /// Sets the value of [key][crate::model::search_response::Facet::key].
23791        ///
23792        /// # Example
23793        /// ```ignore,no_run
23794        /// # use google_cloud_retail_v2::model::search_response::Facet;
23795        /// let x = Facet::new().set_key("example");
23796        /// ```
23797        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23798            self.key = v.into();
23799            self
23800        }
23801
23802        /// Sets the value of [values][crate::model::search_response::Facet::values].
23803        ///
23804        /// # Example
23805        /// ```ignore,no_run
23806        /// # use google_cloud_retail_v2::model::search_response::Facet;
23807        /// use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23808        /// let x = Facet::new()
23809        ///     .set_values([
23810        ///         FacetValue::default()/* use setters */,
23811        ///         FacetValue::default()/* use (different) setters */,
23812        ///     ]);
23813        /// ```
23814        pub fn set_values<T, V>(mut self, v: T) -> Self
23815        where
23816            T: std::iter::IntoIterator<Item = V>,
23817            V: std::convert::Into<crate::model::search_response::facet::FacetValue>,
23818        {
23819            use std::iter::Iterator;
23820            self.values = v.into_iter().map(|i| i.into()).collect();
23821            self
23822        }
23823
23824        /// Sets the value of [dynamic_facet][crate::model::search_response::Facet::dynamic_facet].
23825        ///
23826        /// # Example
23827        /// ```ignore,no_run
23828        /// # use google_cloud_retail_v2::model::search_response::Facet;
23829        /// let x = Facet::new().set_dynamic_facet(true);
23830        /// ```
23831        pub fn set_dynamic_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23832            self.dynamic_facet = v.into();
23833            self
23834        }
23835    }
23836
23837    impl wkt::message::Message for Facet {
23838        fn typename() -> &'static str {
23839            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet"
23840        }
23841    }
23842
23843    /// Defines additional types related to [Facet].
23844    pub mod facet {
23845        #[allow(unused_imports)]
23846        use super::*;
23847
23848        /// A facet value which contains value names and their count.
23849        #[derive(Clone, Default, PartialEq)]
23850        #[non_exhaustive]
23851        pub struct FacetValue {
23852            /// Number of items that have this facet value.
23853            pub count: i64,
23854
23855            /// The minimum value in the
23856            /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
23857            /// Only supported on numerical facets and returned if
23858            /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
23859            /// is true.
23860            ///
23861            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
23862            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
23863            pub min_value: f64,
23864
23865            /// The maximum value in the
23866            /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
23867            /// Only supported on numerical facets and returned if
23868            /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
23869            /// is true.
23870            ///
23871            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
23872            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
23873            pub max_value: f64,
23874
23875            /// A facet value which contains values.
23876            pub facet_value:
23877                std::option::Option<crate::model::search_response::facet::facet_value::FacetValue>,
23878
23879            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23880        }
23881
23882        impl FacetValue {
23883            pub fn new() -> Self {
23884                std::default::Default::default()
23885            }
23886
23887            /// Sets the value of [count][crate::model::search_response::facet::FacetValue::count].
23888            ///
23889            /// # Example
23890            /// ```ignore,no_run
23891            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23892            /// let x = FacetValue::new().set_count(42);
23893            /// ```
23894            pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
23895                self.count = v.into();
23896                self
23897            }
23898
23899            /// Sets the value of [min_value][crate::model::search_response::facet::FacetValue::min_value].
23900            ///
23901            /// # Example
23902            /// ```ignore,no_run
23903            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23904            /// let x = FacetValue::new().set_min_value(42.0);
23905            /// ```
23906            pub fn set_min_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
23907                self.min_value = v.into();
23908                self
23909            }
23910
23911            /// Sets the value of [max_value][crate::model::search_response::facet::FacetValue::max_value].
23912            ///
23913            /// # Example
23914            /// ```ignore,no_run
23915            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23916            /// let x = FacetValue::new().set_max_value(42.0);
23917            /// ```
23918            pub fn set_max_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
23919                self.max_value = v.into();
23920                self
23921            }
23922
23923            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value].
23924            ///
23925            /// Note that all the setters affecting `facet_value` are mutually
23926            /// exclusive.
23927            ///
23928            /// # Example
23929            /// ```ignore,no_run
23930            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23931            /// use google_cloud_retail_v2::model::search_response::facet::facet_value::FacetValue as FacetValueOneOf;
23932            /// let x = FacetValue::new().set_facet_value(Some(FacetValueOneOf::Value("example".to_string())));
23933            /// ```
23934            pub fn set_facet_value<
23935                T: std::convert::Into<
23936                        std::option::Option<
23937                            crate::model::search_response::facet::facet_value::FacetValue,
23938                        >,
23939                    >,
23940            >(
23941                mut self,
23942                v: T,
23943            ) -> Self {
23944                self.facet_value = v.into();
23945                self
23946            }
23947
23948            /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23949            /// if it holds a `Value`, `None` if the field is not set or
23950            /// holds a different branch.
23951            pub fn value(&self) -> std::option::Option<&std::string::String> {
23952                #[allow(unreachable_patterns)]
23953                self.facet_value.as_ref().and_then(|v| match v {
23954                    crate::model::search_response::facet::facet_value::FacetValue::Value(v) => {
23955                        std::option::Option::Some(v)
23956                    }
23957                    _ => std::option::Option::None,
23958                })
23959            }
23960
23961            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23962            /// to hold a `Value`.
23963            ///
23964            /// Note that all the setters affecting `facet_value` are
23965            /// mutually exclusive.
23966            ///
23967            /// # Example
23968            /// ```ignore,no_run
23969            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23970            /// let x = FacetValue::new().set_value("example");
23971            /// assert!(x.value().is_some());
23972            /// assert!(x.interval().is_none());
23973            /// ```
23974            pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23975                self.facet_value = std::option::Option::Some(
23976                    crate::model::search_response::facet::facet_value::FacetValue::Value(v.into()),
23977                );
23978                self
23979            }
23980
23981            /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23982            /// if it holds a `Interval`, `None` if the field is not set or
23983            /// holds a different branch.
23984            pub fn interval(
23985                &self,
23986            ) -> std::option::Option<&std::boxed::Box<crate::model::Interval>> {
23987                #[allow(unreachable_patterns)]
23988                self.facet_value.as_ref().and_then(|v| match v {
23989                    crate::model::search_response::facet::facet_value::FacetValue::Interval(v) => {
23990                        std::option::Option::Some(v)
23991                    }
23992                    _ => std::option::Option::None,
23993                })
23994            }
23995
23996            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23997            /// to hold a `Interval`.
23998            ///
23999            /// Note that all the setters affecting `facet_value` are
24000            /// mutually exclusive.
24001            ///
24002            /// # Example
24003            /// ```ignore,no_run
24004            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24005            /// use google_cloud_retail_v2::model::Interval;
24006            /// let x = FacetValue::new().set_interval(Interval::default()/* use setters */);
24007            /// assert!(x.interval().is_some());
24008            /// assert!(x.value().is_none());
24009            /// ```
24010            pub fn set_interval<T: std::convert::Into<std::boxed::Box<crate::model::Interval>>>(
24011                mut self,
24012                v: T,
24013            ) -> Self {
24014                self.facet_value = std::option::Option::Some(
24015                    crate::model::search_response::facet::facet_value::FacetValue::Interval(
24016                        v.into(),
24017                    ),
24018                );
24019                self
24020            }
24021        }
24022
24023        impl wkt::message::Message for FacetValue {
24024            fn typename() -> &'static str {
24025                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"
24026            }
24027        }
24028
24029        /// Defines additional types related to [FacetValue].
24030        pub mod facet_value {
24031            #[allow(unused_imports)]
24032            use super::*;
24033
24034            /// A facet value which contains values.
24035            #[derive(Clone, Debug, PartialEq)]
24036            #[non_exhaustive]
24037            pub enum FacetValue {
24038                /// Text value of a facet, such as "Black" for facet "colorFamilies".
24039                Value(std::string::String),
24040                /// Interval value for a facet, such as [10, 20) for facet "price".
24041                Interval(std::boxed::Box<crate::model::Interval>),
24042            }
24043        }
24044    }
24045
24046    /// Information describing query expansion including whether expansion has
24047    /// occurred.
24048    #[derive(Clone, Default, PartialEq)]
24049    #[non_exhaustive]
24050    pub struct QueryExpansionInfo {
24051        /// Bool describing whether query expansion has occurred.
24052        pub expanded_query: bool,
24053
24054        /// Number of pinned results. This field will only be set when expansion
24055        /// happens and
24056        /// [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
24057        /// is set to true.
24058        ///
24059        /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]: crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results
24060        pub pinned_result_count: i64,
24061
24062        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24063    }
24064
24065    impl QueryExpansionInfo {
24066        pub fn new() -> Self {
24067            std::default::Default::default()
24068        }
24069
24070        /// Sets the value of [expanded_query][crate::model::search_response::QueryExpansionInfo::expanded_query].
24071        ///
24072        /// # Example
24073        /// ```ignore,no_run
24074        /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24075        /// let x = QueryExpansionInfo::new().set_expanded_query(true);
24076        /// ```
24077        pub fn set_expanded_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24078            self.expanded_query = v.into();
24079            self
24080        }
24081
24082        /// Sets the value of [pinned_result_count][crate::model::search_response::QueryExpansionInfo::pinned_result_count].
24083        ///
24084        /// # Example
24085        /// ```ignore,no_run
24086        /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24087        /// let x = QueryExpansionInfo::new().set_pinned_result_count(42);
24088        /// ```
24089        pub fn set_pinned_result_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24090            self.pinned_result_count = v.into();
24091            self
24092        }
24093    }
24094
24095    impl wkt::message::Message for QueryExpansionInfo {
24096        fn typename() -> &'static str {
24097            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"
24098        }
24099    }
24100
24101    /// This field specifies all related information that is needed on client
24102    /// side for UI rendering of conversational retail search.
24103    #[derive(Clone, Default, PartialEq)]
24104    #[non_exhaustive]
24105    pub struct ConversationalSearchResult {
24106        /// Conversation UUID. This field will be stored in client side storage to
24107        /// maintain the conversation session with server and will be used for next
24108        /// search request's
24109        /// [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]
24110        /// to restore conversation state in server.
24111        ///
24112        /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]: crate::model::search_request::ConversationalSearchSpec::conversation_id
24113        pub conversation_id: std::string::String,
24114
24115        /// The current refined query for the conversational search. This field
24116        /// will be used in customer UI that the query in the search bar should be
24117        /// replaced with the refined query. For example, if
24118        /// [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] is
24119        /// `dress` and next
24120        /// [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]
24121        /// is `red color`, which does not match any product attribute value filters,
24122        /// the refined query will be `dress, red color`.
24123        ///
24124        /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]: crate::model::search_request::conversational_search_spec::UserAnswer::type
24125        /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
24126        pub refined_query: std::string::String,
24127
24128        /// This field is deprecated but will be kept for backward compatibility.
24129        /// There is expected to have only one additional filter and the value will
24130        /// be the same to the same as field `additional_filter`.
24131        #[deprecated]
24132        pub additional_filters: std::vec::Vec<
24133            crate::model::search_response::conversational_search_result::AdditionalFilter,
24134        >,
24135
24136        /// The follow-up question. e.g., `What is the color?`
24137        pub followup_question: std::string::String,
24138
24139        /// The answer options provided to client for the follow-up question.
24140        pub suggested_answers: std::vec::Vec<
24141            crate::model::search_response::conversational_search_result::SuggestedAnswer,
24142        >,
24143
24144        /// This is the incremental additional filters implied from the current
24145        /// user answer. User should add the suggested addition filters to the
24146        /// previous
24147        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],  and
24148        /// use the merged filter in the follow up search request.
24149        ///
24150        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
24151        pub additional_filter: std::option::Option<
24152            crate::model::search_response::conversational_search_result::AdditionalFilter,
24153        >,
24154
24155        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24156    }
24157
24158    impl ConversationalSearchResult {
24159        pub fn new() -> Self {
24160            std::default::Default::default()
24161        }
24162
24163        /// Sets the value of [conversation_id][crate::model::search_response::ConversationalSearchResult::conversation_id].
24164        ///
24165        /// # Example
24166        /// ```ignore,no_run
24167        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24168        /// let x = ConversationalSearchResult::new().set_conversation_id("example");
24169        /// ```
24170        pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
24171            mut self,
24172            v: T,
24173        ) -> Self {
24174            self.conversation_id = v.into();
24175            self
24176        }
24177
24178        /// Sets the value of [refined_query][crate::model::search_response::ConversationalSearchResult::refined_query].
24179        ///
24180        /// # Example
24181        /// ```ignore,no_run
24182        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24183        /// let x = ConversationalSearchResult::new().set_refined_query("example");
24184        /// ```
24185        pub fn set_refined_query<T: std::convert::Into<std::string::String>>(
24186            mut self,
24187            v: T,
24188        ) -> Self {
24189            self.refined_query = v.into();
24190            self
24191        }
24192
24193        /// Sets the value of [additional_filters][crate::model::search_response::ConversationalSearchResult::additional_filters].
24194        ///
24195        /// # Example
24196        /// ```ignore,no_run
24197        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24198        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24199        /// let x = ConversationalSearchResult::new()
24200        ///     .set_additional_filters([
24201        ///         AdditionalFilter::default()/* use setters */,
24202        ///         AdditionalFilter::default()/* use (different) setters */,
24203        ///     ]);
24204        /// ```
24205        #[deprecated]
24206        pub fn set_additional_filters<T, V>(mut self, v: T) -> Self
24207        where
24208            T: std::iter::IntoIterator<Item = V>,
24209            V: std::convert::Into<
24210                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24211                >,
24212        {
24213            use std::iter::Iterator;
24214            self.additional_filters = v.into_iter().map(|i| i.into()).collect();
24215            self
24216        }
24217
24218        /// Sets the value of [followup_question][crate::model::search_response::ConversationalSearchResult::followup_question].
24219        ///
24220        /// # Example
24221        /// ```ignore,no_run
24222        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24223        /// let x = ConversationalSearchResult::new().set_followup_question("example");
24224        /// ```
24225        pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
24226            mut self,
24227            v: T,
24228        ) -> Self {
24229            self.followup_question = v.into();
24230            self
24231        }
24232
24233        /// Sets the value of [suggested_answers][crate::model::search_response::ConversationalSearchResult::suggested_answers].
24234        ///
24235        /// # Example
24236        /// ```ignore,no_run
24237        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24238        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24239        /// let x = ConversationalSearchResult::new()
24240        ///     .set_suggested_answers([
24241        ///         SuggestedAnswer::default()/* use setters */,
24242        ///         SuggestedAnswer::default()/* use (different) setters */,
24243        ///     ]);
24244        /// ```
24245        pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
24246        where
24247            T: std::iter::IntoIterator<Item = V>,
24248            V: std::convert::Into<
24249                    crate::model::search_response::conversational_search_result::SuggestedAnswer,
24250                >,
24251        {
24252            use std::iter::Iterator;
24253            self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
24254            self
24255        }
24256
24257        /// Sets the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24258        ///
24259        /// # Example
24260        /// ```ignore,no_run
24261        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24262        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24263        /// let x = ConversationalSearchResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
24264        /// ```
24265        pub fn set_additional_filter<T>(mut self, v: T) -> Self
24266        where
24267            T: std::convert::Into<
24268                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24269                >,
24270        {
24271            self.additional_filter = std::option::Option::Some(v.into());
24272            self
24273        }
24274
24275        /// Sets or clears the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24276        ///
24277        /// # Example
24278        /// ```ignore,no_run
24279        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24280        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24281        /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
24282        /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
24283        /// ```
24284        pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
24285        where
24286            T: std::convert::Into<
24287                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24288                >,
24289        {
24290            self.additional_filter = v.map(|x| x.into());
24291            self
24292        }
24293    }
24294
24295    impl wkt::message::Message for ConversationalSearchResult {
24296        fn typename() -> &'static str {
24297            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult"
24298        }
24299    }
24300
24301    /// Defines additional types related to [ConversationalSearchResult].
24302    pub mod conversational_search_result {
24303        #[allow(unused_imports)]
24304        use super::*;
24305
24306        /// Suggested answers to the follow-up question.
24307        #[derive(Clone, Default, PartialEq)]
24308        #[non_exhaustive]
24309        pub struct SuggestedAnswer {
24310            /// Product attribute value, including an attribute key and an
24311            /// attribute value. Other types can be added here in the future.
24312            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24313
24314            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24315        }
24316
24317        impl SuggestedAnswer {
24318            pub fn new() -> Self {
24319                std::default::Default::default()
24320            }
24321
24322            /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24323            ///
24324            /// # Example
24325            /// ```ignore,no_run
24326            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24327            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24328            /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24329            /// ```
24330            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24331            where
24332                T: std::convert::Into<crate::model::ProductAttributeValue>,
24333            {
24334                self.product_attribute_value = std::option::Option::Some(v.into());
24335                self
24336            }
24337
24338            /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24339            ///
24340            /// # Example
24341            /// ```ignore,no_run
24342            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24343            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24344            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24345            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24346            /// ```
24347            pub fn set_or_clear_product_attribute_value<T>(
24348                mut self,
24349                v: std::option::Option<T>,
24350            ) -> Self
24351            where
24352                T: std::convert::Into<crate::model::ProductAttributeValue>,
24353            {
24354                self.product_attribute_value = v.map(|x| x.into());
24355                self
24356            }
24357        }
24358
24359        impl wkt::message::Message for SuggestedAnswer {
24360            fn typename() -> &'static str {
24361                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer"
24362            }
24363        }
24364
24365        /// Additional filter that client side need to apply.
24366        #[derive(Clone, Default, PartialEq)]
24367        #[non_exhaustive]
24368        pub struct AdditionalFilter {
24369            /// Product attribute value, including an attribute key and an
24370            /// attribute value. Other types can be added here in the future.
24371            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24372
24373            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24374        }
24375
24376        impl AdditionalFilter {
24377            pub fn new() -> Self {
24378                std::default::Default::default()
24379            }
24380
24381            /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24382            ///
24383            /// # Example
24384            /// ```ignore,no_run
24385            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24386            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24387            /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24388            /// ```
24389            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24390            where
24391                T: std::convert::Into<crate::model::ProductAttributeValue>,
24392            {
24393                self.product_attribute_value = std::option::Option::Some(v.into());
24394                self
24395            }
24396
24397            /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24398            ///
24399            /// # Example
24400            /// ```ignore,no_run
24401            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24402            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24403            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24404            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24405            /// ```
24406            pub fn set_or_clear_product_attribute_value<T>(
24407                mut self,
24408                v: std::option::Option<T>,
24409            ) -> Self
24410            where
24411                T: std::convert::Into<crate::model::ProductAttributeValue>,
24412            {
24413                self.product_attribute_value = v.map(|x| x.into());
24414                self
24415            }
24416        }
24417
24418        impl wkt::message::Message for AdditionalFilter {
24419            fn typename() -> &'static str {
24420                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter"
24421            }
24422        }
24423    }
24424
24425    /// This field specifies all related information for tile navigation that will
24426    /// be used in client side.
24427    #[derive(Clone, Default, PartialEq)]
24428    #[non_exhaustive]
24429    pub struct TileNavigationResult {
24430        /// The current tiles that are used for tile navigation, sorted by
24431        /// engagement.
24432        pub tiles: std::vec::Vec<crate::model::Tile>,
24433
24434        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24435    }
24436
24437    impl TileNavigationResult {
24438        pub fn new() -> Self {
24439            std::default::Default::default()
24440        }
24441
24442        /// Sets the value of [tiles][crate::model::search_response::TileNavigationResult::tiles].
24443        ///
24444        /// # Example
24445        /// ```ignore,no_run
24446        /// # use google_cloud_retail_v2::model::search_response::TileNavigationResult;
24447        /// use google_cloud_retail_v2::model::Tile;
24448        /// let x = TileNavigationResult::new()
24449        ///     .set_tiles([
24450        ///         Tile::default()/* use setters */,
24451        ///         Tile::default()/* use (different) setters */,
24452        ///     ]);
24453        /// ```
24454        pub fn set_tiles<T, V>(mut self, v: T) -> Self
24455        where
24456            T: std::iter::IntoIterator<Item = V>,
24457            V: std::convert::Into<crate::model::Tile>,
24458        {
24459            use std::iter::Iterator;
24460            self.tiles = v.into_iter().map(|i| i.into()).collect();
24461            self
24462        }
24463    }
24464
24465    impl wkt::message::Message for TileNavigationResult {
24466        fn typename() -> &'static str {
24467            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.TileNavigationResult"
24468        }
24469    }
24470}
24471
24472/// Metadata for active A/B testing experiment.
24473#[derive(Clone, Default, PartialEq)]
24474#[non_exhaustive]
24475pub struct ExperimentInfo {
24476    /// The fully qualified resource name of the experiment that provides the
24477    /// serving config under test, should an active experiment exist. For example:
24478    /// `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id`
24479    pub experiment: std::string::String,
24480
24481    /// Information associated with the specific experiment entity being recorded.
24482    pub experiment_metadata: std::option::Option<crate::model::experiment_info::ExperimentMetadata>,
24483
24484    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24485}
24486
24487impl ExperimentInfo {
24488    pub fn new() -> Self {
24489        std::default::Default::default()
24490    }
24491
24492    /// Sets the value of [experiment][crate::model::ExperimentInfo::experiment].
24493    ///
24494    /// # Example
24495    /// ```ignore,no_run
24496    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24497    /// let x = ExperimentInfo::new().set_experiment("example");
24498    /// ```
24499    pub fn set_experiment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24500        self.experiment = v.into();
24501        self
24502    }
24503
24504    /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata].
24505    ///
24506    /// Note that all the setters affecting `experiment_metadata` are mutually
24507    /// exclusive.
24508    ///
24509    /// # Example
24510    /// ```ignore,no_run
24511    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24512    /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24513    /// let x = ExperimentInfo::new().set_experiment_metadata(Some(
24514    ///     google_cloud_retail_v2::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(ServingConfigExperiment::default().into())));
24515    /// ```
24516    pub fn set_experiment_metadata<
24517        T: std::convert::Into<std::option::Option<crate::model::experiment_info::ExperimentMetadata>>,
24518    >(
24519        mut self,
24520        v: T,
24521    ) -> Self {
24522        self.experiment_metadata = v.into();
24523        self
24524    }
24525
24526    /// The value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24527    /// if it holds a `ServingConfigExperiment`, `None` if the field is not set or
24528    /// holds a different branch.
24529    pub fn serving_config_experiment(
24530        &self,
24531    ) -> std::option::Option<&std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>
24532    {
24533        #[allow(unreachable_patterns)]
24534        self.experiment_metadata.as_ref().and_then(|v| match v {
24535            crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v) => {
24536                std::option::Option::Some(v)
24537            }
24538            _ => std::option::Option::None,
24539        })
24540    }
24541
24542    /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24543    /// to hold a `ServingConfigExperiment`.
24544    ///
24545    /// Note that all the setters affecting `experiment_metadata` are
24546    /// mutually exclusive.
24547    ///
24548    /// # Example
24549    /// ```ignore,no_run
24550    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24551    /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24552    /// let x = ExperimentInfo::new().set_serving_config_experiment(ServingConfigExperiment::default()/* use setters */);
24553    /// assert!(x.serving_config_experiment().is_some());
24554    /// ```
24555    pub fn set_serving_config_experiment<
24556        T: std::convert::Into<std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>,
24557    >(
24558        mut self,
24559        v: T,
24560    ) -> Self {
24561        self.experiment_metadata = std::option::Option::Some(
24562            crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v.into()),
24563        );
24564        self
24565    }
24566}
24567
24568impl wkt::message::Message for ExperimentInfo {
24569    fn typename() -> &'static str {
24570        "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo"
24571    }
24572}
24573
24574/// Defines additional types related to [ExperimentInfo].
24575pub mod experiment_info {
24576    #[allow(unused_imports)]
24577    use super::*;
24578
24579    /// Metadata for active serving config A/B tests.
24580    #[derive(Clone, Default, PartialEq)]
24581    #[non_exhaustive]
24582    pub struct ServingConfigExperiment {
24583        /// The fully qualified resource name of the original
24584        /// [SearchRequest.placement][google.cloud.retail.v2.SearchRequest.placement]
24585        /// in the search request prior to reassignment by experiment API. For
24586        /// example: `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24587        ///
24588        /// [google.cloud.retail.v2.SearchRequest.placement]: crate::model::SearchRequest::placement
24589        pub original_serving_config: std::string::String,
24590
24591        /// The fully qualified resource name of the serving config
24592        /// `Experiment.VariantArm.serving_config_id` responsible for generating
24593        /// the search response. For example:
24594        /// `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24595        pub experiment_serving_config: std::string::String,
24596
24597        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24598    }
24599
24600    impl ServingConfigExperiment {
24601        pub fn new() -> Self {
24602            std::default::Default::default()
24603        }
24604
24605        /// Sets the value of [original_serving_config][crate::model::experiment_info::ServingConfigExperiment::original_serving_config].
24606        ///
24607        /// # Example
24608        /// ```ignore,no_run
24609        /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24610        /// let x = ServingConfigExperiment::new().set_original_serving_config("example");
24611        /// ```
24612        pub fn set_original_serving_config<T: std::convert::Into<std::string::String>>(
24613            mut self,
24614            v: T,
24615        ) -> Self {
24616            self.original_serving_config = v.into();
24617            self
24618        }
24619
24620        /// Sets the value of [experiment_serving_config][crate::model::experiment_info::ServingConfigExperiment::experiment_serving_config].
24621        ///
24622        /// # Example
24623        /// ```ignore,no_run
24624        /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24625        /// let x = ServingConfigExperiment::new().set_experiment_serving_config("example");
24626        /// ```
24627        pub fn set_experiment_serving_config<T: std::convert::Into<std::string::String>>(
24628            mut self,
24629            v: T,
24630        ) -> Self {
24631            self.experiment_serving_config = v.into();
24632            self
24633        }
24634    }
24635
24636    impl wkt::message::Message for ServingConfigExperiment {
24637        fn typename() -> &'static str {
24638            "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment"
24639        }
24640    }
24641
24642    /// Information associated with the specific experiment entity being recorded.
24643    #[derive(Clone, Debug, PartialEq)]
24644    #[non_exhaustive]
24645    pub enum ExperimentMetadata {
24646        /// A/B test between existing Cloud Retail Search
24647        /// [ServingConfig][google.cloud.retail.v2.ServingConfig]s.
24648        ///
24649        /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24650        ServingConfigExperiment(
24651            std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>,
24652        ),
24653    }
24654}
24655
24656/// Configures metadata that is used to generate serving time results (e.g.
24657/// search results or recommendation predictions).
24658#[derive(Clone, Default, PartialEq)]
24659#[non_exhaustive]
24660pub struct ServingConfig {
24661    /// Immutable. Fully qualified name
24662    /// `projects/*/locations/global/catalogs/*/servingConfig/*`
24663    pub name: std::string::String,
24664
24665    /// Required. The human readable serving config display name. Used in Retail
24666    /// UI.
24667    ///
24668    /// This field must be a UTF-8 encoded string with a length limit of 128
24669    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
24670    pub display_name: std::string::String,
24671
24672    /// The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
24673    /// to use at serving time. Currently only RecommendationModels are supported:
24674    /// <https://cloud.google.com/retail/recommendations-ai/docs/create-models>
24675    /// Can be changed but only to a compatible model (e.g.
24676    /// others-you-may-like CTR to others-you-may-like CVR).
24677    ///
24678    /// Required when
24679    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24680    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24681    ///
24682    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
24683    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24684    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24685    pub model_id: std::string::String,
24686
24687    /// How much price ranking we want in serving results.
24688    /// Price reranking causes product items with a similar
24689    /// recommendation probability to be ordered by price, with the
24690    /// highest-priced items first. This setting could result in a decrease in
24691    /// click-through and conversion rates.
24692    /// Allowed values are:
24693    ///
24694    /// * `no-price-reranking`
24695    /// * `low-price-reranking`
24696    /// * `medium-price-reranking`
24697    /// * `high-price-reranking`
24698    ///
24699    /// If not specified, we choose default based on model type. Default value:
24700    /// `no-price-reranking`.
24701    ///
24702    /// Can only be set if
24703    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24704    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24705    ///
24706    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24707    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24708    pub price_reranking_level: std::string::String,
24709
24710    /// Facet specifications for faceted search. If empty, no facets are returned.
24711    /// The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
24712    /// resources with only the Facet control set. These controls are assumed to be
24713    /// in the same [Catalog][google.cloud.retail.v2.Catalog] as the
24714    /// [ServingConfig][google.cloud.retail.v2.ServingConfig].
24715    /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
24716    /// is returned.
24717    ///
24718    /// Can only be set if
24719    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24720    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24721    ///
24722    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
24723    /// [google.cloud.retail.v2.Control]: crate::model::Control
24724    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24725    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24726    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24727    pub facet_control_ids: std::vec::Vec<std::string::String>,
24728
24729    /// The specification for dynamically generated facets. Notice that only
24730    /// textual facets can be dynamically generated.
24731    ///
24732    /// Can only be set if
24733    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24734    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24735    ///
24736    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24737    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24738    pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
24739
24740    /// Condition boost specifications. If a product matches multiple conditions
24741    /// in the specifications, boost scores from these specifications are all
24742    /// applied and combined in a non-linear way. Maximum number of
24743    /// specifications is 100.
24744    ///
24745    /// Notice that if both
24746    /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
24747    /// and
24748    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
24749    /// are set, the boost conditions from both places are evaluated. If a search
24750    /// request matches multiple boost conditions, the final boost score is equal
24751    /// to the sum of the boost scores from all matched boost conditions.
24752    ///
24753    /// Can only be set if
24754    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24755    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24756    ///
24757    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
24758    /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
24759    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24760    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24761    pub boost_control_ids: std::vec::Vec<std::string::String>,
24762
24763    /// Condition filter specifications. If a product matches multiple conditions
24764    /// in the specifications, filters from these specifications are all
24765    /// applied and combined via the AND operator. Maximum number of
24766    /// specifications is 100.
24767    ///
24768    /// Can only be set if
24769    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24770    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24771    ///
24772    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24773    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24774    pub filter_control_ids: std::vec::Vec<std::string::String>,
24775
24776    /// Condition redirect specifications. Only the first triggered redirect action
24777    /// is applied, even if multiple apply. Maximum number of specifications is
24778    /// 1000.
24779    ///
24780    /// Can only be set if
24781    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24782    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24783    ///
24784    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24785    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24786    pub redirect_control_ids: std::vec::Vec<std::string::String>,
24787
24788    /// Condition synonyms specifications. If multiple syonyms conditions match,
24789    /// all matching synonyms control in the list will execute. Order of controls
24790    /// in the list will not matter. Maximum number of specifications is
24791    /// 100.
24792    ///
24793    /// Can only be set if
24794    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24795    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24796    ///
24797    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24798    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24799    pub twoway_synonyms_control_ids: std::vec::Vec<std::string::String>,
24800
24801    /// Condition oneway synonyms specifications. If multiple oneway synonyms
24802    /// conditions match, all matching oneway synonyms controls in the list will
24803    /// execute. Order of controls in the list will not matter. Maximum number of
24804    /// specifications is 100.
24805    ///
24806    /// Can only be set if
24807    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24808    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24809    ///
24810    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24811    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24812    pub oneway_synonyms_control_ids: std::vec::Vec<std::string::String>,
24813
24814    /// Condition do not associate specifications. If multiple do not associate
24815    /// conditions match, all matching do not associate controls in the list will
24816    /// execute.
24817    ///
24818    /// - Order does not matter.
24819    /// - Maximum number of specifications is 100.
24820    ///
24821    /// Can only be set if
24822    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24823    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24824    ///
24825    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24826    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24827    pub do_not_associate_control_ids: std::vec::Vec<std::string::String>,
24828
24829    /// Condition replacement specifications.
24830    ///
24831    /// - Applied according to the order in the list.
24832    /// - A previously replaced term can not be re-replaced.
24833    /// - Maximum number of specifications is 100.
24834    ///
24835    /// Can only be set if
24836    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24837    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24838    ///
24839    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24840    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24841    pub replacement_control_ids: std::vec::Vec<std::string::String>,
24842
24843    /// Condition ignore specifications. If multiple ignore
24844    /// conditions match, all matching ignore controls in the list will
24845    /// execute.
24846    ///
24847    /// - Order does not matter.
24848    /// - Maximum number of specifications is 100.
24849    ///
24850    /// Can only be set if
24851    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24852    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24853    ///
24854    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24855    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24856    pub ignore_control_ids: std::vec::Vec<std::string::String>,
24857
24858    /// How much diversity to use in recommendation model results e.g.
24859    /// `medium-diversity` or `high-diversity`. Currently supported values:
24860    ///
24861    /// * `no-diversity`
24862    /// * `low-diversity`
24863    /// * `medium-diversity`
24864    /// * `high-diversity`
24865    /// * `auto-diversity`
24866    ///
24867    /// If not specified, we choose default based on recommendation model
24868    /// type. Default value: `no-diversity`.
24869    ///
24870    /// Can only be set if
24871    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24872    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24873    ///
24874    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24875    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24876    pub diversity_level: std::string::String,
24877
24878    /// What kind of diversity to use - data driven or rule based. If unset, the
24879    /// server behavior defaults to
24880    /// [RULE_BASED_DIVERSITY][google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY].
24881    ///
24882    /// [google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]: crate::model::serving_config::DiversityType::RuleBasedDiversity
24883    pub diversity_type: crate::model::serving_config::DiversityType,
24884
24885    /// Whether to add additional category filters on the `similar-items` model.
24886    /// If not specified, we enable it by default.
24887    /// Allowed values are:
24888    ///
24889    /// * `no-category-match`: No additional filtering of original results from
24890    ///   the model and the customer's filters.
24891    /// * `relaxed-category-match`: Only keep results with categories that match
24892    ///   at least one item categories in the PredictRequests's context item.
24893    ///   * If customer also sends filters in the PredictRequest, then the results
24894    ///     will satisfy both conditions (user given and category match).
24895    ///
24896    /// Can only be set if
24897    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24898    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24899    ///
24900    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24901    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24902    pub enable_category_filter_level: std::string::String,
24903
24904    /// When the flag is enabled, the products in the denylist will not be filtered
24905    /// out in the recommendation filtering results.
24906    pub ignore_recs_denylist: bool,
24907
24908    /// The specification for personalization spec.
24909    ///
24910    /// Can only be set if
24911    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24912    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24913    ///
24914    /// Notice that if both
24915    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
24916    /// and
24917    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
24918    /// are set.
24919    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
24920    /// will override
24921    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
24922    ///
24923    /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
24924    /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
24925    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24926    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24927    pub personalization_spec:
24928        std::option::Option<crate::model::search_request::PersonalizationSpec>,
24929
24930    /// Required. Immutable. Specifies the solution types that a serving config can
24931    /// be associated with. Currently we support setting only one type of solution.
24932    pub solution_types: std::vec::Vec<crate::model::SolutionType>,
24933
24934    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24935}
24936
24937impl ServingConfig {
24938    pub fn new() -> Self {
24939        std::default::Default::default()
24940    }
24941
24942    /// Sets the value of [name][crate::model::ServingConfig::name].
24943    ///
24944    /// # Example
24945    /// ```ignore,no_run
24946    /// # use google_cloud_retail_v2::model::ServingConfig;
24947    /// let x = ServingConfig::new().set_name("example");
24948    /// ```
24949    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24950        self.name = v.into();
24951        self
24952    }
24953
24954    /// Sets the value of [display_name][crate::model::ServingConfig::display_name].
24955    ///
24956    /// # Example
24957    /// ```ignore,no_run
24958    /// # use google_cloud_retail_v2::model::ServingConfig;
24959    /// let x = ServingConfig::new().set_display_name("example");
24960    /// ```
24961    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24962        self.display_name = v.into();
24963        self
24964    }
24965
24966    /// Sets the value of [model_id][crate::model::ServingConfig::model_id].
24967    ///
24968    /// # Example
24969    /// ```ignore,no_run
24970    /// # use google_cloud_retail_v2::model::ServingConfig;
24971    /// let x = ServingConfig::new().set_model_id("example");
24972    /// ```
24973    pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24974        self.model_id = v.into();
24975        self
24976    }
24977
24978    /// Sets the value of [price_reranking_level][crate::model::ServingConfig::price_reranking_level].
24979    ///
24980    /// # Example
24981    /// ```ignore,no_run
24982    /// # use google_cloud_retail_v2::model::ServingConfig;
24983    /// let x = ServingConfig::new().set_price_reranking_level("example");
24984    /// ```
24985    pub fn set_price_reranking_level<T: std::convert::Into<std::string::String>>(
24986        mut self,
24987        v: T,
24988    ) -> Self {
24989        self.price_reranking_level = v.into();
24990        self
24991    }
24992
24993    /// Sets the value of [facet_control_ids][crate::model::ServingConfig::facet_control_ids].
24994    ///
24995    /// # Example
24996    /// ```ignore,no_run
24997    /// # use google_cloud_retail_v2::model::ServingConfig;
24998    /// let x = ServingConfig::new().set_facet_control_ids(["a", "b", "c"]);
24999    /// ```
25000    pub fn set_facet_control_ids<T, V>(mut self, v: T) -> Self
25001    where
25002        T: std::iter::IntoIterator<Item = V>,
25003        V: std::convert::Into<std::string::String>,
25004    {
25005        use std::iter::Iterator;
25006        self.facet_control_ids = v.into_iter().map(|i| i.into()).collect();
25007        self
25008    }
25009
25010    /// Sets the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25011    ///
25012    /// # Example
25013    /// ```ignore,no_run
25014    /// # use google_cloud_retail_v2::model::ServingConfig;
25015    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25016    /// let x = ServingConfig::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
25017    /// ```
25018    pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
25019    where
25020        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25021    {
25022        self.dynamic_facet_spec = std::option::Option::Some(v.into());
25023        self
25024    }
25025
25026    /// Sets or clears the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25027    ///
25028    /// # Example
25029    /// ```ignore,no_run
25030    /// # use google_cloud_retail_v2::model::ServingConfig;
25031    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25032    /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
25033    /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
25034    /// ```
25035    pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
25036    where
25037        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25038    {
25039        self.dynamic_facet_spec = v.map(|x| x.into());
25040        self
25041    }
25042
25043    /// Sets the value of [boost_control_ids][crate::model::ServingConfig::boost_control_ids].
25044    ///
25045    /// # Example
25046    /// ```ignore,no_run
25047    /// # use google_cloud_retail_v2::model::ServingConfig;
25048    /// let x = ServingConfig::new().set_boost_control_ids(["a", "b", "c"]);
25049    /// ```
25050    pub fn set_boost_control_ids<T, V>(mut self, v: T) -> Self
25051    where
25052        T: std::iter::IntoIterator<Item = V>,
25053        V: std::convert::Into<std::string::String>,
25054    {
25055        use std::iter::Iterator;
25056        self.boost_control_ids = v.into_iter().map(|i| i.into()).collect();
25057        self
25058    }
25059
25060    /// Sets the value of [filter_control_ids][crate::model::ServingConfig::filter_control_ids].
25061    ///
25062    /// # Example
25063    /// ```ignore,no_run
25064    /// # use google_cloud_retail_v2::model::ServingConfig;
25065    /// let x = ServingConfig::new().set_filter_control_ids(["a", "b", "c"]);
25066    /// ```
25067    pub fn set_filter_control_ids<T, V>(mut self, v: T) -> Self
25068    where
25069        T: std::iter::IntoIterator<Item = V>,
25070        V: std::convert::Into<std::string::String>,
25071    {
25072        use std::iter::Iterator;
25073        self.filter_control_ids = v.into_iter().map(|i| i.into()).collect();
25074        self
25075    }
25076
25077    /// Sets the value of [redirect_control_ids][crate::model::ServingConfig::redirect_control_ids].
25078    ///
25079    /// # Example
25080    /// ```ignore,no_run
25081    /// # use google_cloud_retail_v2::model::ServingConfig;
25082    /// let x = ServingConfig::new().set_redirect_control_ids(["a", "b", "c"]);
25083    /// ```
25084    pub fn set_redirect_control_ids<T, V>(mut self, v: T) -> Self
25085    where
25086        T: std::iter::IntoIterator<Item = V>,
25087        V: std::convert::Into<std::string::String>,
25088    {
25089        use std::iter::Iterator;
25090        self.redirect_control_ids = v.into_iter().map(|i| i.into()).collect();
25091        self
25092    }
25093
25094    /// Sets the value of [twoway_synonyms_control_ids][crate::model::ServingConfig::twoway_synonyms_control_ids].
25095    ///
25096    /// # Example
25097    /// ```ignore,no_run
25098    /// # use google_cloud_retail_v2::model::ServingConfig;
25099    /// let x = ServingConfig::new().set_twoway_synonyms_control_ids(["a", "b", "c"]);
25100    /// ```
25101    pub fn set_twoway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25102    where
25103        T: std::iter::IntoIterator<Item = V>,
25104        V: std::convert::Into<std::string::String>,
25105    {
25106        use std::iter::Iterator;
25107        self.twoway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25108        self
25109    }
25110
25111    /// Sets the value of [oneway_synonyms_control_ids][crate::model::ServingConfig::oneway_synonyms_control_ids].
25112    ///
25113    /// # Example
25114    /// ```ignore,no_run
25115    /// # use google_cloud_retail_v2::model::ServingConfig;
25116    /// let x = ServingConfig::new().set_oneway_synonyms_control_ids(["a", "b", "c"]);
25117    /// ```
25118    pub fn set_oneway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25119    where
25120        T: std::iter::IntoIterator<Item = V>,
25121        V: std::convert::Into<std::string::String>,
25122    {
25123        use std::iter::Iterator;
25124        self.oneway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25125        self
25126    }
25127
25128    /// Sets the value of [do_not_associate_control_ids][crate::model::ServingConfig::do_not_associate_control_ids].
25129    ///
25130    /// # Example
25131    /// ```ignore,no_run
25132    /// # use google_cloud_retail_v2::model::ServingConfig;
25133    /// let x = ServingConfig::new().set_do_not_associate_control_ids(["a", "b", "c"]);
25134    /// ```
25135    pub fn set_do_not_associate_control_ids<T, V>(mut self, v: T) -> Self
25136    where
25137        T: std::iter::IntoIterator<Item = V>,
25138        V: std::convert::Into<std::string::String>,
25139    {
25140        use std::iter::Iterator;
25141        self.do_not_associate_control_ids = v.into_iter().map(|i| i.into()).collect();
25142        self
25143    }
25144
25145    /// Sets the value of [replacement_control_ids][crate::model::ServingConfig::replacement_control_ids].
25146    ///
25147    /// # Example
25148    /// ```ignore,no_run
25149    /// # use google_cloud_retail_v2::model::ServingConfig;
25150    /// let x = ServingConfig::new().set_replacement_control_ids(["a", "b", "c"]);
25151    /// ```
25152    pub fn set_replacement_control_ids<T, V>(mut self, v: T) -> Self
25153    where
25154        T: std::iter::IntoIterator<Item = V>,
25155        V: std::convert::Into<std::string::String>,
25156    {
25157        use std::iter::Iterator;
25158        self.replacement_control_ids = v.into_iter().map(|i| i.into()).collect();
25159        self
25160    }
25161
25162    /// Sets the value of [ignore_control_ids][crate::model::ServingConfig::ignore_control_ids].
25163    ///
25164    /// # Example
25165    /// ```ignore,no_run
25166    /// # use google_cloud_retail_v2::model::ServingConfig;
25167    /// let x = ServingConfig::new().set_ignore_control_ids(["a", "b", "c"]);
25168    /// ```
25169    pub fn set_ignore_control_ids<T, V>(mut self, v: T) -> Self
25170    where
25171        T: std::iter::IntoIterator<Item = V>,
25172        V: std::convert::Into<std::string::String>,
25173    {
25174        use std::iter::Iterator;
25175        self.ignore_control_ids = v.into_iter().map(|i| i.into()).collect();
25176        self
25177    }
25178
25179    /// Sets the value of [diversity_level][crate::model::ServingConfig::diversity_level].
25180    ///
25181    /// # Example
25182    /// ```ignore,no_run
25183    /// # use google_cloud_retail_v2::model::ServingConfig;
25184    /// let x = ServingConfig::new().set_diversity_level("example");
25185    /// ```
25186    pub fn set_diversity_level<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25187        self.diversity_level = v.into();
25188        self
25189    }
25190
25191    /// Sets the value of [diversity_type][crate::model::ServingConfig::diversity_type].
25192    ///
25193    /// # Example
25194    /// ```ignore,no_run
25195    /// # use google_cloud_retail_v2::model::ServingConfig;
25196    /// use google_cloud_retail_v2::model::serving_config::DiversityType;
25197    /// let x0 = ServingConfig::new().set_diversity_type(DiversityType::RuleBasedDiversity);
25198    /// let x1 = ServingConfig::new().set_diversity_type(DiversityType::DataDrivenDiversity);
25199    /// ```
25200    pub fn set_diversity_type<
25201        T: std::convert::Into<crate::model::serving_config::DiversityType>,
25202    >(
25203        mut self,
25204        v: T,
25205    ) -> Self {
25206        self.diversity_type = v.into();
25207        self
25208    }
25209
25210    /// Sets the value of [enable_category_filter_level][crate::model::ServingConfig::enable_category_filter_level].
25211    ///
25212    /// # Example
25213    /// ```ignore,no_run
25214    /// # use google_cloud_retail_v2::model::ServingConfig;
25215    /// let x = ServingConfig::new().set_enable_category_filter_level("example");
25216    /// ```
25217    pub fn set_enable_category_filter_level<T: std::convert::Into<std::string::String>>(
25218        mut self,
25219        v: T,
25220    ) -> Self {
25221        self.enable_category_filter_level = v.into();
25222        self
25223    }
25224
25225    /// Sets the value of [ignore_recs_denylist][crate::model::ServingConfig::ignore_recs_denylist].
25226    ///
25227    /// # Example
25228    /// ```ignore,no_run
25229    /// # use google_cloud_retail_v2::model::ServingConfig;
25230    /// let x = ServingConfig::new().set_ignore_recs_denylist(true);
25231    /// ```
25232    pub fn set_ignore_recs_denylist<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25233        self.ignore_recs_denylist = v.into();
25234        self
25235    }
25236
25237    /// Sets the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25238    ///
25239    /// # Example
25240    /// ```ignore,no_run
25241    /// # use google_cloud_retail_v2::model::ServingConfig;
25242    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25243    /// let x = ServingConfig::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
25244    /// ```
25245    pub fn set_personalization_spec<T>(mut self, v: T) -> Self
25246    where
25247        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25248    {
25249        self.personalization_spec = std::option::Option::Some(v.into());
25250        self
25251    }
25252
25253    /// Sets or clears the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25254    ///
25255    /// # Example
25256    /// ```ignore,no_run
25257    /// # use google_cloud_retail_v2::model::ServingConfig;
25258    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25259    /// let x = ServingConfig::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
25260    /// let x = ServingConfig::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
25261    /// ```
25262    pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
25263    where
25264        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25265    {
25266        self.personalization_spec = v.map(|x| x.into());
25267        self
25268    }
25269
25270    /// Sets the value of [solution_types][crate::model::ServingConfig::solution_types].
25271    ///
25272    /// # Example
25273    /// ```ignore,no_run
25274    /// # use google_cloud_retail_v2::model::ServingConfig;
25275    /// use google_cloud_retail_v2::model::SolutionType;
25276    /// let x = ServingConfig::new().set_solution_types([
25277    ///     SolutionType::Recommendation,
25278    ///     SolutionType::Search,
25279    /// ]);
25280    /// ```
25281    pub fn set_solution_types<T, V>(mut self, v: T) -> Self
25282    where
25283        T: std::iter::IntoIterator<Item = V>,
25284        V: std::convert::Into<crate::model::SolutionType>,
25285    {
25286        use std::iter::Iterator;
25287        self.solution_types = v.into_iter().map(|i| i.into()).collect();
25288        self
25289    }
25290}
25291
25292impl wkt::message::Message for ServingConfig {
25293    fn typename() -> &'static str {
25294        "type.googleapis.com/google.cloud.retail.v2.ServingConfig"
25295    }
25296}
25297
25298/// Defines additional types related to [ServingConfig].
25299pub mod serving_config {
25300    #[allow(unused_imports)]
25301    use super::*;
25302
25303    /// What type of diversity - data or rule based.
25304    ///
25305    /// # Working with unknown values
25306    ///
25307    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25308    /// additional enum variants at any time. Adding new variants is not considered
25309    /// a breaking change. Applications should write their code in anticipation of:
25310    ///
25311    /// - New values appearing in future releases of the client library, **and**
25312    /// - New values received dynamically, without application changes.
25313    ///
25314    /// Please consult the [Working with enums] section in the user guide for some
25315    /// guidelines.
25316    ///
25317    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25318    #[derive(Clone, Debug, PartialEq)]
25319    #[non_exhaustive]
25320    pub enum DiversityType {
25321        /// Default value.
25322        Unspecified,
25323        /// Rule based diversity.
25324        RuleBasedDiversity,
25325        /// Data driven diversity.
25326        DataDrivenDiversity,
25327        /// If set, the enum was initialized with an unknown value.
25328        ///
25329        /// Applications can examine the value using [DiversityType::value] or
25330        /// [DiversityType::name].
25331        UnknownValue(diversity_type::UnknownValue),
25332    }
25333
25334    #[doc(hidden)]
25335    pub mod diversity_type {
25336        #[allow(unused_imports)]
25337        use super::*;
25338        #[derive(Clone, Debug, PartialEq)]
25339        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25340    }
25341
25342    impl DiversityType {
25343        /// Gets the enum value.
25344        ///
25345        /// Returns `None` if the enum contains an unknown value deserialized from
25346        /// the string representation of enums.
25347        pub fn value(&self) -> std::option::Option<i32> {
25348            match self {
25349                Self::Unspecified => std::option::Option::Some(0),
25350                Self::RuleBasedDiversity => std::option::Option::Some(2),
25351                Self::DataDrivenDiversity => std::option::Option::Some(3),
25352                Self::UnknownValue(u) => u.0.value(),
25353            }
25354        }
25355
25356        /// Gets the enum value as a string.
25357        ///
25358        /// Returns `None` if the enum contains an unknown value deserialized from
25359        /// the integer representation of enums.
25360        pub fn name(&self) -> std::option::Option<&str> {
25361            match self {
25362                Self::Unspecified => std::option::Option::Some("DIVERSITY_TYPE_UNSPECIFIED"),
25363                Self::RuleBasedDiversity => std::option::Option::Some("RULE_BASED_DIVERSITY"),
25364                Self::DataDrivenDiversity => std::option::Option::Some("DATA_DRIVEN_DIVERSITY"),
25365                Self::UnknownValue(u) => u.0.name(),
25366            }
25367        }
25368    }
25369
25370    impl std::default::Default for DiversityType {
25371        fn default() -> Self {
25372            use std::convert::From;
25373            Self::from(0)
25374        }
25375    }
25376
25377    impl std::fmt::Display for DiversityType {
25378        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25379            wkt::internal::display_enum(f, self.name(), self.value())
25380        }
25381    }
25382
25383    impl std::convert::From<i32> for DiversityType {
25384        fn from(value: i32) -> Self {
25385            match value {
25386                0 => Self::Unspecified,
25387                2 => Self::RuleBasedDiversity,
25388                3 => Self::DataDrivenDiversity,
25389                _ => Self::UnknownValue(diversity_type::UnknownValue(
25390                    wkt::internal::UnknownEnumValue::Integer(value),
25391                )),
25392            }
25393        }
25394    }
25395
25396    impl std::convert::From<&str> for DiversityType {
25397        fn from(value: &str) -> Self {
25398            use std::string::ToString;
25399            match value {
25400                "DIVERSITY_TYPE_UNSPECIFIED" => Self::Unspecified,
25401                "RULE_BASED_DIVERSITY" => Self::RuleBasedDiversity,
25402                "DATA_DRIVEN_DIVERSITY" => Self::DataDrivenDiversity,
25403                _ => Self::UnknownValue(diversity_type::UnknownValue(
25404                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25405                )),
25406            }
25407        }
25408    }
25409
25410    impl serde::ser::Serialize for DiversityType {
25411        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25412        where
25413            S: serde::Serializer,
25414        {
25415            match self {
25416                Self::Unspecified => serializer.serialize_i32(0),
25417                Self::RuleBasedDiversity => serializer.serialize_i32(2),
25418                Self::DataDrivenDiversity => serializer.serialize_i32(3),
25419                Self::UnknownValue(u) => u.0.serialize(serializer),
25420            }
25421        }
25422    }
25423
25424    impl<'de> serde::de::Deserialize<'de> for DiversityType {
25425        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25426        where
25427            D: serde::Deserializer<'de>,
25428        {
25429            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiversityType>::new(
25430                ".google.cloud.retail.v2.ServingConfig.DiversityType",
25431            ))
25432        }
25433    }
25434}
25435
25436/// Request for CreateServingConfig method.
25437#[derive(Clone, Default, PartialEq)]
25438#[non_exhaustive]
25439pub struct CreateServingConfigRequest {
25440    /// Required. Full resource name of parent. Format:
25441    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25442    pub parent: std::string::String,
25443
25444    /// Required. The ServingConfig to create.
25445    pub serving_config: std::option::Option<crate::model::ServingConfig>,
25446
25447    /// Required. The ID to use for the ServingConfig, which will become the final
25448    /// component of the ServingConfig's resource name.
25449    ///
25450    /// This value should be 4-63 characters, and valid characters
25451    /// are /[a-z][0-9]-_/.
25452    pub serving_config_id: std::string::String,
25453
25454    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25455}
25456
25457impl CreateServingConfigRequest {
25458    pub fn new() -> Self {
25459        std::default::Default::default()
25460    }
25461
25462    /// Sets the value of [parent][crate::model::CreateServingConfigRequest::parent].
25463    ///
25464    /// # Example
25465    /// ```ignore,no_run
25466    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25467    /// let x = CreateServingConfigRequest::new().set_parent("example");
25468    /// ```
25469    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25470        self.parent = v.into();
25471        self
25472    }
25473
25474    /// Sets the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25475    ///
25476    /// # Example
25477    /// ```ignore,no_run
25478    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25479    /// use google_cloud_retail_v2::model::ServingConfig;
25480    /// let x = CreateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25481    /// ```
25482    pub fn set_serving_config<T>(mut self, v: T) -> Self
25483    where
25484        T: std::convert::Into<crate::model::ServingConfig>,
25485    {
25486        self.serving_config = std::option::Option::Some(v.into());
25487        self
25488    }
25489
25490    /// Sets or clears the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25491    ///
25492    /// # Example
25493    /// ```ignore,no_run
25494    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25495    /// use google_cloud_retail_v2::model::ServingConfig;
25496    /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25497    /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25498    /// ```
25499    pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25500    where
25501        T: std::convert::Into<crate::model::ServingConfig>,
25502    {
25503        self.serving_config = v.map(|x| x.into());
25504        self
25505    }
25506
25507    /// Sets the value of [serving_config_id][crate::model::CreateServingConfigRequest::serving_config_id].
25508    ///
25509    /// # Example
25510    /// ```ignore,no_run
25511    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25512    /// let x = CreateServingConfigRequest::new().set_serving_config_id("example");
25513    /// ```
25514    pub fn set_serving_config_id<T: std::convert::Into<std::string::String>>(
25515        mut self,
25516        v: T,
25517    ) -> Self {
25518        self.serving_config_id = v.into();
25519        self
25520    }
25521}
25522
25523impl wkt::message::Message for CreateServingConfigRequest {
25524    fn typename() -> &'static str {
25525        "type.googleapis.com/google.cloud.retail.v2.CreateServingConfigRequest"
25526    }
25527}
25528
25529/// Request for UpdateServingConfig method.
25530#[derive(Clone, Default, PartialEq)]
25531#[non_exhaustive]
25532pub struct UpdateServingConfigRequest {
25533    /// Required. The ServingConfig to update.
25534    pub serving_config: std::option::Option<crate::model::ServingConfig>,
25535
25536    /// Indicates which fields in the provided
25537    /// [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
25538    /// following are NOT supported:
25539    ///
25540    /// * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
25541    ///
25542    /// If not set, all supported fields are updated.
25543    ///
25544    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25545    /// [google.cloud.retail.v2.ServingConfig.name]: crate::model::ServingConfig::name
25546    pub update_mask: std::option::Option<wkt::FieldMask>,
25547
25548    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25549}
25550
25551impl UpdateServingConfigRequest {
25552    pub fn new() -> Self {
25553        std::default::Default::default()
25554    }
25555
25556    /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25557    ///
25558    /// # Example
25559    /// ```ignore,no_run
25560    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25561    /// use google_cloud_retail_v2::model::ServingConfig;
25562    /// let x = UpdateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25563    /// ```
25564    pub fn set_serving_config<T>(mut self, v: T) -> Self
25565    where
25566        T: std::convert::Into<crate::model::ServingConfig>,
25567    {
25568        self.serving_config = std::option::Option::Some(v.into());
25569        self
25570    }
25571
25572    /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25573    ///
25574    /// # Example
25575    /// ```ignore,no_run
25576    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25577    /// use google_cloud_retail_v2::model::ServingConfig;
25578    /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25579    /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25580    /// ```
25581    pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25582    where
25583        T: std::convert::Into<crate::model::ServingConfig>,
25584    {
25585        self.serving_config = v.map(|x| x.into());
25586        self
25587    }
25588
25589    /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25590    ///
25591    /// # Example
25592    /// ```ignore,no_run
25593    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25594    /// use wkt::FieldMask;
25595    /// let x = UpdateServingConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
25596    /// ```
25597    pub fn set_update_mask<T>(mut self, v: T) -> Self
25598    where
25599        T: std::convert::Into<wkt::FieldMask>,
25600    {
25601        self.update_mask = std::option::Option::Some(v.into());
25602        self
25603    }
25604
25605    /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25606    ///
25607    /// # Example
25608    /// ```ignore,no_run
25609    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25610    /// use wkt::FieldMask;
25611    /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
25612    /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
25613    /// ```
25614    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
25615    where
25616        T: std::convert::Into<wkt::FieldMask>,
25617    {
25618        self.update_mask = v.map(|x| x.into());
25619        self
25620    }
25621}
25622
25623impl wkt::message::Message for UpdateServingConfigRequest {
25624    fn typename() -> &'static str {
25625        "type.googleapis.com/google.cloud.retail.v2.UpdateServingConfigRequest"
25626    }
25627}
25628
25629/// Request for DeleteServingConfig method.
25630#[derive(Clone, Default, PartialEq)]
25631#[non_exhaustive]
25632pub struct DeleteServingConfigRequest {
25633    /// Required. The resource name of the ServingConfig to delete. Format:
25634    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25635    pub name: std::string::String,
25636
25637    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25638}
25639
25640impl DeleteServingConfigRequest {
25641    pub fn new() -> Self {
25642        std::default::Default::default()
25643    }
25644
25645    /// Sets the value of [name][crate::model::DeleteServingConfigRequest::name].
25646    ///
25647    /// # Example
25648    /// ```ignore,no_run
25649    /// # use google_cloud_retail_v2::model::DeleteServingConfigRequest;
25650    /// let x = DeleteServingConfigRequest::new().set_name("example");
25651    /// ```
25652    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25653        self.name = v.into();
25654        self
25655    }
25656}
25657
25658impl wkt::message::Message for DeleteServingConfigRequest {
25659    fn typename() -> &'static str {
25660        "type.googleapis.com/google.cloud.retail.v2.DeleteServingConfigRequest"
25661    }
25662}
25663
25664/// Request for GetServingConfig method.
25665#[derive(Clone, Default, PartialEq)]
25666#[non_exhaustive]
25667pub struct GetServingConfigRequest {
25668    /// Required. The resource name of the ServingConfig to get. Format:
25669    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25670    pub name: std::string::String,
25671
25672    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25673}
25674
25675impl GetServingConfigRequest {
25676    pub fn new() -> Self {
25677        std::default::Default::default()
25678    }
25679
25680    /// Sets the value of [name][crate::model::GetServingConfigRequest::name].
25681    ///
25682    /// # Example
25683    /// ```ignore,no_run
25684    /// # use google_cloud_retail_v2::model::GetServingConfigRequest;
25685    /// let x = GetServingConfigRequest::new().set_name("example");
25686    /// ```
25687    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25688        self.name = v.into();
25689        self
25690    }
25691}
25692
25693impl wkt::message::Message for GetServingConfigRequest {
25694    fn typename() -> &'static str {
25695        "type.googleapis.com/google.cloud.retail.v2.GetServingConfigRequest"
25696    }
25697}
25698
25699/// Request for ListServingConfigs method.
25700#[derive(Clone, Default, PartialEq)]
25701#[non_exhaustive]
25702pub struct ListServingConfigsRequest {
25703    /// Required. The catalog resource name. Format:
25704    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25705    pub parent: std::string::String,
25706
25707    /// Optional. Maximum number of results to return. If unspecified, defaults
25708    /// to 100. If a value greater than 100 is provided, at most 100 results are
25709    /// returned.
25710    pub page_size: i32,
25711
25712    /// Optional. A page token, received from a previous `ListServingConfigs` call.
25713    /// Provide this to retrieve the subsequent page.
25714    pub page_token: std::string::String,
25715
25716    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25717}
25718
25719impl ListServingConfigsRequest {
25720    pub fn new() -> Self {
25721        std::default::Default::default()
25722    }
25723
25724    /// Sets the value of [parent][crate::model::ListServingConfigsRequest::parent].
25725    ///
25726    /// # Example
25727    /// ```ignore,no_run
25728    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25729    /// let x = ListServingConfigsRequest::new().set_parent("example");
25730    /// ```
25731    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25732        self.parent = v.into();
25733        self
25734    }
25735
25736    /// Sets the value of [page_size][crate::model::ListServingConfigsRequest::page_size].
25737    ///
25738    /// # Example
25739    /// ```ignore,no_run
25740    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25741    /// let x = ListServingConfigsRequest::new().set_page_size(42);
25742    /// ```
25743    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25744        self.page_size = v.into();
25745        self
25746    }
25747
25748    /// Sets the value of [page_token][crate::model::ListServingConfigsRequest::page_token].
25749    ///
25750    /// # Example
25751    /// ```ignore,no_run
25752    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25753    /// let x = ListServingConfigsRequest::new().set_page_token("example");
25754    /// ```
25755    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25756        self.page_token = v.into();
25757        self
25758    }
25759}
25760
25761impl wkt::message::Message for ListServingConfigsRequest {
25762    fn typename() -> &'static str {
25763        "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsRequest"
25764    }
25765}
25766
25767/// Response for ListServingConfigs method.
25768#[derive(Clone, Default, PartialEq)]
25769#[non_exhaustive]
25770pub struct ListServingConfigsResponse {
25771    /// All the ServingConfigs for a given catalog.
25772    pub serving_configs: std::vec::Vec<crate::model::ServingConfig>,
25773
25774    /// Pagination token, if not returned indicates the last page.
25775    pub next_page_token: std::string::String,
25776
25777    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25778}
25779
25780impl ListServingConfigsResponse {
25781    pub fn new() -> Self {
25782        std::default::Default::default()
25783    }
25784
25785    /// Sets the value of [serving_configs][crate::model::ListServingConfigsResponse::serving_configs].
25786    ///
25787    /// # Example
25788    /// ```ignore,no_run
25789    /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
25790    /// use google_cloud_retail_v2::model::ServingConfig;
25791    /// let x = ListServingConfigsResponse::new()
25792    ///     .set_serving_configs([
25793    ///         ServingConfig::default()/* use setters */,
25794    ///         ServingConfig::default()/* use (different) setters */,
25795    ///     ]);
25796    /// ```
25797    pub fn set_serving_configs<T, V>(mut self, v: T) -> Self
25798    where
25799        T: std::iter::IntoIterator<Item = V>,
25800        V: std::convert::Into<crate::model::ServingConfig>,
25801    {
25802        use std::iter::Iterator;
25803        self.serving_configs = v.into_iter().map(|i| i.into()).collect();
25804        self
25805    }
25806
25807    /// Sets the value of [next_page_token][crate::model::ListServingConfigsResponse::next_page_token].
25808    ///
25809    /// # Example
25810    /// ```ignore,no_run
25811    /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
25812    /// let x = ListServingConfigsResponse::new().set_next_page_token("example");
25813    /// ```
25814    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25815        self.next_page_token = v.into();
25816        self
25817    }
25818}
25819
25820impl wkt::message::Message for ListServingConfigsResponse {
25821    fn typename() -> &'static str {
25822        "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsResponse"
25823    }
25824}
25825
25826#[doc(hidden)]
25827impl gax::paginator::internal::PageableResponse for ListServingConfigsResponse {
25828    type PageItem = crate::model::ServingConfig;
25829
25830    fn items(self) -> std::vec::Vec<Self::PageItem> {
25831        self.serving_configs
25832    }
25833
25834    fn next_page_token(&self) -> std::string::String {
25835        use std::clone::Clone;
25836        self.next_page_token.clone()
25837    }
25838}
25839
25840/// Request for AddControl method.
25841#[derive(Clone, Default, PartialEq)]
25842#[non_exhaustive]
25843pub struct AddControlRequest {
25844    /// Required. The source ServingConfig resource name . Format:
25845    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25846    pub serving_config: std::string::String,
25847
25848    /// Required. The id of the control to apply. Assumed to be in the same catalog
25849    /// as the serving config - if id is not found a NOT_FOUND error is returned.
25850    pub control_id: std::string::String,
25851
25852    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25853}
25854
25855impl AddControlRequest {
25856    pub fn new() -> Self {
25857        std::default::Default::default()
25858    }
25859
25860    /// Sets the value of [serving_config][crate::model::AddControlRequest::serving_config].
25861    ///
25862    /// # Example
25863    /// ```ignore,no_run
25864    /// # use google_cloud_retail_v2::model::AddControlRequest;
25865    /// let x = AddControlRequest::new().set_serving_config("example");
25866    /// ```
25867    pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25868        self.serving_config = v.into();
25869        self
25870    }
25871
25872    /// Sets the value of [control_id][crate::model::AddControlRequest::control_id].
25873    ///
25874    /// # Example
25875    /// ```ignore,no_run
25876    /// # use google_cloud_retail_v2::model::AddControlRequest;
25877    /// let x = AddControlRequest::new().set_control_id("example");
25878    /// ```
25879    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25880        self.control_id = v.into();
25881        self
25882    }
25883}
25884
25885impl wkt::message::Message for AddControlRequest {
25886    fn typename() -> &'static str {
25887        "type.googleapis.com/google.cloud.retail.v2.AddControlRequest"
25888    }
25889}
25890
25891/// Request for RemoveControl method.
25892#[derive(Clone, Default, PartialEq)]
25893#[non_exhaustive]
25894pub struct RemoveControlRequest {
25895    /// Required. The source ServingConfig resource name . Format:
25896    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25897    pub serving_config: std::string::String,
25898
25899    /// Required. The id of the control to apply. Assumed to be in the same catalog
25900    /// as the serving config.
25901    pub control_id: std::string::String,
25902
25903    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25904}
25905
25906impl RemoveControlRequest {
25907    pub fn new() -> Self {
25908        std::default::Default::default()
25909    }
25910
25911    /// Sets the value of [serving_config][crate::model::RemoveControlRequest::serving_config].
25912    ///
25913    /// # Example
25914    /// ```ignore,no_run
25915    /// # use google_cloud_retail_v2::model::RemoveControlRequest;
25916    /// let x = RemoveControlRequest::new().set_serving_config("example");
25917    /// ```
25918    pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25919        self.serving_config = v.into();
25920        self
25921    }
25922
25923    /// Sets the value of [control_id][crate::model::RemoveControlRequest::control_id].
25924    ///
25925    /// # Example
25926    /// ```ignore,no_run
25927    /// # use google_cloud_retail_v2::model::RemoveControlRequest;
25928    /// let x = RemoveControlRequest::new().set_control_id("example");
25929    /// ```
25930    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25931        self.control_id = v.into();
25932        self
25933    }
25934}
25935
25936impl wkt::message::Message for RemoveControlRequest {
25937    fn typename() -> &'static str {
25938        "type.googleapis.com/google.cloud.retail.v2.RemoveControlRequest"
25939    }
25940}
25941
25942/// UserEvent captures all metadata information Retail API needs to know about
25943/// how end users interact with customers' website.
25944#[derive(Clone, Default, PartialEq)]
25945#[non_exhaustive]
25946pub struct UserEvent {
25947    /// Required. User event type. Allowed values are:
25948    ///
25949    /// * `add-to-cart`: Products being added to cart.
25950    /// * `remove-from-cart`: Products being removed from cart.
25951    /// * `category-page-view`: Special pages such as sale or promotion pages
25952    ///   viewed.
25953    /// * `detail-page-view`: Products detail page viewed.
25954    /// * `home-page-view`: Homepage viewed.
25955    /// * `purchase-complete`: User finishing a purchase.
25956    /// * `search`: Product search.
25957    /// * `shopping-cart-page-view`: User viewing a shopping cart.
25958    pub event_type: std::string::String,
25959
25960    /// Required. A unique identifier for tracking visitors.
25961    ///
25962    /// For example, this could be implemented with an HTTP cookie, which should be
25963    /// able to uniquely identify a visitor on a single device. This unique
25964    /// identifier should not change if the visitor log in/out of the website.
25965    ///
25966    /// Don't set the field to the same fixed ID for different users. This mixes
25967    /// the event history of those users together, which results in degraded model
25968    /// quality.
25969    ///
25970    /// The field must be a UTF-8 encoded string with a length limit of 128
25971    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
25972    ///
25973    /// The field should not contain PII or user-data. We recommend to use Google
25974    /// Analytics [Client
25975    /// ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
25976    /// for this field.
25977    pub visitor_id: std::string::String,
25978
25979    /// A unique identifier for tracking a visitor session with a length limit of
25980    /// 128 bytes. A session is an aggregation of an end user behavior in a time
25981    /// span.
25982    ///
25983    /// A general guideline to populate the session_id:
25984    ///
25985    /// 1. If user has no activity for 30 min, a new session_id should be assigned.
25986    /// 1. The session_id should be unique across users, suggest use uuid or add
25987    ///    visitor_id as prefix.
25988    pub session_id: std::string::String,
25989
25990    /// Only required for
25991    /// [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
25992    /// method. Timestamp of when the user event happened.
25993    ///
25994    /// [google.cloud.retail.v2.UserEventService.ImportUserEvents]: crate::client::UserEventService::import_user_events
25995    pub event_time: std::option::Option<wkt::Timestamp>,
25996
25997    /// A list of identifiers for the independent experiment groups this user event
25998    /// belongs to. This is used to distinguish between user events associated with
25999    /// different experiment setups (e.g. using Retail API, using different
26000    /// recommendation models).
26001    pub experiment_ids: std::vec::Vec<std::string::String>,
26002
26003    /// Highly recommended for user events that are the result of
26004    /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26005    /// This field enables accurate attribution of recommendation model
26006    /// performance.
26007    ///
26008    /// The value must be a valid
26009    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26010    /// for user events that are the result of
26011    /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26012    /// The value must be a valid
26013    /// [SearchResponse.attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
26014    /// for user events that are the result of
26015    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
26016    ///
26017    /// This token enables us to accurately attribute page view or purchase back to
26018    /// the event and the particular predict response containing this
26019    /// clicked/purchased product. If user clicks on product K in the
26020    /// recommendation results, pass
26021    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26022    /// as a URL parameter to product K's page. When recording events on product
26023    /// K's page, log the
26024    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26025    /// to this field.
26026    ///
26027    /// [google.cloud.retail.v2.PredictResponse.attribution_token]: crate::model::PredictResponse::attribution_token
26028    /// [google.cloud.retail.v2.PredictionService.Predict]: crate::client::PredictionService::predict
26029    /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
26030    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
26031    pub attribution_token: std::string::String,
26032
26033    /// The main product details related to the event.
26034    ///
26035    /// This field is optional except for the following event types:
26036    ///
26037    /// * `add-to-cart`
26038    /// * `detail-page-view`
26039    /// * `purchase-complete`
26040    ///
26041    /// In a `search` event, this field represents the products returned to the end
26042    /// user on the current page (the end user may have not finished browsing the
26043    /// whole page yet). When a new page is returned to the end user, after
26044    /// pagination/filtering/ordering even for the same query, a new `search` event
26045    /// with different
26046    /// [product_details][google.cloud.retail.v2.UserEvent.product_details] is
26047    /// desired. The end user may have not finished browsing the whole page yet.
26048    ///
26049    /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
26050    pub product_details: std::vec::Vec<crate::model::ProductDetail>,
26051
26052    /// The main auto-completion details related to the event.
26053    ///
26054    /// This field should be set for `search` event when autocomplete function is
26055    /// enabled and the user clicks a suggestion for search.
26056    pub completion_detail: std::option::Option<crate::model::CompletionDetail>,
26057
26058    /// Extra user event features to include in the recommendation model.
26059    ///
26060    /// If you provide custom attributes for ingested user events, also include
26061    /// them in the user events that you associate with prediction requests. Custom
26062    /// attribute formatting must be consistent between imported events and events
26063    /// provided with prediction requests. This lets the Retail API use
26064    /// those custom attributes when training models and serving predictions, which
26065    /// helps improve recommendation quality.
26066    ///
26067    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
26068    /// error is returned:
26069    ///
26070    /// * The key must be a UTF-8 encoded string with a length limit of 5,000
26071    ///   characters.
26072    /// * For text attributes, at most 400 values are allowed. Empty values are not
26073    ///   allowed. Each value must be a UTF-8 encoded string with a length limit of
26074    ///   256 characters.
26075    /// * For number attributes, at most 400 values are allowed.
26076    ///
26077    /// For product recommendations, an example of extra user information is
26078    /// traffic_channel, which is how a user arrives at the site. Users can arrive
26079    /// at the site by coming to the site directly, coming through Google
26080    /// search, or in other ways.
26081    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
26082
26083    /// The ID or name of the associated shopping cart. This ID is used
26084    /// to associate multiple items added or present in the cart before purchase.
26085    ///
26086    /// This can only be set for `add-to-cart`, `purchase-complete`, or
26087    /// `shopping-cart-page-view` events.
26088    pub cart_id: std::string::String,
26089
26090    /// A transaction represents the entire purchase transaction.
26091    ///
26092    /// Required for `purchase-complete` events. Other event types should not set
26093    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26094    pub purchase_transaction: std::option::Option<crate::model::PurchaseTransaction>,
26095
26096    /// The user's search query.
26097    ///
26098    /// See [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] for
26099    /// definition.
26100    ///
26101    /// The value must be a UTF-8 encoded string with a length limit of 5,000
26102    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26103    ///
26104    /// At least one of
26105    /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26106    /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26107    /// required for `search` events. Other event types should not set this field.
26108    /// Otherwise, an INVALID_ARGUMENT error is returned.
26109    ///
26110    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
26111    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26112    /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26113    pub search_query: std::string::String,
26114
26115    /// The filter syntax consists of an expression language for constructing a
26116    /// predicate from one or more fields of the products being filtered.
26117    ///
26118    /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
26119    /// definition and syntax.
26120    ///
26121    /// The value must be a UTF-8 encoded string with a length limit of 1,000
26122    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26123    ///
26124    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
26125    pub filter: std::string::String,
26126
26127    /// The order in which products are returned.
26128    ///
26129    /// See [SearchRequest.order_by][google.cloud.retail.v2.SearchRequest.order_by]
26130    /// for definition and syntax.
26131    ///
26132    /// The value must be a UTF-8 encoded string with a length limit of 1,000
26133    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26134    ///
26135    /// This can only be set for `search` events. Other event types should not set
26136    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26137    ///
26138    /// [google.cloud.retail.v2.SearchRequest.order_by]: crate::model::SearchRequest::order_by
26139    pub order_by: std::string::String,
26140
26141    /// An integer that specifies the current offset for pagination (the 0-indexed
26142    /// starting location, amongst the products deemed by the API as relevant).
26143    ///
26144    /// See [SearchRequest.offset][google.cloud.retail.v2.SearchRequest.offset] for
26145    /// definition.
26146    ///
26147    /// If this field is negative, an INVALID_ARGUMENT is returned.
26148    ///
26149    /// This can only be set for `search` events. Other event types should not set
26150    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26151    ///
26152    /// [google.cloud.retail.v2.SearchRequest.offset]: crate::model::SearchRequest::offset
26153    pub offset: i32,
26154
26155    /// The categories associated with a category page.
26156    ///
26157    /// To represent full path of category, use '>' sign to separate different
26158    /// hierarchies. If '>' is part of the category name, replace it with
26159    /// other character(s).
26160    ///
26161    /// Category pages include special pages such as sales or promotions. For
26162    /// instance, a special sale page may have the category hierarchy:
26163    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
26164    ///
26165    /// Required for `category-page-view` events. At least one of
26166    /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26167    /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26168    /// required for `search` events. Other event types should not set this field.
26169    /// Otherwise, an INVALID_ARGUMENT error is returned.
26170    ///
26171    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26172    /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26173    pub page_categories: std::vec::Vec<std::string::String>,
26174
26175    /// User information.
26176    pub user_info: std::option::Option<crate::model::UserInfo>,
26177
26178    /// Complete URL (window.location.href) of the user's current page.
26179    ///
26180    /// When using the client side event reporting with JavaScript pixel and Google
26181    /// Tag Manager, this value is filled in automatically. Maximum length 5,000
26182    /// characters.
26183    pub uri: std::string::String,
26184
26185    /// The referrer URL of the current page.
26186    ///
26187    /// When using the client side event reporting with JavaScript pixel and Google
26188    /// Tag Manager, this value is filled in automatically.
26189    pub referrer_uri: std::string::String,
26190
26191    /// A unique ID of a web page view.
26192    ///
26193    /// This should be kept the same for all user events triggered from the same
26194    /// pageview. For example, an item detail page view could trigger multiple
26195    /// events as the user is browsing the page. The `pageViewId` property should
26196    /// be kept the same for all these events so that they can be grouped together
26197    /// properly.
26198    ///
26199    /// When using the client side event reporting with JavaScript pixel and Google
26200    /// Tag Manager, this value is filled in automatically.
26201    pub page_view_id: std::string::String,
26202
26203    /// The entity for customers that may run multiple different entities, domains,
26204    /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
26205    /// `google.com`, `youtube.com`, etc.
26206    /// We recommend that you set this field to get better per-entity search,
26207    /// completion, and prediction results.
26208    pub entity: std::string::String,
26209
26210    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26211}
26212
26213impl UserEvent {
26214    pub fn new() -> Self {
26215        std::default::Default::default()
26216    }
26217
26218    /// Sets the value of [event_type][crate::model::UserEvent::event_type].
26219    ///
26220    /// # Example
26221    /// ```ignore,no_run
26222    /// # use google_cloud_retail_v2::model::UserEvent;
26223    /// let x = UserEvent::new().set_event_type("example");
26224    /// ```
26225    pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26226        self.event_type = v.into();
26227        self
26228    }
26229
26230    /// Sets the value of [visitor_id][crate::model::UserEvent::visitor_id].
26231    ///
26232    /// # Example
26233    /// ```ignore,no_run
26234    /// # use google_cloud_retail_v2::model::UserEvent;
26235    /// let x = UserEvent::new().set_visitor_id("example");
26236    /// ```
26237    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26238        self.visitor_id = v.into();
26239        self
26240    }
26241
26242    /// Sets the value of [session_id][crate::model::UserEvent::session_id].
26243    ///
26244    /// # Example
26245    /// ```ignore,no_run
26246    /// # use google_cloud_retail_v2::model::UserEvent;
26247    /// let x = UserEvent::new().set_session_id("example");
26248    /// ```
26249    pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26250        self.session_id = v.into();
26251        self
26252    }
26253
26254    /// Sets the value of [event_time][crate::model::UserEvent::event_time].
26255    ///
26256    /// # Example
26257    /// ```ignore,no_run
26258    /// # use google_cloud_retail_v2::model::UserEvent;
26259    /// use wkt::Timestamp;
26260    /// let x = UserEvent::new().set_event_time(Timestamp::default()/* use setters */);
26261    /// ```
26262    pub fn set_event_time<T>(mut self, v: T) -> Self
26263    where
26264        T: std::convert::Into<wkt::Timestamp>,
26265    {
26266        self.event_time = std::option::Option::Some(v.into());
26267        self
26268    }
26269
26270    /// Sets or clears the value of [event_time][crate::model::UserEvent::event_time].
26271    ///
26272    /// # Example
26273    /// ```ignore,no_run
26274    /// # use google_cloud_retail_v2::model::UserEvent;
26275    /// use wkt::Timestamp;
26276    /// let x = UserEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
26277    /// let x = UserEvent::new().set_or_clear_event_time(None::<Timestamp>);
26278    /// ```
26279    pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
26280    where
26281        T: std::convert::Into<wkt::Timestamp>,
26282    {
26283        self.event_time = v.map(|x| x.into());
26284        self
26285    }
26286
26287    /// Sets the value of [experiment_ids][crate::model::UserEvent::experiment_ids].
26288    ///
26289    /// # Example
26290    /// ```ignore,no_run
26291    /// # use google_cloud_retail_v2::model::UserEvent;
26292    /// let x = UserEvent::new().set_experiment_ids(["a", "b", "c"]);
26293    /// ```
26294    pub fn set_experiment_ids<T, V>(mut self, v: T) -> Self
26295    where
26296        T: std::iter::IntoIterator<Item = V>,
26297        V: std::convert::Into<std::string::String>,
26298    {
26299        use std::iter::Iterator;
26300        self.experiment_ids = v.into_iter().map(|i| i.into()).collect();
26301        self
26302    }
26303
26304    /// Sets the value of [attribution_token][crate::model::UserEvent::attribution_token].
26305    ///
26306    /// # Example
26307    /// ```ignore,no_run
26308    /// # use google_cloud_retail_v2::model::UserEvent;
26309    /// let x = UserEvent::new().set_attribution_token("example");
26310    /// ```
26311    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
26312        mut self,
26313        v: T,
26314    ) -> Self {
26315        self.attribution_token = v.into();
26316        self
26317    }
26318
26319    /// Sets the value of [product_details][crate::model::UserEvent::product_details].
26320    ///
26321    /// # Example
26322    /// ```ignore,no_run
26323    /// # use google_cloud_retail_v2::model::UserEvent;
26324    /// use google_cloud_retail_v2::model::ProductDetail;
26325    /// let x = UserEvent::new()
26326    ///     .set_product_details([
26327    ///         ProductDetail::default()/* use setters */,
26328    ///         ProductDetail::default()/* use (different) setters */,
26329    ///     ]);
26330    /// ```
26331    pub fn set_product_details<T, V>(mut self, v: T) -> Self
26332    where
26333        T: std::iter::IntoIterator<Item = V>,
26334        V: std::convert::Into<crate::model::ProductDetail>,
26335    {
26336        use std::iter::Iterator;
26337        self.product_details = v.into_iter().map(|i| i.into()).collect();
26338        self
26339    }
26340
26341    /// Sets the value of [completion_detail][crate::model::UserEvent::completion_detail].
26342    ///
26343    /// # Example
26344    /// ```ignore,no_run
26345    /// # use google_cloud_retail_v2::model::UserEvent;
26346    /// use google_cloud_retail_v2::model::CompletionDetail;
26347    /// let x = UserEvent::new().set_completion_detail(CompletionDetail::default()/* use setters */);
26348    /// ```
26349    pub fn set_completion_detail<T>(mut self, v: T) -> Self
26350    where
26351        T: std::convert::Into<crate::model::CompletionDetail>,
26352    {
26353        self.completion_detail = std::option::Option::Some(v.into());
26354        self
26355    }
26356
26357    /// Sets or clears the value of [completion_detail][crate::model::UserEvent::completion_detail].
26358    ///
26359    /// # Example
26360    /// ```ignore,no_run
26361    /// # use google_cloud_retail_v2::model::UserEvent;
26362    /// use google_cloud_retail_v2::model::CompletionDetail;
26363    /// let x = UserEvent::new().set_or_clear_completion_detail(Some(CompletionDetail::default()/* use setters */));
26364    /// let x = UserEvent::new().set_or_clear_completion_detail(None::<CompletionDetail>);
26365    /// ```
26366    pub fn set_or_clear_completion_detail<T>(mut self, v: std::option::Option<T>) -> Self
26367    where
26368        T: std::convert::Into<crate::model::CompletionDetail>,
26369    {
26370        self.completion_detail = v.map(|x| x.into());
26371        self
26372    }
26373
26374    /// Sets the value of [attributes][crate::model::UserEvent::attributes].
26375    ///
26376    /// # Example
26377    /// ```ignore,no_run
26378    /// # use google_cloud_retail_v2::model::UserEvent;
26379    /// use google_cloud_retail_v2::model::CustomAttribute;
26380    /// let x = UserEvent::new().set_attributes([
26381    ///     ("key0", CustomAttribute::default()/* use setters */),
26382    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
26383    /// ]);
26384    /// ```
26385    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
26386    where
26387        T: std::iter::IntoIterator<Item = (K, V)>,
26388        K: std::convert::Into<std::string::String>,
26389        V: std::convert::Into<crate::model::CustomAttribute>,
26390    {
26391        use std::iter::Iterator;
26392        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26393        self
26394    }
26395
26396    /// Sets the value of [cart_id][crate::model::UserEvent::cart_id].
26397    ///
26398    /// # Example
26399    /// ```ignore,no_run
26400    /// # use google_cloud_retail_v2::model::UserEvent;
26401    /// let x = UserEvent::new().set_cart_id("example");
26402    /// ```
26403    pub fn set_cart_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26404        self.cart_id = v.into();
26405        self
26406    }
26407
26408    /// Sets the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26409    ///
26410    /// # Example
26411    /// ```ignore,no_run
26412    /// # use google_cloud_retail_v2::model::UserEvent;
26413    /// use google_cloud_retail_v2::model::PurchaseTransaction;
26414    /// let x = UserEvent::new().set_purchase_transaction(PurchaseTransaction::default()/* use setters */);
26415    /// ```
26416    pub fn set_purchase_transaction<T>(mut self, v: T) -> Self
26417    where
26418        T: std::convert::Into<crate::model::PurchaseTransaction>,
26419    {
26420        self.purchase_transaction = std::option::Option::Some(v.into());
26421        self
26422    }
26423
26424    /// Sets or clears the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26425    ///
26426    /// # Example
26427    /// ```ignore,no_run
26428    /// # use google_cloud_retail_v2::model::UserEvent;
26429    /// use google_cloud_retail_v2::model::PurchaseTransaction;
26430    /// let x = UserEvent::new().set_or_clear_purchase_transaction(Some(PurchaseTransaction::default()/* use setters */));
26431    /// let x = UserEvent::new().set_or_clear_purchase_transaction(None::<PurchaseTransaction>);
26432    /// ```
26433    pub fn set_or_clear_purchase_transaction<T>(mut self, v: std::option::Option<T>) -> Self
26434    where
26435        T: std::convert::Into<crate::model::PurchaseTransaction>,
26436    {
26437        self.purchase_transaction = v.map(|x| x.into());
26438        self
26439    }
26440
26441    /// Sets the value of [search_query][crate::model::UserEvent::search_query].
26442    ///
26443    /// # Example
26444    /// ```ignore,no_run
26445    /// # use google_cloud_retail_v2::model::UserEvent;
26446    /// let x = UserEvent::new().set_search_query("example");
26447    /// ```
26448    pub fn set_search_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26449        self.search_query = v.into();
26450        self
26451    }
26452
26453    /// Sets the value of [filter][crate::model::UserEvent::filter].
26454    ///
26455    /// # Example
26456    /// ```ignore,no_run
26457    /// # use google_cloud_retail_v2::model::UserEvent;
26458    /// let x = UserEvent::new().set_filter("example");
26459    /// ```
26460    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26461        self.filter = v.into();
26462        self
26463    }
26464
26465    /// Sets the value of [order_by][crate::model::UserEvent::order_by].
26466    ///
26467    /// # Example
26468    /// ```ignore,no_run
26469    /// # use google_cloud_retail_v2::model::UserEvent;
26470    /// let x = UserEvent::new().set_order_by("example");
26471    /// ```
26472    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26473        self.order_by = v.into();
26474        self
26475    }
26476
26477    /// Sets the value of [offset][crate::model::UserEvent::offset].
26478    ///
26479    /// # Example
26480    /// ```ignore,no_run
26481    /// # use google_cloud_retail_v2::model::UserEvent;
26482    /// let x = UserEvent::new().set_offset(42);
26483    /// ```
26484    pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26485        self.offset = v.into();
26486        self
26487    }
26488
26489    /// Sets the value of [page_categories][crate::model::UserEvent::page_categories].
26490    ///
26491    /// # Example
26492    /// ```ignore,no_run
26493    /// # use google_cloud_retail_v2::model::UserEvent;
26494    /// let x = UserEvent::new().set_page_categories(["a", "b", "c"]);
26495    /// ```
26496    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
26497    where
26498        T: std::iter::IntoIterator<Item = V>,
26499        V: std::convert::Into<std::string::String>,
26500    {
26501        use std::iter::Iterator;
26502        self.page_categories = v.into_iter().map(|i| i.into()).collect();
26503        self
26504    }
26505
26506    /// Sets the value of [user_info][crate::model::UserEvent::user_info].
26507    ///
26508    /// # Example
26509    /// ```ignore,no_run
26510    /// # use google_cloud_retail_v2::model::UserEvent;
26511    /// use google_cloud_retail_v2::model::UserInfo;
26512    /// let x = UserEvent::new().set_user_info(UserInfo::default()/* use setters */);
26513    /// ```
26514    pub fn set_user_info<T>(mut self, v: T) -> Self
26515    where
26516        T: std::convert::Into<crate::model::UserInfo>,
26517    {
26518        self.user_info = std::option::Option::Some(v.into());
26519        self
26520    }
26521
26522    /// Sets or clears the value of [user_info][crate::model::UserEvent::user_info].
26523    ///
26524    /// # Example
26525    /// ```ignore,no_run
26526    /// # use google_cloud_retail_v2::model::UserEvent;
26527    /// use google_cloud_retail_v2::model::UserInfo;
26528    /// let x = UserEvent::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
26529    /// let x = UserEvent::new().set_or_clear_user_info(None::<UserInfo>);
26530    /// ```
26531    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
26532    where
26533        T: std::convert::Into<crate::model::UserInfo>,
26534    {
26535        self.user_info = v.map(|x| x.into());
26536        self
26537    }
26538
26539    /// Sets the value of [uri][crate::model::UserEvent::uri].
26540    ///
26541    /// # Example
26542    /// ```ignore,no_run
26543    /// # use google_cloud_retail_v2::model::UserEvent;
26544    /// let x = UserEvent::new().set_uri("example");
26545    /// ```
26546    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26547        self.uri = v.into();
26548        self
26549    }
26550
26551    /// Sets the value of [referrer_uri][crate::model::UserEvent::referrer_uri].
26552    ///
26553    /// # Example
26554    /// ```ignore,no_run
26555    /// # use google_cloud_retail_v2::model::UserEvent;
26556    /// let x = UserEvent::new().set_referrer_uri("example");
26557    /// ```
26558    pub fn set_referrer_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26559        self.referrer_uri = v.into();
26560        self
26561    }
26562
26563    /// Sets the value of [page_view_id][crate::model::UserEvent::page_view_id].
26564    ///
26565    /// # Example
26566    /// ```ignore,no_run
26567    /// # use google_cloud_retail_v2::model::UserEvent;
26568    /// let x = UserEvent::new().set_page_view_id("example");
26569    /// ```
26570    pub fn set_page_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26571        self.page_view_id = v.into();
26572        self
26573    }
26574
26575    /// Sets the value of [entity][crate::model::UserEvent::entity].
26576    ///
26577    /// # Example
26578    /// ```ignore,no_run
26579    /// # use google_cloud_retail_v2::model::UserEvent;
26580    /// let x = UserEvent::new().set_entity("example");
26581    /// ```
26582    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26583        self.entity = v.into();
26584        self
26585    }
26586}
26587
26588impl wkt::message::Message for UserEvent {
26589    fn typename() -> &'static str {
26590        "type.googleapis.com/google.cloud.retail.v2.UserEvent"
26591    }
26592}
26593
26594/// Detailed product information associated with a user event.
26595#[derive(Clone, Default, PartialEq)]
26596#[non_exhaustive]
26597pub struct ProductDetail {
26598    /// Required. [Product][google.cloud.retail.v2.Product] information.
26599    ///
26600    /// Required field(s):
26601    ///
26602    /// * [Product.id][google.cloud.retail.v2.Product.id]
26603    ///
26604    /// Optional override field(s):
26605    ///
26606    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
26607    ///
26608    /// If any supported optional fields are provided, we will treat them as a full
26609    /// override when looking up product information from the catalog. Thus, it is
26610    /// important to ensure that the overriding fields are accurate and
26611    /// complete.
26612    ///
26613    /// All other product fields are ignored and instead populated via catalog
26614    /// lookup after event ingestion.
26615    ///
26616    /// [google.cloud.retail.v2.Product]: crate::model::Product
26617    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
26618    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
26619    pub product: std::option::Option<crate::model::Product>,
26620
26621    /// Quantity of the product associated with the user event.
26622    ///
26623    /// For example, this field will be 2 if two products are added to the shopping
26624    /// cart for `purchase-complete` event. Required for `add-to-cart` and
26625    /// `purchase-complete` event types.
26626    pub quantity: std::option::Option<wkt::Int32Value>,
26627
26628    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26629}
26630
26631impl ProductDetail {
26632    pub fn new() -> Self {
26633        std::default::Default::default()
26634    }
26635
26636    /// Sets the value of [product][crate::model::ProductDetail::product].
26637    ///
26638    /// # Example
26639    /// ```ignore,no_run
26640    /// # use google_cloud_retail_v2::model::ProductDetail;
26641    /// use google_cloud_retail_v2::model::Product;
26642    /// let x = ProductDetail::new().set_product(Product::default()/* use setters */);
26643    /// ```
26644    pub fn set_product<T>(mut self, v: T) -> Self
26645    where
26646        T: std::convert::Into<crate::model::Product>,
26647    {
26648        self.product = std::option::Option::Some(v.into());
26649        self
26650    }
26651
26652    /// Sets or clears the value of [product][crate::model::ProductDetail::product].
26653    ///
26654    /// # Example
26655    /// ```ignore,no_run
26656    /// # use google_cloud_retail_v2::model::ProductDetail;
26657    /// use google_cloud_retail_v2::model::Product;
26658    /// let x = ProductDetail::new().set_or_clear_product(Some(Product::default()/* use setters */));
26659    /// let x = ProductDetail::new().set_or_clear_product(None::<Product>);
26660    /// ```
26661    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
26662    where
26663        T: std::convert::Into<crate::model::Product>,
26664    {
26665        self.product = v.map(|x| x.into());
26666        self
26667    }
26668
26669    /// Sets the value of [quantity][crate::model::ProductDetail::quantity].
26670    ///
26671    /// # Example
26672    /// ```ignore,no_run
26673    /// # use google_cloud_retail_v2::model::ProductDetail;
26674    /// use wkt::Int32Value;
26675    /// let x = ProductDetail::new().set_quantity(Int32Value::default()/* use setters */);
26676    /// ```
26677    pub fn set_quantity<T>(mut self, v: T) -> Self
26678    where
26679        T: std::convert::Into<wkt::Int32Value>,
26680    {
26681        self.quantity = std::option::Option::Some(v.into());
26682        self
26683    }
26684
26685    /// Sets or clears the value of [quantity][crate::model::ProductDetail::quantity].
26686    ///
26687    /// # Example
26688    /// ```ignore,no_run
26689    /// # use google_cloud_retail_v2::model::ProductDetail;
26690    /// use wkt::Int32Value;
26691    /// let x = ProductDetail::new().set_or_clear_quantity(Some(Int32Value::default()/* use setters */));
26692    /// let x = ProductDetail::new().set_or_clear_quantity(None::<Int32Value>);
26693    /// ```
26694    pub fn set_or_clear_quantity<T>(mut self, v: std::option::Option<T>) -> Self
26695    where
26696        T: std::convert::Into<wkt::Int32Value>,
26697    {
26698        self.quantity = v.map(|x| x.into());
26699        self
26700    }
26701}
26702
26703impl wkt::message::Message for ProductDetail {
26704    fn typename() -> &'static str {
26705        "type.googleapis.com/google.cloud.retail.v2.ProductDetail"
26706    }
26707}
26708
26709/// Detailed completion information including completion attribution token and
26710/// clicked completion info.
26711#[derive(Clone, Default, PartialEq)]
26712#[non_exhaustive]
26713pub struct CompletionDetail {
26714    /// Completion attribution token in
26715    /// [CompleteQueryResponse.attribution_token][google.cloud.retail.v2.CompleteQueryResponse.attribution_token].
26716    ///
26717    /// [google.cloud.retail.v2.CompleteQueryResponse.attribution_token]: crate::model::CompleteQueryResponse::attribution_token
26718    pub completion_attribution_token: std::string::String,
26719
26720    /// End user selected
26721    /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion].
26722    ///
26723    /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26724    pub selected_suggestion: std::string::String,
26725
26726    /// End user selected
26727    /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]
26728    /// position, starting from 0.
26729    ///
26730    /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26731    pub selected_position: i32,
26732
26733    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26734}
26735
26736impl CompletionDetail {
26737    pub fn new() -> Self {
26738        std::default::Default::default()
26739    }
26740
26741    /// Sets the value of [completion_attribution_token][crate::model::CompletionDetail::completion_attribution_token].
26742    ///
26743    /// # Example
26744    /// ```ignore,no_run
26745    /// # use google_cloud_retail_v2::model::CompletionDetail;
26746    /// let x = CompletionDetail::new().set_completion_attribution_token("example");
26747    /// ```
26748    pub fn set_completion_attribution_token<T: std::convert::Into<std::string::String>>(
26749        mut self,
26750        v: T,
26751    ) -> Self {
26752        self.completion_attribution_token = v.into();
26753        self
26754    }
26755
26756    /// Sets the value of [selected_suggestion][crate::model::CompletionDetail::selected_suggestion].
26757    ///
26758    /// # Example
26759    /// ```ignore,no_run
26760    /// # use google_cloud_retail_v2::model::CompletionDetail;
26761    /// let x = CompletionDetail::new().set_selected_suggestion("example");
26762    /// ```
26763    pub fn set_selected_suggestion<T: std::convert::Into<std::string::String>>(
26764        mut self,
26765        v: T,
26766    ) -> Self {
26767        self.selected_suggestion = v.into();
26768        self
26769    }
26770
26771    /// Sets the value of [selected_position][crate::model::CompletionDetail::selected_position].
26772    ///
26773    /// # Example
26774    /// ```ignore,no_run
26775    /// # use google_cloud_retail_v2::model::CompletionDetail;
26776    /// let x = CompletionDetail::new().set_selected_position(42);
26777    /// ```
26778    pub fn set_selected_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26779        self.selected_position = v.into();
26780        self
26781    }
26782}
26783
26784impl wkt::message::Message for CompletionDetail {
26785    fn typename() -> &'static str {
26786        "type.googleapis.com/google.cloud.retail.v2.CompletionDetail"
26787    }
26788}
26789
26790/// A transaction represents the entire purchase transaction.
26791#[derive(Clone, Default, PartialEq)]
26792#[non_exhaustive]
26793pub struct PurchaseTransaction {
26794    /// The transaction ID with a length limit of 128 characters.
26795    pub id: std::string::String,
26796
26797    /// Required. Total non-zero revenue or grand total associated with the
26798    /// transaction. This value include shipping, tax, or other adjustments to
26799    /// total revenue that you want to include as part of your revenue
26800    /// calculations.
26801    pub revenue: f32,
26802
26803    /// All the taxes associated with the transaction.
26804    pub tax: f32,
26805
26806    /// All the costs associated with the products. These can be manufacturing
26807    /// costs, shipping expenses not borne by the end user, or any other costs,
26808    /// such that:
26809    ///
26810    /// * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
26811    ///   [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
26812    ///   [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
26813    ///
26814    /// [google.cloud.retail.v2.PurchaseTransaction.cost]: crate::model::PurchaseTransaction::cost
26815    /// [google.cloud.retail.v2.PurchaseTransaction.revenue]: crate::model::PurchaseTransaction::revenue
26816    /// [google.cloud.retail.v2.PurchaseTransaction.tax]: crate::model::PurchaseTransaction::tax
26817    pub cost: f32,
26818
26819    /// Required. Currency code. Use three-character ISO-4217 code.
26820    pub currency_code: std::string::String,
26821
26822    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26823}
26824
26825impl PurchaseTransaction {
26826    pub fn new() -> Self {
26827        std::default::Default::default()
26828    }
26829
26830    /// Sets the value of [id][crate::model::PurchaseTransaction::id].
26831    ///
26832    /// # Example
26833    /// ```ignore,no_run
26834    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26835    /// let x = PurchaseTransaction::new().set_id("example");
26836    /// ```
26837    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26838        self.id = v.into();
26839        self
26840    }
26841
26842    /// Sets the value of [revenue][crate::model::PurchaseTransaction::revenue].
26843    ///
26844    /// # Example
26845    /// ```ignore,no_run
26846    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26847    /// let x = PurchaseTransaction::new().set_revenue(42.0);
26848    /// ```
26849    pub fn set_revenue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26850        self.revenue = v.into();
26851        self
26852    }
26853
26854    /// Sets the value of [tax][crate::model::PurchaseTransaction::tax].
26855    ///
26856    /// # Example
26857    /// ```ignore,no_run
26858    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26859    /// let x = PurchaseTransaction::new().set_tax(42.0);
26860    /// ```
26861    pub fn set_tax<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26862        self.tax = v.into();
26863        self
26864    }
26865
26866    /// Sets the value of [cost][crate::model::PurchaseTransaction::cost].
26867    ///
26868    /// # Example
26869    /// ```ignore,no_run
26870    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26871    /// let x = PurchaseTransaction::new().set_cost(42.0);
26872    /// ```
26873    pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26874        self.cost = v.into();
26875        self
26876    }
26877
26878    /// Sets the value of [currency_code][crate::model::PurchaseTransaction::currency_code].
26879    ///
26880    /// # Example
26881    /// ```ignore,no_run
26882    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26883    /// let x = PurchaseTransaction::new().set_currency_code("example");
26884    /// ```
26885    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26886        self.currency_code = v.into();
26887        self
26888    }
26889}
26890
26891impl wkt::message::Message for PurchaseTransaction {
26892    fn typename() -> &'static str {
26893        "type.googleapis.com/google.cloud.retail.v2.PurchaseTransaction"
26894    }
26895}
26896
26897/// Request message for WriteUserEvent method.
26898#[derive(Clone, Default, PartialEq)]
26899#[non_exhaustive]
26900pub struct WriteUserEventRequest {
26901    /// Required. The parent catalog resource name, such as
26902    /// `projects/1234/locations/global/catalogs/default_catalog`.
26903    pub parent: std::string::String,
26904
26905    /// Required. User event to write.
26906    pub user_event: std::option::Option<crate::model::UserEvent>,
26907
26908    /// If set to true, the user event will be written asynchronously after
26909    /// validation, and the API will respond without waiting for the write.
26910    /// Therefore, silent failures can occur even if the API returns success. In
26911    /// case of silent failures, error messages can be found in Stackdriver logs.
26912    pub write_async: bool,
26913
26914    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26915}
26916
26917impl WriteUserEventRequest {
26918    pub fn new() -> Self {
26919        std::default::Default::default()
26920    }
26921
26922    /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
26923    ///
26924    /// # Example
26925    /// ```ignore,no_run
26926    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26927    /// let x = WriteUserEventRequest::new().set_parent("example");
26928    /// ```
26929    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26930        self.parent = v.into();
26931        self
26932    }
26933
26934    /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
26935    ///
26936    /// # Example
26937    /// ```ignore,no_run
26938    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26939    /// use google_cloud_retail_v2::model::UserEvent;
26940    /// let x = WriteUserEventRequest::new().set_user_event(UserEvent::default()/* use setters */);
26941    /// ```
26942    pub fn set_user_event<T>(mut self, v: T) -> Self
26943    where
26944        T: std::convert::Into<crate::model::UserEvent>,
26945    {
26946        self.user_event = std::option::Option::Some(v.into());
26947        self
26948    }
26949
26950    /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
26951    ///
26952    /// # Example
26953    /// ```ignore,no_run
26954    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26955    /// use google_cloud_retail_v2::model::UserEvent;
26956    /// let x = WriteUserEventRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
26957    /// let x = WriteUserEventRequest::new().set_or_clear_user_event(None::<UserEvent>);
26958    /// ```
26959    pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
26960    where
26961        T: std::convert::Into<crate::model::UserEvent>,
26962    {
26963        self.user_event = v.map(|x| x.into());
26964        self
26965    }
26966
26967    /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
26968    ///
26969    /// # Example
26970    /// ```ignore,no_run
26971    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26972    /// let x = WriteUserEventRequest::new().set_write_async(true);
26973    /// ```
26974    pub fn set_write_async<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
26975        self.write_async = v.into();
26976        self
26977    }
26978}
26979
26980impl wkt::message::Message for WriteUserEventRequest {
26981    fn typename() -> &'static str {
26982        "type.googleapis.com/google.cloud.retail.v2.WriteUserEventRequest"
26983    }
26984}
26985
26986/// Request message for CollectUserEvent method.
26987#[derive(Clone, Default, PartialEq)]
26988#[non_exhaustive]
26989pub struct CollectUserEventRequest {
26990    /// Required. The parent catalog name, such as
26991    /// `projects/1234/locations/global/catalogs/default_catalog`.
26992    pub parent: std::string::String,
26993
26994    /// Required. URL encoded UserEvent proto with a length limit of 2,000,000
26995    /// characters.
26996    pub user_event: std::string::String,
26997
26998    /// The URL including cgi-parameters but excluding the hash fragment with a
26999    /// length limit of 5,000 characters. This is often more useful than the
27000    /// referer URL, because many browsers only send the domain for 3rd party
27001    /// requests.
27002    pub uri: std::string::String,
27003
27004    /// The event timestamp in milliseconds. This prevents browser caching of
27005    /// otherwise identical get requests. The name is abbreviated to reduce the
27006    /// payload bytes.
27007    pub ets: i64,
27008
27009    /// An arbitrary serialized JSON string that contains necessary information
27010    /// that can comprise a user event. When this field is specified, the
27011    /// user_event field will be ignored. Note: line-delimited JSON is not
27012    /// supported, a single JSON only.
27013    pub raw_json: std::string::String,
27014
27015    /// The rule that can convert the raw_json to a user event. It is needed
27016    /// only when the raw_json is set.
27017    pub conversion_rule:
27018        std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27019
27020    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27021}
27022
27023impl CollectUserEventRequest {
27024    pub fn new() -> Self {
27025        std::default::Default::default()
27026    }
27027
27028    /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
27029    ///
27030    /// # Example
27031    /// ```ignore,no_run
27032    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27033    /// let x = CollectUserEventRequest::new().set_parent("example");
27034    /// ```
27035    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27036        self.parent = v.into();
27037        self
27038    }
27039
27040    /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
27041    ///
27042    /// # Example
27043    /// ```ignore,no_run
27044    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27045    /// let x = CollectUserEventRequest::new().set_user_event("example");
27046    /// ```
27047    pub fn set_user_event<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27048        self.user_event = v.into();
27049        self
27050    }
27051
27052    /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
27053    ///
27054    /// # Example
27055    /// ```ignore,no_run
27056    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27057    /// let x = CollectUserEventRequest::new().set_uri("example");
27058    /// ```
27059    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27060        self.uri = v.into();
27061        self
27062    }
27063
27064    /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
27065    ///
27066    /// # Example
27067    /// ```ignore,no_run
27068    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27069    /// let x = CollectUserEventRequest::new().set_ets(42);
27070    /// ```
27071    pub fn set_ets<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27072        self.ets = v.into();
27073        self
27074    }
27075
27076    /// Sets the value of [raw_json][crate::model::CollectUserEventRequest::raw_json].
27077    ///
27078    /// # Example
27079    /// ```ignore,no_run
27080    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27081    /// let x = CollectUserEventRequest::new().set_raw_json("example");
27082    /// ```
27083    pub fn set_raw_json<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27084        self.raw_json = v.into();
27085        self
27086    }
27087
27088    /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule].
27089    ///
27090    /// Note that all the setters affecting `conversion_rule` are mutually
27091    /// exclusive.
27092    ///
27093    /// # Example
27094    /// ```ignore,no_run
27095    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27096    /// use google_cloud_retail_v2::model::collect_user_event_request::ConversionRule;
27097    /// let x = CollectUserEventRequest::new().set_conversion_rule(Some(ConversionRule::PrebuiltRule("example".to_string())));
27098    /// ```
27099    pub fn set_conversion_rule<
27100        T: std::convert::Into<
27101                std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27102            >,
27103    >(
27104        mut self,
27105        v: T,
27106    ) -> Self {
27107        self.conversion_rule = v.into();
27108        self
27109    }
27110
27111    /// The value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27112    /// if it holds a `PrebuiltRule`, `None` if the field is not set or
27113    /// holds a different branch.
27114    pub fn prebuilt_rule(&self) -> std::option::Option<&std::string::String> {
27115        #[allow(unreachable_patterns)]
27116        self.conversion_rule.as_ref().and_then(|v| match v {
27117            crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v) => {
27118                std::option::Option::Some(v)
27119            }
27120            _ => std::option::Option::None,
27121        })
27122    }
27123
27124    /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27125    /// to hold a `PrebuiltRule`.
27126    ///
27127    /// Note that all the setters affecting `conversion_rule` are
27128    /// mutually exclusive.
27129    ///
27130    /// # Example
27131    /// ```ignore,no_run
27132    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27133    /// let x = CollectUserEventRequest::new().set_prebuilt_rule("example");
27134    /// assert!(x.prebuilt_rule().is_some());
27135    /// ```
27136    pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27137        self.conversion_rule = std::option::Option::Some(
27138            crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v.into()),
27139        );
27140        self
27141    }
27142}
27143
27144impl wkt::message::Message for CollectUserEventRequest {
27145    fn typename() -> &'static str {
27146        "type.googleapis.com/google.cloud.retail.v2.CollectUserEventRequest"
27147    }
27148}
27149
27150/// Defines additional types related to [CollectUserEventRequest].
27151pub mod collect_user_event_request {
27152    #[allow(unused_imports)]
27153    use super::*;
27154
27155    /// The rule that can convert the raw_json to a user event. It is needed
27156    /// only when the raw_json is set.
27157    #[derive(Clone, Debug, PartialEq)]
27158    #[non_exhaustive]
27159    pub enum ConversionRule {
27160        /// The prebuilt rule name that can convert a specific type of raw_json.
27161        /// For example: "ga4_bq" rule for the GA4 user event schema.
27162        PrebuiltRule(std::string::String),
27163    }
27164}
27165
27166/// Request message for RejoinUserEvents method.
27167#[derive(Clone, Default, PartialEq)]
27168#[non_exhaustive]
27169pub struct RejoinUserEventsRequest {
27170    /// Required. The parent catalog resource name, such as
27171    /// `projects/1234/locations/global/catalogs/default_catalog`.
27172    pub parent: std::string::String,
27173
27174    /// The type of the user event rejoin to define the scope and range of the user
27175    /// events to be rejoined with the latest product catalog. Defaults to
27176    /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
27177    /// an invalid integer value.
27178    pub user_event_rejoin_scope: crate::model::rejoin_user_events_request::UserEventRejoinScope,
27179
27180    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27181}
27182
27183impl RejoinUserEventsRequest {
27184    pub fn new() -> Self {
27185        std::default::Default::default()
27186    }
27187
27188    /// Sets the value of [parent][crate::model::RejoinUserEventsRequest::parent].
27189    ///
27190    /// # Example
27191    /// ```ignore,no_run
27192    /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27193    /// let x = RejoinUserEventsRequest::new().set_parent("example");
27194    /// ```
27195    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27196        self.parent = v.into();
27197        self
27198    }
27199
27200    /// Sets the value of [user_event_rejoin_scope][crate::model::RejoinUserEventsRequest::user_event_rejoin_scope].
27201    ///
27202    /// # Example
27203    /// ```ignore,no_run
27204    /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27205    /// use google_cloud_retail_v2::model::rejoin_user_events_request::UserEventRejoinScope;
27206    /// let x0 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::JoinedEvents);
27207    /// let x1 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::UnjoinedEvents);
27208    /// ```
27209    pub fn set_user_event_rejoin_scope<
27210        T: std::convert::Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
27211    >(
27212        mut self,
27213        v: T,
27214    ) -> Self {
27215        self.user_event_rejoin_scope = v.into();
27216        self
27217    }
27218}
27219
27220impl wkt::message::Message for RejoinUserEventsRequest {
27221    fn typename() -> &'static str {
27222        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsRequest"
27223    }
27224}
27225
27226/// Defines additional types related to [RejoinUserEventsRequest].
27227pub mod rejoin_user_events_request {
27228    #[allow(unused_imports)]
27229    use super::*;
27230
27231    /// The scope of user events to be rejoined with the latest product catalog.
27232    /// If the rejoining aims at reducing number of unjoined events, set
27233    /// `UserEventRejoinScope` to `UNJOINED_EVENTS`.
27234    /// If the rejoining aims at correcting product catalog information in joined
27235    /// events, set `UserEventRejoinScope` to `JOINED_EVENTS`.
27236    /// If all events needs to be rejoined, set `UserEventRejoinScope` to
27237    /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`.
27238    ///
27239    /// # Working with unknown values
27240    ///
27241    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27242    /// additional enum variants at any time. Adding new variants is not considered
27243    /// a breaking change. Applications should write their code in anticipation of:
27244    ///
27245    /// - New values appearing in future releases of the client library, **and**
27246    /// - New values received dynamically, without application changes.
27247    ///
27248    /// Please consult the [Working with enums] section in the user guide for some
27249    /// guidelines.
27250    ///
27251    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27252    #[derive(Clone, Debug, PartialEq)]
27253    #[non_exhaustive]
27254    pub enum UserEventRejoinScope {
27255        /// Rejoin all events with the latest product catalog, including both joined
27256        /// events and unjoined events.
27257        Unspecified,
27258        /// Only rejoin joined events with the latest product catalog.
27259        JoinedEvents,
27260        /// Only rejoin unjoined events with the latest product catalog.
27261        UnjoinedEvents,
27262        /// If set, the enum was initialized with an unknown value.
27263        ///
27264        /// Applications can examine the value using [UserEventRejoinScope::value] or
27265        /// [UserEventRejoinScope::name].
27266        UnknownValue(user_event_rejoin_scope::UnknownValue),
27267    }
27268
27269    #[doc(hidden)]
27270    pub mod user_event_rejoin_scope {
27271        #[allow(unused_imports)]
27272        use super::*;
27273        #[derive(Clone, Debug, PartialEq)]
27274        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27275    }
27276
27277    impl UserEventRejoinScope {
27278        /// Gets the enum value.
27279        ///
27280        /// Returns `None` if the enum contains an unknown value deserialized from
27281        /// the string representation of enums.
27282        pub fn value(&self) -> std::option::Option<i32> {
27283            match self {
27284                Self::Unspecified => std::option::Option::Some(0),
27285                Self::JoinedEvents => std::option::Option::Some(1),
27286                Self::UnjoinedEvents => std::option::Option::Some(2),
27287                Self::UnknownValue(u) => u.0.value(),
27288            }
27289        }
27290
27291        /// Gets the enum value as a string.
27292        ///
27293        /// Returns `None` if the enum contains an unknown value deserialized from
27294        /// the integer representation of enums.
27295        pub fn name(&self) -> std::option::Option<&str> {
27296            match self {
27297                Self::Unspecified => {
27298                    std::option::Option::Some("USER_EVENT_REJOIN_SCOPE_UNSPECIFIED")
27299                }
27300                Self::JoinedEvents => std::option::Option::Some("JOINED_EVENTS"),
27301                Self::UnjoinedEvents => std::option::Option::Some("UNJOINED_EVENTS"),
27302                Self::UnknownValue(u) => u.0.name(),
27303            }
27304        }
27305    }
27306
27307    impl std::default::Default for UserEventRejoinScope {
27308        fn default() -> Self {
27309            use std::convert::From;
27310            Self::from(0)
27311        }
27312    }
27313
27314    impl std::fmt::Display for UserEventRejoinScope {
27315        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27316            wkt::internal::display_enum(f, self.name(), self.value())
27317        }
27318    }
27319
27320    impl std::convert::From<i32> for UserEventRejoinScope {
27321        fn from(value: i32) -> Self {
27322            match value {
27323                0 => Self::Unspecified,
27324                1 => Self::JoinedEvents,
27325                2 => Self::UnjoinedEvents,
27326                _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27327                    wkt::internal::UnknownEnumValue::Integer(value),
27328                )),
27329            }
27330        }
27331    }
27332
27333    impl std::convert::From<&str> for UserEventRejoinScope {
27334        fn from(value: &str) -> Self {
27335            use std::string::ToString;
27336            match value {
27337                "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" => Self::Unspecified,
27338                "JOINED_EVENTS" => Self::JoinedEvents,
27339                "UNJOINED_EVENTS" => Self::UnjoinedEvents,
27340                _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27341                    wkt::internal::UnknownEnumValue::String(value.to_string()),
27342                )),
27343            }
27344        }
27345    }
27346
27347    impl serde::ser::Serialize for UserEventRejoinScope {
27348        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27349        where
27350            S: serde::Serializer,
27351        {
27352            match self {
27353                Self::Unspecified => serializer.serialize_i32(0),
27354                Self::JoinedEvents => serializer.serialize_i32(1),
27355                Self::UnjoinedEvents => serializer.serialize_i32(2),
27356                Self::UnknownValue(u) => u.0.serialize(serializer),
27357            }
27358        }
27359    }
27360
27361    impl<'de> serde::de::Deserialize<'de> for UserEventRejoinScope {
27362        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27363        where
27364            D: serde::Deserializer<'de>,
27365        {
27366            deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserEventRejoinScope>::new(
27367                ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope",
27368            ))
27369        }
27370    }
27371}
27372
27373/// Response message for `RejoinUserEvents` method.
27374#[derive(Clone, Default, PartialEq)]
27375#[non_exhaustive]
27376pub struct RejoinUserEventsResponse {
27377    /// Number of user events that were joined with latest product catalog.
27378    pub rejoined_user_events_count: i64,
27379
27380    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27381}
27382
27383impl RejoinUserEventsResponse {
27384    pub fn new() -> Self {
27385        std::default::Default::default()
27386    }
27387
27388    /// Sets the value of [rejoined_user_events_count][crate::model::RejoinUserEventsResponse::rejoined_user_events_count].
27389    ///
27390    /// # Example
27391    /// ```ignore,no_run
27392    /// # use google_cloud_retail_v2::model::RejoinUserEventsResponse;
27393    /// let x = RejoinUserEventsResponse::new().set_rejoined_user_events_count(42);
27394    /// ```
27395    pub fn set_rejoined_user_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27396        self.rejoined_user_events_count = v.into();
27397        self
27398    }
27399}
27400
27401impl wkt::message::Message for RejoinUserEventsResponse {
27402    fn typename() -> &'static str {
27403        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsResponse"
27404    }
27405}
27406
27407/// Metadata for `RejoinUserEvents` method.
27408#[derive(Clone, Default, PartialEq)]
27409#[non_exhaustive]
27410pub struct RejoinUserEventsMetadata {
27411    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27412}
27413
27414impl RejoinUserEventsMetadata {
27415    pub fn new() -> Self {
27416        std::default::Default::default()
27417    }
27418}
27419
27420impl wkt::message::Message for RejoinUserEventsMetadata {
27421    fn typename() -> &'static str {
27422        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsMetadata"
27423    }
27424}
27425
27426/// At which level we offer configuration for attributes.
27427///
27428/// # Working with unknown values
27429///
27430/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27431/// additional enum variants at any time. Adding new variants is not considered
27432/// a breaking change. Applications should write their code in anticipation of:
27433///
27434/// - New values appearing in future releases of the client library, **and**
27435/// - New values received dynamically, without application changes.
27436///
27437/// Please consult the [Working with enums] section in the user guide for some
27438/// guidelines.
27439///
27440/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27441#[derive(Clone, Debug, PartialEq)]
27442#[non_exhaustive]
27443pub enum AttributeConfigLevel {
27444    /// Value used when unset. In this case, server behavior defaults to
27445    /// [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
27446    ///
27447    /// [google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]: crate::model::AttributeConfigLevel::CatalogLevelAttributeConfig
27448    Unspecified,
27449    /// At this level, we honor the attribute configurations set in
27450    /// [Product.attributes][google.cloud.retail.v2.Product.attributes].
27451    ///
27452    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
27453    ProductLevelAttributeConfig,
27454    /// At this level, we honor the attribute configurations set in
27455    /// `CatalogConfig.attribute_configs`.
27456    CatalogLevelAttributeConfig,
27457    /// If set, the enum was initialized with an unknown value.
27458    ///
27459    /// Applications can examine the value using [AttributeConfigLevel::value] or
27460    /// [AttributeConfigLevel::name].
27461    UnknownValue(attribute_config_level::UnknownValue),
27462}
27463
27464#[doc(hidden)]
27465pub mod attribute_config_level {
27466    #[allow(unused_imports)]
27467    use super::*;
27468    #[derive(Clone, Debug, PartialEq)]
27469    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27470}
27471
27472impl AttributeConfigLevel {
27473    /// Gets the enum value.
27474    ///
27475    /// Returns `None` if the enum contains an unknown value deserialized from
27476    /// the string representation of enums.
27477    pub fn value(&self) -> std::option::Option<i32> {
27478        match self {
27479            Self::Unspecified => std::option::Option::Some(0),
27480            Self::ProductLevelAttributeConfig => std::option::Option::Some(1),
27481            Self::CatalogLevelAttributeConfig => std::option::Option::Some(2),
27482            Self::UnknownValue(u) => u.0.value(),
27483        }
27484    }
27485
27486    /// Gets the enum value as a string.
27487    ///
27488    /// Returns `None` if the enum contains an unknown value deserialized from
27489    /// the integer representation of enums.
27490    pub fn name(&self) -> std::option::Option<&str> {
27491        match self {
27492            Self::Unspecified => std::option::Option::Some("ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"),
27493            Self::ProductLevelAttributeConfig => {
27494                std::option::Option::Some("PRODUCT_LEVEL_ATTRIBUTE_CONFIG")
27495            }
27496            Self::CatalogLevelAttributeConfig => {
27497                std::option::Option::Some("CATALOG_LEVEL_ATTRIBUTE_CONFIG")
27498            }
27499            Self::UnknownValue(u) => u.0.name(),
27500        }
27501    }
27502}
27503
27504impl std::default::Default for AttributeConfigLevel {
27505    fn default() -> Self {
27506        use std::convert::From;
27507        Self::from(0)
27508    }
27509}
27510
27511impl std::fmt::Display for AttributeConfigLevel {
27512    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27513        wkt::internal::display_enum(f, self.name(), self.value())
27514    }
27515}
27516
27517impl std::convert::From<i32> for AttributeConfigLevel {
27518    fn from(value: i32) -> Self {
27519        match value {
27520            0 => Self::Unspecified,
27521            1 => Self::ProductLevelAttributeConfig,
27522            2 => Self::CatalogLevelAttributeConfig,
27523            _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27524                wkt::internal::UnknownEnumValue::Integer(value),
27525            )),
27526        }
27527    }
27528}
27529
27530impl std::convert::From<&str> for AttributeConfigLevel {
27531    fn from(value: &str) -> Self {
27532        use std::string::ToString;
27533        match value {
27534            "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" => Self::Unspecified,
27535            "PRODUCT_LEVEL_ATTRIBUTE_CONFIG" => Self::ProductLevelAttributeConfig,
27536            "CATALOG_LEVEL_ATTRIBUTE_CONFIG" => Self::CatalogLevelAttributeConfig,
27537            _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27538                wkt::internal::UnknownEnumValue::String(value.to_string()),
27539            )),
27540        }
27541    }
27542}
27543
27544impl serde::ser::Serialize for AttributeConfigLevel {
27545    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27546    where
27547        S: serde::Serializer,
27548    {
27549        match self {
27550            Self::Unspecified => serializer.serialize_i32(0),
27551            Self::ProductLevelAttributeConfig => serializer.serialize_i32(1),
27552            Self::CatalogLevelAttributeConfig => serializer.serialize_i32(2),
27553            Self::UnknownValue(u) => u.0.serialize(serializer),
27554        }
27555    }
27556}
27557
27558impl<'de> serde::de::Deserialize<'de> for AttributeConfigLevel {
27559    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27560    where
27561        D: serde::Deserializer<'de>,
27562    {
27563        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeConfigLevel>::new(
27564            ".google.cloud.retail.v2.AttributeConfigLevel",
27565        ))
27566    }
27567}
27568
27569/// The type of solution.
27570///
27571/// # Working with unknown values
27572///
27573/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27574/// additional enum variants at any time. Adding new variants is not considered
27575/// a breaking change. Applications should write their code in anticipation of:
27576///
27577/// - New values appearing in future releases of the client library, **and**
27578/// - New values received dynamically, without application changes.
27579///
27580/// Please consult the [Working with enums] section in the user guide for some
27581/// guidelines.
27582///
27583/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27584#[derive(Clone, Debug, PartialEq)]
27585#[non_exhaustive]
27586pub enum SolutionType {
27587    /// Default value.
27588    Unspecified,
27589    /// Used for Recommendations AI.
27590    Recommendation,
27591    /// Used for Retail Search.
27592    Search,
27593    /// If set, the enum was initialized with an unknown value.
27594    ///
27595    /// Applications can examine the value using [SolutionType::value] or
27596    /// [SolutionType::name].
27597    UnknownValue(solution_type::UnknownValue),
27598}
27599
27600#[doc(hidden)]
27601pub mod solution_type {
27602    #[allow(unused_imports)]
27603    use super::*;
27604    #[derive(Clone, Debug, PartialEq)]
27605    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27606}
27607
27608impl SolutionType {
27609    /// Gets the enum value.
27610    ///
27611    /// Returns `None` if the enum contains an unknown value deserialized from
27612    /// the string representation of enums.
27613    pub fn value(&self) -> std::option::Option<i32> {
27614        match self {
27615            Self::Unspecified => std::option::Option::Some(0),
27616            Self::Recommendation => std::option::Option::Some(1),
27617            Self::Search => std::option::Option::Some(2),
27618            Self::UnknownValue(u) => u.0.value(),
27619        }
27620    }
27621
27622    /// Gets the enum value as a string.
27623    ///
27624    /// Returns `None` if the enum contains an unknown value deserialized from
27625    /// the integer representation of enums.
27626    pub fn name(&self) -> std::option::Option<&str> {
27627        match self {
27628            Self::Unspecified => std::option::Option::Some("SOLUTION_TYPE_UNSPECIFIED"),
27629            Self::Recommendation => std::option::Option::Some("SOLUTION_TYPE_RECOMMENDATION"),
27630            Self::Search => std::option::Option::Some("SOLUTION_TYPE_SEARCH"),
27631            Self::UnknownValue(u) => u.0.name(),
27632        }
27633    }
27634}
27635
27636impl std::default::Default for SolutionType {
27637    fn default() -> Self {
27638        use std::convert::From;
27639        Self::from(0)
27640    }
27641}
27642
27643impl std::fmt::Display for SolutionType {
27644    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27645        wkt::internal::display_enum(f, self.name(), self.value())
27646    }
27647}
27648
27649impl std::convert::From<i32> for SolutionType {
27650    fn from(value: i32) -> Self {
27651        match value {
27652            0 => Self::Unspecified,
27653            1 => Self::Recommendation,
27654            2 => Self::Search,
27655            _ => Self::UnknownValue(solution_type::UnknownValue(
27656                wkt::internal::UnknownEnumValue::Integer(value),
27657            )),
27658        }
27659    }
27660}
27661
27662impl std::convert::From<&str> for SolutionType {
27663    fn from(value: &str) -> Self {
27664        use std::string::ToString;
27665        match value {
27666            "SOLUTION_TYPE_UNSPECIFIED" => Self::Unspecified,
27667            "SOLUTION_TYPE_RECOMMENDATION" => Self::Recommendation,
27668            "SOLUTION_TYPE_SEARCH" => Self::Search,
27669            _ => Self::UnknownValue(solution_type::UnknownValue(
27670                wkt::internal::UnknownEnumValue::String(value.to_string()),
27671            )),
27672        }
27673    }
27674}
27675
27676impl serde::ser::Serialize for SolutionType {
27677    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27678    where
27679        S: serde::Serializer,
27680    {
27681        match self {
27682            Self::Unspecified => serializer.serialize_i32(0),
27683            Self::Recommendation => serializer.serialize_i32(1),
27684            Self::Search => serializer.serialize_i32(2),
27685            Self::UnknownValue(u) => u.0.serialize(serializer),
27686        }
27687    }
27688}
27689
27690impl<'de> serde::de::Deserialize<'de> for SolutionType {
27691    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27692    where
27693        D: serde::Deserializer<'de>,
27694    {
27695        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SolutionType>::new(
27696            ".google.cloud.retail.v2.SolutionType",
27697        ))
27698    }
27699}
27700
27701/// If filtering for recommendations is enabled.
27702///
27703/// # Working with unknown values
27704///
27705/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27706/// additional enum variants at any time. Adding new variants is not considered
27707/// a breaking change. Applications should write their code in anticipation of:
27708///
27709/// - New values appearing in future releases of the client library, **and**
27710/// - New values received dynamically, without application changes.
27711///
27712/// Please consult the [Working with enums] section in the user guide for some
27713/// guidelines.
27714///
27715/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27716#[derive(Clone, Debug, PartialEq)]
27717#[non_exhaustive]
27718pub enum RecommendationsFilteringOption {
27719    /// Value used when unset.
27720    /// In this case, server behavior defaults to
27721    /// [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED].
27722    ///
27723    /// [google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]: crate::model::RecommendationsFilteringOption::RecommendationsFilteringDisabled
27724    Unspecified,
27725    /// Recommendation filtering is disabled.
27726    RecommendationsFilteringDisabled,
27727    /// Recommendation filtering is enabled.
27728    RecommendationsFilteringEnabled,
27729    /// If set, the enum was initialized with an unknown value.
27730    ///
27731    /// Applications can examine the value using [RecommendationsFilteringOption::value] or
27732    /// [RecommendationsFilteringOption::name].
27733    UnknownValue(recommendations_filtering_option::UnknownValue),
27734}
27735
27736#[doc(hidden)]
27737pub mod recommendations_filtering_option {
27738    #[allow(unused_imports)]
27739    use super::*;
27740    #[derive(Clone, Debug, PartialEq)]
27741    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27742}
27743
27744impl RecommendationsFilteringOption {
27745    /// Gets the enum value.
27746    ///
27747    /// Returns `None` if the enum contains an unknown value deserialized from
27748    /// the string representation of enums.
27749    pub fn value(&self) -> std::option::Option<i32> {
27750        match self {
27751            Self::Unspecified => std::option::Option::Some(0),
27752            Self::RecommendationsFilteringDisabled => std::option::Option::Some(1),
27753            Self::RecommendationsFilteringEnabled => std::option::Option::Some(3),
27754            Self::UnknownValue(u) => u.0.value(),
27755        }
27756    }
27757
27758    /// Gets the enum value as a string.
27759    ///
27760    /// Returns `None` if the enum contains an unknown value deserialized from
27761    /// the integer representation of enums.
27762    pub fn name(&self) -> std::option::Option<&str> {
27763        match self {
27764            Self::Unspecified => {
27765                std::option::Option::Some("RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED")
27766            }
27767            Self::RecommendationsFilteringDisabled => {
27768                std::option::Option::Some("RECOMMENDATIONS_FILTERING_DISABLED")
27769            }
27770            Self::RecommendationsFilteringEnabled => {
27771                std::option::Option::Some("RECOMMENDATIONS_FILTERING_ENABLED")
27772            }
27773            Self::UnknownValue(u) => u.0.name(),
27774        }
27775    }
27776}
27777
27778impl std::default::Default for RecommendationsFilteringOption {
27779    fn default() -> Self {
27780        use std::convert::From;
27781        Self::from(0)
27782    }
27783}
27784
27785impl std::fmt::Display for RecommendationsFilteringOption {
27786    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27787        wkt::internal::display_enum(f, self.name(), self.value())
27788    }
27789}
27790
27791impl std::convert::From<i32> for RecommendationsFilteringOption {
27792    fn from(value: i32) -> Self {
27793        match value {
27794            0 => Self::Unspecified,
27795            1 => Self::RecommendationsFilteringDisabled,
27796            3 => Self::RecommendationsFilteringEnabled,
27797            _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
27798                wkt::internal::UnknownEnumValue::Integer(value),
27799            )),
27800        }
27801    }
27802}
27803
27804impl std::convert::From<&str> for RecommendationsFilteringOption {
27805    fn from(value: &str) -> Self {
27806        use std::string::ToString;
27807        match value {
27808            "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" => Self::Unspecified,
27809            "RECOMMENDATIONS_FILTERING_DISABLED" => Self::RecommendationsFilteringDisabled,
27810            "RECOMMENDATIONS_FILTERING_ENABLED" => Self::RecommendationsFilteringEnabled,
27811            _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
27812                wkt::internal::UnknownEnumValue::String(value.to_string()),
27813            )),
27814        }
27815    }
27816}
27817
27818impl serde::ser::Serialize for RecommendationsFilteringOption {
27819    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27820    where
27821        S: serde::Serializer,
27822    {
27823        match self {
27824            Self::Unspecified => serializer.serialize_i32(0),
27825            Self::RecommendationsFilteringDisabled => serializer.serialize_i32(1),
27826            Self::RecommendationsFilteringEnabled => serializer.serialize_i32(3),
27827            Self::UnknownValue(u) => u.0.serialize(serializer),
27828        }
27829    }
27830}
27831
27832impl<'de> serde::de::Deserialize<'de> for RecommendationsFilteringOption {
27833    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27834    where
27835        D: serde::Deserializer<'de>,
27836    {
27837        deserializer.deserialize_any(
27838            wkt::internal::EnumVisitor::<RecommendationsFilteringOption>::new(
27839                ".google.cloud.retail.v2.RecommendationsFilteringOption",
27840            ),
27841        )
27842    }
27843}
27844
27845/// The use case of Cloud Retail Search.
27846///
27847/// # Working with unknown values
27848///
27849/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27850/// additional enum variants at any time. Adding new variants is not considered
27851/// a breaking change. Applications should write their code in anticipation of:
27852///
27853/// - New values appearing in future releases of the client library, **and**
27854/// - New values received dynamically, without application changes.
27855///
27856/// Please consult the [Working with enums] section in the user guide for some
27857/// guidelines.
27858///
27859/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27860#[derive(Clone, Debug, PartialEq)]
27861#[non_exhaustive]
27862pub enum SearchSolutionUseCase {
27863    /// The value when it's unspecified. In this case, server behavior defaults to
27864    /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
27865    ///
27866    /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
27867    Unspecified,
27868    /// Search use case. Expects the traffic has a non-empty
27869    /// [query][google.cloud.retail.v2.SearchRequest.query].
27870    ///
27871    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
27872    Search,
27873    /// Browse use case. Expects the traffic has an empty
27874    /// [query][google.cloud.retail.v2.SearchRequest.query].
27875    ///
27876    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
27877    Browse,
27878    /// If set, the enum was initialized with an unknown value.
27879    ///
27880    /// Applications can examine the value using [SearchSolutionUseCase::value] or
27881    /// [SearchSolutionUseCase::name].
27882    UnknownValue(search_solution_use_case::UnknownValue),
27883}
27884
27885#[doc(hidden)]
27886pub mod search_solution_use_case {
27887    #[allow(unused_imports)]
27888    use super::*;
27889    #[derive(Clone, Debug, PartialEq)]
27890    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27891}
27892
27893impl SearchSolutionUseCase {
27894    /// Gets the enum value.
27895    ///
27896    /// Returns `None` if the enum contains an unknown value deserialized from
27897    /// the string representation of enums.
27898    pub fn value(&self) -> std::option::Option<i32> {
27899        match self {
27900            Self::Unspecified => std::option::Option::Some(0),
27901            Self::Search => std::option::Option::Some(1),
27902            Self::Browse => std::option::Option::Some(2),
27903            Self::UnknownValue(u) => u.0.value(),
27904        }
27905    }
27906
27907    /// Gets the enum value as a string.
27908    ///
27909    /// Returns `None` if the enum contains an unknown value deserialized from
27910    /// the integer representation of enums.
27911    pub fn name(&self) -> std::option::Option<&str> {
27912        match self {
27913            Self::Unspecified => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"),
27914            Self::Search => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_SEARCH"),
27915            Self::Browse => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_BROWSE"),
27916            Self::UnknownValue(u) => u.0.name(),
27917        }
27918    }
27919}
27920
27921impl std::default::Default for SearchSolutionUseCase {
27922    fn default() -> Self {
27923        use std::convert::From;
27924        Self::from(0)
27925    }
27926}
27927
27928impl std::fmt::Display for SearchSolutionUseCase {
27929    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27930        wkt::internal::display_enum(f, self.name(), self.value())
27931    }
27932}
27933
27934impl std::convert::From<i32> for SearchSolutionUseCase {
27935    fn from(value: i32) -> Self {
27936        match value {
27937            0 => Self::Unspecified,
27938            1 => Self::Search,
27939            2 => Self::Browse,
27940            _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
27941                wkt::internal::UnknownEnumValue::Integer(value),
27942            )),
27943        }
27944    }
27945}
27946
27947impl std::convert::From<&str> for SearchSolutionUseCase {
27948    fn from(value: &str) -> Self {
27949        use std::string::ToString;
27950        match value {
27951            "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED" => Self::Unspecified,
27952            "SEARCH_SOLUTION_USE_CASE_SEARCH" => Self::Search,
27953            "SEARCH_SOLUTION_USE_CASE_BROWSE" => Self::Browse,
27954            _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
27955                wkt::internal::UnknownEnumValue::String(value.to_string()),
27956            )),
27957        }
27958    }
27959}
27960
27961impl serde::ser::Serialize for SearchSolutionUseCase {
27962    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27963    where
27964        S: serde::Serializer,
27965    {
27966        match self {
27967            Self::Unspecified => serializer.serialize_i32(0),
27968            Self::Search => serializer.serialize_i32(1),
27969            Self::Browse => serializer.serialize_i32(2),
27970            Self::UnknownValue(u) => u.0.serialize(serializer),
27971        }
27972    }
27973}
27974
27975impl<'de> serde::de::Deserialize<'de> for SearchSolutionUseCase {
27976    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27977    where
27978        D: serde::Deserializer<'de>,
27979    {
27980        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchSolutionUseCase>::new(
27981            ".google.cloud.retail.v2.SearchSolutionUseCase",
27982        ))
27983    }
27984}
27985
27986/// Harm categories that will block the content.
27987///
27988/// # Working with unknown values
27989///
27990/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27991/// additional enum variants at any time. Adding new variants is not considered
27992/// a breaking change. Applications should write their code in anticipation of:
27993///
27994/// - New values appearing in future releases of the client library, **and**
27995/// - New values received dynamically, without application changes.
27996///
27997/// Please consult the [Working with enums] section in the user guide for some
27998/// guidelines.
27999///
28000/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
28001#[derive(Clone, Debug, PartialEq)]
28002#[non_exhaustive]
28003pub enum HarmCategory {
28004    /// The harm category is unspecified.
28005    Unspecified,
28006    /// The harm category is hate speech.
28007    HateSpeech,
28008    /// The harm category is dangerous content.
28009    DangerousContent,
28010    /// The harm category is harassment.
28011    Harassment,
28012    /// The harm category is sexually explicit content.
28013    SexuallyExplicit,
28014    /// The harm category is civic integrity.
28015    CivicIntegrity,
28016    /// If set, the enum was initialized with an unknown value.
28017    ///
28018    /// Applications can examine the value using [HarmCategory::value] or
28019    /// [HarmCategory::name].
28020    UnknownValue(harm_category::UnknownValue),
28021}
28022
28023#[doc(hidden)]
28024pub mod harm_category {
28025    #[allow(unused_imports)]
28026    use super::*;
28027    #[derive(Clone, Debug, PartialEq)]
28028    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28029}
28030
28031impl HarmCategory {
28032    /// Gets the enum value.
28033    ///
28034    /// Returns `None` if the enum contains an unknown value deserialized from
28035    /// the string representation of enums.
28036    pub fn value(&self) -> std::option::Option<i32> {
28037        match self {
28038            Self::Unspecified => std::option::Option::Some(0),
28039            Self::HateSpeech => std::option::Option::Some(1),
28040            Self::DangerousContent => std::option::Option::Some(2),
28041            Self::Harassment => std::option::Option::Some(3),
28042            Self::SexuallyExplicit => std::option::Option::Some(4),
28043            Self::CivicIntegrity => std::option::Option::Some(5),
28044            Self::UnknownValue(u) => u.0.value(),
28045        }
28046    }
28047
28048    /// Gets the enum value as a string.
28049    ///
28050    /// Returns `None` if the enum contains an unknown value deserialized from
28051    /// the integer representation of enums.
28052    pub fn name(&self) -> std::option::Option<&str> {
28053        match self {
28054            Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
28055            Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
28056            Self::DangerousContent => std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT"),
28057            Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
28058            Self::SexuallyExplicit => std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT"),
28059            Self::CivicIntegrity => std::option::Option::Some("HARM_CATEGORY_CIVIC_INTEGRITY"),
28060            Self::UnknownValue(u) => u.0.name(),
28061        }
28062    }
28063}
28064
28065impl std::default::Default for HarmCategory {
28066    fn default() -> Self {
28067        use std::convert::From;
28068        Self::from(0)
28069    }
28070}
28071
28072impl std::fmt::Display for HarmCategory {
28073    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28074        wkt::internal::display_enum(f, self.name(), self.value())
28075    }
28076}
28077
28078impl std::convert::From<i32> for HarmCategory {
28079    fn from(value: i32) -> Self {
28080        match value {
28081            0 => Self::Unspecified,
28082            1 => Self::HateSpeech,
28083            2 => Self::DangerousContent,
28084            3 => Self::Harassment,
28085            4 => Self::SexuallyExplicit,
28086            5 => Self::CivicIntegrity,
28087            _ => Self::UnknownValue(harm_category::UnknownValue(
28088                wkt::internal::UnknownEnumValue::Integer(value),
28089            )),
28090        }
28091    }
28092}
28093
28094impl std::convert::From<&str> for HarmCategory {
28095    fn from(value: &str) -> Self {
28096        use std::string::ToString;
28097        match value {
28098            "HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
28099            "HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
28100            "HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
28101            "HARM_CATEGORY_HARASSMENT" => Self::Harassment,
28102            "HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
28103            "HARM_CATEGORY_CIVIC_INTEGRITY" => Self::CivicIntegrity,
28104            _ => Self::UnknownValue(harm_category::UnknownValue(
28105                wkt::internal::UnknownEnumValue::String(value.to_string()),
28106            )),
28107        }
28108    }
28109}
28110
28111impl serde::ser::Serialize for HarmCategory {
28112    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28113    where
28114        S: serde::Serializer,
28115    {
28116        match self {
28117            Self::Unspecified => serializer.serialize_i32(0),
28118            Self::HateSpeech => serializer.serialize_i32(1),
28119            Self::DangerousContent => serializer.serialize_i32(2),
28120            Self::Harassment => serializer.serialize_i32(3),
28121            Self::SexuallyExplicit => serializer.serialize_i32(4),
28122            Self::CivicIntegrity => serializer.serialize_i32(5),
28123            Self::UnknownValue(u) => u.0.serialize(serializer),
28124        }
28125    }
28126}
28127
28128impl<'de> serde::de::Deserialize<'de> for HarmCategory {
28129    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28130    where
28131        D: serde::Deserializer<'de>,
28132    {
28133        deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
28134            ".google.cloud.retail.v2.HarmCategory",
28135        ))
28136    }
28137}