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 async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_longrunning;
26extern crate google_cloud_lro;
27extern crate google_cloud_rpc;
28extern crate google_cloud_type;
29extern crate lazy_static;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Configures what level the product should be uploaded with regards to
42/// how users will be send events and how predictions will be made.
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct ProductLevelConfig {
46    /// The type of [Product][google.cloud.retail.v2.Product]s allowed to be
47    /// ingested into the catalog. Acceptable values are:
48    ///
49    /// * `primary` (default): You can ingest
50    ///   [Product][google.cloud.retail.v2.Product]s of all types. When
51    ///   ingesting a [Product][google.cloud.retail.v2.Product], its type will
52    ///   default to
53    ///   [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if
54    ///   unset.
55    /// * `variant` (incompatible with Retail Search): You can only
56    ///   ingest
57    ///   [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
58    ///   [Product][google.cloud.retail.v2.Product]s. This means
59    ///   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
60    ///   cannot be empty.
61    ///
62    /// If this field is set to an invalid value other than these, an
63    /// INVALID_ARGUMENT error is returned.
64    ///
65    /// If this field is `variant` and
66    /// [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
67    /// is `itemGroupId`, an INVALID_ARGUMENT error is returned.
68    ///
69    /// See [Product
70    /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
71    /// for more details.
72    ///
73    /// [google.cloud.retail.v2.Product]: crate::model::Product
74    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
75    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
76    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
77    /// [google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]: crate::model::ProductLevelConfig::merchant_center_product_id_field
78    pub ingestion_product_type: std::string::String,
79
80    /// Which field of [Merchant Center
81    /// Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
82    /// imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
83    /// values are:
84    ///
85    /// * `offerId` (default): Import `offerId` as the product ID.
86    /// * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
87    ///   API will choose one item from the ones with the same `itemGroupId`, and
88    ///   use it to represent the item group.
89    ///
90    /// If this field is set to an invalid value other than these, an
91    /// INVALID_ARGUMENT error is returned.
92    ///
93    /// If this field is `itemGroupId` and
94    /// [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
95    /// is `variant`, an INVALID_ARGUMENT error is returned.
96    ///
97    /// See [Product
98    /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
99    /// for more details.
100    ///
101    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
102    /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
103    pub merchant_center_product_id_field: std::string::String,
104
105    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
106}
107
108impl ProductLevelConfig {
109    pub fn new() -> Self {
110        std::default::Default::default()
111    }
112
113    /// Sets the value of [ingestion_product_type][crate::model::ProductLevelConfig::ingestion_product_type].
114    ///
115    /// # Example
116    /// ```ignore,no_run
117    /// # use google_cloud_retail_v2::model::ProductLevelConfig;
118    /// let x = ProductLevelConfig::new().set_ingestion_product_type("example");
119    /// ```
120    pub fn set_ingestion_product_type<T: std::convert::Into<std::string::String>>(
121        mut self,
122        v: T,
123    ) -> Self {
124        self.ingestion_product_type = v.into();
125        self
126    }
127
128    /// Sets the value of [merchant_center_product_id_field][crate::model::ProductLevelConfig::merchant_center_product_id_field].
129    ///
130    /// # Example
131    /// ```ignore,no_run
132    /// # use google_cloud_retail_v2::model::ProductLevelConfig;
133    /// let x = ProductLevelConfig::new().set_merchant_center_product_id_field("example");
134    /// ```
135    pub fn set_merchant_center_product_id_field<T: std::convert::Into<std::string::String>>(
136        mut self,
137        v: T,
138    ) -> Self {
139        self.merchant_center_product_id_field = v.into();
140        self
141    }
142}
143
144impl wkt::message::Message for ProductLevelConfig {
145    fn typename() -> &'static str {
146        "type.googleapis.com/google.cloud.retail.v2.ProductLevelConfig"
147    }
148}
149
150/// Catalog level attribute config for an attribute. For example, if customers
151/// want to enable/disable facet for a specific attribute.
152#[derive(Clone, Default, PartialEq)]
153#[non_exhaustive]
154pub struct CatalogAttribute {
155    /// Required. Attribute name.
156    /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
157    /// `attributes.xyz`.
158    /// To be indexable, the attribute name can contain only alpha-numeric
159    /// characters and underscores. For example, an attribute named
160    /// `attributes.abc_xyz` can be indexed, but an attribute named
161    /// `attributes.abc-xyz` cannot be indexed.
162    ///
163    /// If the attribute key starts with `attributes.`, then the attribute is a
164    /// custom attribute. Attributes such as `brands`, `patterns`, and `title` are
165    /// built-in and called system attributes.
166    pub key: std::string::String,
167
168    /// Output only. Indicates whether this attribute has been used by any
169    /// products. `True` if at least one [Product][google.cloud.retail.v2.Product]
170    /// is using this attribute in
171    /// [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
172    /// this field is `False`.
173    ///
174    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
175    /// pre-loaded by using
176    /// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
177    /// or
178    /// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
179    /// APIs. This field is `False` for pre-loaded
180    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
181    ///
182    /// Only pre-loaded [catalog
183    /// attributes][google.cloud.retail.v2.CatalogAttribute] that are neither in
184    /// use by products nor predefined can be deleted. [Catalog
185    /// attributes][google.cloud.retail.v2.CatalogAttribute] that are
186    /// either in use by products or are predefined attributes cannot be deleted;
187    /// however, their configuration properties will reset to default values upon
188    /// removal request.
189    ///
190    /// After catalog changes, it takes about 10 minutes for this field to update.
191    ///
192    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
193    /// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
194    /// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
195    /// [google.cloud.retail.v2.Product]: crate::model::Product
196    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
197    pub in_use: bool,
198
199    /// Output only. The type of this attribute. This is derived from the attribute
200    /// in [Product.attributes][google.cloud.retail.v2.Product.attributes].
201    ///
202    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
203    pub r#type: crate::model::catalog_attribute::AttributeType,
204
205    /// When
206    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
207    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
208    /// are indexed so that it can be filtered, faceted, or boosted in
209    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
210    ///
211    /// Must be specified when
212    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
213    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
214    ///
215    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
216    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
217    pub indexable_option: crate::model::catalog_attribute::IndexableOption,
218
219    /// If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
220    /// facet. Could only be DYNAMIC_FACETABLE_DISABLED if
221    /// [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
222    /// is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
223    ///
224    /// Must be specified, otherwise throws INVALID_FORMAT error.
225    ///
226    /// [google.cloud.retail.v2.CatalogAttribute.indexable_option]: crate::model::CatalogAttribute::indexable_option
227    pub dynamic_facetable_option: crate::model::catalog_attribute::DynamicFacetableOption,
228
229    /// When
230    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
231    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
232    /// are searchable by text queries in
233    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
234    ///
235    /// If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
236    /// will not be searchable by text queries in
237    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
238    /// there are no text values associated to numerical attributes.
239    ///
240    /// Must be specified, when
241    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
242    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
243    ///
244    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
245    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
246    pub searchable_option: crate::model::catalog_attribute::SearchableOption,
247
248    /// If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable.
249    /// This property only applies to textual custom attributes and requires
250    /// indexable set to enabled to enable exact-searchable. If unset, the server
251    /// behavior defaults to
252    /// [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED].
253    ///
254    /// [google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]: crate::model::catalog_attribute::ExactSearchableOption::ExactSearchableDisabled
255    pub exact_searchable_option: crate::model::catalog_attribute::ExactSearchableOption,
256
257    /// If RETRIEVABLE_ENABLED, attribute values are retrievable in the search
258    /// results. If unset, the server behavior defaults to
259    /// [RETRIEVABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED].
260    ///
261    /// [google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED]: crate::model::catalog_attribute::RetrievableOption::RetrievableDisabled
262    pub retrievable_option: crate::model::catalog_attribute::RetrievableOption,
263
264    /// Contains facet options.
265    pub facet_config: std::option::Option<crate::model::catalog_attribute::FacetConfig>,
266
267    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
268}
269
270impl CatalogAttribute {
271    pub fn new() -> Self {
272        std::default::Default::default()
273    }
274
275    /// Sets the value of [key][crate::model::CatalogAttribute::key].
276    ///
277    /// # Example
278    /// ```ignore,no_run
279    /// # use google_cloud_retail_v2::model::CatalogAttribute;
280    /// let x = CatalogAttribute::new().set_key("example");
281    /// ```
282    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
283        self.key = v.into();
284        self
285    }
286
287    /// Sets the value of [in_use][crate::model::CatalogAttribute::in_use].
288    ///
289    /// # Example
290    /// ```ignore,no_run
291    /// # use google_cloud_retail_v2::model::CatalogAttribute;
292    /// let x = CatalogAttribute::new().set_in_use(true);
293    /// ```
294    pub fn set_in_use<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
295        self.in_use = v.into();
296        self
297    }
298
299    /// Sets the value of [r#type][crate::model::CatalogAttribute::type].
300    ///
301    /// # Example
302    /// ```ignore,no_run
303    /// # use google_cloud_retail_v2::model::CatalogAttribute;
304    /// use google_cloud_retail_v2::model::catalog_attribute::AttributeType;
305    /// let x0 = CatalogAttribute::new().set_type(AttributeType::Textual);
306    /// let x1 = CatalogAttribute::new().set_type(AttributeType::Numerical);
307    /// ```
308    pub fn set_type<T: std::convert::Into<crate::model::catalog_attribute::AttributeType>>(
309        mut self,
310        v: T,
311    ) -> Self {
312        self.r#type = v.into();
313        self
314    }
315
316    /// Sets the value of [indexable_option][crate::model::CatalogAttribute::indexable_option].
317    ///
318    /// # Example
319    /// ```ignore,no_run
320    /// # use google_cloud_retail_v2::model::CatalogAttribute;
321    /// use google_cloud_retail_v2::model::catalog_attribute::IndexableOption;
322    /// let x0 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableEnabled);
323    /// let x1 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableDisabled);
324    /// ```
325    pub fn set_indexable_option<
326        T: std::convert::Into<crate::model::catalog_attribute::IndexableOption>,
327    >(
328        mut self,
329        v: T,
330    ) -> Self {
331        self.indexable_option = v.into();
332        self
333    }
334
335    /// Sets the value of [dynamic_facetable_option][crate::model::CatalogAttribute::dynamic_facetable_option].
336    ///
337    /// # Example
338    /// ```ignore,no_run
339    /// # use google_cloud_retail_v2::model::CatalogAttribute;
340    /// use google_cloud_retail_v2::model::catalog_attribute::DynamicFacetableOption;
341    /// let x0 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableEnabled);
342    /// let x1 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableDisabled);
343    /// ```
344    pub fn set_dynamic_facetable_option<
345        T: std::convert::Into<crate::model::catalog_attribute::DynamicFacetableOption>,
346    >(
347        mut self,
348        v: T,
349    ) -> Self {
350        self.dynamic_facetable_option = v.into();
351        self
352    }
353
354    /// Sets the value of [searchable_option][crate::model::CatalogAttribute::searchable_option].
355    ///
356    /// # Example
357    /// ```ignore,no_run
358    /// # use google_cloud_retail_v2::model::CatalogAttribute;
359    /// use google_cloud_retail_v2::model::catalog_attribute::SearchableOption;
360    /// let x0 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableEnabled);
361    /// let x1 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableDisabled);
362    /// ```
363    pub fn set_searchable_option<
364        T: std::convert::Into<crate::model::catalog_attribute::SearchableOption>,
365    >(
366        mut self,
367        v: T,
368    ) -> Self {
369        self.searchable_option = v.into();
370        self
371    }
372
373    /// Sets the value of [exact_searchable_option][crate::model::CatalogAttribute::exact_searchable_option].
374    ///
375    /// # Example
376    /// ```ignore,no_run
377    /// # use google_cloud_retail_v2::model::CatalogAttribute;
378    /// use google_cloud_retail_v2::model::catalog_attribute::ExactSearchableOption;
379    /// let x0 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableEnabled);
380    /// let x1 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableDisabled);
381    /// ```
382    pub fn set_exact_searchable_option<
383        T: std::convert::Into<crate::model::catalog_attribute::ExactSearchableOption>,
384    >(
385        mut self,
386        v: T,
387    ) -> Self {
388        self.exact_searchable_option = v.into();
389        self
390    }
391
392    /// Sets the value of [retrievable_option][crate::model::CatalogAttribute::retrievable_option].
393    ///
394    /// # Example
395    /// ```ignore,no_run
396    /// # use google_cloud_retail_v2::model::CatalogAttribute;
397    /// use google_cloud_retail_v2::model::catalog_attribute::RetrievableOption;
398    /// let x0 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableEnabled);
399    /// let x1 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableDisabled);
400    /// ```
401    pub fn set_retrievable_option<
402        T: std::convert::Into<crate::model::catalog_attribute::RetrievableOption>,
403    >(
404        mut self,
405        v: T,
406    ) -> Self {
407        self.retrievable_option = v.into();
408        self
409    }
410
411    /// Sets the value of [facet_config][crate::model::CatalogAttribute::facet_config].
412    ///
413    /// # Example
414    /// ```ignore,no_run
415    /// # use google_cloud_retail_v2::model::CatalogAttribute;
416    /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
417    /// let x = CatalogAttribute::new().set_facet_config(FacetConfig::default()/* use setters */);
418    /// ```
419    pub fn set_facet_config<T>(mut self, v: T) -> Self
420    where
421        T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
422    {
423        self.facet_config = std::option::Option::Some(v.into());
424        self
425    }
426
427    /// Sets or clears the value of [facet_config][crate::model::CatalogAttribute::facet_config].
428    ///
429    /// # Example
430    /// ```ignore,no_run
431    /// # use google_cloud_retail_v2::model::CatalogAttribute;
432    /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
433    /// let x = CatalogAttribute::new().set_or_clear_facet_config(Some(FacetConfig::default()/* use setters */));
434    /// let x = CatalogAttribute::new().set_or_clear_facet_config(None::<FacetConfig>);
435    /// ```
436    pub fn set_or_clear_facet_config<T>(mut self, v: std::option::Option<T>) -> Self
437    where
438        T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
439    {
440        self.facet_config = v.map(|x| x.into());
441        self
442    }
443}
444
445impl wkt::message::Message for CatalogAttribute {
446    fn typename() -> &'static str {
447        "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute"
448    }
449}
450
451/// Defines additional types related to [CatalogAttribute].
452pub mod catalog_attribute {
453    #[allow(unused_imports)]
454    use super::*;
455
456    /// Possible options for the facet that corresponds to the current attribute
457    /// config.
458    #[derive(Clone, Default, PartialEq)]
459    #[non_exhaustive]
460    pub struct FacetConfig {
461        /// If you don't set the facet
462        /// [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
463        /// in the request to a numerical attribute, then we use the computed
464        /// intervals with rounded bounds obtained from all its product numerical
465        /// attribute values. The computed intervals might not be ideal for some
466        /// attributes. Therefore, we give you the option to overwrite them with the
467        /// facet_intervals field. The maximum of facet intervals per
468        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
469        /// interval must have a lower bound or an upper bound. If both bounds are
470        /// provided, then the lower bound must be smaller or equal than the upper
471        /// bound.
472        ///
473        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
474        /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
475        pub facet_intervals: std::vec::Vec<crate::model::Interval>,
476
477        /// Each instance represents a list of attribute values to ignore as facet
478        /// values for a specific time range. The maximum number of instances per
479        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
480        ///
481        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
482        pub ignored_facet_values:
483            std::vec::Vec<crate::model::catalog_attribute::facet_config::IgnoredFacetValues>,
484
485        /// Each instance replaces a list of facet values by a merged facet
486        /// value. If a facet value is not in any list, then it will stay the same.
487        /// To avoid conflicts, only paths of length 1 are accepted. In other words,
488        /// if "dark_blue" merged into "BLUE", then the latter can't merge into
489        /// "blues" because this would create a path of length 2. The maximum number
490        /// of instances of MergedFacetValue per
491        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
492        /// feature is available only for textual custom attributes.
493        ///
494        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
495        pub merged_facet_values:
496            std::vec::Vec<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
497
498        /// Use this field only if you want to merge a facet key into another facet
499        /// key.
500        pub merged_facet:
501            std::option::Option<crate::model::catalog_attribute::facet_config::MergedFacet>,
502
503        /// Set this field only if you want to rerank based on facet values engaged
504        /// by the user for the current key. This option is only possible for custom
505        /// facetable textual keys.
506        pub rerank_config:
507            std::option::Option<crate::model::catalog_attribute::facet_config::RerankConfig>,
508
509        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
510    }
511
512    impl FacetConfig {
513        pub fn new() -> Self {
514            std::default::Default::default()
515        }
516
517        /// Sets the value of [facet_intervals][crate::model::catalog_attribute::FacetConfig::facet_intervals].
518        ///
519        /// # Example
520        /// ```ignore,no_run
521        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
522        /// use google_cloud_retail_v2::model::Interval;
523        /// let x = FacetConfig::new()
524        ///     .set_facet_intervals([
525        ///         Interval::default()/* use setters */,
526        ///         Interval::default()/* use (different) setters */,
527        ///     ]);
528        /// ```
529        pub fn set_facet_intervals<T, V>(mut self, v: T) -> Self
530        where
531            T: std::iter::IntoIterator<Item = V>,
532            V: std::convert::Into<crate::model::Interval>,
533        {
534            use std::iter::Iterator;
535            self.facet_intervals = v.into_iter().map(|i| i.into()).collect();
536            self
537        }
538
539        /// Sets the value of [ignored_facet_values][crate::model::catalog_attribute::FacetConfig::ignored_facet_values].
540        ///
541        /// # Example
542        /// ```ignore,no_run
543        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
544        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
545        /// let x = FacetConfig::new()
546        ///     .set_ignored_facet_values([
547        ///         IgnoredFacetValues::default()/* use setters */,
548        ///         IgnoredFacetValues::default()/* use (different) setters */,
549        ///     ]);
550        /// ```
551        pub fn set_ignored_facet_values<T, V>(mut self, v: T) -> Self
552        where
553            T: std::iter::IntoIterator<Item = V>,
554            V: std::convert::Into<
555                    crate::model::catalog_attribute::facet_config::IgnoredFacetValues,
556                >,
557        {
558            use std::iter::Iterator;
559            self.ignored_facet_values = v.into_iter().map(|i| i.into()).collect();
560            self
561        }
562
563        /// Sets the value of [merged_facet_values][crate::model::catalog_attribute::FacetConfig::merged_facet_values].
564        ///
565        /// # Example
566        /// ```ignore,no_run
567        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
568        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
569        /// let x = FacetConfig::new()
570        ///     .set_merged_facet_values([
571        ///         MergedFacetValue::default()/* use setters */,
572        ///         MergedFacetValue::default()/* use (different) setters */,
573        ///     ]);
574        /// ```
575        pub fn set_merged_facet_values<T, V>(mut self, v: T) -> Self
576        where
577            T: std::iter::IntoIterator<Item = V>,
578            V: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
579        {
580            use std::iter::Iterator;
581            self.merged_facet_values = v.into_iter().map(|i| i.into()).collect();
582            self
583        }
584
585        /// Sets the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
586        ///
587        /// # Example
588        /// ```ignore,no_run
589        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
590        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
591        /// let x = FacetConfig::new().set_merged_facet(MergedFacet::default()/* use setters */);
592        /// ```
593        pub fn set_merged_facet<T>(mut self, v: T) -> Self
594        where
595            T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
596        {
597            self.merged_facet = std::option::Option::Some(v.into());
598            self
599        }
600
601        /// Sets or clears the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
602        ///
603        /// # Example
604        /// ```ignore,no_run
605        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
606        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
607        /// let x = FacetConfig::new().set_or_clear_merged_facet(Some(MergedFacet::default()/* use setters */));
608        /// let x = FacetConfig::new().set_or_clear_merged_facet(None::<MergedFacet>);
609        /// ```
610        pub fn set_or_clear_merged_facet<T>(mut self, v: std::option::Option<T>) -> Self
611        where
612            T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
613        {
614            self.merged_facet = v.map(|x| x.into());
615            self
616        }
617
618        /// Sets the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
619        ///
620        /// # Example
621        /// ```ignore,no_run
622        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
623        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
624        /// let x = FacetConfig::new().set_rerank_config(RerankConfig::default()/* use setters */);
625        /// ```
626        pub fn set_rerank_config<T>(mut self, v: T) -> Self
627        where
628            T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
629        {
630            self.rerank_config = std::option::Option::Some(v.into());
631            self
632        }
633
634        /// Sets or clears the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
635        ///
636        /// # Example
637        /// ```ignore,no_run
638        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
639        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
640        /// let x = FacetConfig::new().set_or_clear_rerank_config(Some(RerankConfig::default()/* use setters */));
641        /// let x = FacetConfig::new().set_or_clear_rerank_config(None::<RerankConfig>);
642        /// ```
643        pub fn set_or_clear_rerank_config<T>(mut self, v: std::option::Option<T>) -> Self
644        where
645            T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
646        {
647            self.rerank_config = v.map(|x| x.into());
648            self
649        }
650    }
651
652    impl wkt::message::Message for FacetConfig {
653        fn typename() -> &'static str {
654            "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig"
655        }
656    }
657
658    /// Defines additional types related to [FacetConfig].
659    pub mod facet_config {
660        #[allow(unused_imports)]
661        use super::*;
662
663        /// [Facet values][google.cloud.retail.v2.SearchResponse.Facet.values] to
664        /// ignore on [facets][google.cloud.retail.v2.SearchResponse.Facet] during
665        /// the specified time range for the given
666        /// [SearchResponse.Facet.key][google.cloud.retail.v2.SearchResponse.Facet.key]
667        /// attribute.
668        ///
669        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
670        /// [google.cloud.retail.v2.SearchResponse.Facet.key]: crate::model::search_response::Facet::key
671        /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
672        #[derive(Clone, Default, PartialEq)]
673        #[non_exhaustive]
674        pub struct IgnoredFacetValues {
675            /// List of facet values to ignore for the following time range. The facet
676            /// values are the same as the attribute values. There is a limit of 10
677            /// values per instance of IgnoredFacetValues. Each value can have at most
678            /// 128 characters.
679            pub values: std::vec::Vec<std::string::String>,
680
681            /// Time range for the current list of facet values to ignore.
682            /// If multiple time ranges are specified for an facet value for the
683            /// current attribute, consider all of them. If both are empty, ignore
684            /// always. If start time and end time are set, then start time
685            /// must be before end time.
686            /// If start time is not empty and end time is empty, then will ignore
687            /// these facet values after the start time.
688            pub start_time: std::option::Option<wkt::Timestamp>,
689
690            /// If start time is empty and end time is not empty, then ignore these
691            /// facet values before end time.
692            pub end_time: std::option::Option<wkt::Timestamp>,
693
694            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
695        }
696
697        impl IgnoredFacetValues {
698            pub fn new() -> Self {
699                std::default::Default::default()
700            }
701
702            /// Sets the value of [values][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::values].
703            ///
704            /// # Example
705            /// ```ignore,no_run
706            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
707            /// let x = IgnoredFacetValues::new().set_values(["a", "b", "c"]);
708            /// ```
709            pub fn set_values<T, V>(mut self, v: T) -> Self
710            where
711                T: std::iter::IntoIterator<Item = V>,
712                V: std::convert::Into<std::string::String>,
713            {
714                use std::iter::Iterator;
715                self.values = v.into_iter().map(|i| i.into()).collect();
716                self
717            }
718
719            /// Sets the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
720            ///
721            /// # Example
722            /// ```ignore,no_run
723            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
724            /// use wkt::Timestamp;
725            /// let x = IgnoredFacetValues::new().set_start_time(Timestamp::default()/* use setters */);
726            /// ```
727            pub fn set_start_time<T>(mut self, v: T) -> Self
728            where
729                T: std::convert::Into<wkt::Timestamp>,
730            {
731                self.start_time = std::option::Option::Some(v.into());
732                self
733            }
734
735            /// Sets or clears the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
736            ///
737            /// # Example
738            /// ```ignore,no_run
739            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
740            /// use wkt::Timestamp;
741            /// let x = IgnoredFacetValues::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
742            /// let x = IgnoredFacetValues::new().set_or_clear_start_time(None::<Timestamp>);
743            /// ```
744            pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
745            where
746                T: std::convert::Into<wkt::Timestamp>,
747            {
748                self.start_time = v.map(|x| x.into());
749                self
750            }
751
752            /// Sets the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
753            ///
754            /// # Example
755            /// ```ignore,no_run
756            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
757            /// use wkt::Timestamp;
758            /// let x = IgnoredFacetValues::new().set_end_time(Timestamp::default()/* use setters */);
759            /// ```
760            pub fn set_end_time<T>(mut self, v: T) -> Self
761            where
762                T: std::convert::Into<wkt::Timestamp>,
763            {
764                self.end_time = std::option::Option::Some(v.into());
765                self
766            }
767
768            /// Sets or clears the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
769            ///
770            /// # Example
771            /// ```ignore,no_run
772            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
773            /// use wkt::Timestamp;
774            /// let x = IgnoredFacetValues::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
775            /// let x = IgnoredFacetValues::new().set_or_clear_end_time(None::<Timestamp>);
776            /// ```
777            pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
778            where
779                T: std::convert::Into<wkt::Timestamp>,
780            {
781                self.end_time = v.map(|x| x.into());
782                self
783            }
784        }
785
786        impl wkt::message::Message for IgnoredFacetValues {
787            fn typename() -> &'static str {
788                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues"
789            }
790        }
791
792        /// Replaces a set of textual facet values by the same (possibly different)
793        /// merged facet value. Each facet value should appear at most once as a
794        /// value per [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
795        /// This feature is available only for textual custom attributes.
796        ///
797        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
798        #[derive(Clone, Default, PartialEq)]
799        #[non_exhaustive]
800        pub struct MergedFacetValue {
801            /// All the facet values that are replaces by the same
802            /// [merged_value][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]
803            /// that follows. The maximum number of values per MergedFacetValue is 25.
804            /// Each value can have up to 128 characters.
805            ///
806            /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]: crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value
807            pub values: std::vec::Vec<std::string::String>,
808
809            /// All the previous values are replaced by this merged facet value.
810            /// This merged_value must be non-empty and can have up to 128 characters.
811            pub merged_value: std::string::String,
812
813            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
814        }
815
816        impl MergedFacetValue {
817            pub fn new() -> Self {
818                std::default::Default::default()
819            }
820
821            /// Sets the value of [values][crate::model::catalog_attribute::facet_config::MergedFacetValue::values].
822            ///
823            /// # Example
824            /// ```ignore,no_run
825            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
826            /// let x = MergedFacetValue::new().set_values(["a", "b", "c"]);
827            /// ```
828            pub fn set_values<T, V>(mut self, v: T) -> Self
829            where
830                T: std::iter::IntoIterator<Item = V>,
831                V: std::convert::Into<std::string::String>,
832            {
833                use std::iter::Iterator;
834                self.values = v.into_iter().map(|i| i.into()).collect();
835                self
836            }
837
838            /// Sets the value of [merged_value][crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value].
839            ///
840            /// # Example
841            /// ```ignore,no_run
842            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
843            /// let x = MergedFacetValue::new().set_merged_value("example");
844            /// ```
845            pub fn set_merged_value<T: std::convert::Into<std::string::String>>(
846                mut self,
847                v: T,
848            ) -> Self {
849                self.merged_value = v.into();
850                self
851            }
852        }
853
854        impl wkt::message::Message for MergedFacetValue {
855            fn typename() -> &'static str {
856                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue"
857            }
858        }
859
860        /// The current facet key (i.e. attribute config) maps into the
861        /// [merged_facet_key][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key].
862        /// A facet key can have at most one child. The current facet key and the
863        /// merged facet key need both to be textual custom attributes or both
864        /// numerical custom attributes (same type).
865        ///
866        /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key]: crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key
867        #[derive(Clone, Default, PartialEq)]
868        #[non_exhaustive]
869        pub struct MergedFacet {
870            /// The merged facet key should be a valid facet key that is different than
871            /// the facet key of the current catalog attribute. We refer this is
872            /// merged facet key as the child of the current catalog attribute. This
873            /// merged facet key can't be a parent of another facet key (i.e. no
874            /// directed path of length 2). This merged facet key needs to be either a
875            /// textual custom attribute or a numerical custom attribute.
876            pub merged_facet_key: std::string::String,
877
878            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
879        }
880
881        impl MergedFacet {
882            pub fn new() -> Self {
883                std::default::Default::default()
884            }
885
886            /// Sets the value of [merged_facet_key][crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key].
887            ///
888            /// # Example
889            /// ```ignore,no_run
890            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
891            /// let x = MergedFacet::new().set_merged_facet_key("example");
892            /// ```
893            pub fn set_merged_facet_key<T: std::convert::Into<std::string::String>>(
894                mut self,
895                v: T,
896            ) -> Self {
897                self.merged_facet_key = v.into();
898                self
899            }
900        }
901
902        impl wkt::message::Message for MergedFacet {
903            fn typename() -> &'static str {
904                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet"
905            }
906        }
907
908        /// Options to rerank based on facet values engaged by the user for the
909        /// current key. That key needs to be a custom textual key and facetable.
910        /// To use this control, you also need to pass all the facet keys engaged by
911        /// the user in the request using the field [SearchRequest.FacetSpec]. In
912        /// particular, if you don't pass the facet keys engaged that you want to
913        /// rerank on, this control won't be effective. Moreover, to obtain better
914        /// results, the facet values that you want to rerank on should be close to
915        /// English (ideally made of words, underscores, and spaces).
916        #[derive(Clone, Default, PartialEq)]
917        #[non_exhaustive]
918        pub struct RerankConfig {
919            /// If set to true, then we also rerank the dynamic facets based on the
920            /// facet values engaged by the user for the current attribute key during
921            /// serving.
922            pub rerank_facet: bool,
923
924            /// If empty, rerank on all facet values for the current key. Otherwise,
925            /// will rerank on the facet values from this list only.
926            pub facet_values: std::vec::Vec<std::string::String>,
927
928            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
929        }
930
931        impl RerankConfig {
932            pub fn new() -> Self {
933                std::default::Default::default()
934            }
935
936            /// Sets the value of [rerank_facet][crate::model::catalog_attribute::facet_config::RerankConfig::rerank_facet].
937            ///
938            /// # Example
939            /// ```ignore,no_run
940            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
941            /// let x = RerankConfig::new().set_rerank_facet(true);
942            /// ```
943            pub fn set_rerank_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
944                self.rerank_facet = v.into();
945                self
946            }
947
948            /// Sets the value of [facet_values][crate::model::catalog_attribute::facet_config::RerankConfig::facet_values].
949            ///
950            /// # Example
951            /// ```ignore,no_run
952            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
953            /// let x = RerankConfig::new().set_facet_values(["a", "b", "c"]);
954            /// ```
955            pub fn set_facet_values<T, V>(mut self, v: T) -> Self
956            where
957                T: std::iter::IntoIterator<Item = V>,
958                V: std::convert::Into<std::string::String>,
959            {
960                use std::iter::Iterator;
961                self.facet_values = v.into_iter().map(|i| i.into()).collect();
962                self
963            }
964        }
965
966        impl wkt::message::Message for RerankConfig {
967            fn typename() -> &'static str {
968                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig"
969            }
970        }
971    }
972
973    /// The type of an attribute.
974    ///
975    /// # Working with unknown values
976    ///
977    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
978    /// additional enum variants at any time. Adding new variants is not considered
979    /// a breaking change. Applications should write their code in anticipation of:
980    ///
981    /// - New values appearing in future releases of the client library, **and**
982    /// - New values received dynamically, without application changes.
983    ///
984    /// Please consult the [Working with enums] section in the user guide for some
985    /// guidelines.
986    ///
987    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
988    #[derive(Clone, Debug, PartialEq)]
989    #[non_exhaustive]
990    pub enum AttributeType {
991        /// The type of the attribute is unknown.
992        ///
993        /// Used when type cannot be derived from attribute that is not
994        /// [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
995        ///
996        /// [google.cloud.retail.v2.CatalogAttribute.in_use]: crate::model::CatalogAttribute::in_use
997        Unknown,
998        /// Textual attribute.
999        Textual,
1000        /// Numerical attribute.
1001        Numerical,
1002        /// If set, the enum was initialized with an unknown value.
1003        ///
1004        /// Applications can examine the value using [AttributeType::value] or
1005        /// [AttributeType::name].
1006        UnknownValue(attribute_type::UnknownValue),
1007    }
1008
1009    #[doc(hidden)]
1010    pub mod attribute_type {
1011        #[allow(unused_imports)]
1012        use super::*;
1013        #[derive(Clone, Debug, PartialEq)]
1014        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1015    }
1016
1017    impl AttributeType {
1018        /// Gets the enum value.
1019        ///
1020        /// Returns `None` if the enum contains an unknown value deserialized from
1021        /// the string representation of enums.
1022        pub fn value(&self) -> std::option::Option<i32> {
1023            match self {
1024                Self::Unknown => std::option::Option::Some(0),
1025                Self::Textual => std::option::Option::Some(1),
1026                Self::Numerical => std::option::Option::Some(2),
1027                Self::UnknownValue(u) => u.0.value(),
1028            }
1029        }
1030
1031        /// Gets the enum value as a string.
1032        ///
1033        /// Returns `None` if the enum contains an unknown value deserialized from
1034        /// the integer representation of enums.
1035        pub fn name(&self) -> std::option::Option<&str> {
1036            match self {
1037                Self::Unknown => std::option::Option::Some("UNKNOWN"),
1038                Self::Textual => std::option::Option::Some("TEXTUAL"),
1039                Self::Numerical => std::option::Option::Some("NUMERICAL"),
1040                Self::UnknownValue(u) => u.0.name(),
1041            }
1042        }
1043    }
1044
1045    impl std::default::Default for AttributeType {
1046        fn default() -> Self {
1047            use std::convert::From;
1048            Self::from(0)
1049        }
1050    }
1051
1052    impl std::fmt::Display for AttributeType {
1053        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1054            wkt::internal::display_enum(f, self.name(), self.value())
1055        }
1056    }
1057
1058    impl std::convert::From<i32> for AttributeType {
1059        fn from(value: i32) -> Self {
1060            match value {
1061                0 => Self::Unknown,
1062                1 => Self::Textual,
1063                2 => Self::Numerical,
1064                _ => Self::UnknownValue(attribute_type::UnknownValue(
1065                    wkt::internal::UnknownEnumValue::Integer(value),
1066                )),
1067            }
1068        }
1069    }
1070
1071    impl std::convert::From<&str> for AttributeType {
1072        fn from(value: &str) -> Self {
1073            use std::string::ToString;
1074            match value {
1075                "UNKNOWN" => Self::Unknown,
1076                "TEXTUAL" => Self::Textual,
1077                "NUMERICAL" => Self::Numerical,
1078                _ => Self::UnknownValue(attribute_type::UnknownValue(
1079                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1080                )),
1081            }
1082        }
1083    }
1084
1085    impl serde::ser::Serialize for AttributeType {
1086        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1087        where
1088            S: serde::Serializer,
1089        {
1090            match self {
1091                Self::Unknown => serializer.serialize_i32(0),
1092                Self::Textual => serializer.serialize_i32(1),
1093                Self::Numerical => serializer.serialize_i32(2),
1094                Self::UnknownValue(u) => u.0.serialize(serializer),
1095            }
1096        }
1097    }
1098
1099    impl<'de> serde::de::Deserialize<'de> for AttributeType {
1100        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1101        where
1102            D: serde::Deserializer<'de>,
1103        {
1104            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeType>::new(
1105                ".google.cloud.retail.v2.CatalogAttribute.AttributeType",
1106            ))
1107        }
1108    }
1109
1110    /// The status of the indexable option of a catalog attribute.
1111    ///
1112    /// # Working with unknown values
1113    ///
1114    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1115    /// additional enum variants at any time. Adding new variants is not considered
1116    /// a breaking change. Applications should write their code in anticipation of:
1117    ///
1118    /// - New values appearing in future releases of the client library, **and**
1119    /// - New values received dynamically, without application changes.
1120    ///
1121    /// Please consult the [Working with enums] section in the user guide for some
1122    /// guidelines.
1123    ///
1124    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1125    #[derive(Clone, Debug, PartialEq)]
1126    #[non_exhaustive]
1127    pub enum IndexableOption {
1128        /// Value used when unset.
1129        Unspecified,
1130        /// Indexable option enabled for an attribute.
1131        IndexableEnabled,
1132        /// Indexable option disabled for an attribute.
1133        IndexableDisabled,
1134        /// If set, the enum was initialized with an unknown value.
1135        ///
1136        /// Applications can examine the value using [IndexableOption::value] or
1137        /// [IndexableOption::name].
1138        UnknownValue(indexable_option::UnknownValue),
1139    }
1140
1141    #[doc(hidden)]
1142    pub mod indexable_option {
1143        #[allow(unused_imports)]
1144        use super::*;
1145        #[derive(Clone, Debug, PartialEq)]
1146        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1147    }
1148
1149    impl IndexableOption {
1150        /// Gets the enum value.
1151        ///
1152        /// Returns `None` if the enum contains an unknown value deserialized from
1153        /// the string representation of enums.
1154        pub fn value(&self) -> std::option::Option<i32> {
1155            match self {
1156                Self::Unspecified => std::option::Option::Some(0),
1157                Self::IndexableEnabled => std::option::Option::Some(1),
1158                Self::IndexableDisabled => std::option::Option::Some(2),
1159                Self::UnknownValue(u) => u.0.value(),
1160            }
1161        }
1162
1163        /// Gets the enum value as a string.
1164        ///
1165        /// Returns `None` if the enum contains an unknown value deserialized from
1166        /// the integer representation of enums.
1167        pub fn name(&self) -> std::option::Option<&str> {
1168            match self {
1169                Self::Unspecified => std::option::Option::Some("INDEXABLE_OPTION_UNSPECIFIED"),
1170                Self::IndexableEnabled => std::option::Option::Some("INDEXABLE_ENABLED"),
1171                Self::IndexableDisabled => std::option::Option::Some("INDEXABLE_DISABLED"),
1172                Self::UnknownValue(u) => u.0.name(),
1173            }
1174        }
1175    }
1176
1177    impl std::default::Default for IndexableOption {
1178        fn default() -> Self {
1179            use std::convert::From;
1180            Self::from(0)
1181        }
1182    }
1183
1184    impl std::fmt::Display for IndexableOption {
1185        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1186            wkt::internal::display_enum(f, self.name(), self.value())
1187        }
1188    }
1189
1190    impl std::convert::From<i32> for IndexableOption {
1191        fn from(value: i32) -> Self {
1192            match value {
1193                0 => Self::Unspecified,
1194                1 => Self::IndexableEnabled,
1195                2 => Self::IndexableDisabled,
1196                _ => Self::UnknownValue(indexable_option::UnknownValue(
1197                    wkt::internal::UnknownEnumValue::Integer(value),
1198                )),
1199            }
1200        }
1201    }
1202
1203    impl std::convert::From<&str> for IndexableOption {
1204        fn from(value: &str) -> Self {
1205            use std::string::ToString;
1206            match value {
1207                "INDEXABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1208                "INDEXABLE_ENABLED" => Self::IndexableEnabled,
1209                "INDEXABLE_DISABLED" => Self::IndexableDisabled,
1210                _ => Self::UnknownValue(indexable_option::UnknownValue(
1211                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1212                )),
1213            }
1214        }
1215    }
1216
1217    impl serde::ser::Serialize for IndexableOption {
1218        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1219        where
1220            S: serde::Serializer,
1221        {
1222            match self {
1223                Self::Unspecified => serializer.serialize_i32(0),
1224                Self::IndexableEnabled => serializer.serialize_i32(1),
1225                Self::IndexableDisabled => serializer.serialize_i32(2),
1226                Self::UnknownValue(u) => u.0.serialize(serializer),
1227            }
1228        }
1229    }
1230
1231    impl<'de> serde::de::Deserialize<'de> for IndexableOption {
1232        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1233        where
1234            D: serde::Deserializer<'de>,
1235        {
1236            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexableOption>::new(
1237                ".google.cloud.retail.v2.CatalogAttribute.IndexableOption",
1238            ))
1239        }
1240    }
1241
1242    /// The status of the dynamic facetable option of a catalog attribute.
1243    ///
1244    /// # Working with unknown values
1245    ///
1246    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1247    /// additional enum variants at any time. Adding new variants is not considered
1248    /// a breaking change. Applications should write their code in anticipation of:
1249    ///
1250    /// - New values appearing in future releases of the client library, **and**
1251    /// - New values received dynamically, without application changes.
1252    ///
1253    /// Please consult the [Working with enums] section in the user guide for some
1254    /// guidelines.
1255    ///
1256    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1257    #[derive(Clone, Debug, PartialEq)]
1258    #[non_exhaustive]
1259    pub enum DynamicFacetableOption {
1260        /// Value used when unset.
1261        Unspecified,
1262        /// Dynamic facetable option enabled for an attribute.
1263        DynamicFacetableEnabled,
1264        /// Dynamic facetable option disabled for an attribute.
1265        DynamicFacetableDisabled,
1266        /// If set, the enum was initialized with an unknown value.
1267        ///
1268        /// Applications can examine the value using [DynamicFacetableOption::value] or
1269        /// [DynamicFacetableOption::name].
1270        UnknownValue(dynamic_facetable_option::UnknownValue),
1271    }
1272
1273    #[doc(hidden)]
1274    pub mod dynamic_facetable_option {
1275        #[allow(unused_imports)]
1276        use super::*;
1277        #[derive(Clone, Debug, PartialEq)]
1278        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1279    }
1280
1281    impl DynamicFacetableOption {
1282        /// Gets the enum value.
1283        ///
1284        /// Returns `None` if the enum contains an unknown value deserialized from
1285        /// the string representation of enums.
1286        pub fn value(&self) -> std::option::Option<i32> {
1287            match self {
1288                Self::Unspecified => std::option::Option::Some(0),
1289                Self::DynamicFacetableEnabled => std::option::Option::Some(1),
1290                Self::DynamicFacetableDisabled => std::option::Option::Some(2),
1291                Self::UnknownValue(u) => u.0.value(),
1292            }
1293        }
1294
1295        /// Gets the enum value as a string.
1296        ///
1297        /// Returns `None` if the enum contains an unknown value deserialized from
1298        /// the integer representation of enums.
1299        pub fn name(&self) -> std::option::Option<&str> {
1300            match self {
1301                Self::Unspecified => {
1302                    std::option::Option::Some("DYNAMIC_FACETABLE_OPTION_UNSPECIFIED")
1303                }
1304                Self::DynamicFacetableEnabled => {
1305                    std::option::Option::Some("DYNAMIC_FACETABLE_ENABLED")
1306                }
1307                Self::DynamicFacetableDisabled => {
1308                    std::option::Option::Some("DYNAMIC_FACETABLE_DISABLED")
1309                }
1310                Self::UnknownValue(u) => u.0.name(),
1311            }
1312        }
1313    }
1314
1315    impl std::default::Default for DynamicFacetableOption {
1316        fn default() -> Self {
1317            use std::convert::From;
1318            Self::from(0)
1319        }
1320    }
1321
1322    impl std::fmt::Display for DynamicFacetableOption {
1323        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1324            wkt::internal::display_enum(f, self.name(), self.value())
1325        }
1326    }
1327
1328    impl std::convert::From<i32> for DynamicFacetableOption {
1329        fn from(value: i32) -> Self {
1330            match value {
1331                0 => Self::Unspecified,
1332                1 => Self::DynamicFacetableEnabled,
1333                2 => Self::DynamicFacetableDisabled,
1334                _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1335                    wkt::internal::UnknownEnumValue::Integer(value),
1336                )),
1337            }
1338        }
1339    }
1340
1341    impl std::convert::From<&str> for DynamicFacetableOption {
1342        fn from(value: &str) -> Self {
1343            use std::string::ToString;
1344            match value {
1345                "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1346                "DYNAMIC_FACETABLE_ENABLED" => Self::DynamicFacetableEnabled,
1347                "DYNAMIC_FACETABLE_DISABLED" => Self::DynamicFacetableDisabled,
1348                _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1349                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1350                )),
1351            }
1352        }
1353    }
1354
1355    impl serde::ser::Serialize for DynamicFacetableOption {
1356        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1357        where
1358            S: serde::Serializer,
1359        {
1360            match self {
1361                Self::Unspecified => serializer.serialize_i32(0),
1362                Self::DynamicFacetableEnabled => serializer.serialize_i32(1),
1363                Self::DynamicFacetableDisabled => serializer.serialize_i32(2),
1364                Self::UnknownValue(u) => u.0.serialize(serializer),
1365            }
1366        }
1367    }
1368
1369    impl<'de> serde::de::Deserialize<'de> for DynamicFacetableOption {
1370        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1371        where
1372            D: serde::Deserializer<'de>,
1373        {
1374            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DynamicFacetableOption>::new(
1375                ".google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption",
1376            ))
1377        }
1378    }
1379
1380    /// The status of the searchable option of a catalog attribute.
1381    ///
1382    /// # Working with unknown values
1383    ///
1384    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1385    /// additional enum variants at any time. Adding new variants is not considered
1386    /// a breaking change. Applications should write their code in anticipation of:
1387    ///
1388    /// - New values appearing in future releases of the client library, **and**
1389    /// - New values received dynamically, without application changes.
1390    ///
1391    /// Please consult the [Working with enums] section in the user guide for some
1392    /// guidelines.
1393    ///
1394    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1395    #[derive(Clone, Debug, PartialEq)]
1396    #[non_exhaustive]
1397    pub enum SearchableOption {
1398        /// Value used when unset.
1399        Unspecified,
1400        /// Searchable option enabled for an attribute.
1401        SearchableEnabled,
1402        /// Searchable option disabled for an attribute.
1403        SearchableDisabled,
1404        /// If set, the enum was initialized with an unknown value.
1405        ///
1406        /// Applications can examine the value using [SearchableOption::value] or
1407        /// [SearchableOption::name].
1408        UnknownValue(searchable_option::UnknownValue),
1409    }
1410
1411    #[doc(hidden)]
1412    pub mod searchable_option {
1413        #[allow(unused_imports)]
1414        use super::*;
1415        #[derive(Clone, Debug, PartialEq)]
1416        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1417    }
1418
1419    impl SearchableOption {
1420        /// Gets the enum value.
1421        ///
1422        /// Returns `None` if the enum contains an unknown value deserialized from
1423        /// the string representation of enums.
1424        pub fn value(&self) -> std::option::Option<i32> {
1425            match self {
1426                Self::Unspecified => std::option::Option::Some(0),
1427                Self::SearchableEnabled => std::option::Option::Some(1),
1428                Self::SearchableDisabled => std::option::Option::Some(2),
1429                Self::UnknownValue(u) => u.0.value(),
1430            }
1431        }
1432
1433        /// Gets the enum value as a string.
1434        ///
1435        /// Returns `None` if the enum contains an unknown value deserialized from
1436        /// the integer representation of enums.
1437        pub fn name(&self) -> std::option::Option<&str> {
1438            match self {
1439                Self::Unspecified => std::option::Option::Some("SEARCHABLE_OPTION_UNSPECIFIED"),
1440                Self::SearchableEnabled => std::option::Option::Some("SEARCHABLE_ENABLED"),
1441                Self::SearchableDisabled => std::option::Option::Some("SEARCHABLE_DISABLED"),
1442                Self::UnknownValue(u) => u.0.name(),
1443            }
1444        }
1445    }
1446
1447    impl std::default::Default for SearchableOption {
1448        fn default() -> Self {
1449            use std::convert::From;
1450            Self::from(0)
1451        }
1452    }
1453
1454    impl std::fmt::Display for SearchableOption {
1455        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1456            wkt::internal::display_enum(f, self.name(), self.value())
1457        }
1458    }
1459
1460    impl std::convert::From<i32> for SearchableOption {
1461        fn from(value: i32) -> Self {
1462            match value {
1463                0 => Self::Unspecified,
1464                1 => Self::SearchableEnabled,
1465                2 => Self::SearchableDisabled,
1466                _ => Self::UnknownValue(searchable_option::UnknownValue(
1467                    wkt::internal::UnknownEnumValue::Integer(value),
1468                )),
1469            }
1470        }
1471    }
1472
1473    impl std::convert::From<&str> for SearchableOption {
1474        fn from(value: &str) -> Self {
1475            use std::string::ToString;
1476            match value {
1477                "SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1478                "SEARCHABLE_ENABLED" => Self::SearchableEnabled,
1479                "SEARCHABLE_DISABLED" => Self::SearchableDisabled,
1480                _ => Self::UnknownValue(searchable_option::UnknownValue(
1481                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1482                )),
1483            }
1484        }
1485    }
1486
1487    impl serde::ser::Serialize for SearchableOption {
1488        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1489        where
1490            S: serde::Serializer,
1491        {
1492            match self {
1493                Self::Unspecified => serializer.serialize_i32(0),
1494                Self::SearchableEnabled => serializer.serialize_i32(1),
1495                Self::SearchableDisabled => serializer.serialize_i32(2),
1496                Self::UnknownValue(u) => u.0.serialize(serializer),
1497            }
1498        }
1499    }
1500
1501    impl<'de> serde::de::Deserialize<'de> for SearchableOption {
1502        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1503        where
1504            D: serde::Deserializer<'de>,
1505        {
1506            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchableOption>::new(
1507                ".google.cloud.retail.v2.CatalogAttribute.SearchableOption",
1508            ))
1509        }
1510    }
1511
1512    /// The status of the exact-searchable option of a catalog attribute.
1513    ///
1514    /// # Working with unknown values
1515    ///
1516    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1517    /// additional enum variants at any time. Adding new variants is not considered
1518    /// a breaking change. Applications should write their code in anticipation of:
1519    ///
1520    /// - New values appearing in future releases of the client library, **and**
1521    /// - New values received dynamically, without application changes.
1522    ///
1523    /// Please consult the [Working with enums] section in the user guide for some
1524    /// guidelines.
1525    ///
1526    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1527    #[derive(Clone, Debug, PartialEq)]
1528    #[non_exhaustive]
1529    pub enum ExactSearchableOption {
1530        /// Value used when unset.
1531        Unspecified,
1532        /// Exact searchable option enabled for an attribute.
1533        ExactSearchableEnabled,
1534        /// Exact searchable option disabled for an attribute.
1535        ExactSearchableDisabled,
1536        /// If set, the enum was initialized with an unknown value.
1537        ///
1538        /// Applications can examine the value using [ExactSearchableOption::value] or
1539        /// [ExactSearchableOption::name].
1540        UnknownValue(exact_searchable_option::UnknownValue),
1541    }
1542
1543    #[doc(hidden)]
1544    pub mod exact_searchable_option {
1545        #[allow(unused_imports)]
1546        use super::*;
1547        #[derive(Clone, Debug, PartialEq)]
1548        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1549    }
1550
1551    impl ExactSearchableOption {
1552        /// Gets the enum value.
1553        ///
1554        /// Returns `None` if the enum contains an unknown value deserialized from
1555        /// the string representation of enums.
1556        pub fn value(&self) -> std::option::Option<i32> {
1557            match self {
1558                Self::Unspecified => std::option::Option::Some(0),
1559                Self::ExactSearchableEnabled => std::option::Option::Some(1),
1560                Self::ExactSearchableDisabled => std::option::Option::Some(2),
1561                Self::UnknownValue(u) => u.0.value(),
1562            }
1563        }
1564
1565        /// Gets the enum value as a string.
1566        ///
1567        /// Returns `None` if the enum contains an unknown value deserialized from
1568        /// the integer representation of enums.
1569        pub fn name(&self) -> std::option::Option<&str> {
1570            match self {
1571                Self::Unspecified => {
1572                    std::option::Option::Some("EXACT_SEARCHABLE_OPTION_UNSPECIFIED")
1573                }
1574                Self::ExactSearchableEnabled => {
1575                    std::option::Option::Some("EXACT_SEARCHABLE_ENABLED")
1576                }
1577                Self::ExactSearchableDisabled => {
1578                    std::option::Option::Some("EXACT_SEARCHABLE_DISABLED")
1579                }
1580                Self::UnknownValue(u) => u.0.name(),
1581            }
1582        }
1583    }
1584
1585    impl std::default::Default for ExactSearchableOption {
1586        fn default() -> Self {
1587            use std::convert::From;
1588            Self::from(0)
1589        }
1590    }
1591
1592    impl std::fmt::Display for ExactSearchableOption {
1593        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1594            wkt::internal::display_enum(f, self.name(), self.value())
1595        }
1596    }
1597
1598    impl std::convert::From<i32> for ExactSearchableOption {
1599        fn from(value: i32) -> Self {
1600            match value {
1601                0 => Self::Unspecified,
1602                1 => Self::ExactSearchableEnabled,
1603                2 => Self::ExactSearchableDisabled,
1604                _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1605                    wkt::internal::UnknownEnumValue::Integer(value),
1606                )),
1607            }
1608        }
1609    }
1610
1611    impl std::convert::From<&str> for ExactSearchableOption {
1612        fn from(value: &str) -> Self {
1613            use std::string::ToString;
1614            match value {
1615                "EXACT_SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1616                "EXACT_SEARCHABLE_ENABLED" => Self::ExactSearchableEnabled,
1617                "EXACT_SEARCHABLE_DISABLED" => Self::ExactSearchableDisabled,
1618                _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1619                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1620                )),
1621            }
1622        }
1623    }
1624
1625    impl serde::ser::Serialize for ExactSearchableOption {
1626        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1627        where
1628            S: serde::Serializer,
1629        {
1630            match self {
1631                Self::Unspecified => serializer.serialize_i32(0),
1632                Self::ExactSearchableEnabled => serializer.serialize_i32(1),
1633                Self::ExactSearchableDisabled => serializer.serialize_i32(2),
1634                Self::UnknownValue(u) => u.0.serialize(serializer),
1635            }
1636        }
1637    }
1638
1639    impl<'de> serde::de::Deserialize<'de> for ExactSearchableOption {
1640        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1641        where
1642            D: serde::Deserializer<'de>,
1643        {
1644            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExactSearchableOption>::new(
1645                ".google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption",
1646            ))
1647        }
1648    }
1649
1650    /// The status of the retrievable option of a catalog attribute.
1651    ///
1652    /// # Working with unknown values
1653    ///
1654    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1655    /// additional enum variants at any time. Adding new variants is not considered
1656    /// a breaking change. Applications should write their code in anticipation of:
1657    ///
1658    /// - New values appearing in future releases of the client library, **and**
1659    /// - New values received dynamically, without application changes.
1660    ///
1661    /// Please consult the [Working with enums] section in the user guide for some
1662    /// guidelines.
1663    ///
1664    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1665    #[derive(Clone, Debug, PartialEq)]
1666    #[non_exhaustive]
1667    pub enum RetrievableOption {
1668        /// Value used when unset.
1669        Unspecified,
1670        /// Retrievable option enabled for an attribute.
1671        RetrievableEnabled,
1672        /// Retrievable option disabled for an attribute.
1673        RetrievableDisabled,
1674        /// If set, the enum was initialized with an unknown value.
1675        ///
1676        /// Applications can examine the value using [RetrievableOption::value] or
1677        /// [RetrievableOption::name].
1678        UnknownValue(retrievable_option::UnknownValue),
1679    }
1680
1681    #[doc(hidden)]
1682    pub mod retrievable_option {
1683        #[allow(unused_imports)]
1684        use super::*;
1685        #[derive(Clone, Debug, PartialEq)]
1686        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1687    }
1688
1689    impl RetrievableOption {
1690        /// Gets the enum value.
1691        ///
1692        /// Returns `None` if the enum contains an unknown value deserialized from
1693        /// the string representation of enums.
1694        pub fn value(&self) -> std::option::Option<i32> {
1695            match self {
1696                Self::Unspecified => std::option::Option::Some(0),
1697                Self::RetrievableEnabled => std::option::Option::Some(1),
1698                Self::RetrievableDisabled => std::option::Option::Some(2),
1699                Self::UnknownValue(u) => u.0.value(),
1700            }
1701        }
1702
1703        /// Gets the enum value as a string.
1704        ///
1705        /// Returns `None` if the enum contains an unknown value deserialized from
1706        /// the integer representation of enums.
1707        pub fn name(&self) -> std::option::Option<&str> {
1708            match self {
1709                Self::Unspecified => std::option::Option::Some("RETRIEVABLE_OPTION_UNSPECIFIED"),
1710                Self::RetrievableEnabled => std::option::Option::Some("RETRIEVABLE_ENABLED"),
1711                Self::RetrievableDisabled => std::option::Option::Some("RETRIEVABLE_DISABLED"),
1712                Self::UnknownValue(u) => u.0.name(),
1713            }
1714        }
1715    }
1716
1717    impl std::default::Default for RetrievableOption {
1718        fn default() -> Self {
1719            use std::convert::From;
1720            Self::from(0)
1721        }
1722    }
1723
1724    impl std::fmt::Display for RetrievableOption {
1725        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1726            wkt::internal::display_enum(f, self.name(), self.value())
1727        }
1728    }
1729
1730    impl std::convert::From<i32> for RetrievableOption {
1731        fn from(value: i32) -> Self {
1732            match value {
1733                0 => Self::Unspecified,
1734                1 => Self::RetrievableEnabled,
1735                2 => Self::RetrievableDisabled,
1736                _ => Self::UnknownValue(retrievable_option::UnknownValue(
1737                    wkt::internal::UnknownEnumValue::Integer(value),
1738                )),
1739            }
1740        }
1741    }
1742
1743    impl std::convert::From<&str> for RetrievableOption {
1744        fn from(value: &str) -> Self {
1745            use std::string::ToString;
1746            match value {
1747                "RETRIEVABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1748                "RETRIEVABLE_ENABLED" => Self::RetrievableEnabled,
1749                "RETRIEVABLE_DISABLED" => Self::RetrievableDisabled,
1750                _ => Self::UnknownValue(retrievable_option::UnknownValue(
1751                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1752                )),
1753            }
1754        }
1755    }
1756
1757    impl serde::ser::Serialize for RetrievableOption {
1758        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1759        where
1760            S: serde::Serializer,
1761        {
1762            match self {
1763                Self::Unspecified => serializer.serialize_i32(0),
1764                Self::RetrievableEnabled => serializer.serialize_i32(1),
1765                Self::RetrievableDisabled => serializer.serialize_i32(2),
1766                Self::UnknownValue(u) => u.0.serialize(serializer),
1767            }
1768        }
1769    }
1770
1771    impl<'de> serde::de::Deserialize<'de> for RetrievableOption {
1772        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1773        where
1774            D: serde::Deserializer<'de>,
1775        {
1776            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetrievableOption>::new(
1777                ".google.cloud.retail.v2.CatalogAttribute.RetrievableOption",
1778            ))
1779        }
1780    }
1781}
1782
1783/// Catalog level attribute config.
1784#[derive(Clone, Default, PartialEq)]
1785#[non_exhaustive]
1786pub struct AttributesConfig {
1787    /// Required. Immutable. The fully qualified resource name of the attribute
1788    /// config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
1789    pub name: std::string::String,
1790
1791    /// Enable attribute(s) config at catalog level.
1792    /// For example, indexable, dynamic_facetable, or searchable for each
1793    /// attribute.
1794    ///
1795    /// The key is catalog attribute's name.
1796    /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
1797    /// `attributes.xyz`.
1798    ///
1799    /// The maximum number of catalog attributes allowed in a request is 1000.
1800    pub catalog_attributes:
1801        std::collections::HashMap<std::string::String, crate::model::CatalogAttribute>,
1802
1803    /// Output only. The
1804    /// [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
1805    /// for this catalog.
1806    ///
1807    /// [google.cloud.retail.v2.AttributeConfigLevel]: crate::model::AttributeConfigLevel
1808    pub attribute_config_level: crate::model::AttributeConfigLevel,
1809
1810    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1811}
1812
1813impl AttributesConfig {
1814    pub fn new() -> Self {
1815        std::default::Default::default()
1816    }
1817
1818    /// Sets the value of [name][crate::model::AttributesConfig::name].
1819    ///
1820    /// # Example
1821    /// ```ignore,no_run
1822    /// # use google_cloud_retail_v2::model::AttributesConfig;
1823    /// let x = AttributesConfig::new().set_name("example");
1824    /// ```
1825    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1826        self.name = v.into();
1827        self
1828    }
1829
1830    /// Sets the value of [catalog_attributes][crate::model::AttributesConfig::catalog_attributes].
1831    ///
1832    /// # Example
1833    /// ```ignore,no_run
1834    /// # use google_cloud_retail_v2::model::AttributesConfig;
1835    /// use google_cloud_retail_v2::model::CatalogAttribute;
1836    /// let x = AttributesConfig::new().set_catalog_attributes([
1837    ///     ("key0", CatalogAttribute::default()/* use setters */),
1838    ///     ("key1", CatalogAttribute::default()/* use (different) setters */),
1839    /// ]);
1840    /// ```
1841    pub fn set_catalog_attributes<T, K, V>(mut self, v: T) -> Self
1842    where
1843        T: std::iter::IntoIterator<Item = (K, V)>,
1844        K: std::convert::Into<std::string::String>,
1845        V: std::convert::Into<crate::model::CatalogAttribute>,
1846    {
1847        use std::iter::Iterator;
1848        self.catalog_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1849        self
1850    }
1851
1852    /// Sets the value of [attribute_config_level][crate::model::AttributesConfig::attribute_config_level].
1853    ///
1854    /// # Example
1855    /// ```ignore,no_run
1856    /// # use google_cloud_retail_v2::model::AttributesConfig;
1857    /// use google_cloud_retail_v2::model::AttributeConfigLevel;
1858    /// let x0 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::ProductLevelAttributeConfig);
1859    /// let x1 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::CatalogLevelAttributeConfig);
1860    /// ```
1861    pub fn set_attribute_config_level<T: std::convert::Into<crate::model::AttributeConfigLevel>>(
1862        mut self,
1863        v: T,
1864    ) -> Self {
1865        self.attribute_config_level = v.into();
1866        self
1867    }
1868}
1869
1870impl wkt::message::Message for AttributesConfig {
1871    fn typename() -> &'static str {
1872        "type.googleapis.com/google.cloud.retail.v2.AttributesConfig"
1873    }
1874}
1875
1876/// Catalog level autocomplete config for customers to customize autocomplete
1877/// feature's settings.
1878#[derive(Clone, Default, PartialEq)]
1879#[non_exhaustive]
1880pub struct CompletionConfig {
1881    /// Required. Immutable. Fully qualified name
1882    /// `projects/*/locations/*/catalogs/*/completionConfig`
1883    pub name: std::string::String,
1884
1885    /// Specifies the matching order for autocomplete suggestions, e.g., a query
1886    /// consisting of 'sh' with 'out-of-order' specified would suggest "women's
1887    /// shoes", whereas a query of 'red s' with 'exact-prefix' specified would
1888    /// suggest "red shoes". Currently supported values:
1889    ///
1890    /// * 'out-of-order'
1891    /// * 'exact-prefix'
1892    ///
1893    /// Default value: 'exact-prefix'.
1894    pub matching_order: std::string::String,
1895
1896    /// The maximum number of autocomplete suggestions returned per term. Default
1897    /// value is 20. If left unset or set to 0, then will fallback to default
1898    /// value.
1899    ///
1900    /// Value range is 1 to 20.
1901    pub max_suggestions: i32,
1902
1903    /// The minimum number of characters needed to be typed in order to get
1904    /// suggestions. Default value is 2. If left unset or set to 0, then will
1905    /// fallback to default value.
1906    ///
1907    /// Value range is 1 to 20.
1908    pub min_prefix_length: i32,
1909
1910    /// If set to true, the auto learning function is enabled. Auto learning uses
1911    /// user data to generate suggestions using ML techniques. Default value is
1912    /// false. Only after enabling auto learning can users use `cloud-retail`
1913    /// data in
1914    /// [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
1915    ///
1916    /// [google.cloud.retail.v2.CompleteQueryRequest]: crate::model::CompleteQueryRequest
1917    pub auto_learning: bool,
1918
1919    /// Output only. The source data for the latest import of the autocomplete
1920    /// suggestion phrases.
1921    pub suggestions_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1922
1923    /// Output only. Name of the LRO corresponding to the latest suggestion terms
1924    /// list import.
1925    ///
1926    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API
1927    /// method to retrieve the latest state of the Long Running Operation.
1928    pub last_suggestions_import_operation: std::string::String,
1929
1930    /// Output only. The source data for the latest import of the autocomplete
1931    /// denylist phrases.
1932    pub denylist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1933
1934    /// Output only. Name of the LRO corresponding to the latest denylist import.
1935    ///
1936    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1937    /// retrieve the latest state of the Long Running Operation.
1938    pub last_denylist_import_operation: std::string::String,
1939
1940    /// Output only. The source data for the latest import of the autocomplete
1941    /// allowlist phrases.
1942    pub allowlist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1943
1944    /// Output only. Name of the LRO corresponding to the latest allowlist import.
1945    ///
1946    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1947    /// retrieve the latest state of the Long Running Operation.
1948    pub last_allowlist_import_operation: std::string::String,
1949
1950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1951}
1952
1953impl CompletionConfig {
1954    pub fn new() -> Self {
1955        std::default::Default::default()
1956    }
1957
1958    /// Sets the value of [name][crate::model::CompletionConfig::name].
1959    ///
1960    /// # Example
1961    /// ```ignore,no_run
1962    /// # use google_cloud_retail_v2::model::CompletionConfig;
1963    /// let x = CompletionConfig::new().set_name("example");
1964    /// ```
1965    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1966        self.name = v.into();
1967        self
1968    }
1969
1970    /// Sets the value of [matching_order][crate::model::CompletionConfig::matching_order].
1971    ///
1972    /// # Example
1973    /// ```ignore,no_run
1974    /// # use google_cloud_retail_v2::model::CompletionConfig;
1975    /// let x = CompletionConfig::new().set_matching_order("example");
1976    /// ```
1977    pub fn set_matching_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1978        self.matching_order = v.into();
1979        self
1980    }
1981
1982    /// Sets the value of [max_suggestions][crate::model::CompletionConfig::max_suggestions].
1983    ///
1984    /// # Example
1985    /// ```ignore,no_run
1986    /// # use google_cloud_retail_v2::model::CompletionConfig;
1987    /// let x = CompletionConfig::new().set_max_suggestions(42);
1988    /// ```
1989    pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1990        self.max_suggestions = v.into();
1991        self
1992    }
1993
1994    /// Sets the value of [min_prefix_length][crate::model::CompletionConfig::min_prefix_length].
1995    ///
1996    /// # Example
1997    /// ```ignore,no_run
1998    /// # use google_cloud_retail_v2::model::CompletionConfig;
1999    /// let x = CompletionConfig::new().set_min_prefix_length(42);
2000    /// ```
2001    pub fn set_min_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2002        self.min_prefix_length = v.into();
2003        self
2004    }
2005
2006    /// Sets the value of [auto_learning][crate::model::CompletionConfig::auto_learning].
2007    ///
2008    /// # Example
2009    /// ```ignore,no_run
2010    /// # use google_cloud_retail_v2::model::CompletionConfig;
2011    /// let x = CompletionConfig::new().set_auto_learning(true);
2012    /// ```
2013    pub fn set_auto_learning<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2014        self.auto_learning = v.into();
2015        self
2016    }
2017
2018    /// Sets the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2019    ///
2020    /// # Example
2021    /// ```ignore,no_run
2022    /// # use google_cloud_retail_v2::model::CompletionConfig;
2023    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2024    /// let x = CompletionConfig::new().set_suggestions_input_config(CompletionDataInputConfig::default()/* use setters */);
2025    /// ```
2026    pub fn set_suggestions_input_config<T>(mut self, v: T) -> Self
2027    where
2028        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2029    {
2030        self.suggestions_input_config = std::option::Option::Some(v.into());
2031        self
2032    }
2033
2034    /// Sets or clears the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2035    ///
2036    /// # Example
2037    /// ```ignore,no_run
2038    /// # use google_cloud_retail_v2::model::CompletionConfig;
2039    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2040    /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2041    /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(None::<CompletionDataInputConfig>);
2042    /// ```
2043    pub fn set_or_clear_suggestions_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2044    where
2045        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2046    {
2047        self.suggestions_input_config = v.map(|x| x.into());
2048        self
2049    }
2050
2051    /// Sets the value of [last_suggestions_import_operation][crate::model::CompletionConfig::last_suggestions_import_operation].
2052    ///
2053    /// # Example
2054    /// ```ignore,no_run
2055    /// # use google_cloud_retail_v2::model::CompletionConfig;
2056    /// let x = CompletionConfig::new().set_last_suggestions_import_operation("example");
2057    /// ```
2058    pub fn set_last_suggestions_import_operation<T: std::convert::Into<std::string::String>>(
2059        mut self,
2060        v: T,
2061    ) -> Self {
2062        self.last_suggestions_import_operation = v.into();
2063        self
2064    }
2065
2066    /// Sets the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2067    ///
2068    /// # Example
2069    /// ```ignore,no_run
2070    /// # use google_cloud_retail_v2::model::CompletionConfig;
2071    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2072    /// let x = CompletionConfig::new().set_denylist_input_config(CompletionDataInputConfig::default()/* use setters */);
2073    /// ```
2074    pub fn set_denylist_input_config<T>(mut self, v: T) -> Self
2075    where
2076        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2077    {
2078        self.denylist_input_config = std::option::Option::Some(v.into());
2079        self
2080    }
2081
2082    /// Sets or clears the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2083    ///
2084    /// # Example
2085    /// ```ignore,no_run
2086    /// # use google_cloud_retail_v2::model::CompletionConfig;
2087    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2088    /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2089    /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(None::<CompletionDataInputConfig>);
2090    /// ```
2091    pub fn set_or_clear_denylist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2092    where
2093        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2094    {
2095        self.denylist_input_config = v.map(|x| x.into());
2096        self
2097    }
2098
2099    /// Sets the value of [last_denylist_import_operation][crate::model::CompletionConfig::last_denylist_import_operation].
2100    ///
2101    /// # Example
2102    /// ```ignore,no_run
2103    /// # use google_cloud_retail_v2::model::CompletionConfig;
2104    /// let x = CompletionConfig::new().set_last_denylist_import_operation("example");
2105    /// ```
2106    pub fn set_last_denylist_import_operation<T: std::convert::Into<std::string::String>>(
2107        mut self,
2108        v: T,
2109    ) -> Self {
2110        self.last_denylist_import_operation = v.into();
2111        self
2112    }
2113
2114    /// Sets the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2115    ///
2116    /// # Example
2117    /// ```ignore,no_run
2118    /// # use google_cloud_retail_v2::model::CompletionConfig;
2119    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2120    /// let x = CompletionConfig::new().set_allowlist_input_config(CompletionDataInputConfig::default()/* use setters */);
2121    /// ```
2122    pub fn set_allowlist_input_config<T>(mut self, v: T) -> Self
2123    where
2124        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2125    {
2126        self.allowlist_input_config = std::option::Option::Some(v.into());
2127        self
2128    }
2129
2130    /// Sets or clears the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2131    ///
2132    /// # Example
2133    /// ```ignore,no_run
2134    /// # use google_cloud_retail_v2::model::CompletionConfig;
2135    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2136    /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2137    /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(None::<CompletionDataInputConfig>);
2138    /// ```
2139    pub fn set_or_clear_allowlist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2140    where
2141        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2142    {
2143        self.allowlist_input_config = v.map(|x| x.into());
2144        self
2145    }
2146
2147    /// Sets the value of [last_allowlist_import_operation][crate::model::CompletionConfig::last_allowlist_import_operation].
2148    ///
2149    /// # Example
2150    /// ```ignore,no_run
2151    /// # use google_cloud_retail_v2::model::CompletionConfig;
2152    /// let x = CompletionConfig::new().set_last_allowlist_import_operation("example");
2153    /// ```
2154    pub fn set_last_allowlist_import_operation<T: std::convert::Into<std::string::String>>(
2155        mut self,
2156        v: T,
2157    ) -> Self {
2158        self.last_allowlist_import_operation = v.into();
2159        self
2160    }
2161}
2162
2163impl wkt::message::Message for CompletionConfig {
2164    fn typename() -> &'static str {
2165        "type.googleapis.com/google.cloud.retail.v2.CompletionConfig"
2166    }
2167}
2168
2169/// The catalog configuration.
2170#[derive(Clone, Default, PartialEq)]
2171#[non_exhaustive]
2172pub struct Catalog {
2173    /// Required. Immutable. The fully qualified resource name of the catalog.
2174    pub name: std::string::String,
2175
2176    /// Required. Immutable. The catalog display name.
2177    ///
2178    /// This field must be a UTF-8 encoded string with a length limit of 128
2179    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2180    pub display_name: std::string::String,
2181
2182    /// Required. The product level configuration.
2183    pub product_level_config: std::option::Option<crate::model::ProductLevelConfig>,
2184
2185    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2186}
2187
2188impl Catalog {
2189    pub fn new() -> Self {
2190        std::default::Default::default()
2191    }
2192
2193    /// Sets the value of [name][crate::model::Catalog::name].
2194    ///
2195    /// # Example
2196    /// ```ignore,no_run
2197    /// # use google_cloud_retail_v2::model::Catalog;
2198    /// let x = Catalog::new().set_name("example");
2199    /// ```
2200    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2201        self.name = v.into();
2202        self
2203    }
2204
2205    /// Sets the value of [display_name][crate::model::Catalog::display_name].
2206    ///
2207    /// # Example
2208    /// ```ignore,no_run
2209    /// # use google_cloud_retail_v2::model::Catalog;
2210    /// let x = Catalog::new().set_display_name("example");
2211    /// ```
2212    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2213        self.display_name = v.into();
2214        self
2215    }
2216
2217    /// Sets the value of [product_level_config][crate::model::Catalog::product_level_config].
2218    ///
2219    /// # Example
2220    /// ```ignore,no_run
2221    /// # use google_cloud_retail_v2::model::Catalog;
2222    /// use google_cloud_retail_v2::model::ProductLevelConfig;
2223    /// let x = Catalog::new().set_product_level_config(ProductLevelConfig::default()/* use setters */);
2224    /// ```
2225    pub fn set_product_level_config<T>(mut self, v: T) -> Self
2226    where
2227        T: std::convert::Into<crate::model::ProductLevelConfig>,
2228    {
2229        self.product_level_config = std::option::Option::Some(v.into());
2230        self
2231    }
2232
2233    /// Sets or clears the value of [product_level_config][crate::model::Catalog::product_level_config].
2234    ///
2235    /// # Example
2236    /// ```ignore,no_run
2237    /// # use google_cloud_retail_v2::model::Catalog;
2238    /// use google_cloud_retail_v2::model::ProductLevelConfig;
2239    /// let x = Catalog::new().set_or_clear_product_level_config(Some(ProductLevelConfig::default()/* use setters */));
2240    /// let x = Catalog::new().set_or_clear_product_level_config(None::<ProductLevelConfig>);
2241    /// ```
2242    pub fn set_or_clear_product_level_config<T>(mut self, v: std::option::Option<T>) -> Self
2243    where
2244        T: std::convert::Into<crate::model::ProductLevelConfig>,
2245    {
2246        self.product_level_config = v.map(|x| x.into());
2247        self
2248    }
2249}
2250
2251impl wkt::message::Message for Catalog {
2252    fn typename() -> &'static str {
2253        "type.googleapis.com/google.cloud.retail.v2.Catalog"
2254    }
2255}
2256
2257/// Request for
2258/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2259/// method.
2260///
2261/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2262#[derive(Clone, Default, PartialEq)]
2263#[non_exhaustive]
2264pub struct ListCatalogsRequest {
2265    /// Required. The account resource name with an associated location.
2266    ///
2267    /// If the caller does not have permission to list
2268    /// [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
2269    /// of whether or not this location exists, a PERMISSION_DENIED error is
2270    /// returned.
2271    ///
2272    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2273    pub parent: std::string::String,
2274
2275    /// Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
2276    /// unspecified, defaults to 50. The maximum allowed value is 1000. Values
2277    /// above 1000 will be coerced to 1000.
2278    ///
2279    /// If this field is negative, an INVALID_ARGUMENT is returned.
2280    ///
2281    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2282    pub page_size: i32,
2283
2284    /// A page token
2285    /// [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
2286    /// received from a previous
2287    /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2288    /// call. Provide this to retrieve the subsequent page.
2289    ///
2290    /// When paginating, all other parameters provided to
2291    /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2292    /// must match the call that provided the page token. Otherwise, an
2293    /// INVALID_ARGUMENT error is returned.
2294    ///
2295    /// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2296    /// [google.cloud.retail.v2.ListCatalogsResponse.next_page_token]: crate::model::ListCatalogsResponse::next_page_token
2297    pub page_token: std::string::String,
2298
2299    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2300}
2301
2302impl ListCatalogsRequest {
2303    pub fn new() -> Self {
2304        std::default::Default::default()
2305    }
2306
2307    /// Sets the value of [parent][crate::model::ListCatalogsRequest::parent].
2308    ///
2309    /// # Example
2310    /// ```ignore,no_run
2311    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2312    /// let x = ListCatalogsRequest::new().set_parent("example");
2313    /// ```
2314    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2315        self.parent = v.into();
2316        self
2317    }
2318
2319    /// Sets the value of [page_size][crate::model::ListCatalogsRequest::page_size].
2320    ///
2321    /// # Example
2322    /// ```ignore,no_run
2323    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2324    /// let x = ListCatalogsRequest::new().set_page_size(42);
2325    /// ```
2326    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2327        self.page_size = v.into();
2328        self
2329    }
2330
2331    /// Sets the value of [page_token][crate::model::ListCatalogsRequest::page_token].
2332    ///
2333    /// # Example
2334    /// ```ignore,no_run
2335    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2336    /// let x = ListCatalogsRequest::new().set_page_token("example");
2337    /// ```
2338    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2339        self.page_token = v.into();
2340        self
2341    }
2342}
2343
2344impl wkt::message::Message for ListCatalogsRequest {
2345    fn typename() -> &'static str {
2346        "type.googleapis.com/google.cloud.retail.v2.ListCatalogsRequest"
2347    }
2348}
2349
2350/// Response for
2351/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2352/// method.
2353///
2354/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2355#[derive(Clone, Default, PartialEq)]
2356#[non_exhaustive]
2357pub struct ListCatalogsResponse {
2358    /// All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
2359    ///
2360    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2361    pub catalogs: std::vec::Vec<crate::model::Catalog>,
2362
2363    /// A token that can be sent as
2364    /// [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
2365    /// to retrieve the next page. If this field is omitted, there are no
2366    /// subsequent pages.
2367    ///
2368    /// [google.cloud.retail.v2.ListCatalogsRequest.page_token]: crate::model::ListCatalogsRequest::page_token
2369    pub next_page_token: std::string::String,
2370
2371    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2372}
2373
2374impl ListCatalogsResponse {
2375    pub fn new() -> Self {
2376        std::default::Default::default()
2377    }
2378
2379    /// Sets the value of [catalogs][crate::model::ListCatalogsResponse::catalogs].
2380    ///
2381    /// # Example
2382    /// ```ignore,no_run
2383    /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2384    /// use google_cloud_retail_v2::model::Catalog;
2385    /// let x = ListCatalogsResponse::new()
2386    ///     .set_catalogs([
2387    ///         Catalog::default()/* use setters */,
2388    ///         Catalog::default()/* use (different) setters */,
2389    ///     ]);
2390    /// ```
2391    pub fn set_catalogs<T, V>(mut self, v: T) -> Self
2392    where
2393        T: std::iter::IntoIterator<Item = V>,
2394        V: std::convert::Into<crate::model::Catalog>,
2395    {
2396        use std::iter::Iterator;
2397        self.catalogs = v.into_iter().map(|i| i.into()).collect();
2398        self
2399    }
2400
2401    /// Sets the value of [next_page_token][crate::model::ListCatalogsResponse::next_page_token].
2402    ///
2403    /// # Example
2404    /// ```ignore,no_run
2405    /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2406    /// let x = ListCatalogsResponse::new().set_next_page_token("example");
2407    /// ```
2408    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2409        self.next_page_token = v.into();
2410        self
2411    }
2412}
2413
2414impl wkt::message::Message for ListCatalogsResponse {
2415    fn typename() -> &'static str {
2416        "type.googleapis.com/google.cloud.retail.v2.ListCatalogsResponse"
2417    }
2418}
2419
2420#[doc(hidden)]
2421impl google_cloud_gax::paginator::internal::PageableResponse for ListCatalogsResponse {
2422    type PageItem = crate::model::Catalog;
2423
2424    fn items(self) -> std::vec::Vec<Self::PageItem> {
2425        self.catalogs
2426    }
2427
2428    fn next_page_token(&self) -> std::string::String {
2429        use std::clone::Clone;
2430        self.next_page_token.clone()
2431    }
2432}
2433
2434/// Request for
2435/// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
2436/// method.
2437///
2438/// [google.cloud.retail.v2.CatalogService.UpdateCatalog]: crate::client::CatalogService::update_catalog
2439#[derive(Clone, Default, PartialEq)]
2440#[non_exhaustive]
2441pub struct UpdateCatalogRequest {
2442    /// Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
2443    ///
2444    /// If the caller does not have permission to update the
2445    /// [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
2446    /// exists, a PERMISSION_DENIED error is returned.
2447    ///
2448    /// If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
2449    /// a NOT_FOUND error is returned.
2450    ///
2451    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2452    pub catalog: std::option::Option<crate::model::Catalog>,
2453
2454    /// Indicates which fields in the provided
2455    /// [Catalog][google.cloud.retail.v2.Catalog] to update.
2456    ///
2457    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
2458    /// is returned.
2459    ///
2460    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2461    pub update_mask: std::option::Option<wkt::FieldMask>,
2462
2463    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2464}
2465
2466impl UpdateCatalogRequest {
2467    pub fn new() -> Self {
2468        std::default::Default::default()
2469    }
2470
2471    /// Sets the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2472    ///
2473    /// # Example
2474    /// ```ignore,no_run
2475    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2476    /// use google_cloud_retail_v2::model::Catalog;
2477    /// let x = UpdateCatalogRequest::new().set_catalog(Catalog::default()/* use setters */);
2478    /// ```
2479    pub fn set_catalog<T>(mut self, v: T) -> Self
2480    where
2481        T: std::convert::Into<crate::model::Catalog>,
2482    {
2483        self.catalog = std::option::Option::Some(v.into());
2484        self
2485    }
2486
2487    /// Sets or clears the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2488    ///
2489    /// # Example
2490    /// ```ignore,no_run
2491    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2492    /// use google_cloud_retail_v2::model::Catalog;
2493    /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(Some(Catalog::default()/* use setters */));
2494    /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(None::<Catalog>);
2495    /// ```
2496    pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
2497    where
2498        T: std::convert::Into<crate::model::Catalog>,
2499    {
2500        self.catalog = v.map(|x| x.into());
2501        self
2502    }
2503
2504    /// Sets the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2505    ///
2506    /// # Example
2507    /// ```ignore,no_run
2508    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2509    /// use wkt::FieldMask;
2510    /// let x = UpdateCatalogRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2511    /// ```
2512    pub fn set_update_mask<T>(mut self, v: T) -> Self
2513    where
2514        T: std::convert::Into<wkt::FieldMask>,
2515    {
2516        self.update_mask = std::option::Option::Some(v.into());
2517        self
2518    }
2519
2520    /// Sets or clears the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2521    ///
2522    /// # Example
2523    /// ```ignore,no_run
2524    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2525    /// use wkt::FieldMask;
2526    /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2527    /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2528    /// ```
2529    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2530    where
2531        T: std::convert::Into<wkt::FieldMask>,
2532    {
2533        self.update_mask = v.map(|x| x.into());
2534        self
2535    }
2536}
2537
2538impl wkt::message::Message for UpdateCatalogRequest {
2539    fn typename() -> &'static str {
2540        "type.googleapis.com/google.cloud.retail.v2.UpdateCatalogRequest"
2541    }
2542}
2543
2544/// Request message to set a specified branch as new default_branch.
2545#[derive(Clone, Default, PartialEq)]
2546#[non_exhaustive]
2547pub struct SetDefaultBranchRequest {
2548    /// Full resource name of the catalog, such as
2549    /// `projects/*/locations/global/catalogs/default_catalog`.
2550    pub catalog: std::string::String,
2551
2552    /// The final component of the resource name of a branch.
2553    ///
2554    /// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
2555    /// error is returned.
2556    ///
2557    /// If there are no sufficient active products in the targeted branch and
2558    /// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
2559    /// FAILED_PRECONDITION error is returned.
2560    ///
2561    /// [google.cloud.retail.v2.SetDefaultBranchRequest.force]: crate::model::SetDefaultBranchRequest::force
2562    pub branch_id: std::string::String,
2563
2564    /// Some note on this request, this can be retrieved by
2565    /// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
2566    /// before next valid default branch set occurs.
2567    ///
2568    /// This field must be a UTF-8 encoded string with a length limit of 1,000
2569    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2570    ///
2571    /// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2572    pub note: std::string::String,
2573
2574    /// If set to true, it permits switching to a branch with
2575    /// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
2576    /// if it has no sufficient active products.
2577    ///
2578    /// [google.cloud.retail.v2.SetDefaultBranchRequest.branch_id]: crate::model::SetDefaultBranchRequest::branch_id
2579    pub force: bool,
2580
2581    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2582}
2583
2584impl SetDefaultBranchRequest {
2585    pub fn new() -> Self {
2586        std::default::Default::default()
2587    }
2588
2589    /// Sets the value of [catalog][crate::model::SetDefaultBranchRequest::catalog].
2590    ///
2591    /// # Example
2592    /// ```ignore,no_run
2593    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2594    /// let x = SetDefaultBranchRequest::new().set_catalog("example");
2595    /// ```
2596    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2597        self.catalog = v.into();
2598        self
2599    }
2600
2601    /// Sets the value of [branch_id][crate::model::SetDefaultBranchRequest::branch_id].
2602    ///
2603    /// # Example
2604    /// ```ignore,no_run
2605    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2606    /// let x = SetDefaultBranchRequest::new().set_branch_id("example");
2607    /// ```
2608    pub fn set_branch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2609        self.branch_id = v.into();
2610        self
2611    }
2612
2613    /// Sets the value of [note][crate::model::SetDefaultBranchRequest::note].
2614    ///
2615    /// # Example
2616    /// ```ignore,no_run
2617    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2618    /// let x = SetDefaultBranchRequest::new().set_note("example");
2619    /// ```
2620    pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2621        self.note = v.into();
2622        self
2623    }
2624
2625    /// Sets the value of [force][crate::model::SetDefaultBranchRequest::force].
2626    ///
2627    /// # Example
2628    /// ```ignore,no_run
2629    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2630    /// let x = SetDefaultBranchRequest::new().set_force(true);
2631    /// ```
2632    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2633        self.force = v.into();
2634        self
2635    }
2636}
2637
2638impl wkt::message::Message for SetDefaultBranchRequest {
2639    fn typename() -> &'static str {
2640        "type.googleapis.com/google.cloud.retail.v2.SetDefaultBranchRequest"
2641    }
2642}
2643
2644/// Request message to show which branch is currently the default branch.
2645#[derive(Clone, Default, PartialEq)]
2646#[non_exhaustive]
2647pub struct GetDefaultBranchRequest {
2648    /// The parent catalog resource name, such as
2649    /// `projects/*/locations/global/catalogs/default_catalog`.
2650    pub catalog: std::string::String,
2651
2652    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2653}
2654
2655impl GetDefaultBranchRequest {
2656    pub fn new() -> Self {
2657        std::default::Default::default()
2658    }
2659
2660    /// Sets the value of [catalog][crate::model::GetDefaultBranchRequest::catalog].
2661    ///
2662    /// # Example
2663    /// ```ignore,no_run
2664    /// # use google_cloud_retail_v2::model::GetDefaultBranchRequest;
2665    /// let x = GetDefaultBranchRequest::new().set_catalog("example");
2666    /// ```
2667    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2668        self.catalog = v.into();
2669        self
2670    }
2671}
2672
2673impl wkt::message::Message for GetDefaultBranchRequest {
2674    fn typename() -> &'static str {
2675        "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchRequest"
2676    }
2677}
2678
2679/// Response message of
2680/// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch].
2681///
2682/// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2683#[derive(Clone, Default, PartialEq)]
2684#[non_exhaustive]
2685pub struct GetDefaultBranchResponse {
2686    /// Full resource name of the branch id currently set as default branch.
2687    pub branch: std::string::String,
2688
2689    /// The time when this branch is set to default.
2690    pub set_time: std::option::Option<wkt::Timestamp>,
2691
2692    /// This corresponds to
2693    /// [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note]
2694    /// field, when this branch was set as default.
2695    ///
2696    /// [google.cloud.retail.v2.SetDefaultBranchRequest.note]: crate::model::SetDefaultBranchRequest::note
2697    pub note: std::string::String,
2698
2699    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2700}
2701
2702impl GetDefaultBranchResponse {
2703    pub fn new() -> Self {
2704        std::default::Default::default()
2705    }
2706
2707    /// Sets the value of [branch][crate::model::GetDefaultBranchResponse::branch].
2708    ///
2709    /// # Example
2710    /// ```ignore,no_run
2711    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2712    /// let x = GetDefaultBranchResponse::new().set_branch("example");
2713    /// ```
2714    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2715        self.branch = v.into();
2716        self
2717    }
2718
2719    /// Sets the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2720    ///
2721    /// # Example
2722    /// ```ignore,no_run
2723    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2724    /// use wkt::Timestamp;
2725    /// let x = GetDefaultBranchResponse::new().set_set_time(Timestamp::default()/* use setters */);
2726    /// ```
2727    pub fn set_set_time<T>(mut self, v: T) -> Self
2728    where
2729        T: std::convert::Into<wkt::Timestamp>,
2730    {
2731        self.set_time = std::option::Option::Some(v.into());
2732        self
2733    }
2734
2735    /// Sets or clears the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2736    ///
2737    /// # Example
2738    /// ```ignore,no_run
2739    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2740    /// use wkt::Timestamp;
2741    /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
2742    /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(None::<Timestamp>);
2743    /// ```
2744    pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
2745    where
2746        T: std::convert::Into<wkt::Timestamp>,
2747    {
2748        self.set_time = v.map(|x| x.into());
2749        self
2750    }
2751
2752    /// Sets the value of [note][crate::model::GetDefaultBranchResponse::note].
2753    ///
2754    /// # Example
2755    /// ```ignore,no_run
2756    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2757    /// let x = GetDefaultBranchResponse::new().set_note("example");
2758    /// ```
2759    pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2760        self.note = v.into();
2761        self
2762    }
2763}
2764
2765impl wkt::message::Message for GetDefaultBranchResponse {
2766    fn typename() -> &'static str {
2767        "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchResponse"
2768    }
2769}
2770
2771/// Request for
2772/// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
2773/// method.
2774///
2775/// [google.cloud.retail.v2.CatalogService.GetCompletionConfig]: crate::client::CatalogService::get_completion_config
2776#[derive(Clone, Default, PartialEq)]
2777#[non_exhaustive]
2778pub struct GetCompletionConfigRequest {
2779    /// Required. Full CompletionConfig resource name. Format:
2780    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
2781    pub name: std::string::String,
2782
2783    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2784}
2785
2786impl GetCompletionConfigRequest {
2787    pub fn new() -> Self {
2788        std::default::Default::default()
2789    }
2790
2791    /// Sets the value of [name][crate::model::GetCompletionConfigRequest::name].
2792    ///
2793    /// # Example
2794    /// ```ignore,no_run
2795    /// # use google_cloud_retail_v2::model::GetCompletionConfigRequest;
2796    /// let x = GetCompletionConfigRequest::new().set_name("example");
2797    /// ```
2798    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2799        self.name = v.into();
2800        self
2801    }
2802}
2803
2804impl wkt::message::Message for GetCompletionConfigRequest {
2805    fn typename() -> &'static str {
2806        "type.googleapis.com/google.cloud.retail.v2.GetCompletionConfigRequest"
2807    }
2808}
2809
2810/// Request for
2811/// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
2812/// method.
2813///
2814/// [google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]: crate::client::CatalogService::update_completion_config
2815#[derive(Clone, Default, PartialEq)]
2816#[non_exhaustive]
2817pub struct UpdateCompletionConfigRequest {
2818    /// Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
2819    /// to update.
2820    ///
2821    /// If the caller does not have permission to update the
2822    /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
2823    /// PERMISSION_DENIED error is returned.
2824    ///
2825    /// If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
2826    /// update does not exist, a NOT_FOUND error is returned.
2827    ///
2828    /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2829    pub completion_config: std::option::Option<crate::model::CompletionConfig>,
2830
2831    /// Indicates which fields in the provided
2832    /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
2833    /// following are the only supported fields:
2834    ///
2835    /// * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
2836    /// * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
2837    /// * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
2838    /// * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
2839    ///
2840    /// If not set, all supported fields are updated.
2841    ///
2842    /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2843    /// [google.cloud.retail.v2.CompletionConfig.auto_learning]: crate::model::CompletionConfig::auto_learning
2844    /// [google.cloud.retail.v2.CompletionConfig.matching_order]: crate::model::CompletionConfig::matching_order
2845    /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
2846    /// [google.cloud.retail.v2.CompletionConfig.min_prefix_length]: crate::model::CompletionConfig::min_prefix_length
2847    pub update_mask: std::option::Option<wkt::FieldMask>,
2848
2849    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2850}
2851
2852impl UpdateCompletionConfigRequest {
2853    pub fn new() -> Self {
2854        std::default::Default::default()
2855    }
2856
2857    /// Sets the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2858    ///
2859    /// # Example
2860    /// ```ignore,no_run
2861    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2862    /// use google_cloud_retail_v2::model::CompletionConfig;
2863    /// let x = UpdateCompletionConfigRequest::new().set_completion_config(CompletionConfig::default()/* use setters */);
2864    /// ```
2865    pub fn set_completion_config<T>(mut self, v: T) -> Self
2866    where
2867        T: std::convert::Into<crate::model::CompletionConfig>,
2868    {
2869        self.completion_config = std::option::Option::Some(v.into());
2870        self
2871    }
2872
2873    /// Sets or clears the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2874    ///
2875    /// # Example
2876    /// ```ignore,no_run
2877    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2878    /// use google_cloud_retail_v2::model::CompletionConfig;
2879    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(Some(CompletionConfig::default()/* use setters */));
2880    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(None::<CompletionConfig>);
2881    /// ```
2882    pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
2883    where
2884        T: std::convert::Into<crate::model::CompletionConfig>,
2885    {
2886        self.completion_config = v.map(|x| x.into());
2887        self
2888    }
2889
2890    /// Sets the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2891    ///
2892    /// # Example
2893    /// ```ignore,no_run
2894    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2895    /// use wkt::FieldMask;
2896    /// let x = UpdateCompletionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2897    /// ```
2898    pub fn set_update_mask<T>(mut self, v: T) -> Self
2899    where
2900        T: std::convert::Into<wkt::FieldMask>,
2901    {
2902        self.update_mask = std::option::Option::Some(v.into());
2903        self
2904    }
2905
2906    /// Sets or clears the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2907    ///
2908    /// # Example
2909    /// ```ignore,no_run
2910    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2911    /// use wkt::FieldMask;
2912    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2913    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2914    /// ```
2915    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2916    where
2917        T: std::convert::Into<wkt::FieldMask>,
2918    {
2919        self.update_mask = v.map(|x| x.into());
2920        self
2921    }
2922}
2923
2924impl wkt::message::Message for UpdateCompletionConfigRequest {
2925    fn typename() -> &'static str {
2926        "type.googleapis.com/google.cloud.retail.v2.UpdateCompletionConfigRequest"
2927    }
2928}
2929
2930/// Request for
2931/// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
2932/// method.
2933///
2934/// [google.cloud.retail.v2.CatalogService.GetAttributesConfig]: crate::client::CatalogService::get_attributes_config
2935#[derive(Clone, Default, PartialEq)]
2936#[non_exhaustive]
2937pub struct GetAttributesConfigRequest {
2938    /// Required. Full AttributesConfig resource name. Format:
2939    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
2940    pub name: std::string::String,
2941
2942    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2943}
2944
2945impl GetAttributesConfigRequest {
2946    pub fn new() -> Self {
2947        std::default::Default::default()
2948    }
2949
2950    /// Sets the value of [name][crate::model::GetAttributesConfigRequest::name].
2951    ///
2952    /// # Example
2953    /// ```ignore,no_run
2954    /// # use google_cloud_retail_v2::model::GetAttributesConfigRequest;
2955    /// let x = GetAttributesConfigRequest::new().set_name("example");
2956    /// ```
2957    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2958        self.name = v.into();
2959        self
2960    }
2961}
2962
2963impl wkt::message::Message for GetAttributesConfigRequest {
2964    fn typename() -> &'static str {
2965        "type.googleapis.com/google.cloud.retail.v2.GetAttributesConfigRequest"
2966    }
2967}
2968
2969/// Request for
2970/// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
2971/// method.
2972///
2973/// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
2974#[derive(Clone, Default, PartialEq)]
2975#[non_exhaustive]
2976pub struct UpdateAttributesConfigRequest {
2977    /// Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
2978    /// to update.
2979    ///
2980    /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
2981    pub attributes_config: std::option::Option<crate::model::AttributesConfig>,
2982
2983    /// Indicates which fields in the provided
2984    /// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
2985    /// following is the only supported field:
2986    ///
2987    /// * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
2988    ///
2989    /// If not set, all supported fields are updated.
2990    ///
2991    /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
2992    /// [google.cloud.retail.v2.AttributesConfig.catalog_attributes]: crate::model::AttributesConfig::catalog_attributes
2993    pub update_mask: std::option::Option<wkt::FieldMask>,
2994
2995    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2996}
2997
2998impl UpdateAttributesConfigRequest {
2999    pub fn new() -> Self {
3000        std::default::Default::default()
3001    }
3002
3003    /// Sets the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3004    ///
3005    /// # Example
3006    /// ```ignore,no_run
3007    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3008    /// use google_cloud_retail_v2::model::AttributesConfig;
3009    /// let x = UpdateAttributesConfigRequest::new().set_attributes_config(AttributesConfig::default()/* use setters */);
3010    /// ```
3011    pub fn set_attributes_config<T>(mut self, v: T) -> Self
3012    where
3013        T: std::convert::Into<crate::model::AttributesConfig>,
3014    {
3015        self.attributes_config = std::option::Option::Some(v.into());
3016        self
3017    }
3018
3019    /// Sets or clears the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3020    ///
3021    /// # Example
3022    /// ```ignore,no_run
3023    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3024    /// use google_cloud_retail_v2::model::AttributesConfig;
3025    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(Some(AttributesConfig::default()/* use setters */));
3026    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(None::<AttributesConfig>);
3027    /// ```
3028    pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
3029    where
3030        T: std::convert::Into<crate::model::AttributesConfig>,
3031    {
3032        self.attributes_config = v.map(|x| x.into());
3033        self
3034    }
3035
3036    /// Sets the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3037    ///
3038    /// # Example
3039    /// ```ignore,no_run
3040    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3041    /// use wkt::FieldMask;
3042    /// let x = UpdateAttributesConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3043    /// ```
3044    pub fn set_update_mask<T>(mut self, v: T) -> Self
3045    where
3046        T: std::convert::Into<wkt::FieldMask>,
3047    {
3048        self.update_mask = std::option::Option::Some(v.into());
3049        self
3050    }
3051
3052    /// Sets or clears the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3053    ///
3054    /// # Example
3055    /// ```ignore,no_run
3056    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3057    /// use wkt::FieldMask;
3058    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3059    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3060    /// ```
3061    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3062    where
3063        T: std::convert::Into<wkt::FieldMask>,
3064    {
3065        self.update_mask = v.map(|x| x.into());
3066        self
3067    }
3068}
3069
3070impl wkt::message::Message for UpdateAttributesConfigRequest {
3071    fn typename() -> &'static str {
3072        "type.googleapis.com/google.cloud.retail.v2.UpdateAttributesConfigRequest"
3073    }
3074}
3075
3076/// Request for
3077/// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
3078/// method.
3079///
3080/// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
3081#[derive(Clone, Default, PartialEq)]
3082#[non_exhaustive]
3083pub struct AddCatalogAttributeRequest {
3084    /// Required. Full AttributesConfig resource name. Format:
3085    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3086    pub attributes_config: std::string::String,
3087
3088    /// Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
3089    /// to add.
3090    ///
3091    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3092    pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3093
3094    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3095}
3096
3097impl AddCatalogAttributeRequest {
3098    pub fn new() -> Self {
3099        std::default::Default::default()
3100    }
3101
3102    /// Sets the value of [attributes_config][crate::model::AddCatalogAttributeRequest::attributes_config].
3103    ///
3104    /// # Example
3105    /// ```ignore,no_run
3106    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3107    /// let x = AddCatalogAttributeRequest::new().set_attributes_config("example");
3108    /// ```
3109    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3110        mut self,
3111        v: T,
3112    ) -> Self {
3113        self.attributes_config = v.into();
3114        self
3115    }
3116
3117    /// Sets the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3118    ///
3119    /// # Example
3120    /// ```ignore,no_run
3121    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3122    /// use google_cloud_retail_v2::model::CatalogAttribute;
3123    /// let x = AddCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3124    /// ```
3125    pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3126    where
3127        T: std::convert::Into<crate::model::CatalogAttribute>,
3128    {
3129        self.catalog_attribute = std::option::Option::Some(v.into());
3130        self
3131    }
3132
3133    /// Sets or clears the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3134    ///
3135    /// # Example
3136    /// ```ignore,no_run
3137    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3138    /// use google_cloud_retail_v2::model::CatalogAttribute;
3139    /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3140    /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3141    /// ```
3142    pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3143    where
3144        T: std::convert::Into<crate::model::CatalogAttribute>,
3145    {
3146        self.catalog_attribute = v.map(|x| x.into());
3147        self
3148    }
3149}
3150
3151impl wkt::message::Message for AddCatalogAttributeRequest {
3152    fn typename() -> &'static str {
3153        "type.googleapis.com/google.cloud.retail.v2.AddCatalogAttributeRequest"
3154    }
3155}
3156
3157/// Request for
3158/// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
3159/// method.
3160///
3161/// [google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]: crate::client::CatalogService::remove_catalog_attribute
3162#[derive(Clone, Default, PartialEq)]
3163#[non_exhaustive]
3164pub struct RemoveCatalogAttributeRequest {
3165    /// Required. Full AttributesConfig resource name. Format:
3166    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3167    pub attributes_config: std::string::String,
3168
3169    /// Required. The attribute name key of the
3170    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
3171    ///
3172    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3173    pub key: std::string::String,
3174
3175    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3176}
3177
3178impl RemoveCatalogAttributeRequest {
3179    pub fn new() -> Self {
3180        std::default::Default::default()
3181    }
3182
3183    /// Sets the value of [attributes_config][crate::model::RemoveCatalogAttributeRequest::attributes_config].
3184    ///
3185    /// # Example
3186    /// ```ignore,no_run
3187    /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3188    /// let x = RemoveCatalogAttributeRequest::new().set_attributes_config("example");
3189    /// ```
3190    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3191        mut self,
3192        v: T,
3193    ) -> Self {
3194        self.attributes_config = v.into();
3195        self
3196    }
3197
3198    /// Sets the value of [key][crate::model::RemoveCatalogAttributeRequest::key].
3199    ///
3200    /// # Example
3201    /// ```ignore,no_run
3202    /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3203    /// let x = RemoveCatalogAttributeRequest::new().set_key("example");
3204    /// ```
3205    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3206        self.key = v.into();
3207        self
3208    }
3209}
3210
3211impl wkt::message::Message for RemoveCatalogAttributeRequest {
3212    fn typename() -> &'static str {
3213        "type.googleapis.com/google.cloud.retail.v2.RemoveCatalogAttributeRequest"
3214    }
3215}
3216
3217/// Request for
3218/// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
3219/// method.
3220///
3221/// [google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]: crate::client::CatalogService::replace_catalog_attribute
3222#[derive(Clone, Default, PartialEq)]
3223#[non_exhaustive]
3224pub struct ReplaceCatalogAttributeRequest {
3225    /// Required. Full AttributesConfig resource name. Format:
3226    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3227    pub attributes_config: std::string::String,
3228
3229    /// Required. The updated
3230    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
3231    ///
3232    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3233    pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3234
3235    /// Indicates which fields in the provided
3236    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
3237    /// following are NOT supported:
3238    ///
3239    /// * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
3240    ///
3241    /// If not set, all supported fields are updated.
3242    ///
3243    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3244    /// [google.cloud.retail.v2.CatalogAttribute.key]: crate::model::CatalogAttribute::key
3245    pub update_mask: std::option::Option<wkt::FieldMask>,
3246
3247    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3248}
3249
3250impl ReplaceCatalogAttributeRequest {
3251    pub fn new() -> Self {
3252        std::default::Default::default()
3253    }
3254
3255    /// Sets the value of [attributes_config][crate::model::ReplaceCatalogAttributeRequest::attributes_config].
3256    ///
3257    /// # Example
3258    /// ```ignore,no_run
3259    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3260    /// let x = ReplaceCatalogAttributeRequest::new().set_attributes_config("example");
3261    /// ```
3262    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3263        mut self,
3264        v: T,
3265    ) -> Self {
3266        self.attributes_config = v.into();
3267        self
3268    }
3269
3270    /// Sets the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3271    ///
3272    /// # Example
3273    /// ```ignore,no_run
3274    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3275    /// use google_cloud_retail_v2::model::CatalogAttribute;
3276    /// let x = ReplaceCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3277    /// ```
3278    pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3279    where
3280        T: std::convert::Into<crate::model::CatalogAttribute>,
3281    {
3282        self.catalog_attribute = std::option::Option::Some(v.into());
3283        self
3284    }
3285
3286    /// Sets or clears the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3287    ///
3288    /// # Example
3289    /// ```ignore,no_run
3290    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3291    /// use google_cloud_retail_v2::model::CatalogAttribute;
3292    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3293    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3294    /// ```
3295    pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3296    where
3297        T: std::convert::Into<crate::model::CatalogAttribute>,
3298    {
3299        self.catalog_attribute = v.map(|x| x.into());
3300        self
3301    }
3302
3303    /// Sets the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3304    ///
3305    /// # Example
3306    /// ```ignore,no_run
3307    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3308    /// use wkt::FieldMask;
3309    /// let x = ReplaceCatalogAttributeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3310    /// ```
3311    pub fn set_update_mask<T>(mut self, v: T) -> Self
3312    where
3313        T: std::convert::Into<wkt::FieldMask>,
3314    {
3315        self.update_mask = std::option::Option::Some(v.into());
3316        self
3317    }
3318
3319    /// Sets or clears the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3320    ///
3321    /// # Example
3322    /// ```ignore,no_run
3323    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3324    /// use wkt::FieldMask;
3325    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3326    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3327    /// ```
3328    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3329    where
3330        T: std::convert::Into<wkt::FieldMask>,
3331    {
3332        self.update_mask = v.map(|x| x.into());
3333        self
3334    }
3335}
3336
3337impl wkt::message::Message for ReplaceCatalogAttributeRequest {
3338    fn typename() -> &'static str {
3339        "type.googleapis.com/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"
3340    }
3341}
3342
3343/// Metadata that is used to define a condition that triggers an action.
3344/// A valid condition must specify at least one of 'query_terms' or
3345/// 'products_filter'. If multiple fields are specified, the condition is met if
3346/// all the fields are satisfied e.g. if a set of query terms and product_filter
3347/// are set, then only items matching the product_filter for requests with a
3348/// query matching the query terms wil get boosted.
3349#[derive(Clone, Default, PartialEq)]
3350#[non_exhaustive]
3351pub struct Condition {
3352    /// A list (up to 10 entries) of terms to match the query on. If not
3353    /// specified, match all queries.
3354    /// If many query terms are specified, the condition
3355    /// is matched if any of the terms is a match (i.e. using the OR operator).
3356    pub query_terms: std::vec::Vec<crate::model::condition::QueryTerm>,
3357
3358    /// Range of time(s) specifying when Condition is active.
3359    /// Condition true if any time range matches.
3360    pub active_time_range: std::vec::Vec<crate::model::condition::TimeRange>,
3361
3362    /// Used to support browse uses cases.
3363    /// A list (up to 10 entries) of categories or departments.
3364    /// The format should be the same as
3365    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
3366    ///
3367    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
3368    pub page_categories: std::vec::Vec<std::string::String>,
3369
3370    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3371}
3372
3373impl Condition {
3374    pub fn new() -> Self {
3375        std::default::Default::default()
3376    }
3377
3378    /// Sets the value of [query_terms][crate::model::Condition::query_terms].
3379    ///
3380    /// # Example
3381    /// ```ignore,no_run
3382    /// # use google_cloud_retail_v2::model::Condition;
3383    /// use google_cloud_retail_v2::model::condition::QueryTerm;
3384    /// let x = Condition::new()
3385    ///     .set_query_terms([
3386    ///         QueryTerm::default()/* use setters */,
3387    ///         QueryTerm::default()/* use (different) setters */,
3388    ///     ]);
3389    /// ```
3390    pub fn set_query_terms<T, V>(mut self, v: T) -> Self
3391    where
3392        T: std::iter::IntoIterator<Item = V>,
3393        V: std::convert::Into<crate::model::condition::QueryTerm>,
3394    {
3395        use std::iter::Iterator;
3396        self.query_terms = v.into_iter().map(|i| i.into()).collect();
3397        self
3398    }
3399
3400    /// Sets the value of [active_time_range][crate::model::Condition::active_time_range].
3401    ///
3402    /// # Example
3403    /// ```ignore,no_run
3404    /// # use google_cloud_retail_v2::model::Condition;
3405    /// use google_cloud_retail_v2::model::condition::TimeRange;
3406    /// let x = Condition::new()
3407    ///     .set_active_time_range([
3408    ///         TimeRange::default()/* use setters */,
3409    ///         TimeRange::default()/* use (different) setters */,
3410    ///     ]);
3411    /// ```
3412    pub fn set_active_time_range<T, V>(mut self, v: T) -> Self
3413    where
3414        T: std::iter::IntoIterator<Item = V>,
3415        V: std::convert::Into<crate::model::condition::TimeRange>,
3416    {
3417        use std::iter::Iterator;
3418        self.active_time_range = v.into_iter().map(|i| i.into()).collect();
3419        self
3420    }
3421
3422    /// Sets the value of [page_categories][crate::model::Condition::page_categories].
3423    ///
3424    /// # Example
3425    /// ```ignore,no_run
3426    /// # use google_cloud_retail_v2::model::Condition;
3427    /// let x = Condition::new().set_page_categories(["a", "b", "c"]);
3428    /// ```
3429    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
3430    where
3431        T: std::iter::IntoIterator<Item = V>,
3432        V: std::convert::Into<std::string::String>,
3433    {
3434        use std::iter::Iterator;
3435        self.page_categories = v.into_iter().map(|i| i.into()).collect();
3436        self
3437    }
3438}
3439
3440impl wkt::message::Message for Condition {
3441    fn typename() -> &'static str {
3442        "type.googleapis.com/google.cloud.retail.v2.Condition"
3443    }
3444}
3445
3446/// Defines additional types related to [Condition].
3447pub mod condition {
3448    #[allow(unused_imports)]
3449    use super::*;
3450
3451    /// Query terms that we want to match on.
3452    #[derive(Clone, Default, PartialEq)]
3453    #[non_exhaustive]
3454    pub struct QueryTerm {
3455        /// The value of the term to match on.
3456        /// Value cannot be empty.
3457        /// Value can have at most 3 terms if specified as a partial match. Each
3458        /// space separated string is considered as one term.
3459        /// For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms
3460        /// and not allowed for a partial match.
3461        pub value: std::string::String,
3462
3463        /// Whether this is supposed to be a full or partial match.
3464        pub full_match: bool,
3465
3466        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3467    }
3468
3469    impl QueryTerm {
3470        pub fn new() -> Self {
3471            std::default::Default::default()
3472        }
3473
3474        /// Sets the value of [value][crate::model::condition::QueryTerm::value].
3475        ///
3476        /// # Example
3477        /// ```ignore,no_run
3478        /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3479        /// let x = QueryTerm::new().set_value("example");
3480        /// ```
3481        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3482            self.value = v.into();
3483            self
3484        }
3485
3486        /// Sets the value of [full_match][crate::model::condition::QueryTerm::full_match].
3487        ///
3488        /// # Example
3489        /// ```ignore,no_run
3490        /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3491        /// let x = QueryTerm::new().set_full_match(true);
3492        /// ```
3493        pub fn set_full_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3494            self.full_match = v.into();
3495            self
3496        }
3497    }
3498
3499    impl wkt::message::Message for QueryTerm {
3500        fn typename() -> &'static str {
3501            "type.googleapis.com/google.cloud.retail.v2.Condition.QueryTerm"
3502        }
3503    }
3504
3505    /// Used for time-dependent conditions.
3506    /// Example: Want to have rule applied for week long sale.
3507    #[derive(Clone, Default, PartialEq)]
3508    #[non_exhaustive]
3509    pub struct TimeRange {
3510        /// Start of time range. Range is inclusive.
3511        pub start_time: std::option::Option<wkt::Timestamp>,
3512
3513        /// End of time range. Range is inclusive.
3514        pub end_time: std::option::Option<wkt::Timestamp>,
3515
3516        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3517    }
3518
3519    impl TimeRange {
3520        pub fn new() -> Self {
3521            std::default::Default::default()
3522        }
3523
3524        /// Sets the value of [start_time][crate::model::condition::TimeRange::start_time].
3525        ///
3526        /// # Example
3527        /// ```ignore,no_run
3528        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3529        /// use wkt::Timestamp;
3530        /// let x = TimeRange::new().set_start_time(Timestamp::default()/* use setters */);
3531        /// ```
3532        pub fn set_start_time<T>(mut self, v: T) -> Self
3533        where
3534            T: std::convert::Into<wkt::Timestamp>,
3535        {
3536            self.start_time = std::option::Option::Some(v.into());
3537            self
3538        }
3539
3540        /// Sets or clears the value of [start_time][crate::model::condition::TimeRange::start_time].
3541        ///
3542        /// # Example
3543        /// ```ignore,no_run
3544        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3545        /// use wkt::Timestamp;
3546        /// let x = TimeRange::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3547        /// let x = TimeRange::new().set_or_clear_start_time(None::<Timestamp>);
3548        /// ```
3549        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3550        where
3551            T: std::convert::Into<wkt::Timestamp>,
3552        {
3553            self.start_time = v.map(|x| x.into());
3554            self
3555        }
3556
3557        /// Sets the value of [end_time][crate::model::condition::TimeRange::end_time].
3558        ///
3559        /// # Example
3560        /// ```ignore,no_run
3561        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3562        /// use wkt::Timestamp;
3563        /// let x = TimeRange::new().set_end_time(Timestamp::default()/* use setters */);
3564        /// ```
3565        pub fn set_end_time<T>(mut self, v: T) -> Self
3566        where
3567            T: std::convert::Into<wkt::Timestamp>,
3568        {
3569            self.end_time = std::option::Option::Some(v.into());
3570            self
3571        }
3572
3573        /// Sets or clears the value of [end_time][crate::model::condition::TimeRange::end_time].
3574        ///
3575        /// # Example
3576        /// ```ignore,no_run
3577        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3578        /// use wkt::Timestamp;
3579        /// let x = TimeRange::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3580        /// let x = TimeRange::new().set_or_clear_end_time(None::<Timestamp>);
3581        /// ```
3582        pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3583        where
3584            T: std::convert::Into<wkt::Timestamp>,
3585        {
3586            self.end_time = v.map(|x| x.into());
3587            self
3588        }
3589    }
3590
3591    impl wkt::message::Message for TimeRange {
3592        fn typename() -> &'static str {
3593            "type.googleapis.com/google.cloud.retail.v2.Condition.TimeRange"
3594        }
3595    }
3596}
3597
3598/// A rule is a condition-action pair
3599///
3600/// * A condition defines when a rule is to be triggered.
3601/// * An action specifies what occurs on that trigger.
3602///   Currently rules only work for [controls][google.cloud.retail.v2.Control] with
3603///   [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
3604///
3605/// [google.cloud.retail.v2.Control]: crate::model::Control
3606/// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
3607#[derive(Clone, Default, PartialEq)]
3608#[non_exhaustive]
3609pub struct Rule {
3610    /// Required. The condition that triggers the rule.
3611    /// If the condition is empty, the rule will always apply.
3612    pub condition: std::option::Option<crate::model::Condition>,
3613
3614    /// An action must be provided.
3615    pub action: std::option::Option<crate::model::rule::Action>,
3616
3617    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3618}
3619
3620impl Rule {
3621    pub fn new() -> Self {
3622        std::default::Default::default()
3623    }
3624
3625    /// Sets the value of [condition][crate::model::Rule::condition].
3626    ///
3627    /// # Example
3628    /// ```ignore,no_run
3629    /// # use google_cloud_retail_v2::model::Rule;
3630    /// use google_cloud_retail_v2::model::Condition;
3631    /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
3632    /// ```
3633    pub fn set_condition<T>(mut self, v: T) -> Self
3634    where
3635        T: std::convert::Into<crate::model::Condition>,
3636    {
3637        self.condition = std::option::Option::Some(v.into());
3638        self
3639    }
3640
3641    /// Sets or clears the value of [condition][crate::model::Rule::condition].
3642    ///
3643    /// # Example
3644    /// ```ignore,no_run
3645    /// # use google_cloud_retail_v2::model::Rule;
3646    /// use google_cloud_retail_v2::model::Condition;
3647    /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
3648    /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
3649    /// ```
3650    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
3651    where
3652        T: std::convert::Into<crate::model::Condition>,
3653    {
3654        self.condition = v.map(|x| x.into());
3655        self
3656    }
3657
3658    /// Sets the value of [action][crate::model::Rule::action].
3659    ///
3660    /// Note that all the setters affecting `action` are mutually
3661    /// exclusive.
3662    ///
3663    /// # Example
3664    /// ```ignore,no_run
3665    /// # use google_cloud_retail_v2::model::Rule;
3666    /// use google_cloud_retail_v2::model::rule::BoostAction;
3667    /// let x = Rule::new().set_action(Some(
3668    ///     google_cloud_retail_v2::model::rule::Action::BoostAction(BoostAction::default().into())));
3669    /// ```
3670    pub fn set_action<T: std::convert::Into<std::option::Option<crate::model::rule::Action>>>(
3671        mut self,
3672        v: T,
3673    ) -> Self {
3674        self.action = v.into();
3675        self
3676    }
3677
3678    /// The value of [action][crate::model::Rule::action]
3679    /// if it holds a `BoostAction`, `None` if the field is not set or
3680    /// holds a different branch.
3681    pub fn boost_action(
3682        &self,
3683    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::BoostAction>> {
3684        #[allow(unreachable_patterns)]
3685        self.action.as_ref().and_then(|v| match v {
3686            crate::model::rule::Action::BoostAction(v) => std::option::Option::Some(v),
3687            _ => std::option::Option::None,
3688        })
3689    }
3690
3691    /// Sets the value of [action][crate::model::Rule::action]
3692    /// to hold a `BoostAction`.
3693    ///
3694    /// Note that all the setters affecting `action` are
3695    /// mutually exclusive.
3696    ///
3697    /// # Example
3698    /// ```ignore,no_run
3699    /// # use google_cloud_retail_v2::model::Rule;
3700    /// use google_cloud_retail_v2::model::rule::BoostAction;
3701    /// let x = Rule::new().set_boost_action(BoostAction::default()/* use setters */);
3702    /// assert!(x.boost_action().is_some());
3703    /// assert!(x.redirect_action().is_none());
3704    /// assert!(x.oneway_synonyms_action().is_none());
3705    /// assert!(x.do_not_associate_action().is_none());
3706    /// assert!(x.replacement_action().is_none());
3707    /// assert!(x.ignore_action().is_none());
3708    /// assert!(x.filter_action().is_none());
3709    /// assert!(x.twoway_synonyms_action().is_none());
3710    /// assert!(x.force_return_facet_action().is_none());
3711    /// assert!(x.remove_facet_action().is_none());
3712    /// assert!(x.pin_action().is_none());
3713    /// ```
3714    pub fn set_boost_action<
3715        T: std::convert::Into<std::boxed::Box<crate::model::rule::BoostAction>>,
3716    >(
3717        mut self,
3718        v: T,
3719    ) -> Self {
3720        self.action = std::option::Option::Some(crate::model::rule::Action::BoostAction(v.into()));
3721        self
3722    }
3723
3724    /// The value of [action][crate::model::Rule::action]
3725    /// if it holds a `RedirectAction`, `None` if the field is not set or
3726    /// holds a different branch.
3727    pub fn redirect_action(
3728        &self,
3729    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RedirectAction>> {
3730        #[allow(unreachable_patterns)]
3731        self.action.as_ref().and_then(|v| match v {
3732            crate::model::rule::Action::RedirectAction(v) => std::option::Option::Some(v),
3733            _ => std::option::Option::None,
3734        })
3735    }
3736
3737    /// Sets the value of [action][crate::model::Rule::action]
3738    /// to hold a `RedirectAction`.
3739    ///
3740    /// Note that all the setters affecting `action` are
3741    /// mutually exclusive.
3742    ///
3743    /// # Example
3744    /// ```ignore,no_run
3745    /// # use google_cloud_retail_v2::model::Rule;
3746    /// use google_cloud_retail_v2::model::rule::RedirectAction;
3747    /// let x = Rule::new().set_redirect_action(RedirectAction::default()/* use setters */);
3748    /// assert!(x.redirect_action().is_some());
3749    /// assert!(x.boost_action().is_none());
3750    /// assert!(x.oneway_synonyms_action().is_none());
3751    /// assert!(x.do_not_associate_action().is_none());
3752    /// assert!(x.replacement_action().is_none());
3753    /// assert!(x.ignore_action().is_none());
3754    /// assert!(x.filter_action().is_none());
3755    /// assert!(x.twoway_synonyms_action().is_none());
3756    /// assert!(x.force_return_facet_action().is_none());
3757    /// assert!(x.remove_facet_action().is_none());
3758    /// assert!(x.pin_action().is_none());
3759    /// ```
3760    pub fn set_redirect_action<
3761        T: std::convert::Into<std::boxed::Box<crate::model::rule::RedirectAction>>,
3762    >(
3763        mut self,
3764        v: T,
3765    ) -> Self {
3766        self.action =
3767            std::option::Option::Some(crate::model::rule::Action::RedirectAction(v.into()));
3768        self
3769    }
3770
3771    /// The value of [action][crate::model::Rule::action]
3772    /// if it holds a `OnewaySynonymsAction`, `None` if the field is not set or
3773    /// holds a different branch.
3774    pub fn oneway_synonyms_action(
3775        &self,
3776    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::OnewaySynonymsAction>> {
3777        #[allow(unreachable_patterns)]
3778        self.action.as_ref().and_then(|v| match v {
3779            crate::model::rule::Action::OnewaySynonymsAction(v) => std::option::Option::Some(v),
3780            _ => std::option::Option::None,
3781        })
3782    }
3783
3784    /// Sets the value of [action][crate::model::Rule::action]
3785    /// to hold a `OnewaySynonymsAction`.
3786    ///
3787    /// Note that all the setters affecting `action` are
3788    /// mutually exclusive.
3789    ///
3790    /// # Example
3791    /// ```ignore,no_run
3792    /// # use google_cloud_retail_v2::model::Rule;
3793    /// use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
3794    /// let x = Rule::new().set_oneway_synonyms_action(OnewaySynonymsAction::default()/* use setters */);
3795    /// assert!(x.oneway_synonyms_action().is_some());
3796    /// assert!(x.boost_action().is_none());
3797    /// assert!(x.redirect_action().is_none());
3798    /// assert!(x.do_not_associate_action().is_none());
3799    /// assert!(x.replacement_action().is_none());
3800    /// assert!(x.ignore_action().is_none());
3801    /// assert!(x.filter_action().is_none());
3802    /// assert!(x.twoway_synonyms_action().is_none());
3803    /// assert!(x.force_return_facet_action().is_none());
3804    /// assert!(x.remove_facet_action().is_none());
3805    /// assert!(x.pin_action().is_none());
3806    /// ```
3807    pub fn set_oneway_synonyms_action<
3808        T: std::convert::Into<std::boxed::Box<crate::model::rule::OnewaySynonymsAction>>,
3809    >(
3810        mut self,
3811        v: T,
3812    ) -> Self {
3813        self.action =
3814            std::option::Option::Some(crate::model::rule::Action::OnewaySynonymsAction(v.into()));
3815        self
3816    }
3817
3818    /// The value of [action][crate::model::Rule::action]
3819    /// if it holds a `DoNotAssociateAction`, `None` if the field is not set or
3820    /// holds a different branch.
3821    pub fn do_not_associate_action(
3822        &self,
3823    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::DoNotAssociateAction>> {
3824        #[allow(unreachable_patterns)]
3825        self.action.as_ref().and_then(|v| match v {
3826            crate::model::rule::Action::DoNotAssociateAction(v) => std::option::Option::Some(v),
3827            _ => std::option::Option::None,
3828        })
3829    }
3830
3831    /// Sets the value of [action][crate::model::Rule::action]
3832    /// to hold a `DoNotAssociateAction`.
3833    ///
3834    /// Note that all the setters affecting `action` are
3835    /// mutually exclusive.
3836    ///
3837    /// # Example
3838    /// ```ignore,no_run
3839    /// # use google_cloud_retail_v2::model::Rule;
3840    /// use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
3841    /// let x = Rule::new().set_do_not_associate_action(DoNotAssociateAction::default()/* use setters */);
3842    /// assert!(x.do_not_associate_action().is_some());
3843    /// assert!(x.boost_action().is_none());
3844    /// assert!(x.redirect_action().is_none());
3845    /// assert!(x.oneway_synonyms_action().is_none());
3846    /// assert!(x.replacement_action().is_none());
3847    /// assert!(x.ignore_action().is_none());
3848    /// assert!(x.filter_action().is_none());
3849    /// assert!(x.twoway_synonyms_action().is_none());
3850    /// assert!(x.force_return_facet_action().is_none());
3851    /// assert!(x.remove_facet_action().is_none());
3852    /// assert!(x.pin_action().is_none());
3853    /// ```
3854    pub fn set_do_not_associate_action<
3855        T: std::convert::Into<std::boxed::Box<crate::model::rule::DoNotAssociateAction>>,
3856    >(
3857        mut self,
3858        v: T,
3859    ) -> Self {
3860        self.action =
3861            std::option::Option::Some(crate::model::rule::Action::DoNotAssociateAction(v.into()));
3862        self
3863    }
3864
3865    /// The value of [action][crate::model::Rule::action]
3866    /// if it holds a `ReplacementAction`, `None` if the field is not set or
3867    /// holds a different branch.
3868    pub fn replacement_action(
3869        &self,
3870    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ReplacementAction>> {
3871        #[allow(unreachable_patterns)]
3872        self.action.as_ref().and_then(|v| match v {
3873            crate::model::rule::Action::ReplacementAction(v) => std::option::Option::Some(v),
3874            _ => std::option::Option::None,
3875        })
3876    }
3877
3878    /// Sets the value of [action][crate::model::Rule::action]
3879    /// to hold a `ReplacementAction`.
3880    ///
3881    /// Note that all the setters affecting `action` are
3882    /// mutually exclusive.
3883    ///
3884    /// # Example
3885    /// ```ignore,no_run
3886    /// # use google_cloud_retail_v2::model::Rule;
3887    /// use google_cloud_retail_v2::model::rule::ReplacementAction;
3888    /// let x = Rule::new().set_replacement_action(ReplacementAction::default()/* use setters */);
3889    /// assert!(x.replacement_action().is_some());
3890    /// assert!(x.boost_action().is_none());
3891    /// assert!(x.redirect_action().is_none());
3892    /// assert!(x.oneway_synonyms_action().is_none());
3893    /// assert!(x.do_not_associate_action().is_none());
3894    /// assert!(x.ignore_action().is_none());
3895    /// assert!(x.filter_action().is_none());
3896    /// assert!(x.twoway_synonyms_action().is_none());
3897    /// assert!(x.force_return_facet_action().is_none());
3898    /// assert!(x.remove_facet_action().is_none());
3899    /// assert!(x.pin_action().is_none());
3900    /// ```
3901    pub fn set_replacement_action<
3902        T: std::convert::Into<std::boxed::Box<crate::model::rule::ReplacementAction>>,
3903    >(
3904        mut self,
3905        v: T,
3906    ) -> Self {
3907        self.action =
3908            std::option::Option::Some(crate::model::rule::Action::ReplacementAction(v.into()));
3909        self
3910    }
3911
3912    /// The value of [action][crate::model::Rule::action]
3913    /// if it holds a `IgnoreAction`, `None` if the field is not set or
3914    /// holds a different branch.
3915    pub fn ignore_action(
3916        &self,
3917    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::IgnoreAction>> {
3918        #[allow(unreachable_patterns)]
3919        self.action.as_ref().and_then(|v| match v {
3920            crate::model::rule::Action::IgnoreAction(v) => std::option::Option::Some(v),
3921            _ => std::option::Option::None,
3922        })
3923    }
3924
3925    /// Sets the value of [action][crate::model::Rule::action]
3926    /// to hold a `IgnoreAction`.
3927    ///
3928    /// Note that all the setters affecting `action` are
3929    /// mutually exclusive.
3930    ///
3931    /// # Example
3932    /// ```ignore,no_run
3933    /// # use google_cloud_retail_v2::model::Rule;
3934    /// use google_cloud_retail_v2::model::rule::IgnoreAction;
3935    /// let x = Rule::new().set_ignore_action(IgnoreAction::default()/* use setters */);
3936    /// assert!(x.ignore_action().is_some());
3937    /// assert!(x.boost_action().is_none());
3938    /// assert!(x.redirect_action().is_none());
3939    /// assert!(x.oneway_synonyms_action().is_none());
3940    /// assert!(x.do_not_associate_action().is_none());
3941    /// assert!(x.replacement_action().is_none());
3942    /// assert!(x.filter_action().is_none());
3943    /// assert!(x.twoway_synonyms_action().is_none());
3944    /// assert!(x.force_return_facet_action().is_none());
3945    /// assert!(x.remove_facet_action().is_none());
3946    /// assert!(x.pin_action().is_none());
3947    /// ```
3948    pub fn set_ignore_action<
3949        T: std::convert::Into<std::boxed::Box<crate::model::rule::IgnoreAction>>,
3950    >(
3951        mut self,
3952        v: T,
3953    ) -> Self {
3954        self.action = std::option::Option::Some(crate::model::rule::Action::IgnoreAction(v.into()));
3955        self
3956    }
3957
3958    /// The value of [action][crate::model::Rule::action]
3959    /// if it holds a `FilterAction`, `None` if the field is not set or
3960    /// holds a different branch.
3961    pub fn filter_action(
3962        &self,
3963    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::FilterAction>> {
3964        #[allow(unreachable_patterns)]
3965        self.action.as_ref().and_then(|v| match v {
3966            crate::model::rule::Action::FilterAction(v) => std::option::Option::Some(v),
3967            _ => std::option::Option::None,
3968        })
3969    }
3970
3971    /// Sets the value of [action][crate::model::Rule::action]
3972    /// to hold a `FilterAction`.
3973    ///
3974    /// Note that all the setters affecting `action` are
3975    /// mutually exclusive.
3976    ///
3977    /// # Example
3978    /// ```ignore,no_run
3979    /// # use google_cloud_retail_v2::model::Rule;
3980    /// use google_cloud_retail_v2::model::rule::FilterAction;
3981    /// let x = Rule::new().set_filter_action(FilterAction::default()/* use setters */);
3982    /// assert!(x.filter_action().is_some());
3983    /// assert!(x.boost_action().is_none());
3984    /// assert!(x.redirect_action().is_none());
3985    /// assert!(x.oneway_synonyms_action().is_none());
3986    /// assert!(x.do_not_associate_action().is_none());
3987    /// assert!(x.replacement_action().is_none());
3988    /// assert!(x.ignore_action().is_none());
3989    /// assert!(x.twoway_synonyms_action().is_none());
3990    /// assert!(x.force_return_facet_action().is_none());
3991    /// assert!(x.remove_facet_action().is_none());
3992    /// assert!(x.pin_action().is_none());
3993    /// ```
3994    pub fn set_filter_action<
3995        T: std::convert::Into<std::boxed::Box<crate::model::rule::FilterAction>>,
3996    >(
3997        mut self,
3998        v: T,
3999    ) -> Self {
4000        self.action = std::option::Option::Some(crate::model::rule::Action::FilterAction(v.into()));
4001        self
4002    }
4003
4004    /// The value of [action][crate::model::Rule::action]
4005    /// if it holds a `TwowaySynonymsAction`, `None` if the field is not set or
4006    /// holds a different branch.
4007    pub fn twoway_synonyms_action(
4008        &self,
4009    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::TwowaySynonymsAction>> {
4010        #[allow(unreachable_patterns)]
4011        self.action.as_ref().and_then(|v| match v {
4012            crate::model::rule::Action::TwowaySynonymsAction(v) => std::option::Option::Some(v),
4013            _ => std::option::Option::None,
4014        })
4015    }
4016
4017    /// Sets the value of [action][crate::model::Rule::action]
4018    /// to hold a `TwowaySynonymsAction`.
4019    ///
4020    /// Note that all the setters affecting `action` are
4021    /// mutually exclusive.
4022    ///
4023    /// # Example
4024    /// ```ignore,no_run
4025    /// # use google_cloud_retail_v2::model::Rule;
4026    /// use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4027    /// let x = Rule::new().set_twoway_synonyms_action(TwowaySynonymsAction::default()/* use setters */);
4028    /// assert!(x.twoway_synonyms_action().is_some());
4029    /// assert!(x.boost_action().is_none());
4030    /// assert!(x.redirect_action().is_none());
4031    /// assert!(x.oneway_synonyms_action().is_none());
4032    /// assert!(x.do_not_associate_action().is_none());
4033    /// assert!(x.replacement_action().is_none());
4034    /// assert!(x.ignore_action().is_none());
4035    /// assert!(x.filter_action().is_none());
4036    /// assert!(x.force_return_facet_action().is_none());
4037    /// assert!(x.remove_facet_action().is_none());
4038    /// assert!(x.pin_action().is_none());
4039    /// ```
4040    pub fn set_twoway_synonyms_action<
4041        T: std::convert::Into<std::boxed::Box<crate::model::rule::TwowaySynonymsAction>>,
4042    >(
4043        mut self,
4044        v: T,
4045    ) -> Self {
4046        self.action =
4047            std::option::Option::Some(crate::model::rule::Action::TwowaySynonymsAction(v.into()));
4048        self
4049    }
4050
4051    /// The value of [action][crate::model::Rule::action]
4052    /// if it holds a `ForceReturnFacetAction`, `None` if the field is not set or
4053    /// holds a different branch.
4054    pub fn force_return_facet_action(
4055        &self,
4056    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ForceReturnFacetAction>> {
4057        #[allow(unreachable_patterns)]
4058        self.action.as_ref().and_then(|v| match v {
4059            crate::model::rule::Action::ForceReturnFacetAction(v) => std::option::Option::Some(v),
4060            _ => std::option::Option::None,
4061        })
4062    }
4063
4064    /// Sets the value of [action][crate::model::Rule::action]
4065    /// to hold a `ForceReturnFacetAction`.
4066    ///
4067    /// Note that all the setters affecting `action` are
4068    /// mutually exclusive.
4069    ///
4070    /// # Example
4071    /// ```ignore,no_run
4072    /// # use google_cloud_retail_v2::model::Rule;
4073    /// use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4074    /// let x = Rule::new().set_force_return_facet_action(ForceReturnFacetAction::default()/* use setters */);
4075    /// assert!(x.force_return_facet_action().is_some());
4076    /// assert!(x.boost_action().is_none());
4077    /// assert!(x.redirect_action().is_none());
4078    /// assert!(x.oneway_synonyms_action().is_none());
4079    /// assert!(x.do_not_associate_action().is_none());
4080    /// assert!(x.replacement_action().is_none());
4081    /// assert!(x.ignore_action().is_none());
4082    /// assert!(x.filter_action().is_none());
4083    /// assert!(x.twoway_synonyms_action().is_none());
4084    /// assert!(x.remove_facet_action().is_none());
4085    /// assert!(x.pin_action().is_none());
4086    /// ```
4087    pub fn set_force_return_facet_action<
4088        T: std::convert::Into<std::boxed::Box<crate::model::rule::ForceReturnFacetAction>>,
4089    >(
4090        mut self,
4091        v: T,
4092    ) -> Self {
4093        self.action =
4094            std::option::Option::Some(crate::model::rule::Action::ForceReturnFacetAction(v.into()));
4095        self
4096    }
4097
4098    /// The value of [action][crate::model::Rule::action]
4099    /// if it holds a `RemoveFacetAction`, `None` if the field is not set or
4100    /// holds a different branch.
4101    pub fn remove_facet_action(
4102        &self,
4103    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RemoveFacetAction>> {
4104        #[allow(unreachable_patterns)]
4105        self.action.as_ref().and_then(|v| match v {
4106            crate::model::rule::Action::RemoveFacetAction(v) => std::option::Option::Some(v),
4107            _ => std::option::Option::None,
4108        })
4109    }
4110
4111    /// Sets the value of [action][crate::model::Rule::action]
4112    /// to hold a `RemoveFacetAction`.
4113    ///
4114    /// Note that all the setters affecting `action` are
4115    /// mutually exclusive.
4116    ///
4117    /// # Example
4118    /// ```ignore,no_run
4119    /// # use google_cloud_retail_v2::model::Rule;
4120    /// use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4121    /// let x = Rule::new().set_remove_facet_action(RemoveFacetAction::default()/* use setters */);
4122    /// assert!(x.remove_facet_action().is_some());
4123    /// assert!(x.boost_action().is_none());
4124    /// assert!(x.redirect_action().is_none());
4125    /// assert!(x.oneway_synonyms_action().is_none());
4126    /// assert!(x.do_not_associate_action().is_none());
4127    /// assert!(x.replacement_action().is_none());
4128    /// assert!(x.ignore_action().is_none());
4129    /// assert!(x.filter_action().is_none());
4130    /// assert!(x.twoway_synonyms_action().is_none());
4131    /// assert!(x.force_return_facet_action().is_none());
4132    /// assert!(x.pin_action().is_none());
4133    /// ```
4134    pub fn set_remove_facet_action<
4135        T: std::convert::Into<std::boxed::Box<crate::model::rule::RemoveFacetAction>>,
4136    >(
4137        mut self,
4138        v: T,
4139    ) -> Self {
4140        self.action =
4141            std::option::Option::Some(crate::model::rule::Action::RemoveFacetAction(v.into()));
4142        self
4143    }
4144
4145    /// The value of [action][crate::model::Rule::action]
4146    /// if it holds a `PinAction`, `None` if the field is not set or
4147    /// holds a different branch.
4148    pub fn pin_action(
4149        &self,
4150    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::PinAction>> {
4151        #[allow(unreachable_patterns)]
4152        self.action.as_ref().and_then(|v| match v {
4153            crate::model::rule::Action::PinAction(v) => std::option::Option::Some(v),
4154            _ => std::option::Option::None,
4155        })
4156    }
4157
4158    /// Sets the value of [action][crate::model::Rule::action]
4159    /// to hold a `PinAction`.
4160    ///
4161    /// Note that all the setters affecting `action` are
4162    /// mutually exclusive.
4163    ///
4164    /// # Example
4165    /// ```ignore,no_run
4166    /// # use google_cloud_retail_v2::model::Rule;
4167    /// use google_cloud_retail_v2::model::rule::PinAction;
4168    /// let x = Rule::new().set_pin_action(PinAction::default()/* use setters */);
4169    /// assert!(x.pin_action().is_some());
4170    /// assert!(x.boost_action().is_none());
4171    /// assert!(x.redirect_action().is_none());
4172    /// assert!(x.oneway_synonyms_action().is_none());
4173    /// assert!(x.do_not_associate_action().is_none());
4174    /// assert!(x.replacement_action().is_none());
4175    /// assert!(x.ignore_action().is_none());
4176    /// assert!(x.filter_action().is_none());
4177    /// assert!(x.twoway_synonyms_action().is_none());
4178    /// assert!(x.force_return_facet_action().is_none());
4179    /// assert!(x.remove_facet_action().is_none());
4180    /// ```
4181    pub fn set_pin_action<T: std::convert::Into<std::boxed::Box<crate::model::rule::PinAction>>>(
4182        mut self,
4183        v: T,
4184    ) -> Self {
4185        self.action = std::option::Option::Some(crate::model::rule::Action::PinAction(v.into()));
4186        self
4187    }
4188}
4189
4190impl wkt::message::Message for Rule {
4191    fn typename() -> &'static str {
4192        "type.googleapis.com/google.cloud.retail.v2.Rule"
4193    }
4194}
4195
4196/// Defines additional types related to [Rule].
4197pub mod rule {
4198    #[allow(unused_imports)]
4199    use super::*;
4200
4201    /// A boost action to apply to results matching condition specified above.
4202    #[derive(Clone, Default, PartialEq)]
4203    #[non_exhaustive]
4204    pub struct BoostAction {
4205        /// Strength of the condition boost, which must be in [-1, 1]. Negative
4206        /// boost means demotion. Default is 0.0.
4207        ///
4208        /// Setting to 1.0 gives the item a big promotion. However, it does not
4209        /// necessarily mean that the boosted item will be the top result at all
4210        /// times, nor that other items will be excluded. Results could still be
4211        /// shown even when none of them matches the condition. And results that
4212        /// are significantly more relevant to the search query can still trump
4213        /// your heavily favored but irrelevant items.
4214        ///
4215        /// Setting to -1.0 gives the item a big demotion. However, results that
4216        /// are deeply relevant might still be shown. The item will have an
4217        /// upstream battle to get a fairly high ranking, but it is not blocked out
4218        /// completely.
4219        ///
4220        /// Setting to 0.0 means no boost applied. The boosting condition is
4221        /// ignored.
4222        pub boost: f32,
4223
4224        /// The filter can have a max size of 5000 characters.
4225        /// An expression which specifies which products to apply an action to.
4226        /// The syntax and supported fields are the same as a filter expression. See
4227        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
4228        /// detail syntax and limitations.
4229        ///
4230        /// Examples:
4231        ///
4232        /// * To boost products with product ID "product_1" or "product_2", and
4233        ///   color
4234        ///   "Red" or "Blue":\<br\>
4235        ///   *(id: ANY("product_1", "product_2"))<br>*
4236        ///   *AND<br>*
4237        ///   *(colorFamilies: ANY("Red", "Blue"))<br>*
4238        ///
4239        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4240        pub products_filter: std::string::String,
4241
4242        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4243    }
4244
4245    impl BoostAction {
4246        pub fn new() -> Self {
4247            std::default::Default::default()
4248        }
4249
4250        /// Sets the value of [boost][crate::model::rule::BoostAction::boost].
4251        ///
4252        /// # Example
4253        /// ```ignore,no_run
4254        /// # use google_cloud_retail_v2::model::rule::BoostAction;
4255        /// let x = BoostAction::new().set_boost(42.0);
4256        /// ```
4257        pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4258            self.boost = v.into();
4259            self
4260        }
4261
4262        /// Sets the value of [products_filter][crate::model::rule::BoostAction::products_filter].
4263        ///
4264        /// # Example
4265        /// ```ignore,no_run
4266        /// # use google_cloud_retail_v2::model::rule::BoostAction;
4267        /// let x = BoostAction::new().set_products_filter("example");
4268        /// ```
4269        pub fn set_products_filter<T: std::convert::Into<std::string::String>>(
4270            mut self,
4271            v: T,
4272        ) -> Self {
4273            self.products_filter = v.into();
4274            self
4275        }
4276    }
4277
4278    impl wkt::message::Message for BoostAction {
4279        fn typename() -> &'static str {
4280            "type.googleapis.com/google.cloud.retail.v2.Rule.BoostAction"
4281        }
4282    }
4283
4284    /// * Rule Condition:
4285    ///
4286    ///   - No
4287    ///     [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4288    ///     provided is a global match.
4289    ///   - 1 or more
4290    ///     [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4291    ///     provided are combined with OR operator.
4292    /// * Action Input: The request query and filter that are applied to the
4293    ///   retrieved products, in addition to any filters already provided with the
4294    ///   SearchRequest. The AND operator is used to combine the query's existing
4295    ///   filters with the filter rule(s). NOTE: May result in 0 results when
4296    ///   filters conflict.
4297    ///
4298    /// * Action Result: Filters the returned objects to be ONLY those that passed
4299    ///   the filter.
4300    ///
4301    ///
4302    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4303    #[derive(Clone, Default, PartialEq)]
4304    #[non_exhaustive]
4305    pub struct FilterAction {
4306        /// A filter to apply on the matching condition results. Supported features:
4307        ///
4308        /// * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
4309        /// * Filter syntax is identical to
4310        ///   [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. For
4311        ///   more
4312        ///   information, see [Filter](/retail/docs/filter-and-order#filter).
4313        /// * To filter products with product ID "product_1" or "product_2", and
4314        ///   color
4315        ///   "Red" or "Blue":\<br\>
4316        ///   *(id: ANY("product_1", "product_2"))<br>*
4317        ///   *AND<br>*
4318        ///   *(colorFamilies: ANY("Red", "Blue"))<br>*
4319        ///
4320        /// [google.cloud.retail.v2.Rule.FilterAction.filter]: crate::model::rule::FilterAction::filter
4321        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4322        pub filter: std::string::String,
4323
4324        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4325    }
4326
4327    impl FilterAction {
4328        pub fn new() -> Self {
4329            std::default::Default::default()
4330        }
4331
4332        /// Sets the value of [filter][crate::model::rule::FilterAction::filter].
4333        ///
4334        /// # Example
4335        /// ```ignore,no_run
4336        /// # use google_cloud_retail_v2::model::rule::FilterAction;
4337        /// let x = FilterAction::new().set_filter("example");
4338        /// ```
4339        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4340            self.filter = v.into();
4341            self
4342        }
4343    }
4344
4345    impl wkt::message::Message for FilterAction {
4346        fn typename() -> &'static str {
4347            "type.googleapis.com/google.cloud.retail.v2.Rule.FilterAction"
4348        }
4349    }
4350
4351    /// Redirects a shopper to a specific page.
4352    ///
4353    /// * Rule Condition:
4354    ///   Must specify
4355    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
4356    /// * Action Input: Request Query
4357    /// * Action Result: Redirects shopper to provided uri.
4358    ///
4359    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4360    #[derive(Clone, Default, PartialEq)]
4361    #[non_exhaustive]
4362    pub struct RedirectAction {
4363        /// URL must have length equal or less than 2000 characters.
4364        pub redirect_uri: std::string::String,
4365
4366        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4367    }
4368
4369    impl RedirectAction {
4370        pub fn new() -> Self {
4371            std::default::Default::default()
4372        }
4373
4374        /// Sets the value of [redirect_uri][crate::model::rule::RedirectAction::redirect_uri].
4375        ///
4376        /// # Example
4377        /// ```ignore,no_run
4378        /// # use google_cloud_retail_v2::model::rule::RedirectAction;
4379        /// let x = RedirectAction::new().set_redirect_uri("example");
4380        /// ```
4381        pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(
4382            mut self,
4383            v: T,
4384        ) -> Self {
4385            self.redirect_uri = v.into();
4386            self
4387        }
4388    }
4389
4390    impl wkt::message::Message for RedirectAction {
4391        fn typename() -> &'static str {
4392            "type.googleapis.com/google.cloud.retail.v2.Rule.RedirectAction"
4393        }
4394    }
4395
4396    /// Creates a set of terms that will be treated as synonyms of each other.
4397    /// Example: synonyms of "sneakers" and "shoes":
4398    ///
4399    /// * "sneakers" will use a synonym of "shoes".
4400    /// * "shoes" will use a synonym of "sneakers".
4401    #[derive(Clone, Default, PartialEq)]
4402    #[non_exhaustive]
4403    pub struct TwowaySynonymsAction {
4404        /// Defines a set of synonyms.
4405        /// Can specify up to 100 synonyms.
4406        /// Must specify at least 2 synonyms.
4407        pub synonyms: std::vec::Vec<std::string::String>,
4408
4409        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4410    }
4411
4412    impl TwowaySynonymsAction {
4413        pub fn new() -> Self {
4414            std::default::Default::default()
4415        }
4416
4417        /// Sets the value of [synonyms][crate::model::rule::TwowaySynonymsAction::synonyms].
4418        ///
4419        /// # Example
4420        /// ```ignore,no_run
4421        /// # use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4422        /// let x = TwowaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4423        /// ```
4424        pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4425        where
4426            T: std::iter::IntoIterator<Item = V>,
4427            V: std::convert::Into<std::string::String>,
4428        {
4429            use std::iter::Iterator;
4430            self.synonyms = v.into_iter().map(|i| i.into()).collect();
4431            self
4432        }
4433    }
4434
4435    impl wkt::message::Message for TwowaySynonymsAction {
4436        fn typename() -> &'static str {
4437            "type.googleapis.com/google.cloud.retail.v2.Rule.TwowaySynonymsAction"
4438        }
4439    }
4440
4441    /// Maps a set of terms to a set of synonyms.
4442    /// Set of synonyms will be treated as synonyms of each query term only.
4443    /// `query_terms` will not be treated as synonyms of each other.
4444    /// Example: "sneakers" will use a synonym of "shoes".
4445    /// "shoes" will not use a synonym of "sneakers".
4446    #[derive(Clone, Default, PartialEq)]
4447    #[non_exhaustive]
4448    pub struct OnewaySynonymsAction {
4449        /// Terms from the search query.
4450        /// Will treat synonyms as their synonyms.
4451        /// Not themselves synonyms of the synonyms.
4452        /// Can specify up to 100 terms.
4453        pub query_terms: std::vec::Vec<std::string::String>,
4454
4455        /// Defines a set of synonyms.
4456        /// Cannot contain duplicates.
4457        /// Can specify up to 100 synonyms.
4458        pub synonyms: std::vec::Vec<std::string::String>,
4459
4460        /// Will be [deprecated = true] post migration;
4461        pub oneway_terms: std::vec::Vec<std::string::String>,
4462
4463        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4464    }
4465
4466    impl OnewaySynonymsAction {
4467        pub fn new() -> Self {
4468            std::default::Default::default()
4469        }
4470
4471        /// Sets the value of [query_terms][crate::model::rule::OnewaySynonymsAction::query_terms].
4472        ///
4473        /// # Example
4474        /// ```ignore,no_run
4475        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4476        /// let x = OnewaySynonymsAction::new().set_query_terms(["a", "b", "c"]);
4477        /// ```
4478        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4479        where
4480            T: std::iter::IntoIterator<Item = V>,
4481            V: std::convert::Into<std::string::String>,
4482        {
4483            use std::iter::Iterator;
4484            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4485            self
4486        }
4487
4488        /// Sets the value of [synonyms][crate::model::rule::OnewaySynonymsAction::synonyms].
4489        ///
4490        /// # Example
4491        /// ```ignore,no_run
4492        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4493        /// let x = OnewaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4494        /// ```
4495        pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4496        where
4497            T: std::iter::IntoIterator<Item = V>,
4498            V: std::convert::Into<std::string::String>,
4499        {
4500            use std::iter::Iterator;
4501            self.synonyms = v.into_iter().map(|i| i.into()).collect();
4502            self
4503        }
4504
4505        /// Sets the value of [oneway_terms][crate::model::rule::OnewaySynonymsAction::oneway_terms].
4506        ///
4507        /// # Example
4508        /// ```ignore,no_run
4509        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4510        /// let x = OnewaySynonymsAction::new().set_oneway_terms(["a", "b", "c"]);
4511        /// ```
4512        pub fn set_oneway_terms<T, V>(mut self, v: T) -> Self
4513        where
4514            T: std::iter::IntoIterator<Item = V>,
4515            V: std::convert::Into<std::string::String>,
4516        {
4517            use std::iter::Iterator;
4518            self.oneway_terms = v.into_iter().map(|i| i.into()).collect();
4519            self
4520        }
4521    }
4522
4523    impl wkt::message::Message for OnewaySynonymsAction {
4524        fn typename() -> &'static str {
4525            "type.googleapis.com/google.cloud.retail.v2.Rule.OnewaySynonymsAction"
4526        }
4527    }
4528
4529    /// Prevents `query_term` from being associated with specified terms during
4530    /// search.
4531    /// Example: Don't associate "gShoe" and "cheap".
4532    #[derive(Clone, Default, PartialEq)]
4533    #[non_exhaustive]
4534    pub struct DoNotAssociateAction {
4535        /// Terms from the search query.
4536        /// Will not consider do_not_associate_terms for search if in search query.
4537        /// Can specify up to 100 terms.
4538        pub query_terms: std::vec::Vec<std::string::String>,
4539
4540        /// Cannot contain duplicates or the query term.
4541        /// Can specify up to 100 terms.
4542        pub do_not_associate_terms: std::vec::Vec<std::string::String>,
4543
4544        /// Will be [deprecated = true] post migration;
4545        pub terms: std::vec::Vec<std::string::String>,
4546
4547        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4548    }
4549
4550    impl DoNotAssociateAction {
4551        pub fn new() -> Self {
4552            std::default::Default::default()
4553        }
4554
4555        /// Sets the value of [query_terms][crate::model::rule::DoNotAssociateAction::query_terms].
4556        ///
4557        /// # Example
4558        /// ```ignore,no_run
4559        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4560        /// let x = DoNotAssociateAction::new().set_query_terms(["a", "b", "c"]);
4561        /// ```
4562        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4563        where
4564            T: std::iter::IntoIterator<Item = V>,
4565            V: std::convert::Into<std::string::String>,
4566        {
4567            use std::iter::Iterator;
4568            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4569            self
4570        }
4571
4572        /// Sets the value of [do_not_associate_terms][crate::model::rule::DoNotAssociateAction::do_not_associate_terms].
4573        ///
4574        /// # Example
4575        /// ```ignore,no_run
4576        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4577        /// let x = DoNotAssociateAction::new().set_do_not_associate_terms(["a", "b", "c"]);
4578        /// ```
4579        pub fn set_do_not_associate_terms<T, V>(mut self, v: T) -> Self
4580        where
4581            T: std::iter::IntoIterator<Item = V>,
4582            V: std::convert::Into<std::string::String>,
4583        {
4584            use std::iter::Iterator;
4585            self.do_not_associate_terms = v.into_iter().map(|i| i.into()).collect();
4586            self
4587        }
4588
4589        /// Sets the value of [terms][crate::model::rule::DoNotAssociateAction::terms].
4590        ///
4591        /// # Example
4592        /// ```ignore,no_run
4593        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4594        /// let x = DoNotAssociateAction::new().set_terms(["a", "b", "c"]);
4595        /// ```
4596        pub fn set_terms<T, V>(mut self, v: T) -> Self
4597        where
4598            T: std::iter::IntoIterator<Item = V>,
4599            V: std::convert::Into<std::string::String>,
4600        {
4601            use std::iter::Iterator;
4602            self.terms = v.into_iter().map(|i| i.into()).collect();
4603            self
4604        }
4605    }
4606
4607    impl wkt::message::Message for DoNotAssociateAction {
4608        fn typename() -> &'static str {
4609            "type.googleapis.com/google.cloud.retail.v2.Rule.DoNotAssociateAction"
4610        }
4611    }
4612
4613    /// Replaces a term in the query. Multiple replacement candidates can be
4614    /// specified. All `query_terms` will be replaced with the replacement term.
4615    /// Example: Replace "gShoe" with "google shoe".
4616    #[derive(Clone, Default, PartialEq)]
4617    #[non_exhaustive]
4618    pub struct ReplacementAction {
4619        /// Terms from the search query.
4620        /// Will be replaced by replacement term.
4621        /// Can specify up to 100 terms.
4622        pub query_terms: std::vec::Vec<std::string::String>,
4623
4624        /// Term that will be used for replacement.
4625        pub replacement_term: std::string::String,
4626
4627        /// Will be [deprecated = true] post migration;
4628        pub term: std::string::String,
4629
4630        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4631    }
4632
4633    impl ReplacementAction {
4634        pub fn new() -> Self {
4635            std::default::Default::default()
4636        }
4637
4638        /// Sets the value of [query_terms][crate::model::rule::ReplacementAction::query_terms].
4639        ///
4640        /// # Example
4641        /// ```ignore,no_run
4642        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4643        /// let x = ReplacementAction::new().set_query_terms(["a", "b", "c"]);
4644        /// ```
4645        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4646        where
4647            T: std::iter::IntoIterator<Item = V>,
4648            V: std::convert::Into<std::string::String>,
4649        {
4650            use std::iter::Iterator;
4651            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4652            self
4653        }
4654
4655        /// Sets the value of [replacement_term][crate::model::rule::ReplacementAction::replacement_term].
4656        ///
4657        /// # Example
4658        /// ```ignore,no_run
4659        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4660        /// let x = ReplacementAction::new().set_replacement_term("example");
4661        /// ```
4662        pub fn set_replacement_term<T: std::convert::Into<std::string::String>>(
4663            mut self,
4664            v: T,
4665        ) -> Self {
4666            self.replacement_term = v.into();
4667            self
4668        }
4669
4670        /// Sets the value of [term][crate::model::rule::ReplacementAction::term].
4671        ///
4672        /// # Example
4673        /// ```ignore,no_run
4674        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4675        /// let x = ReplacementAction::new().set_term("example");
4676        /// ```
4677        pub fn set_term<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4678            self.term = v.into();
4679            self
4680        }
4681    }
4682
4683    impl wkt::message::Message for ReplacementAction {
4684        fn typename() -> &'static str {
4685            "type.googleapis.com/google.cloud.retail.v2.Rule.ReplacementAction"
4686        }
4687    }
4688
4689    /// Prevents a term in the query from being used in search.
4690    /// Example: Don't search for "shoddy".
4691    #[derive(Clone, Default, PartialEq)]
4692    #[non_exhaustive]
4693    pub struct IgnoreAction {
4694        /// Terms to ignore in the search query.
4695        pub ignore_terms: std::vec::Vec<std::string::String>,
4696
4697        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4698    }
4699
4700    impl IgnoreAction {
4701        pub fn new() -> Self {
4702            std::default::Default::default()
4703        }
4704
4705        /// Sets the value of [ignore_terms][crate::model::rule::IgnoreAction::ignore_terms].
4706        ///
4707        /// # Example
4708        /// ```ignore,no_run
4709        /// # use google_cloud_retail_v2::model::rule::IgnoreAction;
4710        /// let x = IgnoreAction::new().set_ignore_terms(["a", "b", "c"]);
4711        /// ```
4712        pub fn set_ignore_terms<T, V>(mut self, v: T) -> Self
4713        where
4714            T: std::iter::IntoIterator<Item = V>,
4715            V: std::convert::Into<std::string::String>,
4716        {
4717            use std::iter::Iterator;
4718            self.ignore_terms = v.into_iter().map(|i| i.into()).collect();
4719            self
4720        }
4721    }
4722
4723    impl wkt::message::Message for IgnoreAction {
4724        fn typename() -> &'static str {
4725            "type.googleapis.com/google.cloud.retail.v2.Rule.IgnoreAction"
4726        }
4727    }
4728
4729    /// Force returns an attribute/facet in the request around a certain position
4730    /// or above.
4731    ///
4732    /// * Rule Condition:
4733    ///   Must specify non-empty
4734    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4735    ///   (for search only) or
4736    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4737    ///   (for browse only), but can't specify both.
4738    ///
4739    /// * Action Inputs: attribute name, position
4740    ///
4741    /// * Action Result: Will force return a facet key around a certain position
4742    ///   or above if the condition is satisfied.
4743    ///
4744    ///
4745    /// Example: Suppose the query is "shoes", the
4746    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4747    /// "shoes", the
4748    /// [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]
4749    /// is "size" and the
4750    /// [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]
4751    /// is 8.
4752    ///
4753    /// Two cases: a) The facet key "size" is not already in the top 8 slots, then
4754    /// the facet "size" will appear at a position close to 8. b) The facet key
4755    /// "size" in among the top 8 positions in the request, then it will stay at
4756    /// its current rank.
4757    ///
4758    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4759    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4760    /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name
4761    /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position
4762    #[derive(Clone, Default, PartialEq)]
4763    #[non_exhaustive]
4764    pub struct ForceReturnFacetAction {
4765        /// Each instance corresponds to a force return attribute for the given
4766        /// condition. There can't be more 15 instances here.
4767        pub facet_position_adjustments:
4768            std::vec::Vec<crate::model::rule::force_return_facet_action::FacetPositionAdjustment>,
4769
4770        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4771    }
4772
4773    impl ForceReturnFacetAction {
4774        pub fn new() -> Self {
4775            std::default::Default::default()
4776        }
4777
4778        /// Sets the value of [facet_position_adjustments][crate::model::rule::ForceReturnFacetAction::facet_position_adjustments].
4779        ///
4780        /// # Example
4781        /// ```ignore,no_run
4782        /// # use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4783        /// use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4784        /// let x = ForceReturnFacetAction::new()
4785        ///     .set_facet_position_adjustments([
4786        ///         FacetPositionAdjustment::default()/* use setters */,
4787        ///         FacetPositionAdjustment::default()/* use (different) setters */,
4788        ///     ]);
4789        /// ```
4790        pub fn set_facet_position_adjustments<T, V>(mut self, v: T) -> Self
4791        where
4792            T: std::iter::IntoIterator<Item = V>,
4793            V: std::convert::Into<
4794                    crate::model::rule::force_return_facet_action::FacetPositionAdjustment,
4795                >,
4796        {
4797            use std::iter::Iterator;
4798            self.facet_position_adjustments = v.into_iter().map(|i| i.into()).collect();
4799            self
4800        }
4801    }
4802
4803    impl wkt::message::Message for ForceReturnFacetAction {
4804        fn typename() -> &'static str {
4805            "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction"
4806        }
4807    }
4808
4809    /// Defines additional types related to [ForceReturnFacetAction].
4810    pub mod force_return_facet_action {
4811        #[allow(unused_imports)]
4812        use super::*;
4813
4814        /// Each facet position adjustment consists of a single attribute name (i.e.
4815        /// facet key) along with a specified position.
4816        #[derive(Clone, Default, PartialEq)]
4817        #[non_exhaustive]
4818        pub struct FacetPositionAdjustment {
4819            /// The attribute name to force return as a facet. Each attribute name
4820            /// should be a valid attribute name, be non-empty and contain at most 80
4821            /// characters long.
4822            pub attribute_name: std::string::String,
4823
4824            /// This is the position in the request as explained above. It should be
4825            /// strictly positive be at most 100.
4826            pub position: i32,
4827
4828            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4829        }
4830
4831        impl FacetPositionAdjustment {
4832            pub fn new() -> Self {
4833                std::default::Default::default()
4834            }
4835
4836            /// Sets the value of [attribute_name][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name].
4837            ///
4838            /// # Example
4839            /// ```ignore,no_run
4840            /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4841            /// let x = FacetPositionAdjustment::new().set_attribute_name("example");
4842            /// ```
4843            pub fn set_attribute_name<T: std::convert::Into<std::string::String>>(
4844                mut self,
4845                v: T,
4846            ) -> Self {
4847                self.attribute_name = v.into();
4848                self
4849            }
4850
4851            /// Sets the value of [position][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position].
4852            ///
4853            /// # Example
4854            /// ```ignore,no_run
4855            /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4856            /// let x = FacetPositionAdjustment::new().set_position(42);
4857            /// ```
4858            pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4859                self.position = v.into();
4860                self
4861            }
4862        }
4863
4864        impl wkt::message::Message for FacetPositionAdjustment {
4865            fn typename() -> &'static str {
4866                "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment"
4867            }
4868        }
4869    }
4870
4871    /// Removes an attribute/facet in the request if is present.
4872    ///
4873    /// * Rule Condition:
4874    ///   Must specify non-empty
4875    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4876    ///   (for search only) or
4877    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4878    ///   (for browse only), but can't specify both.
4879    ///
4880    /// * Action Input: attribute name
4881    ///
4882    /// * Action Result: Will remove the attribute (as a facet) from the request
4883    ///   if it is present.
4884    ///
4885    ///
4886    /// Example: Suppose the query is "shoes", the
4887    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4888    /// "shoes" and the attribute name "size", then facet key "size" will be
4889    /// removed from the request (if it is present).
4890    ///
4891    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4892    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4893    #[derive(Clone, Default, PartialEq)]
4894    #[non_exhaustive]
4895    pub struct RemoveFacetAction {
4896        /// The attribute names (i.e. facet keys) to remove from the dynamic facets
4897        /// (if present in the request). There can't be more 3 attribute names.
4898        /// Each attribute name should be a valid attribute name, be non-empty and
4899        /// contain at most 80 characters.
4900        pub attribute_names: std::vec::Vec<std::string::String>,
4901
4902        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4903    }
4904
4905    impl RemoveFacetAction {
4906        pub fn new() -> Self {
4907            std::default::Default::default()
4908        }
4909
4910        /// Sets the value of [attribute_names][crate::model::rule::RemoveFacetAction::attribute_names].
4911        ///
4912        /// # Example
4913        /// ```ignore,no_run
4914        /// # use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4915        /// let x = RemoveFacetAction::new().set_attribute_names(["a", "b", "c"]);
4916        /// ```
4917        pub fn set_attribute_names<T, V>(mut self, v: T) -> Self
4918        where
4919            T: std::iter::IntoIterator<Item = V>,
4920            V: std::convert::Into<std::string::String>,
4921        {
4922            use std::iter::Iterator;
4923            self.attribute_names = v.into_iter().map(|i| i.into()).collect();
4924            self
4925        }
4926    }
4927
4928    impl wkt::message::Message for RemoveFacetAction {
4929        fn typename() -> &'static str {
4930            "type.googleapis.com/google.cloud.retail.v2.Rule.RemoveFacetAction"
4931        }
4932    }
4933
4934    /// Pins one or more specified products to a specific position in the
4935    /// results.
4936    ///
4937    /// * Rule Condition:
4938    ///   Must specify non-empty
4939    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4940    ///   (for search only) or
4941    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4942    ///   (for browse only), but can't specify both.
4943    ///
4944    /// * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
4945    ///   uses 1-based indexing).
4946    ///
4947    /// * Action Result: Will pin products with matching ids to the position
4948    ///   specified in the final result order.
4949    ///
4950    ///
4951    /// Example: Suppose the query is `shoes`, the
4952    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4953    /// `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
4954    /// pinned to the top position in the final results.
4955    ///
4956    /// If multiple PinActions are matched to a single request the actions will
4957    /// be processed from most to least recently updated.
4958    ///
4959    /// Pins to positions larger than the max allowed page size of 120 are not
4960    /// allowed.
4961    ///
4962    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4963    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4964    #[derive(Clone, Default, PartialEq)]
4965    #[non_exhaustive]
4966    pub struct PinAction {
4967        /// Required. A map of positions to product_ids.
4968        ///
4969        /// Partial matches per action are allowed, if a certain position in the map
4970        /// is already filled that `[position, product_id]` pair will be ignored
4971        /// but the rest may still be applied. This case will only occur if multiple
4972        /// pin actions are matched to a single request, as the map guarantees that
4973        /// pin positions are unique within the same action.
4974        ///
4975        /// Duplicate product_ids are not permitted within a single pin map.
4976        ///
4977        /// The max size of this map is 120, equivalent to the max [request page
4978        /// size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
4979        pub pin_map: std::collections::HashMap<i64, std::string::String>,
4980
4981        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4982    }
4983
4984    impl PinAction {
4985        pub fn new() -> Self {
4986            std::default::Default::default()
4987        }
4988
4989        /// Sets the value of [pin_map][crate::model::rule::PinAction::pin_map].
4990        ///
4991        /// # Example
4992        /// ```ignore,no_run
4993        /// # use google_cloud_retail_v2::model::rule::PinAction;
4994        /// let x = PinAction::new().set_pin_map([
4995        ///     (0, "abc"),
4996        ///     (1, "xyz"),
4997        /// ]);
4998        /// ```
4999        pub fn set_pin_map<T, K, V>(mut self, v: T) -> Self
5000        where
5001            T: std::iter::IntoIterator<Item = (K, V)>,
5002            K: std::convert::Into<i64>,
5003            V: std::convert::Into<std::string::String>,
5004        {
5005            use std::iter::Iterator;
5006            self.pin_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5007            self
5008        }
5009    }
5010
5011    impl wkt::message::Message for PinAction {
5012        fn typename() -> &'static str {
5013            "type.googleapis.com/google.cloud.retail.v2.Rule.PinAction"
5014        }
5015    }
5016
5017    /// An action must be provided.
5018    #[derive(Clone, Debug, PartialEq)]
5019    #[non_exhaustive]
5020    pub enum Action {
5021        /// A boost action.
5022        BoostAction(std::boxed::Box<crate::model::rule::BoostAction>),
5023        /// Redirects a shopper to a specific page.
5024        RedirectAction(std::boxed::Box<crate::model::rule::RedirectAction>),
5025        /// Treats specific term as a synonym with a group of terms.
5026        /// Group of terms will not be treated as synonyms with the specific term.
5027        OnewaySynonymsAction(std::boxed::Box<crate::model::rule::OnewaySynonymsAction>),
5028        /// Prevents term from being associated with other terms.
5029        DoNotAssociateAction(std::boxed::Box<crate::model::rule::DoNotAssociateAction>),
5030        /// Replaces specific terms in the query.
5031        ReplacementAction(std::boxed::Box<crate::model::rule::ReplacementAction>),
5032        /// Ignores specific terms from query during search.
5033        IgnoreAction(std::boxed::Box<crate::model::rule::IgnoreAction>),
5034        /// Filters results.
5035        FilterAction(std::boxed::Box<crate::model::rule::FilterAction>),
5036        /// Treats a set of terms as synonyms of one another.
5037        TwowaySynonymsAction(std::boxed::Box<crate::model::rule::TwowaySynonymsAction>),
5038        /// Force returns an attribute as a facet in the request.
5039        ForceReturnFacetAction(std::boxed::Box<crate::model::rule::ForceReturnFacetAction>),
5040        /// Remove an attribute as a facet in the request (if present).
5041        RemoveFacetAction(std::boxed::Box<crate::model::rule::RemoveFacetAction>),
5042        /// Pins one or more specified products to a specific position in the
5043        /// results.
5044        PinAction(std::boxed::Box<crate::model::rule::PinAction>),
5045    }
5046}
5047
5048/// An intended audience of the [Product][google.cloud.retail.v2.Product] for
5049/// whom it's sold.
5050///
5051/// [google.cloud.retail.v2.Product]: crate::model::Product
5052#[derive(Clone, Default, PartialEq)]
5053#[non_exhaustive]
5054pub struct Audience {
5055    /// The genders of the audience. Strongly encouraged to use the standard
5056    /// values: "male", "female", "unisex".
5057    ///
5058    /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5059    /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5060    /// is returned.
5061    ///
5062    /// Google Merchant Center property
5063    /// [gender](https://support.google.com/merchants/answer/6324479). Schema.org
5064    /// property
5065    /// [Product.audience.suggestedGender](https://schema.org/suggestedGender).
5066    pub genders: std::vec::Vec<std::string::String>,
5067
5068    /// The age groups of the audience. Strongly encouraged to use the standard
5069    /// values: "newborn" (up to 3 months old), "infant" (3–12 months old),
5070    /// "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
5071    /// teens or older).
5072    ///
5073    /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5074    /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5075    /// is returned.
5076    ///
5077    /// Google Merchant Center property
5078    /// [age_group](https://support.google.com/merchants/answer/6324463).
5079    /// Schema.org property
5080    /// [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
5081    /// [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
5082    pub age_groups: std::vec::Vec<std::string::String>,
5083
5084    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5085}
5086
5087impl Audience {
5088    pub fn new() -> Self {
5089        std::default::Default::default()
5090    }
5091
5092    /// Sets the value of [genders][crate::model::Audience::genders].
5093    ///
5094    /// # Example
5095    /// ```ignore,no_run
5096    /// # use google_cloud_retail_v2::model::Audience;
5097    /// let x = Audience::new().set_genders(["a", "b", "c"]);
5098    /// ```
5099    pub fn set_genders<T, V>(mut self, v: T) -> Self
5100    where
5101        T: std::iter::IntoIterator<Item = V>,
5102        V: std::convert::Into<std::string::String>,
5103    {
5104        use std::iter::Iterator;
5105        self.genders = v.into_iter().map(|i| i.into()).collect();
5106        self
5107    }
5108
5109    /// Sets the value of [age_groups][crate::model::Audience::age_groups].
5110    ///
5111    /// # Example
5112    /// ```ignore,no_run
5113    /// # use google_cloud_retail_v2::model::Audience;
5114    /// let x = Audience::new().set_age_groups(["a", "b", "c"]);
5115    /// ```
5116    pub fn set_age_groups<T, V>(mut self, v: T) -> Self
5117    where
5118        T: std::iter::IntoIterator<Item = V>,
5119        V: std::convert::Into<std::string::String>,
5120    {
5121        use std::iter::Iterator;
5122        self.age_groups = v.into_iter().map(|i| i.into()).collect();
5123        self
5124    }
5125}
5126
5127impl wkt::message::Message for Audience {
5128    fn typename() -> &'static str {
5129        "type.googleapis.com/google.cloud.retail.v2.Audience"
5130    }
5131}
5132
5133/// The color information of a [Product][google.cloud.retail.v2.Product].
5134///
5135/// [google.cloud.retail.v2.Product]: crate::model::Product
5136#[derive(Clone, Default, PartialEq)]
5137#[non_exhaustive]
5138pub struct ColorInfo {
5139    /// The standard color families. Strongly recommended to use the following
5140    /// standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
5141    /// "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
5142    /// Normally it is expected to have only 1 color family. May consider using
5143    /// single "Mixed" instead of multiple values.
5144    ///
5145    /// A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
5146    /// string with a length limit of 128 characters. Otherwise, an
5147    /// INVALID_ARGUMENT error is returned.
5148    ///
5149    /// Google Merchant Center property
5150    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5151    /// property [Product.color](https://schema.org/color).
5152    ///
5153    /// The colorFamilies field as a system attribute is not a required field but
5154    /// strongly recommended to be specified. Google Search models treat this field
5155    /// as more important than a custom product attribute when specified.
5156    pub color_families: std::vec::Vec<std::string::String>,
5157
5158    /// The color display names, which may be different from standard color family
5159    /// names, such as the color aliases used in the website frontend. Normally
5160    /// it is expected to have only 1 color. May consider using single "Mixed"
5161    /// instead of multiple values.
5162    ///
5163    /// A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded
5164    /// string with a length limit of 128 characters. Otherwise, an
5165    /// INVALID_ARGUMENT error is returned.
5166    ///
5167    /// Google Merchant Center property
5168    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5169    /// property [Product.color](https://schema.org/color).
5170    pub colors: std::vec::Vec<std::string::String>,
5171
5172    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5173}
5174
5175impl ColorInfo {
5176    pub fn new() -> Self {
5177        std::default::Default::default()
5178    }
5179
5180    /// Sets the value of [color_families][crate::model::ColorInfo::color_families].
5181    ///
5182    /// # Example
5183    /// ```ignore,no_run
5184    /// # use google_cloud_retail_v2::model::ColorInfo;
5185    /// let x = ColorInfo::new().set_color_families(["a", "b", "c"]);
5186    /// ```
5187    pub fn set_color_families<T, V>(mut self, v: T) -> Self
5188    where
5189        T: std::iter::IntoIterator<Item = V>,
5190        V: std::convert::Into<std::string::String>,
5191    {
5192        use std::iter::Iterator;
5193        self.color_families = v.into_iter().map(|i| i.into()).collect();
5194        self
5195    }
5196
5197    /// Sets the value of [colors][crate::model::ColorInfo::colors].
5198    ///
5199    /// # Example
5200    /// ```ignore,no_run
5201    /// # use google_cloud_retail_v2::model::ColorInfo;
5202    /// let x = ColorInfo::new().set_colors(["a", "b", "c"]);
5203    /// ```
5204    pub fn set_colors<T, V>(mut self, v: T) -> Self
5205    where
5206        T: std::iter::IntoIterator<Item = V>,
5207        V: std::convert::Into<std::string::String>,
5208    {
5209        use std::iter::Iterator;
5210        self.colors = v.into_iter().map(|i| i.into()).collect();
5211        self
5212    }
5213}
5214
5215impl wkt::message::Message for ColorInfo {
5216    fn typename() -> &'static str {
5217        "type.googleapis.com/google.cloud.retail.v2.ColorInfo"
5218    }
5219}
5220
5221/// A custom attribute that is not explicitly modeled in
5222/// [Product][google.cloud.retail.v2.Product].
5223///
5224/// [google.cloud.retail.v2.Product]: crate::model::Product
5225#[derive(Clone, Default, PartialEq)]
5226#[non_exhaustive]
5227pub struct CustomAttribute {
5228    /// The textual values of this custom attribute. For example, `["yellow",
5229    /// "green"]` when the key is "color".
5230    ///
5231    /// Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
5232    /// returned.
5233    ///
5234    /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5235    /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5236    /// Otherwise, an INVALID_ARGUMENT error is returned.
5237    ///
5238    /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5239    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5240    pub text: std::vec::Vec<std::string::String>,
5241
5242    /// The numerical values of this custom attribute. For example, `[2.3, 15.4]`
5243    /// when the key is "lengths_cm".
5244    ///
5245    /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5246    /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5247    /// Otherwise, an INVALID_ARGUMENT error is returned.
5248    ///
5249    /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5250    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5251    pub numbers: std::vec::Vec<f64>,
5252
5253    /// This field is normally ignored unless
5254    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5255    /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5256    /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5257    /// attribute configuration, see [Configuration
5258    /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5259    /// If true, custom attribute values are searchable by text queries in
5260    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5261    ///
5262    /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5263    ///
5264    /// Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
5265    /// set. Otherwise, a INVALID_ARGUMENT error is returned.
5266    ///
5267    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5268    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5269    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5270    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5271    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5272    #[deprecated]
5273    pub searchable: std::option::Option<bool>,
5274
5275    /// This field is normally ignored unless
5276    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5277    /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5278    /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5279    /// attribute configuration, see [Configuration
5280    /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5281    /// If true, custom attribute values are indexed, so that they can be filtered,
5282    /// faceted or boosted in
5283    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5284    ///
5285    /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5286    ///
5287    /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
5288    /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
5289    /// and
5290    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
5291    /// for more details.
5292    ///
5293    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5294    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5295    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
5296    /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
5297    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
5298    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5299    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5300    #[deprecated]
5301    pub indexable: std::option::Option<bool>,
5302
5303    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5304}
5305
5306impl CustomAttribute {
5307    pub fn new() -> Self {
5308        std::default::Default::default()
5309    }
5310
5311    /// Sets the value of [text][crate::model::CustomAttribute::text].
5312    ///
5313    /// # Example
5314    /// ```ignore,no_run
5315    /// # use google_cloud_retail_v2::model::CustomAttribute;
5316    /// let x = CustomAttribute::new().set_text(["a", "b", "c"]);
5317    /// ```
5318    pub fn set_text<T, V>(mut self, v: T) -> Self
5319    where
5320        T: std::iter::IntoIterator<Item = V>,
5321        V: std::convert::Into<std::string::String>,
5322    {
5323        use std::iter::Iterator;
5324        self.text = v.into_iter().map(|i| i.into()).collect();
5325        self
5326    }
5327
5328    /// Sets the value of [numbers][crate::model::CustomAttribute::numbers].
5329    ///
5330    /// # Example
5331    /// ```ignore,no_run
5332    /// # use google_cloud_retail_v2::model::CustomAttribute;
5333    /// let x = CustomAttribute::new().set_numbers([1.0, 2.0, 3.0]);
5334    /// ```
5335    pub fn set_numbers<T, V>(mut self, v: T) -> Self
5336    where
5337        T: std::iter::IntoIterator<Item = V>,
5338        V: std::convert::Into<f64>,
5339    {
5340        use std::iter::Iterator;
5341        self.numbers = v.into_iter().map(|i| i.into()).collect();
5342        self
5343    }
5344
5345    /// Sets the value of [searchable][crate::model::CustomAttribute::searchable].
5346    ///
5347    /// # Example
5348    /// ```ignore,no_run
5349    /// # use google_cloud_retail_v2::model::CustomAttribute;
5350    /// let x = CustomAttribute::new().set_searchable(true);
5351    /// ```
5352    #[deprecated]
5353    pub fn set_searchable<T>(mut self, v: T) -> Self
5354    where
5355        T: std::convert::Into<bool>,
5356    {
5357        self.searchable = std::option::Option::Some(v.into());
5358        self
5359    }
5360
5361    /// Sets or clears the value of [searchable][crate::model::CustomAttribute::searchable].
5362    ///
5363    /// # Example
5364    /// ```ignore,no_run
5365    /// # use google_cloud_retail_v2::model::CustomAttribute;
5366    /// let x = CustomAttribute::new().set_or_clear_searchable(Some(false));
5367    /// let x = CustomAttribute::new().set_or_clear_searchable(None::<bool>);
5368    /// ```
5369    #[deprecated]
5370    pub fn set_or_clear_searchable<T>(mut self, v: std::option::Option<T>) -> Self
5371    where
5372        T: std::convert::Into<bool>,
5373    {
5374        self.searchable = v.map(|x| x.into());
5375        self
5376    }
5377
5378    /// Sets the value of [indexable][crate::model::CustomAttribute::indexable].
5379    ///
5380    /// # Example
5381    /// ```ignore,no_run
5382    /// # use google_cloud_retail_v2::model::CustomAttribute;
5383    /// let x = CustomAttribute::new().set_indexable(true);
5384    /// ```
5385    #[deprecated]
5386    pub fn set_indexable<T>(mut self, v: T) -> Self
5387    where
5388        T: std::convert::Into<bool>,
5389    {
5390        self.indexable = std::option::Option::Some(v.into());
5391        self
5392    }
5393
5394    /// Sets or clears the value of [indexable][crate::model::CustomAttribute::indexable].
5395    ///
5396    /// # Example
5397    /// ```ignore,no_run
5398    /// # use google_cloud_retail_v2::model::CustomAttribute;
5399    /// let x = CustomAttribute::new().set_or_clear_indexable(Some(false));
5400    /// let x = CustomAttribute::new().set_or_clear_indexable(None::<bool>);
5401    /// ```
5402    #[deprecated]
5403    pub fn set_or_clear_indexable<T>(mut self, v: std::option::Option<T>) -> Self
5404    where
5405        T: std::convert::Into<bool>,
5406    {
5407        self.indexable = v.map(|x| x.into());
5408        self
5409    }
5410}
5411
5412impl wkt::message::Message for CustomAttribute {
5413    fn typename() -> &'static str {
5414        "type.googleapis.com/google.cloud.retail.v2.CustomAttribute"
5415    }
5416}
5417
5418/// Fulfillment information, such as the store IDs for in-store pickup or region
5419/// IDs for different shipping methods.
5420#[derive(Clone, Default, PartialEq)]
5421#[non_exhaustive]
5422pub struct FulfillmentInfo {
5423    /// The fulfillment type, including commonly used types (such as pickup in
5424    /// store and same day delivery), and custom types. Customers have to map
5425    /// custom types to their display names before rendering UI.
5426    ///
5427    /// Supported values:
5428    ///
5429    /// * "pickup-in-store"
5430    /// * "ship-to-store"
5431    /// * "same-day-delivery"
5432    /// * "next-day-delivery"
5433    /// * "custom-type-1"
5434    /// * "custom-type-2"
5435    /// * "custom-type-3"
5436    /// * "custom-type-4"
5437    /// * "custom-type-5"
5438    ///
5439    /// If this field is set to an invalid value other than these, an
5440    /// INVALID_ARGUMENT error is returned.
5441    pub r#type: std::string::String,
5442
5443    /// The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
5444    /// as the store IDs for
5445    /// [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
5446    /// or the region IDs for
5447    /// [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
5448    ///
5449    /// A maximum of 3000 values are allowed. Each value must be a string with a
5450    /// length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such
5451    /// as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is
5452    /// returned.
5453    ///
5454    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
5455    pub place_ids: std::vec::Vec<std::string::String>,
5456
5457    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5458}
5459
5460impl FulfillmentInfo {
5461    pub fn new() -> Self {
5462        std::default::Default::default()
5463    }
5464
5465    /// Sets the value of [r#type][crate::model::FulfillmentInfo::type].
5466    ///
5467    /// # Example
5468    /// ```ignore,no_run
5469    /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5470    /// let x = FulfillmentInfo::new().set_type("example");
5471    /// ```
5472    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5473        self.r#type = v.into();
5474        self
5475    }
5476
5477    /// Sets the value of [place_ids][crate::model::FulfillmentInfo::place_ids].
5478    ///
5479    /// # Example
5480    /// ```ignore,no_run
5481    /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5482    /// let x = FulfillmentInfo::new().set_place_ids(["a", "b", "c"]);
5483    /// ```
5484    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
5485    where
5486        T: std::iter::IntoIterator<Item = V>,
5487        V: std::convert::Into<std::string::String>,
5488    {
5489        use std::iter::Iterator;
5490        self.place_ids = v.into_iter().map(|i| i.into()).collect();
5491        self
5492    }
5493}
5494
5495impl wkt::message::Message for FulfillmentInfo {
5496    fn typename() -> &'static str {
5497        "type.googleapis.com/google.cloud.retail.v2.FulfillmentInfo"
5498    }
5499}
5500
5501/// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
5502/// Retail Search use product images to improve prediction and search results.
5503/// Product images can be returned in results, and are shown in prediction or
5504/// search previews in the console. Please try to provide correct product images
5505/// and avoid using images with size too small.
5506///
5507/// [google.cloud.retail.v2.Product]: crate::model::Product
5508#[derive(Clone, Default, PartialEq)]
5509#[non_exhaustive]
5510pub struct Image {
5511    /// Required. URI of the image.
5512    ///
5513    /// This field must be a valid UTF-8 encoded URI with a length limit of 5,000
5514    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
5515    ///
5516    /// Google Merchant Center property
5517    /// [image_link](https://support.google.com/merchants/answer/6324350).
5518    /// Schema.org property [Product.image](https://schema.org/image).
5519    pub uri: std::string::String,
5520
5521    /// Height of the image in number of pixels.
5522    ///
5523    /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5524    /// returned.
5525    pub height: i32,
5526
5527    /// Width of the image in number of pixels.
5528    ///
5529    /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5530    /// returned.
5531    pub width: i32,
5532
5533    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5534}
5535
5536impl Image {
5537    pub fn new() -> Self {
5538        std::default::Default::default()
5539    }
5540
5541    /// Sets the value of [uri][crate::model::Image::uri].
5542    ///
5543    /// # Example
5544    /// ```ignore,no_run
5545    /// # use google_cloud_retail_v2::model::Image;
5546    /// let x = Image::new().set_uri("example");
5547    /// ```
5548    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5549        self.uri = v.into();
5550        self
5551    }
5552
5553    /// Sets the value of [height][crate::model::Image::height].
5554    ///
5555    /// # Example
5556    /// ```ignore,no_run
5557    /// # use google_cloud_retail_v2::model::Image;
5558    /// let x = Image::new().set_height(42);
5559    /// ```
5560    pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5561        self.height = v.into();
5562        self
5563    }
5564
5565    /// Sets the value of [width][crate::model::Image::width].
5566    ///
5567    /// # Example
5568    /// ```ignore,no_run
5569    /// # use google_cloud_retail_v2::model::Image;
5570    /// let x = Image::new().set_width(42);
5571    /// ```
5572    pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5573        self.width = v.into();
5574        self
5575    }
5576}
5577
5578impl wkt::message::Message for Image {
5579    fn typename() -> &'static str {
5580        "type.googleapis.com/google.cloud.retail.v2.Image"
5581    }
5582}
5583
5584/// A floating point interval.
5585#[derive(Clone, Default, PartialEq)]
5586#[non_exhaustive]
5587pub struct Interval {
5588    /// The lower bound of the interval. If neither of the min fields are set, then
5589    /// the lower bound is negative infinity.
5590    ///
5591    /// This field must not be larger than max.
5592    /// Otherwise, an INVALID_ARGUMENT error is returned.
5593    pub min: std::option::Option<crate::model::interval::Min>,
5594
5595    /// The upper bound of the interval. If neither of the max fields are set, then
5596    /// the upper bound is positive infinity.
5597    ///
5598    /// This field must be not smaller than min.
5599    /// Otherwise, an INVALID_ARGUMENT error is returned.
5600    pub max: std::option::Option<crate::model::interval::Max>,
5601
5602    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5603}
5604
5605impl Interval {
5606    pub fn new() -> Self {
5607        std::default::Default::default()
5608    }
5609
5610    /// Sets the value of [min][crate::model::Interval::min].
5611    ///
5612    /// Note that all the setters affecting `min` are mutually
5613    /// exclusive.
5614    ///
5615    /// # Example
5616    /// ```ignore,no_run
5617    /// # use google_cloud_retail_v2::model::Interval;
5618    /// use google_cloud_retail_v2::model::interval::Min;
5619    /// let x = Interval::new().set_min(Some(Min::Minimum(42.0)));
5620    /// ```
5621    pub fn set_min<T: std::convert::Into<std::option::Option<crate::model::interval::Min>>>(
5622        mut self,
5623        v: T,
5624    ) -> Self {
5625        self.min = v.into();
5626        self
5627    }
5628
5629    /// The value of [min][crate::model::Interval::min]
5630    /// if it holds a `Minimum`, `None` if the field is not set or
5631    /// holds a different branch.
5632    pub fn minimum(&self) -> std::option::Option<&f64> {
5633        #[allow(unreachable_patterns)]
5634        self.min.as_ref().and_then(|v| match v {
5635            crate::model::interval::Min::Minimum(v) => std::option::Option::Some(v),
5636            _ => std::option::Option::None,
5637        })
5638    }
5639
5640    /// Sets the value of [min][crate::model::Interval::min]
5641    /// to hold a `Minimum`.
5642    ///
5643    /// Note that all the setters affecting `min` are
5644    /// mutually exclusive.
5645    ///
5646    /// # Example
5647    /// ```ignore,no_run
5648    /// # use google_cloud_retail_v2::model::Interval;
5649    /// let x = Interval::new().set_minimum(42.0);
5650    /// assert!(x.minimum().is_some());
5651    /// assert!(x.exclusive_minimum().is_none());
5652    /// ```
5653    pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5654        self.min = std::option::Option::Some(crate::model::interval::Min::Minimum(v.into()));
5655        self
5656    }
5657
5658    /// The value of [min][crate::model::Interval::min]
5659    /// if it holds a `ExclusiveMinimum`, `None` if the field is not set or
5660    /// holds a different branch.
5661    pub fn exclusive_minimum(&self) -> std::option::Option<&f64> {
5662        #[allow(unreachable_patterns)]
5663        self.min.as_ref().and_then(|v| match v {
5664            crate::model::interval::Min::ExclusiveMinimum(v) => std::option::Option::Some(v),
5665            _ => std::option::Option::None,
5666        })
5667    }
5668
5669    /// Sets the value of [min][crate::model::Interval::min]
5670    /// to hold a `ExclusiveMinimum`.
5671    ///
5672    /// Note that all the setters affecting `min` are
5673    /// mutually exclusive.
5674    ///
5675    /// # Example
5676    /// ```ignore,no_run
5677    /// # use google_cloud_retail_v2::model::Interval;
5678    /// let x = Interval::new().set_exclusive_minimum(42.0);
5679    /// assert!(x.exclusive_minimum().is_some());
5680    /// assert!(x.minimum().is_none());
5681    /// ```
5682    pub fn set_exclusive_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5683        self.min =
5684            std::option::Option::Some(crate::model::interval::Min::ExclusiveMinimum(v.into()));
5685        self
5686    }
5687
5688    /// Sets the value of [max][crate::model::Interval::max].
5689    ///
5690    /// Note that all the setters affecting `max` are mutually
5691    /// exclusive.
5692    ///
5693    /// # Example
5694    /// ```ignore,no_run
5695    /// # use google_cloud_retail_v2::model::Interval;
5696    /// use google_cloud_retail_v2::model::interval::Max;
5697    /// let x = Interval::new().set_max(Some(Max::Maximum(42.0)));
5698    /// ```
5699    pub fn set_max<T: std::convert::Into<std::option::Option<crate::model::interval::Max>>>(
5700        mut self,
5701        v: T,
5702    ) -> Self {
5703        self.max = v.into();
5704        self
5705    }
5706
5707    /// The value of [max][crate::model::Interval::max]
5708    /// if it holds a `Maximum`, `None` if the field is not set or
5709    /// holds a different branch.
5710    pub fn maximum(&self) -> std::option::Option<&f64> {
5711        #[allow(unreachable_patterns)]
5712        self.max.as_ref().and_then(|v| match v {
5713            crate::model::interval::Max::Maximum(v) => std::option::Option::Some(v),
5714            _ => std::option::Option::None,
5715        })
5716    }
5717
5718    /// Sets the value of [max][crate::model::Interval::max]
5719    /// to hold a `Maximum`.
5720    ///
5721    /// Note that all the setters affecting `max` are
5722    /// mutually exclusive.
5723    ///
5724    /// # Example
5725    /// ```ignore,no_run
5726    /// # use google_cloud_retail_v2::model::Interval;
5727    /// let x = Interval::new().set_maximum(42.0);
5728    /// assert!(x.maximum().is_some());
5729    /// assert!(x.exclusive_maximum().is_none());
5730    /// ```
5731    pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5732        self.max = std::option::Option::Some(crate::model::interval::Max::Maximum(v.into()));
5733        self
5734    }
5735
5736    /// The value of [max][crate::model::Interval::max]
5737    /// if it holds a `ExclusiveMaximum`, `None` if the field is not set or
5738    /// holds a different branch.
5739    pub fn exclusive_maximum(&self) -> std::option::Option<&f64> {
5740        #[allow(unreachable_patterns)]
5741        self.max.as_ref().and_then(|v| match v {
5742            crate::model::interval::Max::ExclusiveMaximum(v) => std::option::Option::Some(v),
5743            _ => std::option::Option::None,
5744        })
5745    }
5746
5747    /// Sets the value of [max][crate::model::Interval::max]
5748    /// to hold a `ExclusiveMaximum`.
5749    ///
5750    /// Note that all the setters affecting `max` are
5751    /// mutually exclusive.
5752    ///
5753    /// # Example
5754    /// ```ignore,no_run
5755    /// # use google_cloud_retail_v2::model::Interval;
5756    /// let x = Interval::new().set_exclusive_maximum(42.0);
5757    /// assert!(x.exclusive_maximum().is_some());
5758    /// assert!(x.maximum().is_none());
5759    /// ```
5760    pub fn set_exclusive_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5761        self.max =
5762            std::option::Option::Some(crate::model::interval::Max::ExclusiveMaximum(v.into()));
5763        self
5764    }
5765}
5766
5767impl wkt::message::Message for Interval {
5768    fn typename() -> &'static str {
5769        "type.googleapis.com/google.cloud.retail.v2.Interval"
5770    }
5771}
5772
5773/// Defines additional types related to [Interval].
5774pub mod interval {
5775    #[allow(unused_imports)]
5776    use super::*;
5777
5778    /// The lower bound of the interval. If neither of the min fields are set, then
5779    /// the lower bound is negative infinity.
5780    ///
5781    /// This field must not be larger than max.
5782    /// Otherwise, an INVALID_ARGUMENT error is returned.
5783    #[derive(Clone, Debug, PartialEq)]
5784    #[non_exhaustive]
5785    pub enum Min {
5786        /// Inclusive lower bound.
5787        Minimum(f64),
5788        /// Exclusive lower bound.
5789        ExclusiveMinimum(f64),
5790    }
5791
5792    /// The upper bound of the interval. If neither of the max fields are set, then
5793    /// the upper bound is positive infinity.
5794    ///
5795    /// This field must be not smaller than min.
5796    /// Otherwise, an INVALID_ARGUMENT error is returned.
5797    #[derive(Clone, Debug, PartialEq)]
5798    #[non_exhaustive]
5799    pub enum Max {
5800        /// Inclusive upper bound.
5801        Maximum(f64),
5802        /// Exclusive upper bound.
5803        ExclusiveMaximum(f64),
5804    }
5805}
5806
5807/// The price information of a [Product][google.cloud.retail.v2.Product].
5808///
5809/// [google.cloud.retail.v2.Product]: crate::model::Product
5810#[derive(Clone, Default, PartialEq)]
5811#[non_exhaustive]
5812pub struct PriceInfo {
5813    /// The 3-letter currency code defined in [ISO
5814    /// 4217](https://www.iso.org/iso-4217-currency-codes.html).
5815    ///
5816    /// If this field is an unrecognizable currency code, an INVALID_ARGUMENT
5817    /// error is returned.
5818    ///
5819    /// The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5820    /// [Product][google.cloud.retail.v2.Product]s with the same
5821    /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
5822    /// must share the same
5823    /// [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
5824    /// a FAILED_PRECONDITION error is returned.
5825    ///
5826    /// [google.cloud.retail.v2.PriceInfo.currency_code]: crate::model::PriceInfo::currency_code
5827    /// [google.cloud.retail.v2.Product]: crate::model::Product
5828    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5829    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
5830    pub currency_code: std::string::String,
5831
5832    /// Price of the product.
5833    ///
5834    /// Google Merchant Center property
5835    /// [price](https://support.google.com/merchants/answer/6324371). Schema.org
5836    /// property [Offer.price](https://schema.org/price).
5837    pub price: f32,
5838
5839    /// Price of the product without any discount. If zero, by default set to be
5840    /// the [price][google.cloud.retail.v2.PriceInfo.price]. If set,
5841    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be
5842    /// greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price],
5843    /// otherwise an INVALID_ARGUMENT error is thrown.
5844    ///
5845    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5846    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5847    pub original_price: f32,
5848
5849    /// The costs associated with the sale of a particular product. Used for gross
5850    /// profit reporting.
5851    ///
5852    /// * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
5853    ///   [cost][google.cloud.retail.v2.PriceInfo.cost]
5854    ///
5855    /// Google Merchant Center property
5856    /// [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
5857    ///
5858    /// [google.cloud.retail.v2.PriceInfo.cost]: crate::model::PriceInfo::cost
5859    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5860    pub cost: f32,
5861
5862    /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5863    /// starts to be effective. This can be set as a future timestamp, and the
5864    /// [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
5865    /// after
5866    /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5867    /// If so, the
5868    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5869    /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5870    /// is used before
5871    /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5872    ///
5873    /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5874    /// effective because it will cause additional latency during search.
5875    ///
5876    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5877    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5878    /// [google.cloud.retail.v2.PriceInfo.price_effective_time]: crate::model::PriceInfo::price_effective_time
5879    pub price_effective_time: std::option::Option<wkt::Timestamp>,
5880
5881    /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5882    /// stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
5883    /// is used for search before
5884    /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
5885    /// this field is set, the
5886    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5887    /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5888    /// is used after
5889    /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
5890    ///
5891    /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5892    /// effective because it will cause additional latency during search.
5893    ///
5894    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5895    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5896    /// [google.cloud.retail.v2.PriceInfo.price_expire_time]: crate::model::PriceInfo::price_expire_time
5897    pub price_expire_time: std::option::Option<wkt::Timestamp>,
5898
5899    /// Output only. The price range of all the child
5900    /// [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5901    /// [Product][google.cloud.retail.v2.Product]s grouped together on the
5902    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5903    /// [Product][google.cloud.retail.v2.Product]. Only populated for
5904    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5905    /// [Product][google.cloud.retail.v2.Product]s.
5906    ///
5907    /// Note: This field is OUTPUT_ONLY for
5908    /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
5909    /// Do not set this field in API requests.
5910    ///
5911    /// [google.cloud.retail.v2.Product]: crate::model::Product
5912    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
5913    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5914    /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
5915    pub price_range: std::option::Option<crate::model::price_info::PriceRange>,
5916
5917    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5918}
5919
5920impl PriceInfo {
5921    pub fn new() -> Self {
5922        std::default::Default::default()
5923    }
5924
5925    /// Sets the value of [currency_code][crate::model::PriceInfo::currency_code].
5926    ///
5927    /// # Example
5928    /// ```ignore,no_run
5929    /// # use google_cloud_retail_v2::model::PriceInfo;
5930    /// let x = PriceInfo::new().set_currency_code("example");
5931    /// ```
5932    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5933        self.currency_code = v.into();
5934        self
5935    }
5936
5937    /// Sets the value of [price][crate::model::PriceInfo::price].
5938    ///
5939    /// # Example
5940    /// ```ignore,no_run
5941    /// # use google_cloud_retail_v2::model::PriceInfo;
5942    /// let x = PriceInfo::new().set_price(42.0);
5943    /// ```
5944    pub fn set_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5945        self.price = v.into();
5946        self
5947    }
5948
5949    /// Sets the value of [original_price][crate::model::PriceInfo::original_price].
5950    ///
5951    /// # Example
5952    /// ```ignore,no_run
5953    /// # use google_cloud_retail_v2::model::PriceInfo;
5954    /// let x = PriceInfo::new().set_original_price(42.0);
5955    /// ```
5956    pub fn set_original_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5957        self.original_price = v.into();
5958        self
5959    }
5960
5961    /// Sets the value of [cost][crate::model::PriceInfo::cost].
5962    ///
5963    /// # Example
5964    /// ```ignore,no_run
5965    /// # use google_cloud_retail_v2::model::PriceInfo;
5966    /// let x = PriceInfo::new().set_cost(42.0);
5967    /// ```
5968    pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5969        self.cost = v.into();
5970        self
5971    }
5972
5973    /// Sets the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
5974    ///
5975    /// # Example
5976    /// ```ignore,no_run
5977    /// # use google_cloud_retail_v2::model::PriceInfo;
5978    /// use wkt::Timestamp;
5979    /// let x = PriceInfo::new().set_price_effective_time(Timestamp::default()/* use setters */);
5980    /// ```
5981    pub fn set_price_effective_time<T>(mut self, v: T) -> Self
5982    where
5983        T: std::convert::Into<wkt::Timestamp>,
5984    {
5985        self.price_effective_time = std::option::Option::Some(v.into());
5986        self
5987    }
5988
5989    /// Sets or clears the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
5990    ///
5991    /// # Example
5992    /// ```ignore,no_run
5993    /// # use google_cloud_retail_v2::model::PriceInfo;
5994    /// use wkt::Timestamp;
5995    /// let x = PriceInfo::new().set_or_clear_price_effective_time(Some(Timestamp::default()/* use setters */));
5996    /// let x = PriceInfo::new().set_or_clear_price_effective_time(None::<Timestamp>);
5997    /// ```
5998    pub fn set_or_clear_price_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
5999    where
6000        T: std::convert::Into<wkt::Timestamp>,
6001    {
6002        self.price_effective_time = v.map(|x| x.into());
6003        self
6004    }
6005
6006    /// Sets the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6007    ///
6008    /// # Example
6009    /// ```ignore,no_run
6010    /// # use google_cloud_retail_v2::model::PriceInfo;
6011    /// use wkt::Timestamp;
6012    /// let x = PriceInfo::new().set_price_expire_time(Timestamp::default()/* use setters */);
6013    /// ```
6014    pub fn set_price_expire_time<T>(mut self, v: T) -> Self
6015    where
6016        T: std::convert::Into<wkt::Timestamp>,
6017    {
6018        self.price_expire_time = std::option::Option::Some(v.into());
6019        self
6020    }
6021
6022    /// Sets or clears the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6023    ///
6024    /// # Example
6025    /// ```ignore,no_run
6026    /// # use google_cloud_retail_v2::model::PriceInfo;
6027    /// use wkt::Timestamp;
6028    /// let x = PriceInfo::new().set_or_clear_price_expire_time(Some(Timestamp::default()/* use setters */));
6029    /// let x = PriceInfo::new().set_or_clear_price_expire_time(None::<Timestamp>);
6030    /// ```
6031    pub fn set_or_clear_price_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
6032    where
6033        T: std::convert::Into<wkt::Timestamp>,
6034    {
6035        self.price_expire_time = v.map(|x| x.into());
6036        self
6037    }
6038
6039    /// Sets the value of [price_range][crate::model::PriceInfo::price_range].
6040    ///
6041    /// # Example
6042    /// ```ignore,no_run
6043    /// # use google_cloud_retail_v2::model::PriceInfo;
6044    /// use google_cloud_retail_v2::model::price_info::PriceRange;
6045    /// let x = PriceInfo::new().set_price_range(PriceRange::default()/* use setters */);
6046    /// ```
6047    pub fn set_price_range<T>(mut self, v: T) -> Self
6048    where
6049        T: std::convert::Into<crate::model::price_info::PriceRange>,
6050    {
6051        self.price_range = std::option::Option::Some(v.into());
6052        self
6053    }
6054
6055    /// Sets or clears the value of [price_range][crate::model::PriceInfo::price_range].
6056    ///
6057    /// # Example
6058    /// ```ignore,no_run
6059    /// # use google_cloud_retail_v2::model::PriceInfo;
6060    /// use google_cloud_retail_v2::model::price_info::PriceRange;
6061    /// let x = PriceInfo::new().set_or_clear_price_range(Some(PriceRange::default()/* use setters */));
6062    /// let x = PriceInfo::new().set_or_clear_price_range(None::<PriceRange>);
6063    /// ```
6064    pub fn set_or_clear_price_range<T>(mut self, v: std::option::Option<T>) -> Self
6065    where
6066        T: std::convert::Into<crate::model::price_info::PriceRange>,
6067    {
6068        self.price_range = v.map(|x| x.into());
6069        self
6070    }
6071}
6072
6073impl wkt::message::Message for PriceInfo {
6074    fn typename() -> &'static str {
6075        "type.googleapis.com/google.cloud.retail.v2.PriceInfo"
6076    }
6077}
6078
6079/// Defines additional types related to [PriceInfo].
6080pub mod price_info {
6081    #[allow(unused_imports)]
6082    use super::*;
6083
6084    /// The price range of all
6085    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6086    /// [Product][google.cloud.retail.v2.Product] having the same
6087    /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6088    ///
6089    /// [google.cloud.retail.v2.Product]: crate::model::Product
6090    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6091    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6092    #[derive(Clone, Default, PartialEq)]
6093    #[non_exhaustive]
6094    pub struct PriceRange {
6095        /// The inclusive
6096        /// [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
6097        /// interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6098        /// [Product][google.cloud.retail.v2.Product] having the same
6099        /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6100        ///
6101        /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
6102        /// [google.cloud.retail.v2.Product]: crate::model::Product
6103        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6104        /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6105        pub price: std::option::Option<crate::model::Interval>,
6106
6107        /// The inclusive
6108        /// [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
6109        /// internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6110        /// [Product][google.cloud.retail.v2.Product] having the same
6111        /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6112        ///
6113        /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
6114        /// [google.cloud.retail.v2.Product]: crate::model::Product
6115        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6116        /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6117        pub original_price: std::option::Option<crate::model::Interval>,
6118
6119        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6120    }
6121
6122    impl PriceRange {
6123        pub fn new() -> Self {
6124            std::default::Default::default()
6125        }
6126
6127        /// Sets the value of [price][crate::model::price_info::PriceRange::price].
6128        ///
6129        /// # Example
6130        /// ```ignore,no_run
6131        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6132        /// use google_cloud_retail_v2::model::Interval;
6133        /// let x = PriceRange::new().set_price(Interval::default()/* use setters */);
6134        /// ```
6135        pub fn set_price<T>(mut self, v: T) -> Self
6136        where
6137            T: std::convert::Into<crate::model::Interval>,
6138        {
6139            self.price = std::option::Option::Some(v.into());
6140            self
6141        }
6142
6143        /// Sets or clears the value of [price][crate::model::price_info::PriceRange::price].
6144        ///
6145        /// # Example
6146        /// ```ignore,no_run
6147        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6148        /// use google_cloud_retail_v2::model::Interval;
6149        /// let x = PriceRange::new().set_or_clear_price(Some(Interval::default()/* use setters */));
6150        /// let x = PriceRange::new().set_or_clear_price(None::<Interval>);
6151        /// ```
6152        pub fn set_or_clear_price<T>(mut self, v: std::option::Option<T>) -> Self
6153        where
6154            T: std::convert::Into<crate::model::Interval>,
6155        {
6156            self.price = v.map(|x| x.into());
6157            self
6158        }
6159
6160        /// Sets the value of [original_price][crate::model::price_info::PriceRange::original_price].
6161        ///
6162        /// # Example
6163        /// ```ignore,no_run
6164        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6165        /// use google_cloud_retail_v2::model::Interval;
6166        /// let x = PriceRange::new().set_original_price(Interval::default()/* use setters */);
6167        /// ```
6168        pub fn set_original_price<T>(mut self, v: T) -> Self
6169        where
6170            T: std::convert::Into<crate::model::Interval>,
6171        {
6172            self.original_price = std::option::Option::Some(v.into());
6173            self
6174        }
6175
6176        /// Sets or clears the value of [original_price][crate::model::price_info::PriceRange::original_price].
6177        ///
6178        /// # Example
6179        /// ```ignore,no_run
6180        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6181        /// use google_cloud_retail_v2::model::Interval;
6182        /// let x = PriceRange::new().set_or_clear_original_price(Some(Interval::default()/* use setters */));
6183        /// let x = PriceRange::new().set_or_clear_original_price(None::<Interval>);
6184        /// ```
6185        pub fn set_or_clear_original_price<T>(mut self, v: std::option::Option<T>) -> Self
6186        where
6187            T: std::convert::Into<crate::model::Interval>,
6188        {
6189            self.original_price = v.map(|x| x.into());
6190            self
6191        }
6192    }
6193
6194    impl wkt::message::Message for PriceRange {
6195        fn typename() -> &'static str {
6196            "type.googleapis.com/google.cloud.retail.v2.PriceInfo.PriceRange"
6197        }
6198    }
6199}
6200
6201/// The rating of a [Product][google.cloud.retail.v2.Product].
6202///
6203/// [google.cloud.retail.v2.Product]: crate::model::Product
6204#[derive(Clone, Default, PartialEq)]
6205#[non_exhaustive]
6206pub struct Rating {
6207    /// The total number of ratings. This value is independent of the value of
6208    /// [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
6209    ///
6210    /// This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
6211    /// returned.
6212    ///
6213    /// [google.cloud.retail.v2.Rating.rating_histogram]: crate::model::Rating::rating_histogram
6214    pub rating_count: i32,
6215
6216    /// The average rating of the [Product][google.cloud.retail.v2.Product].
6217    ///
6218    /// The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
6219    /// returned.
6220    ///
6221    /// [google.cloud.retail.v2.Product]: crate::model::Product
6222    pub average_rating: f32,
6223
6224    /// List of rating counts per rating value (index = rating - 1). The list is
6225    /// empty if there is no rating. If the list is non-empty, its size is
6226    /// always 5. Otherwise, an INVALID_ARGUMENT error is returned.
6227    ///
6228    /// For example, [41, 14, 13, 47, 303]. It means that the
6229    /// [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
6230    /// ratings with 2 star, and so on.
6231    ///
6232    /// [google.cloud.retail.v2.Product]: crate::model::Product
6233    pub rating_histogram: std::vec::Vec<i32>,
6234
6235    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6236}
6237
6238impl Rating {
6239    pub fn new() -> Self {
6240        std::default::Default::default()
6241    }
6242
6243    /// Sets the value of [rating_count][crate::model::Rating::rating_count].
6244    ///
6245    /// # Example
6246    /// ```ignore,no_run
6247    /// # use google_cloud_retail_v2::model::Rating;
6248    /// let x = Rating::new().set_rating_count(42);
6249    /// ```
6250    pub fn set_rating_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6251        self.rating_count = v.into();
6252        self
6253    }
6254
6255    /// Sets the value of [average_rating][crate::model::Rating::average_rating].
6256    ///
6257    /// # Example
6258    /// ```ignore,no_run
6259    /// # use google_cloud_retail_v2::model::Rating;
6260    /// let x = Rating::new().set_average_rating(42.0);
6261    /// ```
6262    pub fn set_average_rating<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6263        self.average_rating = v.into();
6264        self
6265    }
6266
6267    /// Sets the value of [rating_histogram][crate::model::Rating::rating_histogram].
6268    ///
6269    /// # Example
6270    /// ```ignore,no_run
6271    /// # use google_cloud_retail_v2::model::Rating;
6272    /// let x = Rating::new().set_rating_histogram([1, 2, 3]);
6273    /// ```
6274    pub fn set_rating_histogram<T, V>(mut self, v: T) -> Self
6275    where
6276        T: std::iter::IntoIterator<Item = V>,
6277        V: std::convert::Into<i32>,
6278    {
6279        use std::iter::Iterator;
6280        self.rating_histogram = v.into_iter().map(|i| i.into()).collect();
6281        self
6282    }
6283}
6284
6285impl wkt::message::Message for Rating {
6286    fn typename() -> &'static str {
6287        "type.googleapis.com/google.cloud.retail.v2.Rating"
6288    }
6289}
6290
6291/// Information of an end user.
6292#[derive(Clone, Default, PartialEq)]
6293#[non_exhaustive]
6294pub struct UserInfo {
6295    /// Highly recommended for logged-in users. Unique identifier for logged-in
6296    /// user, such as a user name. Don't set for anonymous users.
6297    ///
6298    /// Always use a hashed value for this ID.
6299    ///
6300    /// Don't set the field to the same fixed ID for different users. This mixes
6301    /// the event history of those users together, which results in degraded
6302    /// model quality.
6303    ///
6304    /// The field must be a UTF-8 encoded string with a length limit of 128
6305    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6306    pub user_id: std::string::String,
6307
6308    /// The end user's IP address. This field is used to extract location
6309    /// information for personalization.
6310    ///
6311    /// This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
6312    /// address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
6313    /// INVALID_ARGUMENT error is returned.
6314    ///
6315    /// This should not be set when:
6316    ///
6317    /// * setting
6318    ///   [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
6319    /// * using the JavaScript tag in
6320    ///   [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6321    ///   or if
6322    ///   [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6323    ///   is set.
6324    ///
6325    /// [google.cloud.retail.v2.SearchRequest.user_info]: crate::model::SearchRequest::user_info
6326    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6327    /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6328    pub ip_address: std::string::String,
6329
6330    /// User agent as included in the HTTP header.
6331    /// The field must be a UTF-8 encoded string with a length limit of 1,000
6332    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6333    ///
6334    /// This should not be set when using the client side event reporting with
6335    /// GTM or JavaScript tag in
6336    /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6337    /// or if
6338    /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6339    /// is set.
6340    ///
6341    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6342    /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6343    pub user_agent: std::string::String,
6344
6345    /// True if the request is made directly from the end user, in which case the
6346    /// [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
6347    /// [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
6348    /// from the HTTP request. This flag should be set only if the API request is
6349    /// made directly from the end user such as a mobile app (and not if a gateway
6350    /// or a server is processing and pushing the user events).
6351    ///
6352    /// This should not be set when using the JavaScript tag in
6353    /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
6354    ///
6355    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6356    /// [google.cloud.retail.v2.UserInfo.ip_address]: crate::model::UserInfo::ip_address
6357    /// [google.cloud.retail.v2.UserInfo.user_agent]: crate::model::UserInfo::user_agent
6358    pub direct_user_request: bool,
6359
6360    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6361}
6362
6363impl UserInfo {
6364    pub fn new() -> Self {
6365        std::default::Default::default()
6366    }
6367
6368    /// Sets the value of [user_id][crate::model::UserInfo::user_id].
6369    ///
6370    /// # Example
6371    /// ```ignore,no_run
6372    /// # use google_cloud_retail_v2::model::UserInfo;
6373    /// let x = UserInfo::new().set_user_id("example");
6374    /// ```
6375    pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6376        self.user_id = v.into();
6377        self
6378    }
6379
6380    /// Sets the value of [ip_address][crate::model::UserInfo::ip_address].
6381    ///
6382    /// # Example
6383    /// ```ignore,no_run
6384    /// # use google_cloud_retail_v2::model::UserInfo;
6385    /// let x = UserInfo::new().set_ip_address("example");
6386    /// ```
6387    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6388        self.ip_address = v.into();
6389        self
6390    }
6391
6392    /// Sets the value of [user_agent][crate::model::UserInfo::user_agent].
6393    ///
6394    /// # Example
6395    /// ```ignore,no_run
6396    /// # use google_cloud_retail_v2::model::UserInfo;
6397    /// let x = UserInfo::new().set_user_agent("example");
6398    /// ```
6399    pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6400        self.user_agent = v.into();
6401        self
6402    }
6403
6404    /// Sets the value of [direct_user_request][crate::model::UserInfo::direct_user_request].
6405    ///
6406    /// # Example
6407    /// ```ignore,no_run
6408    /// # use google_cloud_retail_v2::model::UserInfo;
6409    /// let x = UserInfo::new().set_direct_user_request(true);
6410    /// ```
6411    pub fn set_direct_user_request<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6412        self.direct_user_request = v.into();
6413        self
6414    }
6415}
6416
6417impl wkt::message::Message for UserInfo {
6418    fn typename() -> &'static str {
6419        "type.googleapis.com/google.cloud.retail.v2.UserInfo"
6420    }
6421}
6422
6423/// The inventory information at a place (e.g. a store) identified
6424/// by a place ID.
6425#[derive(Clone, Default, PartialEq)]
6426#[non_exhaustive]
6427pub struct LocalInventory {
6428    /// Optional. The place ID for the current set of inventory information.
6429    pub place_id: std::string::String,
6430
6431    /// Optional. Product price and cost information.
6432    ///
6433    /// Google Merchant Center property
6434    /// [price](https://support.google.com/merchants/answer/6324371).
6435    pub price_info: std::option::Option<crate::model::PriceInfo>,
6436
6437    /// Optional. Additional local inventory attributes, for example, store name,
6438    /// promotion tags, etc.
6439    ///
6440    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
6441    /// error is returned:
6442    ///
6443    /// * At most 30 attributes are allowed.
6444    /// * The key must be a UTF-8 encoded string with a length limit of 32
6445    ///   characters.
6446    /// * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
6447    ///   key0LikeThis or KEY_1_LIKE_THIS.
6448    /// * The attribute values must be of the same type (text or number).
6449    /// * Only 1 value is allowed for each attribute.
6450    /// * For text values, the length limit is 256 UTF-8 characters.
6451    /// * The attribute does not support search. The `searchable` field should be
6452    ///   unset or set to false.
6453    /// * The max summed total bytes of custom attribute keys and values per
6454    ///   product is 5MiB.
6455    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
6456
6457    /// Optional. Supported fulfillment types. Valid fulfillment type values
6458    /// include commonly used types (such as pickup in store and same day
6459    /// delivery), and custom types. Customers have to map custom types to their
6460    /// display names before rendering UI.
6461    ///
6462    /// Supported values:
6463    ///
6464    /// * "pickup-in-store"
6465    /// * "ship-to-store"
6466    /// * "same-day-delivery"
6467    /// * "next-day-delivery"
6468    /// * "custom-type-1"
6469    /// * "custom-type-2"
6470    /// * "custom-type-3"
6471    /// * "custom-type-4"
6472    /// * "custom-type-5"
6473    ///
6474    /// If this field is set to an invalid value other than these, an
6475    /// INVALID_ARGUMENT error is returned.
6476    ///
6477    /// All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
6478    /// returned.
6479    pub fulfillment_types: std::vec::Vec<std::string::String>,
6480
6481    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6482}
6483
6484impl LocalInventory {
6485    pub fn new() -> Self {
6486        std::default::Default::default()
6487    }
6488
6489    /// Sets the value of [place_id][crate::model::LocalInventory::place_id].
6490    ///
6491    /// # Example
6492    /// ```ignore,no_run
6493    /// # use google_cloud_retail_v2::model::LocalInventory;
6494    /// let x = LocalInventory::new().set_place_id("example");
6495    /// ```
6496    pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6497        self.place_id = v.into();
6498        self
6499    }
6500
6501    /// Sets the value of [price_info][crate::model::LocalInventory::price_info].
6502    ///
6503    /// # Example
6504    /// ```ignore,no_run
6505    /// # use google_cloud_retail_v2::model::LocalInventory;
6506    /// use google_cloud_retail_v2::model::PriceInfo;
6507    /// let x = LocalInventory::new().set_price_info(PriceInfo::default()/* use setters */);
6508    /// ```
6509    pub fn set_price_info<T>(mut self, v: T) -> Self
6510    where
6511        T: std::convert::Into<crate::model::PriceInfo>,
6512    {
6513        self.price_info = std::option::Option::Some(v.into());
6514        self
6515    }
6516
6517    /// Sets or clears the value of [price_info][crate::model::LocalInventory::price_info].
6518    ///
6519    /// # Example
6520    /// ```ignore,no_run
6521    /// # use google_cloud_retail_v2::model::LocalInventory;
6522    /// use google_cloud_retail_v2::model::PriceInfo;
6523    /// let x = LocalInventory::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
6524    /// let x = LocalInventory::new().set_or_clear_price_info(None::<PriceInfo>);
6525    /// ```
6526    pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
6527    where
6528        T: std::convert::Into<crate::model::PriceInfo>,
6529    {
6530        self.price_info = v.map(|x| x.into());
6531        self
6532    }
6533
6534    /// Sets the value of [attributes][crate::model::LocalInventory::attributes].
6535    ///
6536    /// # Example
6537    /// ```ignore,no_run
6538    /// # use google_cloud_retail_v2::model::LocalInventory;
6539    /// use google_cloud_retail_v2::model::CustomAttribute;
6540    /// let x = LocalInventory::new().set_attributes([
6541    ///     ("key0", CustomAttribute::default()/* use setters */),
6542    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
6543    /// ]);
6544    /// ```
6545    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6546    where
6547        T: std::iter::IntoIterator<Item = (K, V)>,
6548        K: std::convert::Into<std::string::String>,
6549        V: std::convert::Into<crate::model::CustomAttribute>,
6550    {
6551        use std::iter::Iterator;
6552        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6553        self
6554    }
6555
6556    /// Sets the value of [fulfillment_types][crate::model::LocalInventory::fulfillment_types].
6557    ///
6558    /// # Example
6559    /// ```ignore,no_run
6560    /// # use google_cloud_retail_v2::model::LocalInventory;
6561    /// let x = LocalInventory::new().set_fulfillment_types(["a", "b", "c"]);
6562    /// ```
6563    pub fn set_fulfillment_types<T, V>(mut self, v: T) -> Self
6564    where
6565        T: std::iter::IntoIterator<Item = V>,
6566        V: std::convert::Into<std::string::String>,
6567    {
6568        use std::iter::Iterator;
6569        self.fulfillment_types = v.into_iter().map(|i| i.into()).collect();
6570        self
6571    }
6572}
6573
6574impl wkt::message::Message for LocalInventory {
6575    fn typename() -> &'static str {
6576        "type.googleapis.com/google.cloud.retail.v2.LocalInventory"
6577    }
6578}
6579
6580/// Metadata for pinning to be returned in the response.
6581/// This is used for distinguishing between applied vs dropped pins.
6582#[derive(Clone, Default, PartialEq)]
6583#[non_exhaustive]
6584pub struct PinControlMetadata {
6585    /// Map of all matched pins, keyed by pin position.
6586    pub all_matched_pins:
6587        std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6588
6589    /// Map of pins that were dropped due to overlap with other matching pins,
6590    /// keyed by pin position.
6591    pub dropped_pins:
6592        std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6593
6594    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6595}
6596
6597impl PinControlMetadata {
6598    pub fn new() -> Self {
6599        std::default::Default::default()
6600    }
6601
6602    /// Sets the value of [all_matched_pins][crate::model::PinControlMetadata::all_matched_pins].
6603    ///
6604    /// # Example
6605    /// ```ignore,no_run
6606    /// # use google_cloud_retail_v2::model::PinControlMetadata;
6607    /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6608    /// let x = PinControlMetadata::new().set_all_matched_pins([
6609    ///     (0, ProductPins::default()/* use setters */),
6610    ///     (1, ProductPins::default()/* use (different) setters */),
6611    /// ]);
6612    /// ```
6613    pub fn set_all_matched_pins<T, K, V>(mut self, v: T) -> Self
6614    where
6615        T: std::iter::IntoIterator<Item = (K, V)>,
6616        K: std::convert::Into<i64>,
6617        V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6618    {
6619        use std::iter::Iterator;
6620        self.all_matched_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6621        self
6622    }
6623
6624    /// Sets the value of [dropped_pins][crate::model::PinControlMetadata::dropped_pins].
6625    ///
6626    /// # Example
6627    /// ```ignore,no_run
6628    /// # use google_cloud_retail_v2::model::PinControlMetadata;
6629    /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6630    /// let x = PinControlMetadata::new().set_dropped_pins([
6631    ///     (0, ProductPins::default()/* use setters */),
6632    ///     (1, ProductPins::default()/* use (different) setters */),
6633    /// ]);
6634    /// ```
6635    pub fn set_dropped_pins<T, K, V>(mut self, v: T) -> Self
6636    where
6637        T: std::iter::IntoIterator<Item = (K, V)>,
6638        K: std::convert::Into<i64>,
6639        V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6640    {
6641        use std::iter::Iterator;
6642        self.dropped_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6643        self
6644    }
6645}
6646
6647impl wkt::message::Message for PinControlMetadata {
6648    fn typename() -> &'static str {
6649        "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata"
6650    }
6651}
6652
6653/// Defines additional types related to [PinControlMetadata].
6654pub mod pin_control_metadata {
6655    #[allow(unused_imports)]
6656    use super::*;
6657
6658    /// List of product ids which have associated pins.
6659    #[derive(Clone, Default, PartialEq)]
6660    #[non_exhaustive]
6661    pub struct ProductPins {
6662        /// List of product ids which have associated pins.
6663        pub product_id: std::vec::Vec<std::string::String>,
6664
6665        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6666    }
6667
6668    impl ProductPins {
6669        pub fn new() -> Self {
6670            std::default::Default::default()
6671        }
6672
6673        /// Sets the value of [product_id][crate::model::pin_control_metadata::ProductPins::product_id].
6674        ///
6675        /// # Example
6676        /// ```ignore,no_run
6677        /// # use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6678        /// let x = ProductPins::new().set_product_id(["a", "b", "c"]);
6679        /// ```
6680        pub fn set_product_id<T, V>(mut self, v: T) -> Self
6681        where
6682            T: std::iter::IntoIterator<Item = V>,
6683            V: std::convert::Into<std::string::String>,
6684        {
6685            use std::iter::Iterator;
6686            self.product_id = v.into_iter().map(|i| i.into()).collect();
6687            self
6688        }
6689    }
6690
6691    impl wkt::message::Message for ProductPins {
6692        fn typename() -> &'static str {
6693            "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata.ProductPins"
6694        }
6695    }
6696}
6697
6698/// A list of string values.
6699#[derive(Clone, Default, PartialEq)]
6700#[non_exhaustive]
6701pub struct StringList {
6702    /// String values.
6703    pub values: std::vec::Vec<std::string::String>,
6704
6705    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6706}
6707
6708impl StringList {
6709    pub fn new() -> Self {
6710        std::default::Default::default()
6711    }
6712
6713    /// Sets the value of [values][crate::model::StringList::values].
6714    ///
6715    /// # Example
6716    /// ```ignore,no_run
6717    /// # use google_cloud_retail_v2::model::StringList;
6718    /// let x = StringList::new().set_values(["a", "b", "c"]);
6719    /// ```
6720    pub fn set_values<T, V>(mut self, v: T) -> Self
6721    where
6722        T: std::iter::IntoIterator<Item = V>,
6723        V: std::convert::Into<std::string::String>,
6724    {
6725        use std::iter::Iterator;
6726        self.values = v.into_iter().map(|i| i.into()).collect();
6727        self
6728    }
6729}
6730
6731impl wkt::message::Message for StringList {
6732    fn typename() -> &'static str {
6733        "type.googleapis.com/google.cloud.retail.v2.StringList"
6734    }
6735}
6736
6737/// A message with a list of double values.
6738#[derive(Clone, Default, PartialEq)]
6739#[non_exhaustive]
6740pub struct DoubleList {
6741    /// The list of double values.
6742    pub values: std::vec::Vec<f64>,
6743
6744    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6745}
6746
6747impl DoubleList {
6748    pub fn new() -> Self {
6749        std::default::Default::default()
6750    }
6751
6752    /// Sets the value of [values][crate::model::DoubleList::values].
6753    ///
6754    /// # Example
6755    /// ```ignore,no_run
6756    /// # use google_cloud_retail_v2::model::DoubleList;
6757    /// let x = DoubleList::new().set_values([1.0, 2.0, 3.0]);
6758    /// ```
6759    pub fn set_values<T, V>(mut self, v: T) -> Self
6760    where
6761        T: std::iter::IntoIterator<Item = V>,
6762        V: std::convert::Into<f64>,
6763    {
6764        use std::iter::Iterator;
6765        self.values = v.into_iter().map(|i| i.into()).collect();
6766        self
6767    }
6768}
6769
6770impl wkt::message::Message for DoubleList {
6771    fn typename() -> &'static str {
6772        "type.googleapis.com/google.cloud.retail.v2.DoubleList"
6773    }
6774}
6775
6776/// Autocomplete parameters.
6777#[derive(Clone, Default, PartialEq)]
6778#[non_exhaustive]
6779pub struct CompleteQueryRequest {
6780    /// Required. Catalog for which the completion is performed.
6781    ///
6782    /// Full resource name of catalog, such as
6783    /// `projects/*/locations/global/catalogs/default_catalog`.
6784    pub catalog: std::string::String,
6785
6786    /// Required. The query used to generate suggestions.
6787    ///
6788    /// The maximum number of allowed characters is 255.
6789    pub query: std::string::String,
6790
6791    /// Recommended field. A unique identifier for tracking visitors. For example,
6792    /// this could be implemented with an HTTP cookie, which should be able to
6793    /// uniquely identify a visitor on a single device. This unique identifier
6794    /// should not change if the visitor logs in or out of the website.
6795    ///
6796    /// The field must be a UTF-8 encoded string with a length limit of 128
6797    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6798    pub visitor_id: std::string::String,
6799
6800    /// Note that this field applies for `user-data` dataset only. For requests
6801    /// with `cloud-retail` dataset, setting this field has no effect.
6802    ///
6803    /// The language filters applied to the output suggestions. If set, it should
6804    /// contain the language of the query. If not set, suggestions are returned
6805    /// without considering language restrictions. This is the BCP-47 language
6806    /// code, such as "en-US" or "sr-Latn". For more information, see [Tags for
6807    /// Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum
6808    /// number of language codes is 3.
6809    pub language_codes: std::vec::Vec<std::string::String>,
6810
6811    /// The device type context for completion suggestions. We recommend that you
6812    /// leave this field empty.
6813    ///
6814    /// It can apply different suggestions on different device types, e.g.
6815    /// `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device
6816    /// types.
6817    ///
6818    /// Supported formats:
6819    ///
6820    /// * `UNKNOWN_DEVICE_TYPE`
6821    ///
6822    /// * `DESKTOP`
6823    ///
6824    /// * `MOBILE`
6825    ///
6826    /// * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`.
6827    ///
6828    pub device_type: std::string::String,
6829
6830    /// Determines which dataset to use for fetching completion. "user-data" will
6831    /// use the dataset imported through
6832    /// [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData].
6833    /// `cloud-retail` will use the dataset generated by Cloud Retail based on user
6834    /// events. If left empty, completions will be fetched from the `user-data`
6835    /// dataset.
6836    ///
6837    /// Current supported values:
6838    ///
6839    /// * user-data
6840    ///
6841    /// * cloud-retail:
6842    ///   This option requires enabling auto-learning function first. See
6843    ///   [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset).
6844    ///
6845    ///
6846    /// [google.cloud.retail.v2.CompletionService.ImportCompletionData]: crate::client::CompletionService::import_completion_data
6847    pub dataset: std::string::String,
6848
6849    /// Completion max suggestions. If left unset or set to 0, then will fallback
6850    /// to the configured value
6851    /// [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
6852    ///
6853    /// The maximum allowed max suggestions is 20. If it is set higher, it will be
6854    /// capped by 20.
6855    ///
6856    /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
6857    pub max_suggestions: i32,
6858
6859    /// If true, attribute suggestions are enabled and provided in the response.
6860    ///
6861    /// This field is only available for the `cloud-retail` dataset.
6862    pub enable_attribute_suggestions: bool,
6863
6864    /// The entity for customers who run multiple entities, domains, sites, or
6865    /// regions, for example, `Google US`, `Google Ads`, `Waymo`,
6866    /// `google.com`, `youtube.com`, etc.
6867    /// If this is set, it must be an exact match with
6868    /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get
6869    /// per-entity autocomplete results. This field will be applied to
6870    /// `completion_results` only. It has no effect on the `attribute_results`.
6871    /// Also, this entity should be limited to 256 characters, if too long, it will
6872    /// be truncated to 256 characters in both generation and serving time, and may
6873    /// lead to mis-match. To ensure it works, please set the entity with string
6874    /// within 256 characters.
6875    ///
6876    /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
6877    pub entity: std::string::String,
6878
6879    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6880}
6881
6882impl CompleteQueryRequest {
6883    pub fn new() -> Self {
6884        std::default::Default::default()
6885    }
6886
6887    /// Sets the value of [catalog][crate::model::CompleteQueryRequest::catalog].
6888    ///
6889    /// # Example
6890    /// ```ignore,no_run
6891    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6892    /// let x = CompleteQueryRequest::new().set_catalog("example");
6893    /// ```
6894    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6895        self.catalog = v.into();
6896        self
6897    }
6898
6899    /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
6900    ///
6901    /// # Example
6902    /// ```ignore,no_run
6903    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6904    /// let x = CompleteQueryRequest::new().set_query("example");
6905    /// ```
6906    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6907        self.query = v.into();
6908        self
6909    }
6910
6911    /// Sets the value of [visitor_id][crate::model::CompleteQueryRequest::visitor_id].
6912    ///
6913    /// # Example
6914    /// ```ignore,no_run
6915    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6916    /// let x = CompleteQueryRequest::new().set_visitor_id("example");
6917    /// ```
6918    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6919        self.visitor_id = v.into();
6920        self
6921    }
6922
6923    /// Sets the value of [language_codes][crate::model::CompleteQueryRequest::language_codes].
6924    ///
6925    /// # Example
6926    /// ```ignore,no_run
6927    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6928    /// let x = CompleteQueryRequest::new().set_language_codes(["a", "b", "c"]);
6929    /// ```
6930    pub fn set_language_codes<T, V>(mut self, v: T) -> Self
6931    where
6932        T: std::iter::IntoIterator<Item = V>,
6933        V: std::convert::Into<std::string::String>,
6934    {
6935        use std::iter::Iterator;
6936        self.language_codes = v.into_iter().map(|i| i.into()).collect();
6937        self
6938    }
6939
6940    /// Sets the value of [device_type][crate::model::CompleteQueryRequest::device_type].
6941    ///
6942    /// # Example
6943    /// ```ignore,no_run
6944    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6945    /// let x = CompleteQueryRequest::new().set_device_type("example");
6946    /// ```
6947    pub fn set_device_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6948        self.device_type = v.into();
6949        self
6950    }
6951
6952    /// Sets the value of [dataset][crate::model::CompleteQueryRequest::dataset].
6953    ///
6954    /// # Example
6955    /// ```ignore,no_run
6956    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6957    /// let x = CompleteQueryRequest::new().set_dataset("example");
6958    /// ```
6959    pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6960        self.dataset = v.into();
6961        self
6962    }
6963
6964    /// Sets the value of [max_suggestions][crate::model::CompleteQueryRequest::max_suggestions].
6965    ///
6966    /// # Example
6967    /// ```ignore,no_run
6968    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6969    /// let x = CompleteQueryRequest::new().set_max_suggestions(42);
6970    /// ```
6971    pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6972        self.max_suggestions = v.into();
6973        self
6974    }
6975
6976    /// Sets the value of [enable_attribute_suggestions][crate::model::CompleteQueryRequest::enable_attribute_suggestions].
6977    ///
6978    /// # Example
6979    /// ```ignore,no_run
6980    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6981    /// let x = CompleteQueryRequest::new().set_enable_attribute_suggestions(true);
6982    /// ```
6983    pub fn set_enable_attribute_suggestions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6984        self.enable_attribute_suggestions = v.into();
6985        self
6986    }
6987
6988    /// Sets the value of [entity][crate::model::CompleteQueryRequest::entity].
6989    ///
6990    /// # Example
6991    /// ```ignore,no_run
6992    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6993    /// let x = CompleteQueryRequest::new().set_entity("example");
6994    /// ```
6995    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6996        self.entity = v.into();
6997        self
6998    }
6999}
7000
7001impl wkt::message::Message for CompleteQueryRequest {
7002    fn typename() -> &'static str {
7003        "type.googleapis.com/google.cloud.retail.v2.CompleteQueryRequest"
7004    }
7005}
7006
7007/// Response of the autocomplete query.
7008#[derive(Clone, Default, PartialEq)]
7009#[non_exhaustive]
7010pub struct CompleteQueryResponse {
7011    /// Results of the matching suggestions. The result list is ordered and the
7012    /// first result is top suggestion.
7013    pub completion_results: std::vec::Vec<crate::model::complete_query_response::CompletionResult>,
7014
7015    /// A unique complete token. This should be included in the
7016    /// [UserEvent.completion_detail][google.cloud.retail.v2.UserEvent.completion_detail]
7017    /// for search events resulting from this completion, which enables accurate
7018    /// attribution of complete model performance.
7019    ///
7020    /// [google.cloud.retail.v2.UserEvent.completion_detail]: crate::model::UserEvent::completion_detail
7021    pub attribution_token: std::string::String,
7022
7023    /// Deprecated. Matched recent searches of this user. The maximum number of
7024    /// recent searches is 10. This field is a restricted feature. If you want to
7025    /// enable it, contact Retail Search support.
7026    ///
7027    /// This feature is only available when
7028    /// [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
7029    /// field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
7030    /// The recent searches satisfy the follow rules:
7031    ///
7032    /// * They are ordered from latest to oldest.
7033    ///
7034    /// * They are matched with
7035    ///   [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
7036    ///   case insensitively.
7037    ///
7038    /// * They are transformed to lower case.
7039    ///
7040    /// * They are UTF-8 safe.
7041    ///
7042    ///
7043    /// Recent searches are deduplicated. More recent searches will be reserved
7044    /// when duplication happens.
7045    ///
7046    /// [google.cloud.retail.v2.CompleteQueryRequest.query]: crate::model::CompleteQueryRequest::query
7047    /// [google.cloud.retail.v2.CompleteQueryRequest.visitor_id]: crate::model::CompleteQueryRequest::visitor_id
7048    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
7049    #[deprecated]
7050    pub recent_search_results:
7051        std::vec::Vec<crate::model::complete_query_response::RecentSearchResult>,
7052
7053    /// A map of matched attribute suggestions. This field is only available for
7054    /// `cloud-retail` dataset.
7055    ///
7056    /// Current supported keys:
7057    ///
7058    /// * `brands`
7059    ///
7060    /// * `categories`
7061    ///
7062    pub attribute_results: std::collections::HashMap<
7063        std::string::String,
7064        crate::model::complete_query_response::AttributeResult,
7065    >,
7066
7067    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7068}
7069
7070impl CompleteQueryResponse {
7071    pub fn new() -> Self {
7072        std::default::Default::default()
7073    }
7074
7075    /// Sets the value of [completion_results][crate::model::CompleteQueryResponse::completion_results].
7076    ///
7077    /// # Example
7078    /// ```ignore,no_run
7079    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7080    /// use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7081    /// let x = CompleteQueryResponse::new()
7082    ///     .set_completion_results([
7083    ///         CompletionResult::default()/* use setters */,
7084    ///         CompletionResult::default()/* use (different) setters */,
7085    ///     ]);
7086    /// ```
7087    pub fn set_completion_results<T, V>(mut self, v: T) -> Self
7088    where
7089        T: std::iter::IntoIterator<Item = V>,
7090        V: std::convert::Into<crate::model::complete_query_response::CompletionResult>,
7091    {
7092        use std::iter::Iterator;
7093        self.completion_results = v.into_iter().map(|i| i.into()).collect();
7094        self
7095    }
7096
7097    /// Sets the value of [attribution_token][crate::model::CompleteQueryResponse::attribution_token].
7098    ///
7099    /// # Example
7100    /// ```ignore,no_run
7101    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7102    /// let x = CompleteQueryResponse::new().set_attribution_token("example");
7103    /// ```
7104    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
7105        mut self,
7106        v: T,
7107    ) -> Self {
7108        self.attribution_token = v.into();
7109        self
7110    }
7111
7112    /// Sets the value of [recent_search_results][crate::model::CompleteQueryResponse::recent_search_results].
7113    ///
7114    /// # Example
7115    /// ```ignore,no_run
7116    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7117    /// use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7118    /// let x = CompleteQueryResponse::new()
7119    ///     .set_recent_search_results([
7120    ///         RecentSearchResult::default()/* use setters */,
7121    ///         RecentSearchResult::default()/* use (different) setters */,
7122    ///     ]);
7123    /// ```
7124    #[deprecated]
7125    pub fn set_recent_search_results<T, V>(mut self, v: T) -> Self
7126    where
7127        T: std::iter::IntoIterator<Item = V>,
7128        V: std::convert::Into<crate::model::complete_query_response::RecentSearchResult>,
7129    {
7130        use std::iter::Iterator;
7131        self.recent_search_results = v.into_iter().map(|i| i.into()).collect();
7132        self
7133    }
7134
7135    /// Sets the value of [attribute_results][crate::model::CompleteQueryResponse::attribute_results].
7136    ///
7137    /// # Example
7138    /// ```ignore,no_run
7139    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7140    /// use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7141    /// let x = CompleteQueryResponse::new().set_attribute_results([
7142    ///     ("key0", AttributeResult::default()/* use setters */),
7143    ///     ("key1", AttributeResult::default()/* use (different) setters */),
7144    /// ]);
7145    /// ```
7146    pub fn set_attribute_results<T, K, V>(mut self, v: T) -> Self
7147    where
7148        T: std::iter::IntoIterator<Item = (K, V)>,
7149        K: std::convert::Into<std::string::String>,
7150        V: std::convert::Into<crate::model::complete_query_response::AttributeResult>,
7151    {
7152        use std::iter::Iterator;
7153        self.attribute_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7154        self
7155    }
7156}
7157
7158impl wkt::message::Message for CompleteQueryResponse {
7159    fn typename() -> &'static str {
7160        "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse"
7161    }
7162}
7163
7164/// Defines additional types related to [CompleteQueryResponse].
7165pub mod complete_query_response {
7166    #[allow(unused_imports)]
7167    use super::*;
7168
7169    /// Resource that represents completion results.
7170    #[derive(Clone, Default, PartialEq)]
7171    #[non_exhaustive]
7172    pub struct CompletionResult {
7173        /// The suggestion for the query.
7174        pub suggestion: std::string::String,
7175
7176        /// Custom attributes for the suggestion term.
7177        ///
7178        /// * For `user-data`, the attributes are additional custom attributes
7179        ///   ingested through BigQuery.
7180        ///
7181        /// * For `cloud-retail`, the attributes are product attributes generated
7182        ///   by Cloud Retail. It requires
7183        ///   [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details]
7184        ///   is imported properly.
7185        ///
7186        ///
7187        /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
7188        pub attributes:
7189            std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
7190
7191        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7192    }
7193
7194    impl CompletionResult {
7195        pub fn new() -> Self {
7196            std::default::Default::default()
7197        }
7198
7199        /// Sets the value of [suggestion][crate::model::complete_query_response::CompletionResult::suggestion].
7200        ///
7201        /// # Example
7202        /// ```ignore,no_run
7203        /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7204        /// let x = CompletionResult::new().set_suggestion("example");
7205        /// ```
7206        pub fn set_suggestion<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7207            self.suggestion = v.into();
7208            self
7209        }
7210
7211        /// Sets the value of [attributes][crate::model::complete_query_response::CompletionResult::attributes].
7212        ///
7213        /// # Example
7214        /// ```ignore,no_run
7215        /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7216        /// use google_cloud_retail_v2::model::CustomAttribute;
7217        /// let x = CompletionResult::new().set_attributes([
7218        ///     ("key0", CustomAttribute::default()/* use setters */),
7219        ///     ("key1", CustomAttribute::default()/* use (different) setters */),
7220        /// ]);
7221        /// ```
7222        pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7223        where
7224            T: std::iter::IntoIterator<Item = (K, V)>,
7225            K: std::convert::Into<std::string::String>,
7226            V: std::convert::Into<crate::model::CustomAttribute>,
7227        {
7228            use std::iter::Iterator;
7229            self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7230            self
7231        }
7232    }
7233
7234    impl wkt::message::Message for CompletionResult {
7235        fn typename() -> &'static str {
7236            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
7237        }
7238    }
7239
7240    /// Deprecated: Recent search of this user.
7241    #[derive(Clone, Default, PartialEq)]
7242    #[non_exhaustive]
7243    #[deprecated]
7244    pub struct RecentSearchResult {
7245        /// The recent search query.
7246        pub recent_search: std::string::String,
7247
7248        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7249    }
7250
7251    impl RecentSearchResult {
7252        pub fn new() -> Self {
7253            std::default::Default::default()
7254        }
7255
7256        /// Sets the value of [recent_search][crate::model::complete_query_response::RecentSearchResult::recent_search].
7257        ///
7258        /// # Example
7259        /// ```ignore,no_run
7260        /// # use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7261        /// let x = RecentSearchResult::new().set_recent_search("example");
7262        /// ```
7263        pub fn set_recent_search<T: std::convert::Into<std::string::String>>(
7264            mut self,
7265            v: T,
7266        ) -> Self {
7267            self.recent_search = v.into();
7268            self
7269        }
7270    }
7271
7272    impl wkt::message::Message for RecentSearchResult {
7273        fn typename() -> &'static str {
7274            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
7275        }
7276    }
7277
7278    /// Resource that represents attribute results.
7279    #[derive(Clone, Default, PartialEq)]
7280    #[non_exhaustive]
7281    pub struct AttributeResult {
7282        /// The list of suggestions for the attribute.
7283        pub suggestions: std::vec::Vec<std::string::String>,
7284
7285        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7286    }
7287
7288    impl AttributeResult {
7289        pub fn new() -> Self {
7290            std::default::Default::default()
7291        }
7292
7293        /// Sets the value of [suggestions][crate::model::complete_query_response::AttributeResult::suggestions].
7294        ///
7295        /// # Example
7296        /// ```ignore,no_run
7297        /// # use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7298        /// let x = AttributeResult::new().set_suggestions(["a", "b", "c"]);
7299        /// ```
7300        pub fn set_suggestions<T, V>(mut self, v: T) -> Self
7301        where
7302            T: std::iter::IntoIterator<Item = V>,
7303            V: std::convert::Into<std::string::String>,
7304        {
7305            use std::iter::Iterator;
7306            self.suggestions = v.into_iter().map(|i| i.into()).collect();
7307            self
7308        }
7309    }
7310
7311    impl wkt::message::Message for AttributeResult {
7312        fn typename() -> &'static str {
7313            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.AttributeResult"
7314        }
7315    }
7316}
7317
7318/// Configures dynamic metadata that can be linked to a
7319/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
7320/// recommendation results at serving time.
7321///
7322/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7323#[derive(Clone, Default, PartialEq)]
7324#[non_exhaustive]
7325pub struct Control {
7326    /// Immutable. Fully qualified name
7327    /// `projects/*/locations/global/catalogs/*/controls/*`
7328    pub name: std::string::String,
7329
7330    /// Required. The human readable control display name. Used in Retail UI.
7331    ///
7332    /// This field must be a UTF-8 encoded string with a length limit of 128
7333    /// characters. Otherwise, an INVALID_ARGUMENT error is thrown.
7334    pub display_name: std::string::String,
7335
7336    /// Output only. List of [serving config][google.cloud.retail.v2.ServingConfig]
7337    /// ids that are associated with this control in the same
7338    /// [Catalog][google.cloud.retail.v2.Catalog].
7339    ///
7340    /// Note the association is managed via the
7341    /// [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
7342    /// only denormalized view.
7343    ///
7344    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
7345    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7346    pub associated_serving_config_ids: std::vec::Vec<std::string::String>,
7347
7348    /// Required. Immutable. The solution types that the control is used for.
7349    /// Currently we support setting only one type of solution at creation time.
7350    ///
7351    /// Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
7352    /// If no solution type is provided at creation time, will default to
7353    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
7354    ///
7355    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
7356    pub solution_types: std::vec::Vec<crate::model::SolutionType>,
7357
7358    /// Specifies the use case for the control.
7359    /// Affects what condition fields can be set.
7360    /// Only settable by search controls.
7361    /// Will default to
7362    /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
7363    /// if not specified. Currently only allow one search_solution_use_case per
7364    /// control.
7365    ///
7366    /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
7367    pub search_solution_use_case: std::vec::Vec<crate::model::SearchSolutionUseCase>,
7368
7369    /// The behavior/type of the control
7370    ///
7371    /// A behavior/type must be specified on creation. Type cannot be changed once
7372    /// specified (e.g. A Rule control will always be a Rule control.). An
7373    /// INVALID_ARGUMENT will be returned if either condition is violated.
7374    pub control: std::option::Option<crate::model::control::Control>,
7375
7376    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7377}
7378
7379impl Control {
7380    pub fn new() -> Self {
7381        std::default::Default::default()
7382    }
7383
7384    /// Sets the value of [name][crate::model::Control::name].
7385    ///
7386    /// # Example
7387    /// ```ignore,no_run
7388    /// # use google_cloud_retail_v2::model::Control;
7389    /// let x = Control::new().set_name("example");
7390    /// ```
7391    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7392        self.name = v.into();
7393        self
7394    }
7395
7396    /// Sets the value of [display_name][crate::model::Control::display_name].
7397    ///
7398    /// # Example
7399    /// ```ignore,no_run
7400    /// # use google_cloud_retail_v2::model::Control;
7401    /// let x = Control::new().set_display_name("example");
7402    /// ```
7403    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7404        self.display_name = v.into();
7405        self
7406    }
7407
7408    /// Sets the value of [associated_serving_config_ids][crate::model::Control::associated_serving_config_ids].
7409    ///
7410    /// # Example
7411    /// ```ignore,no_run
7412    /// # use google_cloud_retail_v2::model::Control;
7413    /// let x = Control::new().set_associated_serving_config_ids(["a", "b", "c"]);
7414    /// ```
7415    pub fn set_associated_serving_config_ids<T, V>(mut self, v: T) -> Self
7416    where
7417        T: std::iter::IntoIterator<Item = V>,
7418        V: std::convert::Into<std::string::String>,
7419    {
7420        use std::iter::Iterator;
7421        self.associated_serving_config_ids = v.into_iter().map(|i| i.into()).collect();
7422        self
7423    }
7424
7425    /// Sets the value of [solution_types][crate::model::Control::solution_types].
7426    ///
7427    /// # Example
7428    /// ```ignore,no_run
7429    /// # use google_cloud_retail_v2::model::Control;
7430    /// use google_cloud_retail_v2::model::SolutionType;
7431    /// let x = Control::new().set_solution_types([
7432    ///     SolutionType::Recommendation,
7433    ///     SolutionType::Search,
7434    /// ]);
7435    /// ```
7436    pub fn set_solution_types<T, V>(mut self, v: T) -> Self
7437    where
7438        T: std::iter::IntoIterator<Item = V>,
7439        V: std::convert::Into<crate::model::SolutionType>,
7440    {
7441        use std::iter::Iterator;
7442        self.solution_types = v.into_iter().map(|i| i.into()).collect();
7443        self
7444    }
7445
7446    /// Sets the value of [search_solution_use_case][crate::model::Control::search_solution_use_case].
7447    ///
7448    /// # Example
7449    /// ```ignore,no_run
7450    /// # use google_cloud_retail_v2::model::Control;
7451    /// use google_cloud_retail_v2::model::SearchSolutionUseCase;
7452    /// let x = Control::new().set_search_solution_use_case([
7453    ///     SearchSolutionUseCase::Search,
7454    ///     SearchSolutionUseCase::Browse,
7455    /// ]);
7456    /// ```
7457    pub fn set_search_solution_use_case<T, V>(mut self, v: T) -> Self
7458    where
7459        T: std::iter::IntoIterator<Item = V>,
7460        V: std::convert::Into<crate::model::SearchSolutionUseCase>,
7461    {
7462        use std::iter::Iterator;
7463        self.search_solution_use_case = v.into_iter().map(|i| i.into()).collect();
7464        self
7465    }
7466
7467    /// Sets the value of [control][crate::model::Control::control].
7468    ///
7469    /// Note that all the setters affecting `control` are mutually
7470    /// exclusive.
7471    ///
7472    /// # Example
7473    /// ```ignore,no_run
7474    /// # use google_cloud_retail_v2::model::Control;
7475    /// use google_cloud_retail_v2::model::Rule;
7476    /// let x = Control::new().set_control(Some(
7477    ///     google_cloud_retail_v2::model::control::Control::Rule(Rule::default().into())));
7478    /// ```
7479    pub fn set_control<
7480        T: std::convert::Into<std::option::Option<crate::model::control::Control>>,
7481    >(
7482        mut self,
7483        v: T,
7484    ) -> Self {
7485        self.control = v.into();
7486        self
7487    }
7488
7489    /// The value of [control][crate::model::Control::control]
7490    /// if it holds a `Rule`, `None` if the field is not set or
7491    /// holds a different branch.
7492    pub fn rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::Rule>> {
7493        #[allow(unreachable_patterns)]
7494        self.control.as_ref().and_then(|v| match v {
7495            crate::model::control::Control::Rule(v) => std::option::Option::Some(v),
7496            _ => std::option::Option::None,
7497        })
7498    }
7499
7500    /// Sets the value of [control][crate::model::Control::control]
7501    /// to hold a `Rule`.
7502    ///
7503    /// Note that all the setters affecting `control` are
7504    /// mutually exclusive.
7505    ///
7506    /// # Example
7507    /// ```ignore,no_run
7508    /// # use google_cloud_retail_v2::model::Control;
7509    /// use google_cloud_retail_v2::model::Rule;
7510    /// let x = Control::new().set_rule(Rule::default()/* use setters */);
7511    /// assert!(x.rule().is_some());
7512    /// ```
7513    pub fn set_rule<T: std::convert::Into<std::boxed::Box<crate::model::Rule>>>(
7514        mut self,
7515        v: T,
7516    ) -> Self {
7517        self.control = std::option::Option::Some(crate::model::control::Control::Rule(v.into()));
7518        self
7519    }
7520}
7521
7522impl wkt::message::Message for Control {
7523    fn typename() -> &'static str {
7524        "type.googleapis.com/google.cloud.retail.v2.Control"
7525    }
7526}
7527
7528/// Defines additional types related to [Control].
7529pub mod control {
7530    #[allow(unused_imports)]
7531    use super::*;
7532
7533    /// The behavior/type of the control
7534    ///
7535    /// A behavior/type must be specified on creation. Type cannot be changed once
7536    /// specified (e.g. A Rule control will always be a Rule control.). An
7537    /// INVALID_ARGUMENT will be returned if either condition is violated.
7538    #[derive(Clone, Debug, PartialEq)]
7539    #[non_exhaustive]
7540    pub enum Control {
7541        /// A rule control - a condition-action pair.
7542        /// Enacts a set action when the condition is triggered.
7543        /// For example: Boost "gShoe" when query full matches "Running Shoes".
7544        Rule(std::boxed::Box<crate::model::Rule>),
7545    }
7546}
7547
7548/// Request for CreateControl method.
7549#[derive(Clone, Default, PartialEq)]
7550#[non_exhaustive]
7551pub struct CreateControlRequest {
7552    /// Required. Full resource name of parent catalog. Format:
7553    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7554    pub parent: std::string::String,
7555
7556    /// Required. The Control to create.
7557    pub control: std::option::Option<crate::model::Control>,
7558
7559    /// Required. The ID to use for the Control, which will become the final
7560    /// component of the Control's resource name.
7561    ///
7562    /// This value should be 4-63 characters, and valid characters
7563    /// are /[a-z][0-9]-_/.
7564    pub control_id: std::string::String,
7565
7566    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7567}
7568
7569impl CreateControlRequest {
7570    pub fn new() -> Self {
7571        std::default::Default::default()
7572    }
7573
7574    /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
7575    ///
7576    /// # Example
7577    /// ```ignore,no_run
7578    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7579    /// let x = CreateControlRequest::new().set_parent("example");
7580    /// ```
7581    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7582        self.parent = v.into();
7583        self
7584    }
7585
7586    /// Sets the value of [control][crate::model::CreateControlRequest::control].
7587    ///
7588    /// # Example
7589    /// ```ignore,no_run
7590    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7591    /// use google_cloud_retail_v2::model::Control;
7592    /// let x = CreateControlRequest::new().set_control(Control::default()/* use setters */);
7593    /// ```
7594    pub fn set_control<T>(mut self, v: T) -> Self
7595    where
7596        T: std::convert::Into<crate::model::Control>,
7597    {
7598        self.control = std::option::Option::Some(v.into());
7599        self
7600    }
7601
7602    /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
7603    ///
7604    /// # Example
7605    /// ```ignore,no_run
7606    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7607    /// use google_cloud_retail_v2::model::Control;
7608    /// let x = CreateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7609    /// let x = CreateControlRequest::new().set_or_clear_control(None::<Control>);
7610    /// ```
7611    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7612    where
7613        T: std::convert::Into<crate::model::Control>,
7614    {
7615        self.control = v.map(|x| x.into());
7616        self
7617    }
7618
7619    /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
7620    ///
7621    /// # Example
7622    /// ```ignore,no_run
7623    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7624    /// let x = CreateControlRequest::new().set_control_id("example");
7625    /// ```
7626    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7627        self.control_id = v.into();
7628        self
7629    }
7630}
7631
7632impl wkt::message::Message for CreateControlRequest {
7633    fn typename() -> &'static str {
7634        "type.googleapis.com/google.cloud.retail.v2.CreateControlRequest"
7635    }
7636}
7637
7638/// Request for UpdateControl method.
7639#[derive(Clone, Default, PartialEq)]
7640#[non_exhaustive]
7641pub struct UpdateControlRequest {
7642    /// Required. The Control to update.
7643    pub control: std::option::Option<crate::model::Control>,
7644
7645    /// Indicates which fields in the provided
7646    /// [Control][google.cloud.retail.v2.Control] to update. The following are NOT
7647    /// supported:
7648    ///
7649    /// * [Control.name][google.cloud.retail.v2.Control.name]
7650    ///
7651    /// If not set or empty, all supported fields are updated.
7652    ///
7653    /// [google.cloud.retail.v2.Control]: crate::model::Control
7654    /// [google.cloud.retail.v2.Control.name]: crate::model::Control::name
7655    pub update_mask: std::option::Option<wkt::FieldMask>,
7656
7657    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7658}
7659
7660impl UpdateControlRequest {
7661    pub fn new() -> Self {
7662        std::default::Default::default()
7663    }
7664
7665    /// Sets the value of [control][crate::model::UpdateControlRequest::control].
7666    ///
7667    /// # Example
7668    /// ```ignore,no_run
7669    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7670    /// use google_cloud_retail_v2::model::Control;
7671    /// let x = UpdateControlRequest::new().set_control(Control::default()/* use setters */);
7672    /// ```
7673    pub fn set_control<T>(mut self, v: T) -> Self
7674    where
7675        T: std::convert::Into<crate::model::Control>,
7676    {
7677        self.control = std::option::Option::Some(v.into());
7678        self
7679    }
7680
7681    /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
7682    ///
7683    /// # Example
7684    /// ```ignore,no_run
7685    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7686    /// use google_cloud_retail_v2::model::Control;
7687    /// let x = UpdateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7688    /// let x = UpdateControlRequest::new().set_or_clear_control(None::<Control>);
7689    /// ```
7690    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7691    where
7692        T: std::convert::Into<crate::model::Control>,
7693    {
7694        self.control = v.map(|x| x.into());
7695        self
7696    }
7697
7698    /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7699    ///
7700    /// # Example
7701    /// ```ignore,no_run
7702    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7703    /// use wkt::FieldMask;
7704    /// let x = UpdateControlRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7705    /// ```
7706    pub fn set_update_mask<T>(mut self, v: T) -> Self
7707    where
7708        T: std::convert::Into<wkt::FieldMask>,
7709    {
7710        self.update_mask = std::option::Option::Some(v.into());
7711        self
7712    }
7713
7714    /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7715    ///
7716    /// # Example
7717    /// ```ignore,no_run
7718    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7719    /// use wkt::FieldMask;
7720    /// let x = UpdateControlRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7721    /// let x = UpdateControlRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7722    /// ```
7723    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7724    where
7725        T: std::convert::Into<wkt::FieldMask>,
7726    {
7727        self.update_mask = v.map(|x| x.into());
7728        self
7729    }
7730}
7731
7732impl wkt::message::Message for UpdateControlRequest {
7733    fn typename() -> &'static str {
7734        "type.googleapis.com/google.cloud.retail.v2.UpdateControlRequest"
7735    }
7736}
7737
7738/// Request for DeleteControl method.
7739#[derive(Clone, Default, PartialEq)]
7740#[non_exhaustive]
7741pub struct DeleteControlRequest {
7742    /// Required. The resource name of the Control to delete. Format:
7743    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7744    pub name: std::string::String,
7745
7746    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7747}
7748
7749impl DeleteControlRequest {
7750    pub fn new() -> Self {
7751        std::default::Default::default()
7752    }
7753
7754    /// Sets the value of [name][crate::model::DeleteControlRequest::name].
7755    ///
7756    /// # Example
7757    /// ```ignore,no_run
7758    /// # use google_cloud_retail_v2::model::DeleteControlRequest;
7759    /// let x = DeleteControlRequest::new().set_name("example");
7760    /// ```
7761    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7762        self.name = v.into();
7763        self
7764    }
7765}
7766
7767impl wkt::message::Message for DeleteControlRequest {
7768    fn typename() -> &'static str {
7769        "type.googleapis.com/google.cloud.retail.v2.DeleteControlRequest"
7770    }
7771}
7772
7773/// Request for GetControl method.
7774#[derive(Clone, Default, PartialEq)]
7775#[non_exhaustive]
7776pub struct GetControlRequest {
7777    /// Required. The resource name of the Control to get. Format:
7778    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7779    pub name: std::string::String,
7780
7781    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7782}
7783
7784impl GetControlRequest {
7785    pub fn new() -> Self {
7786        std::default::Default::default()
7787    }
7788
7789    /// Sets the value of [name][crate::model::GetControlRequest::name].
7790    ///
7791    /// # Example
7792    /// ```ignore,no_run
7793    /// # use google_cloud_retail_v2::model::GetControlRequest;
7794    /// let x = GetControlRequest::new().set_name("example");
7795    /// ```
7796    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7797        self.name = v.into();
7798        self
7799    }
7800}
7801
7802impl wkt::message::Message for GetControlRequest {
7803    fn typename() -> &'static str {
7804        "type.googleapis.com/google.cloud.retail.v2.GetControlRequest"
7805    }
7806}
7807
7808/// Request for ListControls method.
7809#[derive(Clone, Default, PartialEq)]
7810#[non_exhaustive]
7811pub struct ListControlsRequest {
7812    /// Required. The catalog resource name. Format:
7813    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7814    pub parent: std::string::String,
7815
7816    /// Optional. Maximum number of results to return. If unspecified, defaults
7817    /// to 50. Max allowed value is 1000.
7818    pub page_size: i32,
7819
7820    /// Optional. A page token, received from a previous `ListControls` call.
7821    /// Provide this to retrieve the subsequent page.
7822    pub page_token: std::string::String,
7823
7824    /// Optional. A filter to apply on the list results. Supported features:
7825    ///
7826    /// * List all the products under the parent branch if
7827    ///   [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
7828    /// * List controls that are used in a single ServingConfig:
7829    ///   'serving_config = "boosted_home_page_cvr"'
7830    ///
7831    /// [google.cloud.retail.v2.ListControlsRequest.filter]: crate::model::ListControlsRequest::filter
7832    pub filter: std::string::String,
7833
7834    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7835}
7836
7837impl ListControlsRequest {
7838    pub fn new() -> Self {
7839        std::default::Default::default()
7840    }
7841
7842    /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
7843    ///
7844    /// # Example
7845    /// ```ignore,no_run
7846    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7847    /// let x = ListControlsRequest::new().set_parent("example");
7848    /// ```
7849    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7850        self.parent = v.into();
7851        self
7852    }
7853
7854    /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
7855    ///
7856    /// # Example
7857    /// ```ignore,no_run
7858    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7859    /// let x = ListControlsRequest::new().set_page_size(42);
7860    /// ```
7861    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7862        self.page_size = v.into();
7863        self
7864    }
7865
7866    /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
7867    ///
7868    /// # Example
7869    /// ```ignore,no_run
7870    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7871    /// let x = ListControlsRequest::new().set_page_token("example");
7872    /// ```
7873    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7874        self.page_token = v.into();
7875        self
7876    }
7877
7878    /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
7879    ///
7880    /// # Example
7881    /// ```ignore,no_run
7882    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7883    /// let x = ListControlsRequest::new().set_filter("example");
7884    /// ```
7885    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7886        self.filter = v.into();
7887        self
7888    }
7889}
7890
7891impl wkt::message::Message for ListControlsRequest {
7892    fn typename() -> &'static str {
7893        "type.googleapis.com/google.cloud.retail.v2.ListControlsRequest"
7894    }
7895}
7896
7897/// Response for ListControls method.
7898#[derive(Clone, Default, PartialEq)]
7899#[non_exhaustive]
7900pub struct ListControlsResponse {
7901    /// All the Controls for a given catalog.
7902    pub controls: std::vec::Vec<crate::model::Control>,
7903
7904    /// Pagination token, if not returned indicates the last page.
7905    pub next_page_token: std::string::String,
7906
7907    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7908}
7909
7910impl ListControlsResponse {
7911    pub fn new() -> Self {
7912        std::default::Default::default()
7913    }
7914
7915    /// Sets the value of [controls][crate::model::ListControlsResponse::controls].
7916    ///
7917    /// # Example
7918    /// ```ignore,no_run
7919    /// # use google_cloud_retail_v2::model::ListControlsResponse;
7920    /// use google_cloud_retail_v2::model::Control;
7921    /// let x = ListControlsResponse::new()
7922    ///     .set_controls([
7923    ///         Control::default()/* use setters */,
7924    ///         Control::default()/* use (different) setters */,
7925    ///     ]);
7926    /// ```
7927    pub fn set_controls<T, V>(mut self, v: T) -> Self
7928    where
7929        T: std::iter::IntoIterator<Item = V>,
7930        V: std::convert::Into<crate::model::Control>,
7931    {
7932        use std::iter::Iterator;
7933        self.controls = v.into_iter().map(|i| i.into()).collect();
7934        self
7935    }
7936
7937    /// Sets the value of [next_page_token][crate::model::ListControlsResponse::next_page_token].
7938    ///
7939    /// # Example
7940    /// ```ignore,no_run
7941    /// # use google_cloud_retail_v2::model::ListControlsResponse;
7942    /// let x = ListControlsResponse::new().set_next_page_token("example");
7943    /// ```
7944    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7945        self.next_page_token = v.into();
7946        self
7947    }
7948}
7949
7950impl wkt::message::Message for ListControlsResponse {
7951    fn typename() -> &'static str {
7952        "type.googleapis.com/google.cloud.retail.v2.ListControlsResponse"
7953    }
7954}
7955
7956#[doc(hidden)]
7957impl google_cloud_gax::paginator::internal::PageableResponse for ListControlsResponse {
7958    type PageItem = crate::model::Control;
7959
7960    fn items(self) -> std::vec::Vec<Self::PageItem> {
7961        self.controls
7962    }
7963
7964    fn next_page_token(&self) -> std::string::String {
7965        use std::clone::Clone;
7966        self.next_page_token.clone()
7967    }
7968}
7969
7970/// Request message for
7971/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
7972/// method.
7973#[derive(Clone, Default, PartialEq)]
7974#[non_exhaustive]
7975pub struct ConversationalSearchRequest {
7976    /// Required. The resource name of the search engine placement, such as
7977    /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`
7978    /// or
7979    /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
7980    /// This field is used to identify the serving config name and the set
7981    /// of models that will be used to make the search.
7982    pub placement: std::string::String,
7983
7984    /// Required. The branch resource name, such as
7985    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
7986    ///
7987    /// Use "default_branch" as the branch ID or leave this field empty, to search
7988    /// products under the default branch.
7989    pub branch: std::string::String,
7990
7991    /// Optional. Raw search query to be searched for.
7992    ///
7993    /// If this field is empty, the request is considered a category browsing
7994    /// request.
7995    pub query: std::string::String,
7996
7997    /// Optional. The categories associated with a category page. Must be set for
7998    /// category navigation queries to achieve good search quality. The format
7999    /// should be the same as
8000    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
8001    ///
8002    /// To represent full path of category, use '>' sign to separate different
8003    /// hierarchies. If '>' is part of the category name, replace it with
8004    /// other character(s).
8005    ///
8006    /// Category pages include special pages such as sales or promotions. For
8007    /// instance, a special sale page may have the category hierarchy:
8008    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
8009    ///
8010    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
8011    pub page_categories: std::vec::Vec<std::string::String>,
8012
8013    /// Optional. This field specifies the conversation id, which maintains the
8014    /// state of the conversation between client side and server side. Use the
8015    /// value from the previous
8016    /// [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2.ConversationalSearchResponse.conversation_id].
8017    /// For the initial request, this should be empty.
8018    ///
8019    /// [google.cloud.retail.v2.ConversationalSearchResponse.conversation_id]: crate::model::ConversationalSearchResponse::conversation_id
8020    pub conversation_id: std::string::String,
8021
8022    /// Optional. Search parameters.
8023    pub search_params:
8024        std::option::Option<crate::model::conversational_search_request::SearchParams>,
8025
8026    /// Required. A unique identifier for tracking visitors. For example, this
8027    /// could be implemented with an HTTP cookie, which should be able to uniquely
8028    /// identify a visitor on a single device. This unique identifier should not
8029    /// change if the visitor logs in or out of the website.
8030    ///
8031    /// This should be the same identifier as
8032    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
8033    ///
8034    /// The field must be a UTF-8 encoded string with a length limit of 128
8035    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
8036    ///
8037    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
8038    pub visitor_id: std::string::String,
8039
8040    /// Optional. User information.
8041    pub user_info: std::option::Option<crate::model::UserInfo>,
8042
8043    /// Optional. This field specifies all conversational filtering related
8044    /// parameters.
8045    pub conversational_filtering_spec: std::option::Option<
8046        crate::model::conversational_search_request::ConversationalFilteringSpec,
8047    >,
8048
8049    /// Optional. The user labels applied to a resource must meet the following
8050    /// requirements:
8051    ///
8052    /// * Each resource can have multiple labels, up to a maximum of 64.
8053    /// * Each label must be a key-value pair.
8054    /// * Keys have a minimum length of 1 character and a maximum length of 63
8055    ///   characters and cannot be empty. Values can be empty and have a maximum
8056    ///   length of 63 characters.
8057    /// * Keys and values can contain only lowercase letters, numeric characters,
8058    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
8059    ///   international characters are allowed.
8060    /// * The key portion of a label must be unique. However, you can use the same
8061    ///   key with multiple resources.
8062    /// * Keys must start with a lowercase letter or international character.
8063    ///
8064    /// See [Google Cloud
8065    /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
8066    /// for more details.
8067    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8068
8069    /// Optional. The safety settings to be applied to the generated content.
8070    pub safety_settings: std::vec::Vec<crate::model::SafetySetting>,
8071
8072    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8073}
8074
8075impl ConversationalSearchRequest {
8076    pub fn new() -> Self {
8077        std::default::Default::default()
8078    }
8079
8080    /// Sets the value of [placement][crate::model::ConversationalSearchRequest::placement].
8081    ///
8082    /// # Example
8083    /// ```ignore,no_run
8084    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8085    /// let x = ConversationalSearchRequest::new().set_placement("example");
8086    /// ```
8087    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8088        self.placement = v.into();
8089        self
8090    }
8091
8092    /// Sets the value of [branch][crate::model::ConversationalSearchRequest::branch].
8093    ///
8094    /// # Example
8095    /// ```ignore,no_run
8096    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8097    /// let x = ConversationalSearchRequest::new().set_branch("example");
8098    /// ```
8099    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8100        self.branch = v.into();
8101        self
8102    }
8103
8104    /// Sets the value of [query][crate::model::ConversationalSearchRequest::query].
8105    ///
8106    /// # Example
8107    /// ```ignore,no_run
8108    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8109    /// let x = ConversationalSearchRequest::new().set_query("example");
8110    /// ```
8111    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8112        self.query = v.into();
8113        self
8114    }
8115
8116    /// Sets the value of [page_categories][crate::model::ConversationalSearchRequest::page_categories].
8117    ///
8118    /// # Example
8119    /// ```ignore,no_run
8120    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8121    /// let x = ConversationalSearchRequest::new().set_page_categories(["a", "b", "c"]);
8122    /// ```
8123    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
8124    where
8125        T: std::iter::IntoIterator<Item = V>,
8126        V: std::convert::Into<std::string::String>,
8127    {
8128        use std::iter::Iterator;
8129        self.page_categories = v.into_iter().map(|i| i.into()).collect();
8130        self
8131    }
8132
8133    /// Sets the value of [conversation_id][crate::model::ConversationalSearchRequest::conversation_id].
8134    ///
8135    /// # Example
8136    /// ```ignore,no_run
8137    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8138    /// let x = ConversationalSearchRequest::new().set_conversation_id("example");
8139    /// ```
8140    pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8141        self.conversation_id = v.into();
8142        self
8143    }
8144
8145    /// Sets the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8146    ///
8147    /// # Example
8148    /// ```ignore,no_run
8149    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8150    /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8151    /// let x = ConversationalSearchRequest::new().set_search_params(SearchParams::default()/* use setters */);
8152    /// ```
8153    pub fn set_search_params<T>(mut self, v: T) -> Self
8154    where
8155        T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8156    {
8157        self.search_params = std::option::Option::Some(v.into());
8158        self
8159    }
8160
8161    /// Sets or clears the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8162    ///
8163    /// # Example
8164    /// ```ignore,no_run
8165    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8166    /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8167    /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(Some(SearchParams::default()/* use setters */));
8168    /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(None::<SearchParams>);
8169    /// ```
8170    pub fn set_or_clear_search_params<T>(mut self, v: std::option::Option<T>) -> Self
8171    where
8172        T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8173    {
8174        self.search_params = v.map(|x| x.into());
8175        self
8176    }
8177
8178    /// Sets the value of [visitor_id][crate::model::ConversationalSearchRequest::visitor_id].
8179    ///
8180    /// # Example
8181    /// ```ignore,no_run
8182    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8183    /// let x = ConversationalSearchRequest::new().set_visitor_id("example");
8184    /// ```
8185    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8186        self.visitor_id = v.into();
8187        self
8188    }
8189
8190    /// Sets the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8191    ///
8192    /// # Example
8193    /// ```ignore,no_run
8194    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8195    /// use google_cloud_retail_v2::model::UserInfo;
8196    /// let x = ConversationalSearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
8197    /// ```
8198    pub fn set_user_info<T>(mut self, v: T) -> Self
8199    where
8200        T: std::convert::Into<crate::model::UserInfo>,
8201    {
8202        self.user_info = std::option::Option::Some(v.into());
8203        self
8204    }
8205
8206    /// Sets or clears the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8207    ///
8208    /// # Example
8209    /// ```ignore,no_run
8210    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8211    /// use google_cloud_retail_v2::model::UserInfo;
8212    /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
8213    /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
8214    /// ```
8215    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
8216    where
8217        T: std::convert::Into<crate::model::UserInfo>,
8218    {
8219        self.user_info = v.map(|x| x.into());
8220        self
8221    }
8222
8223    /// Sets the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8224    ///
8225    /// # Example
8226    /// ```ignore,no_run
8227    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8228    /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8229    /// let x = ConversationalSearchRequest::new().set_conversational_filtering_spec(ConversationalFilteringSpec::default()/* use setters */);
8230    /// ```
8231    pub fn set_conversational_filtering_spec<T>(mut self, v: T) -> Self
8232    where
8233        T: std::convert::Into<
8234                crate::model::conversational_search_request::ConversationalFilteringSpec,
8235            >,
8236    {
8237        self.conversational_filtering_spec = std::option::Option::Some(v.into());
8238        self
8239    }
8240
8241    /// Sets or clears the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8242    ///
8243    /// # Example
8244    /// ```ignore,no_run
8245    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8246    /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8247    /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(Some(ConversationalFilteringSpec::default()/* use setters */));
8248    /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(None::<ConversationalFilteringSpec>);
8249    /// ```
8250    pub fn set_or_clear_conversational_filtering_spec<T>(
8251        mut self,
8252        v: std::option::Option<T>,
8253    ) -> Self
8254    where
8255        T: std::convert::Into<
8256                crate::model::conversational_search_request::ConversationalFilteringSpec,
8257            >,
8258    {
8259        self.conversational_filtering_spec = v.map(|x| x.into());
8260        self
8261    }
8262
8263    /// Sets the value of [user_labels][crate::model::ConversationalSearchRequest::user_labels].
8264    ///
8265    /// # Example
8266    /// ```ignore,no_run
8267    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8268    /// let x = ConversationalSearchRequest::new().set_user_labels([
8269    ///     ("key0", "abc"),
8270    ///     ("key1", "xyz"),
8271    /// ]);
8272    /// ```
8273    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8274    where
8275        T: std::iter::IntoIterator<Item = (K, V)>,
8276        K: std::convert::Into<std::string::String>,
8277        V: std::convert::Into<std::string::String>,
8278    {
8279        use std::iter::Iterator;
8280        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8281        self
8282    }
8283
8284    /// Sets the value of [safety_settings][crate::model::ConversationalSearchRequest::safety_settings].
8285    ///
8286    /// # Example
8287    /// ```ignore,no_run
8288    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8289    /// use google_cloud_retail_v2::model::SafetySetting;
8290    /// let x = ConversationalSearchRequest::new()
8291    ///     .set_safety_settings([
8292    ///         SafetySetting::default()/* use setters */,
8293    ///         SafetySetting::default()/* use (different) setters */,
8294    ///     ]);
8295    /// ```
8296    pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
8297    where
8298        T: std::iter::IntoIterator<Item = V>,
8299        V: std::convert::Into<crate::model::SafetySetting>,
8300    {
8301        use std::iter::Iterator;
8302        self.safety_settings = v.into_iter().map(|i| i.into()).collect();
8303        self
8304    }
8305}
8306
8307impl wkt::message::Message for ConversationalSearchRequest {
8308    fn typename() -> &'static str {
8309        "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest"
8310    }
8311}
8312
8313/// Defines additional types related to [ConversationalSearchRequest].
8314pub mod conversational_search_request {
8315    #[allow(unused_imports)]
8316    use super::*;
8317
8318    /// Search parameters.
8319    #[derive(Clone, Default, PartialEq)]
8320    #[non_exhaustive]
8321    pub struct SearchParams {
8322        /// Optional. The filter string to restrict search results.
8323        ///
8324        /// The syntax of the filter string is the same as
8325        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
8326        ///
8327        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
8328        pub filter: std::string::String,
8329
8330        /// Optional. The canonical filter string to restrict search results.
8331        ///
8332        /// The syntax of the canonical filter string is the same as
8333        /// [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter].
8334        ///
8335        /// [google.cloud.retail.v2.SearchRequest.canonical_filter]: crate::model::SearchRequest::canonical_filter
8336        pub canonical_filter: std::string::String,
8337
8338        /// Optional. The sort string to specify the sorting of search results.
8339        ///
8340        /// The syntax of the sort string is the same as
8341        /// [SearchRequest.sort][].
8342        pub sort_by: std::string::String,
8343
8344        /// Optional. The boost spec to specify the boosting of search results.
8345        ///
8346        /// The syntax of the boost spec is the same as
8347        /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec].
8348        ///
8349        /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
8350        pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
8351
8352        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8353    }
8354
8355    impl SearchParams {
8356        pub fn new() -> Self {
8357            std::default::Default::default()
8358        }
8359
8360        /// Sets the value of [filter][crate::model::conversational_search_request::SearchParams::filter].
8361        ///
8362        /// # Example
8363        /// ```ignore,no_run
8364        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8365        /// let x = SearchParams::new().set_filter("example");
8366        /// ```
8367        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8368            self.filter = v.into();
8369            self
8370        }
8371
8372        /// Sets the value of [canonical_filter][crate::model::conversational_search_request::SearchParams::canonical_filter].
8373        ///
8374        /// # Example
8375        /// ```ignore,no_run
8376        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8377        /// let x = SearchParams::new().set_canonical_filter("example");
8378        /// ```
8379        pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
8380            mut self,
8381            v: T,
8382        ) -> Self {
8383            self.canonical_filter = v.into();
8384            self
8385        }
8386
8387        /// Sets the value of [sort_by][crate::model::conversational_search_request::SearchParams::sort_by].
8388        ///
8389        /// # Example
8390        /// ```ignore,no_run
8391        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8392        /// let x = SearchParams::new().set_sort_by("example");
8393        /// ```
8394        pub fn set_sort_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8395            self.sort_by = v.into();
8396            self
8397        }
8398
8399        /// Sets the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8400        ///
8401        /// # Example
8402        /// ```ignore,no_run
8403        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8404        /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8405        /// let x = SearchParams::new().set_boost_spec(BoostSpec::default()/* use setters */);
8406        /// ```
8407        pub fn set_boost_spec<T>(mut self, v: T) -> Self
8408        where
8409            T: std::convert::Into<crate::model::search_request::BoostSpec>,
8410        {
8411            self.boost_spec = std::option::Option::Some(v.into());
8412            self
8413        }
8414
8415        /// Sets or clears the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8416        ///
8417        /// # Example
8418        /// ```ignore,no_run
8419        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8420        /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8421        /// let x = SearchParams::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
8422        /// let x = SearchParams::new().set_or_clear_boost_spec(None::<BoostSpec>);
8423        /// ```
8424        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
8425        where
8426            T: std::convert::Into<crate::model::search_request::BoostSpec>,
8427        {
8428            self.boost_spec = v.map(|x| x.into());
8429            self
8430        }
8431    }
8432
8433    impl wkt::message::Message for SearchParams {
8434        fn typename() -> &'static str {
8435            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.SearchParams"
8436        }
8437    }
8438
8439    /// This field specifies the current user answer during the conversational
8440    /// filtering search. This can be either user selected from suggested answers
8441    /// or user input plain text.
8442    #[derive(Clone, Default, PartialEq)]
8443    #[non_exhaustive]
8444    pub struct UserAnswer {
8445        /// This field specifies the type of user answer.
8446        pub r#type:
8447            std::option::Option<crate::model::conversational_search_request::user_answer::Type>,
8448
8449        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8450    }
8451
8452    impl UserAnswer {
8453        pub fn new() -> Self {
8454            std::default::Default::default()
8455        }
8456
8457        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::type].
8458        ///
8459        /// Note that all the setters affecting `r#type` are mutually
8460        /// exclusive.
8461        ///
8462        /// # Example
8463        /// ```ignore,no_run
8464        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8465        /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::Type;
8466        /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
8467        /// ```
8468        pub fn set_type<
8469            T: std::convert::Into<
8470                    std::option::Option<
8471                        crate::model::conversational_search_request::user_answer::Type,
8472                    >,
8473                >,
8474        >(
8475            mut self,
8476            v: T,
8477        ) -> Self {
8478            self.r#type = v.into();
8479            self
8480        }
8481
8482        /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8483        /// if it holds a `TextAnswer`, `None` if the field is not set or
8484        /// holds a different branch.
8485        pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
8486            #[allow(unreachable_patterns)]
8487            self.r#type.as_ref().and_then(|v| match v {
8488                crate::model::conversational_search_request::user_answer::Type::TextAnswer(v) => {
8489                    std::option::Option::Some(v)
8490                }
8491                _ => std::option::Option::None,
8492            })
8493        }
8494
8495        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8496        /// to hold a `TextAnswer`.
8497        ///
8498        /// Note that all the setters affecting `r#type` are
8499        /// mutually exclusive.
8500        ///
8501        /// # Example
8502        /// ```ignore,no_run
8503        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8504        /// let x = UserAnswer::new().set_text_answer("example");
8505        /// assert!(x.text_answer().is_some());
8506        /// assert!(x.selected_answer().is_none());
8507        /// ```
8508        pub fn set_text_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8509            self.r#type = std::option::Option::Some(
8510                crate::model::conversational_search_request::user_answer::Type::TextAnswer(
8511                    v.into(),
8512                ),
8513            );
8514            self
8515        }
8516
8517        /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8518        /// if it holds a `SelectedAnswer`, `None` if the field is not set or
8519        /// holds a different branch.
8520        pub fn selected_answer(
8521            &self,
8522        ) -> std::option::Option<
8523            &std::boxed::Box<
8524                crate::model::conversational_search_request::user_answer::SelectedAnswer,
8525            >,
8526        > {
8527            #[allow(unreachable_patterns)]
8528            self.r#type.as_ref().and_then(|v| match v {
8529                crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8530                    v,
8531                ) => std::option::Option::Some(v),
8532                _ => std::option::Option::None,
8533            })
8534        }
8535
8536        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8537        /// to hold a `SelectedAnswer`.
8538        ///
8539        /// Note that all the setters affecting `r#type` are
8540        /// mutually exclusive.
8541        ///
8542        /// # Example
8543        /// ```ignore,no_run
8544        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8545        /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8546        /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
8547        /// assert!(x.selected_answer().is_some());
8548        /// assert!(x.text_answer().is_none());
8549        /// ```
8550        pub fn set_selected_answer<
8551            T: std::convert::Into<
8552                    std::boxed::Box<
8553                        crate::model::conversational_search_request::user_answer::SelectedAnswer,
8554                    >,
8555                >,
8556        >(
8557            mut self,
8558            v: T,
8559        ) -> Self {
8560            self.r#type = std::option::Option::Some(
8561                crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8562                    v.into(),
8563                ),
8564            );
8565            self
8566        }
8567    }
8568
8569    impl wkt::message::Message for UserAnswer {
8570        fn typename() -> &'static str {
8571            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer"
8572        }
8573    }
8574
8575    /// Defines additional types related to [UserAnswer].
8576    pub mod user_answer {
8577        #[allow(unused_imports)]
8578        use super::*;
8579
8580        /// This field specifies the selected answers during the conversational
8581        /// search.
8582        #[derive(Clone, Default, PartialEq)]
8583        #[non_exhaustive]
8584        pub struct SelectedAnswer {
8585            /// Optional. This field specifies the selected answer which is a attribute
8586            /// key-value.
8587            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
8588
8589            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8590        }
8591
8592        impl SelectedAnswer {
8593            pub fn new() -> Self {
8594                std::default::Default::default()
8595            }
8596
8597            /// Sets the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8598            ///
8599            /// # Example
8600            /// ```ignore,no_run
8601            /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8602            /// use google_cloud_retail_v2::model::ProductAttributeValue;
8603            /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
8604            /// ```
8605            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
8606            where
8607                T: std::convert::Into<crate::model::ProductAttributeValue>,
8608            {
8609                self.product_attribute_value = std::option::Option::Some(v.into());
8610                self
8611            }
8612
8613            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8614            ///
8615            /// # Example
8616            /// ```ignore,no_run
8617            /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8618            /// use google_cloud_retail_v2::model::ProductAttributeValue;
8619            /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
8620            /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
8621            /// ```
8622            pub fn set_or_clear_product_attribute_value<T>(
8623                mut self,
8624                v: std::option::Option<T>,
8625            ) -> Self
8626            where
8627                T: std::convert::Into<crate::model::ProductAttributeValue>,
8628            {
8629                self.product_attribute_value = v.map(|x| x.into());
8630                self
8631            }
8632        }
8633
8634        impl wkt::message::Message for SelectedAnswer {
8635            fn typename() -> &'static str {
8636                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer"
8637            }
8638        }
8639
8640        /// This field specifies the type of user answer.
8641        #[derive(Clone, Debug, PartialEq)]
8642        #[non_exhaustive]
8643        pub enum Type {
8644            /// This field specifies the incremental input text from the user during
8645            /// the conversational search.
8646            TextAnswer(std::string::String),
8647            /// Optional. This field specifies the selected answer during the
8648            /// conversational search. This should be a subset of
8649            /// [ConversationalSearchResponse.followup_question.suggested_answers][].
8650            SelectedAnswer(
8651                std::boxed::Box<
8652                    crate::model::conversational_search_request::user_answer::SelectedAnswer,
8653                >,
8654            ),
8655        }
8656    }
8657
8658    /// This field specifies all conversational filtering related parameters
8659    /// addition to conversational retail search.
8660    #[derive(Clone, Default, PartialEq)]
8661    #[non_exhaustive]
8662    pub struct ConversationalFilteringSpec {
8663        /// Optional. This field is deprecated. Please use
8664        /// [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]
8665        /// instead.
8666        ///
8667        /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]: crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode
8668        #[deprecated]
8669        pub enable_conversational_filtering: bool,
8670
8671        /// Optional. This field specifies the current user answer during the
8672        /// conversational filtering search. It can be either user selected from
8673        /// suggested answers or user input plain text.
8674        pub user_answer:
8675            std::option::Option<crate::model::conversational_search_request::UserAnswer>,
8676
8677        /// Optional. Mode to control Conversational Filtering.
8678        /// Defaults to
8679        /// [Mode.DISABLED][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]
8680        /// if it's unset.
8681        ///
8682        /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]: crate::model::conversational_search_request::conversational_filtering_spec::Mode::Disabled
8683        pub conversational_filtering_mode:
8684            crate::model::conversational_search_request::conversational_filtering_spec::Mode,
8685
8686        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8687    }
8688
8689    impl ConversationalFilteringSpec {
8690        pub fn new() -> Self {
8691            std::default::Default::default()
8692        }
8693
8694        /// Sets the value of [enable_conversational_filtering][crate::model::conversational_search_request::ConversationalFilteringSpec::enable_conversational_filtering].
8695        ///
8696        /// # Example
8697        /// ```ignore,no_run
8698        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8699        /// let x = ConversationalFilteringSpec::new().set_enable_conversational_filtering(true);
8700        /// ```
8701        #[deprecated]
8702        pub fn set_enable_conversational_filtering<T: std::convert::Into<bool>>(
8703            mut self,
8704            v: T,
8705        ) -> Self {
8706            self.enable_conversational_filtering = v.into();
8707            self
8708        }
8709
8710        /// Sets the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8711        ///
8712        /// # Example
8713        /// ```ignore,no_run
8714        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8715        /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8716        /// let x = ConversationalFilteringSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
8717        /// ```
8718        pub fn set_user_answer<T>(mut self, v: T) -> Self
8719        where
8720            T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8721        {
8722            self.user_answer = std::option::Option::Some(v.into());
8723            self
8724        }
8725
8726        /// Sets or clears the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8727        ///
8728        /// # Example
8729        /// ```ignore,no_run
8730        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8731        /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8732        /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
8733        /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
8734        /// ```
8735        pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
8736        where
8737            T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8738        {
8739            self.user_answer = v.map(|x| x.into());
8740            self
8741        }
8742
8743        /// Sets the value of [conversational_filtering_mode][crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode].
8744        ///
8745        /// # Example
8746        /// ```ignore,no_run
8747        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8748        /// use google_cloud_retail_v2::model::conversational_search_request::conversational_filtering_spec::Mode;
8749        /// let x0 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Disabled);
8750        /// let x1 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Enabled);
8751        /// let x2 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::ConversationalFilterOnly);
8752        /// ```
8753        pub fn set_conversational_filtering_mode<T: std::convert::Into<crate::model::conversational_search_request::conversational_filtering_spec::Mode>>(mut self, v: T) -> Self{
8754            self.conversational_filtering_mode = v.into();
8755            self
8756        }
8757    }
8758
8759    impl wkt::message::Message for ConversationalFilteringSpec {
8760        fn typename() -> &'static str {
8761            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec"
8762        }
8763    }
8764
8765    /// Defines additional types related to [ConversationalFilteringSpec].
8766    pub mod conversational_filtering_spec {
8767        #[allow(unused_imports)]
8768        use super::*;
8769
8770        /// Enum to control Conversational Filtering mode.
8771        /// A single conversation session including multiple turns supports modes for
8772        /// Conversational Search OR Conversational Filtering without
8773        /// Conversational Search, but not both.
8774        ///
8775        /// # Working with unknown values
8776        ///
8777        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8778        /// additional enum variants at any time. Adding new variants is not considered
8779        /// a breaking change. Applications should write their code in anticipation of:
8780        ///
8781        /// - New values appearing in future releases of the client library, **and**
8782        /// - New values received dynamically, without application changes.
8783        ///
8784        /// Please consult the [Working with enums] section in the user guide for some
8785        /// guidelines.
8786        ///
8787        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
8788        #[derive(Clone, Debug, PartialEq)]
8789        #[non_exhaustive]
8790        pub enum Mode {
8791            /// Default value.
8792            Unspecified,
8793            /// Disables Conversational Filtering when using Conversational Search.
8794            Disabled,
8795            /// Enables Conversational Filtering when using Conversational Search.
8796            Enabled,
8797            /// Enables Conversational Filtering without Conversational Search.
8798            ConversationalFilterOnly,
8799            /// If set, the enum was initialized with an unknown value.
8800            ///
8801            /// Applications can examine the value using [Mode::value] or
8802            /// [Mode::name].
8803            UnknownValue(mode::UnknownValue),
8804        }
8805
8806        #[doc(hidden)]
8807        pub mod mode {
8808            #[allow(unused_imports)]
8809            use super::*;
8810            #[derive(Clone, Debug, PartialEq)]
8811            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8812        }
8813
8814        impl Mode {
8815            /// Gets the enum value.
8816            ///
8817            /// Returns `None` if the enum contains an unknown value deserialized from
8818            /// the string representation of enums.
8819            pub fn value(&self) -> std::option::Option<i32> {
8820                match self {
8821                    Self::Unspecified => std::option::Option::Some(0),
8822                    Self::Disabled => std::option::Option::Some(1),
8823                    Self::Enabled => std::option::Option::Some(2),
8824                    Self::ConversationalFilterOnly => std::option::Option::Some(3),
8825                    Self::UnknownValue(u) => u.0.value(),
8826                }
8827            }
8828
8829            /// Gets the enum value as a string.
8830            ///
8831            /// Returns `None` if the enum contains an unknown value deserialized from
8832            /// the integer representation of enums.
8833            pub fn name(&self) -> std::option::Option<&str> {
8834                match self {
8835                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
8836                    Self::Disabled => std::option::Option::Some("DISABLED"),
8837                    Self::Enabled => std::option::Option::Some("ENABLED"),
8838                    Self::ConversationalFilterOnly => {
8839                        std::option::Option::Some("CONVERSATIONAL_FILTER_ONLY")
8840                    }
8841                    Self::UnknownValue(u) => u.0.name(),
8842                }
8843            }
8844        }
8845
8846        impl std::default::Default for Mode {
8847            fn default() -> Self {
8848                use std::convert::From;
8849                Self::from(0)
8850            }
8851        }
8852
8853        impl std::fmt::Display for Mode {
8854            fn fmt(
8855                &self,
8856                f: &mut std::fmt::Formatter<'_>,
8857            ) -> std::result::Result<(), std::fmt::Error> {
8858                wkt::internal::display_enum(f, self.name(), self.value())
8859            }
8860        }
8861
8862        impl std::convert::From<i32> for Mode {
8863            fn from(value: i32) -> Self {
8864                match value {
8865                    0 => Self::Unspecified,
8866                    1 => Self::Disabled,
8867                    2 => Self::Enabled,
8868                    3 => Self::ConversationalFilterOnly,
8869                    _ => Self::UnknownValue(mode::UnknownValue(
8870                        wkt::internal::UnknownEnumValue::Integer(value),
8871                    )),
8872                }
8873            }
8874        }
8875
8876        impl std::convert::From<&str> for Mode {
8877            fn from(value: &str) -> Self {
8878                use std::string::ToString;
8879                match value {
8880                    "MODE_UNSPECIFIED" => Self::Unspecified,
8881                    "DISABLED" => Self::Disabled,
8882                    "ENABLED" => Self::Enabled,
8883                    "CONVERSATIONAL_FILTER_ONLY" => Self::ConversationalFilterOnly,
8884                    _ => Self::UnknownValue(mode::UnknownValue(
8885                        wkt::internal::UnknownEnumValue::String(value.to_string()),
8886                    )),
8887                }
8888            }
8889        }
8890
8891        impl serde::ser::Serialize for Mode {
8892            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8893            where
8894                S: serde::Serializer,
8895            {
8896                match self {
8897                    Self::Unspecified => serializer.serialize_i32(0),
8898                    Self::Disabled => serializer.serialize_i32(1),
8899                    Self::Enabled => serializer.serialize_i32(2),
8900                    Self::ConversationalFilterOnly => serializer.serialize_i32(3),
8901                    Self::UnknownValue(u) => u.0.serialize(serializer),
8902                }
8903            }
8904        }
8905
8906        impl<'de> serde::de::Deserialize<'de> for Mode {
8907            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8908            where
8909                D: serde::Deserializer<'de>,
8910            {
8911                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
8912                    ".google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode"))
8913            }
8914        }
8915    }
8916}
8917
8918/// Response message for
8919/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
8920/// method.
8921#[derive(Clone, Default, PartialEq)]
8922#[non_exhaustive]
8923pub struct ConversationalSearchResponse {
8924    /// The types Retail classifies the search query as.
8925    ///
8926    /// Supported values are:
8927    ///
8928    /// - "ORDER_SUPPORT"
8929    /// - "SIMPLE_PRODUCT_SEARCH"
8930    /// - "INTENT_REFINEMENT"
8931    /// - "PRODUCT_DETAILS"
8932    /// - "PRODUCT_COMPARISON"
8933    /// - "DEALS_AND_COUPONS"
8934    /// - "STORE_RELEVANT"
8935    /// - "BLOCKLISTED"
8936    /// - "BEST_PRODUCT"
8937    /// - "RETAIL_SUPPORT"
8938    /// - "DISABLED"
8939    pub user_query_types: std::vec::Vec<std::string::String>,
8940
8941    /// The conversational answer-based text response generated by the Server.
8942    pub conversational_text_response: std::string::String,
8943
8944    /// The conversational followup question generated for Intent refinement.
8945    pub followup_question:
8946        std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
8947
8948    /// Conversation UUID. This field will be stored in client side storage to
8949    /// maintain the conversation session with server and will be used for next
8950    /// search request's
8951    /// [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]
8952    /// to restore conversation state in server.
8953    ///
8954    /// [google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]: crate::model::ConversationalSearchRequest::conversation_id
8955    pub conversation_id: std::string::String,
8956
8957    /// The proposed refined search queries. They can be used to fetch the relevant
8958    /// search results. When using CONVERSATIONAL_FILTER_ONLY mode, the
8959    /// refined_query from search response will be populated here.
8960    pub refined_search: std::vec::Vec<crate::model::conversational_search_response::RefinedSearch>,
8961
8962    /// This field specifies all related information that is needed on client
8963    /// side for UI rendering of conversational filtering search.
8964    pub conversational_filtering_result: std::option::Option<
8965        crate::model::conversational_search_response::ConversationalFilteringResult,
8966    >,
8967
8968    /// Output only. The state of the response generation.
8969    pub state: crate::model::conversational_search_response::State,
8970
8971    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8972}
8973
8974impl ConversationalSearchResponse {
8975    pub fn new() -> Self {
8976        std::default::Default::default()
8977    }
8978
8979    /// Sets the value of [user_query_types][crate::model::ConversationalSearchResponse::user_query_types].
8980    ///
8981    /// # Example
8982    /// ```ignore,no_run
8983    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
8984    /// let x = ConversationalSearchResponse::new().set_user_query_types(["a", "b", "c"]);
8985    /// ```
8986    pub fn set_user_query_types<T, V>(mut self, v: T) -> Self
8987    where
8988        T: std::iter::IntoIterator<Item = V>,
8989        V: std::convert::Into<std::string::String>,
8990    {
8991        use std::iter::Iterator;
8992        self.user_query_types = v.into_iter().map(|i| i.into()).collect();
8993        self
8994    }
8995
8996    /// Sets the value of [conversational_text_response][crate::model::ConversationalSearchResponse::conversational_text_response].
8997    ///
8998    /// # Example
8999    /// ```ignore,no_run
9000    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9001    /// let x = ConversationalSearchResponse::new().set_conversational_text_response("example");
9002    /// ```
9003    pub fn set_conversational_text_response<T: std::convert::Into<std::string::String>>(
9004        mut self,
9005        v: T,
9006    ) -> Self {
9007        self.conversational_text_response = v.into();
9008        self
9009    }
9010
9011    /// Sets the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9012    ///
9013    /// # Example
9014    /// ```ignore,no_run
9015    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9016    /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9017    /// let x = ConversationalSearchResponse::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9018    /// ```
9019    pub fn set_followup_question<T>(mut self, v: T) -> Self
9020    where
9021        T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9022    {
9023        self.followup_question = std::option::Option::Some(v.into());
9024        self
9025    }
9026
9027    /// Sets or clears the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9028    ///
9029    /// # Example
9030    /// ```ignore,no_run
9031    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9032    /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9033    /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9034    /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9035    /// ```
9036    pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9037    where
9038        T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9039    {
9040        self.followup_question = v.map(|x| x.into());
9041        self
9042    }
9043
9044    /// Sets the value of [conversation_id][crate::model::ConversationalSearchResponse::conversation_id].
9045    ///
9046    /// # Example
9047    /// ```ignore,no_run
9048    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9049    /// let x = ConversationalSearchResponse::new().set_conversation_id("example");
9050    /// ```
9051    pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9052        self.conversation_id = v.into();
9053        self
9054    }
9055
9056    /// Sets the value of [refined_search][crate::model::ConversationalSearchResponse::refined_search].
9057    ///
9058    /// # Example
9059    /// ```ignore,no_run
9060    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9061    /// use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9062    /// let x = ConversationalSearchResponse::new()
9063    ///     .set_refined_search([
9064    ///         RefinedSearch::default()/* use setters */,
9065    ///         RefinedSearch::default()/* use (different) setters */,
9066    ///     ]);
9067    /// ```
9068    pub fn set_refined_search<T, V>(mut self, v: T) -> Self
9069    where
9070        T: std::iter::IntoIterator<Item = V>,
9071        V: std::convert::Into<crate::model::conversational_search_response::RefinedSearch>,
9072    {
9073        use std::iter::Iterator;
9074        self.refined_search = v.into_iter().map(|i| i.into()).collect();
9075        self
9076    }
9077
9078    /// Sets the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9079    ///
9080    /// # Example
9081    /// ```ignore,no_run
9082    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9083    /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9084    /// let x = ConversationalSearchResponse::new().set_conversational_filtering_result(ConversationalFilteringResult::default()/* use setters */);
9085    /// ```
9086    pub fn set_conversational_filtering_result<T>(mut self, v: T) -> Self
9087    where
9088        T: std::convert::Into<
9089                crate::model::conversational_search_response::ConversationalFilteringResult,
9090            >,
9091    {
9092        self.conversational_filtering_result = std::option::Option::Some(v.into());
9093        self
9094    }
9095
9096    /// Sets or clears the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9097    ///
9098    /// # Example
9099    /// ```ignore,no_run
9100    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9101    /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9102    /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(Some(ConversationalFilteringResult::default()/* use setters */));
9103    /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(None::<ConversationalFilteringResult>);
9104    /// ```
9105    pub fn set_or_clear_conversational_filtering_result<T>(
9106        mut self,
9107        v: std::option::Option<T>,
9108    ) -> Self
9109    where
9110        T: std::convert::Into<
9111                crate::model::conversational_search_response::ConversationalFilteringResult,
9112            >,
9113    {
9114        self.conversational_filtering_result = v.map(|x| x.into());
9115        self
9116    }
9117
9118    /// Sets the value of [state][crate::model::ConversationalSearchResponse::state].
9119    ///
9120    /// # Example
9121    /// ```ignore,no_run
9122    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9123    /// use google_cloud_retail_v2::model::conversational_search_response::State;
9124    /// let x0 = ConversationalSearchResponse::new().set_state(State::Streaming);
9125    /// let x1 = ConversationalSearchResponse::new().set_state(State::Succeeded);
9126    /// ```
9127    pub fn set_state<T: std::convert::Into<crate::model::conversational_search_response::State>>(
9128        mut self,
9129        v: T,
9130    ) -> Self {
9131        self.state = v.into();
9132        self
9133    }
9134}
9135
9136impl wkt::message::Message for ConversationalSearchResponse {
9137    fn typename() -> &'static str {
9138        "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse"
9139    }
9140}
9141
9142/// Defines additional types related to [ConversationalSearchResponse].
9143pub mod conversational_search_response {
9144    #[allow(unused_imports)]
9145    use super::*;
9146
9147    /// The conversational followup question generated for Intent refinement.
9148    #[derive(Clone, Default, PartialEq)]
9149    #[non_exhaustive]
9150    pub struct FollowupQuestion {
9151        /// The conversational followup question generated for Intent refinement.
9152        pub followup_question: std::string::String,
9153
9154        /// The answer options provided to client for the follow-up question.
9155        pub suggested_answers: std::vec::Vec<
9156            crate::model::conversational_search_response::followup_question::SuggestedAnswer,
9157        >,
9158
9159        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9160    }
9161
9162    impl FollowupQuestion {
9163        pub fn new() -> Self {
9164            std::default::Default::default()
9165        }
9166
9167        /// Sets the value of [followup_question][crate::model::conversational_search_response::FollowupQuestion::followup_question].
9168        ///
9169        /// # Example
9170        /// ```ignore,no_run
9171        /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9172        /// let x = FollowupQuestion::new().set_followup_question("example");
9173        /// ```
9174        pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
9175            mut self,
9176            v: T,
9177        ) -> Self {
9178            self.followup_question = v.into();
9179            self
9180        }
9181
9182        /// Sets the value of [suggested_answers][crate::model::conversational_search_response::FollowupQuestion::suggested_answers].
9183        ///
9184        /// # Example
9185        /// ```ignore,no_run
9186        /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9187        /// use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9188        /// let x = FollowupQuestion::new()
9189        ///     .set_suggested_answers([
9190        ///         SuggestedAnswer::default()/* use setters */,
9191        ///         SuggestedAnswer::default()/* use (different) setters */,
9192        ///     ]);
9193        /// ```
9194        pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
9195        where
9196            T: std::iter::IntoIterator<Item = V>,
9197            V: std::convert::Into<crate::model::conversational_search_response::followup_question::SuggestedAnswer>
9198        {
9199            use std::iter::Iterator;
9200            self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
9201            self
9202        }
9203    }
9204
9205    impl wkt::message::Message for FollowupQuestion {
9206        fn typename() -> &'static str {
9207            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion"
9208        }
9209    }
9210
9211    /// Defines additional types related to [FollowupQuestion].
9212    pub mod followup_question {
9213        #[allow(unused_imports)]
9214        use super::*;
9215
9216        /// Suggested answers to the follow-up question.
9217        /// If it's numerical attribute, only ProductAttributeInterval will be set.
9218        /// If it's textual attribute, only productAttributeValue will be set.
9219        #[derive(Clone, Default, PartialEq)]
9220        #[non_exhaustive]
9221        pub struct SuggestedAnswer {
9222            /// Product attribute value, including an attribute key and an
9223            /// attribute value. Other types can be added here in the future.
9224            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9225
9226            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9227        }
9228
9229        impl SuggestedAnswer {
9230            pub fn new() -> Self {
9231                std::default::Default::default()
9232            }
9233
9234            /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9235            ///
9236            /// # Example
9237            /// ```ignore,no_run
9238            /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9239            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9240            /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9241            /// ```
9242            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9243            where
9244                T: std::convert::Into<crate::model::ProductAttributeValue>,
9245            {
9246                self.product_attribute_value = std::option::Option::Some(v.into());
9247                self
9248            }
9249
9250            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9251            ///
9252            /// # Example
9253            /// ```ignore,no_run
9254            /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9255            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9256            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9257            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9258            /// ```
9259            pub fn set_or_clear_product_attribute_value<T>(
9260                mut self,
9261                v: std::option::Option<T>,
9262            ) -> Self
9263            where
9264                T: std::convert::Into<crate::model::ProductAttributeValue>,
9265            {
9266                self.product_attribute_value = v.map(|x| x.into());
9267                self
9268            }
9269        }
9270
9271        impl wkt::message::Message for SuggestedAnswer {
9272            fn typename() -> &'static str {
9273                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer"
9274            }
9275        }
9276    }
9277
9278    /// The proposed refined search for intent-refinement/bundled shopping
9279    /// conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the
9280    /// refined_query from search response will be populated here.
9281    #[derive(Clone, Default, PartialEq)]
9282    #[non_exhaustive]
9283    pub struct RefinedSearch {
9284        /// The query to be used for search.
9285        pub query: std::string::String,
9286
9287        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9288    }
9289
9290    impl RefinedSearch {
9291        pub fn new() -> Self {
9292            std::default::Default::default()
9293        }
9294
9295        /// Sets the value of [query][crate::model::conversational_search_response::RefinedSearch::query].
9296        ///
9297        /// # Example
9298        /// ```ignore,no_run
9299        /// # use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9300        /// let x = RefinedSearch::new().set_query("example");
9301        /// ```
9302        pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9303            self.query = v.into();
9304            self
9305        }
9306    }
9307
9308    impl wkt::message::Message for RefinedSearch {
9309        fn typename() -> &'static str {
9310            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch"
9311        }
9312    }
9313
9314    /// This field specifies all related information that is needed on client
9315    /// side for UI rendering of conversational filtering search.
9316    #[derive(Clone, Default, PartialEq)]
9317    #[non_exhaustive]
9318    pub struct ConversationalFilteringResult {
9319
9320        /// The conversational filtering question.
9321        pub followup_question: std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9322
9323        /// This is the incremental additional filters implied from the current
9324        /// user answer. User should add the suggested addition filters to the
9325        /// previous [ConversationalSearchRequest.search_params.filter][] and
9326        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],  and
9327        /// use the merged filter in the follow up requests.
9328        ///
9329        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
9330        pub additional_filter: std::option::Option<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>,
9331
9332        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9333    }
9334
9335    impl ConversationalFilteringResult {
9336        pub fn new() -> Self {
9337            std::default::Default::default()
9338        }
9339
9340        /// Sets the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9341        ///
9342        /// # Example
9343        /// ```ignore,no_run
9344        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9345        /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9346        /// let x = ConversationalFilteringResult::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9347        /// ```
9348        pub fn set_followup_question<T>(mut self, v: T) -> Self
9349        where
9350            T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9351        {
9352            self.followup_question = std::option::Option::Some(v.into());
9353            self
9354        }
9355
9356        /// Sets or clears the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9357        ///
9358        /// # Example
9359        /// ```ignore,no_run
9360        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9361        /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9362        /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9363        /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9364        /// ```
9365        pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9366        where
9367            T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9368        {
9369            self.followup_question = v.map(|x| x.into());
9370            self
9371        }
9372
9373        /// Sets the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9374        ///
9375        /// # Example
9376        /// ```ignore,no_run
9377        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9378        /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9379        /// let x = ConversationalFilteringResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
9380        /// ```
9381        pub fn set_additional_filter<T>(mut self, v: T) -> Self
9382        where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9383        {
9384            self.additional_filter = std::option::Option::Some(v.into());
9385            self
9386        }
9387
9388        /// Sets or clears the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9389        ///
9390        /// # Example
9391        /// ```ignore,no_run
9392        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9393        /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9394        /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
9395        /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
9396        /// ```
9397        pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
9398        where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9399        {
9400            self.additional_filter = v.map(|x| x.into());
9401            self
9402        }
9403    }
9404
9405    impl wkt::message::Message for ConversationalFilteringResult {
9406        fn typename() -> &'static str {
9407            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult"
9408        }
9409    }
9410
9411    /// Defines additional types related to [ConversationalFilteringResult].
9412    pub mod conversational_filtering_result {
9413        #[allow(unused_imports)]
9414        use super::*;
9415
9416        /// Additional filter that client side need to apply.
9417        #[derive(Clone, Default, PartialEq)]
9418        #[non_exhaustive]
9419        pub struct AdditionalFilter {
9420            /// Product attribute value, including an attribute key and an
9421            /// attribute value. Other types can be added here in the future.
9422            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9423
9424            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9425        }
9426
9427        impl AdditionalFilter {
9428            pub fn new() -> Self {
9429                std::default::Default::default()
9430            }
9431
9432            /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9433            ///
9434            /// # Example
9435            /// ```ignore,no_run
9436            /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9437            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9438            /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9439            /// ```
9440            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9441            where
9442                T: std::convert::Into<crate::model::ProductAttributeValue>,
9443            {
9444                self.product_attribute_value = std::option::Option::Some(v.into());
9445                self
9446            }
9447
9448            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9449            ///
9450            /// # Example
9451            /// ```ignore,no_run
9452            /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9453            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9454            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9455            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9456            /// ```
9457            pub fn set_or_clear_product_attribute_value<T>(
9458                mut self,
9459                v: std::option::Option<T>,
9460            ) -> Self
9461            where
9462                T: std::convert::Into<crate::model::ProductAttributeValue>,
9463            {
9464                self.product_attribute_value = v.map(|x| x.into());
9465                self
9466            }
9467        }
9468
9469        impl wkt::message::Message for AdditionalFilter {
9470            fn typename() -> &'static str {
9471                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter"
9472            }
9473        }
9474    }
9475
9476    /// The state of the response generation.
9477    ///
9478    /// # Working with unknown values
9479    ///
9480    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9481    /// additional enum variants at any time. Adding new variants is not considered
9482    /// a breaking change. Applications should write their code in anticipation of:
9483    ///
9484    /// - New values appearing in future releases of the client library, **and**
9485    /// - New values received dynamically, without application changes.
9486    ///
9487    /// Please consult the [Working with enums] section in the user guide for some
9488    /// guidelines.
9489    ///
9490    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
9491    #[derive(Clone, Debug, PartialEq)]
9492    #[non_exhaustive]
9493    pub enum State {
9494        /// Unknown.
9495        Unspecified,
9496        /// Response generation is being streamed.
9497        Streaming,
9498        /// Response generation has succeeded.
9499        Succeeded,
9500        /// If set, the enum was initialized with an unknown value.
9501        ///
9502        /// Applications can examine the value using [State::value] or
9503        /// [State::name].
9504        UnknownValue(state::UnknownValue),
9505    }
9506
9507    #[doc(hidden)]
9508    pub mod state {
9509        #[allow(unused_imports)]
9510        use super::*;
9511        #[derive(Clone, Debug, PartialEq)]
9512        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9513    }
9514
9515    impl State {
9516        /// Gets the enum value.
9517        ///
9518        /// Returns `None` if the enum contains an unknown value deserialized from
9519        /// the string representation of enums.
9520        pub fn value(&self) -> std::option::Option<i32> {
9521            match self {
9522                Self::Unspecified => std::option::Option::Some(0),
9523                Self::Streaming => std::option::Option::Some(1),
9524                Self::Succeeded => std::option::Option::Some(2),
9525                Self::UnknownValue(u) => u.0.value(),
9526            }
9527        }
9528
9529        /// Gets the enum value as a string.
9530        ///
9531        /// Returns `None` if the enum contains an unknown value deserialized from
9532        /// the integer representation of enums.
9533        pub fn name(&self) -> std::option::Option<&str> {
9534            match self {
9535                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9536                Self::Streaming => std::option::Option::Some("STREAMING"),
9537                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9538                Self::UnknownValue(u) => u.0.name(),
9539            }
9540        }
9541    }
9542
9543    impl std::default::Default for State {
9544        fn default() -> Self {
9545            use std::convert::From;
9546            Self::from(0)
9547        }
9548    }
9549
9550    impl std::fmt::Display for State {
9551        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9552            wkt::internal::display_enum(f, self.name(), self.value())
9553        }
9554    }
9555
9556    impl std::convert::From<i32> for State {
9557        fn from(value: i32) -> Self {
9558            match value {
9559                0 => Self::Unspecified,
9560                1 => Self::Streaming,
9561                2 => Self::Succeeded,
9562                _ => Self::UnknownValue(state::UnknownValue(
9563                    wkt::internal::UnknownEnumValue::Integer(value),
9564                )),
9565            }
9566        }
9567    }
9568
9569    impl std::convert::From<&str> for State {
9570        fn from(value: &str) -> Self {
9571            use std::string::ToString;
9572            match value {
9573                "STATE_UNSPECIFIED" => Self::Unspecified,
9574                "STREAMING" => Self::Streaming,
9575                "SUCCEEDED" => Self::Succeeded,
9576                _ => Self::UnknownValue(state::UnknownValue(
9577                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9578                )),
9579            }
9580        }
9581    }
9582
9583    impl serde::ser::Serialize for State {
9584        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9585        where
9586            S: serde::Serializer,
9587        {
9588            match self {
9589                Self::Unspecified => serializer.serialize_i32(0),
9590                Self::Streaming => serializer.serialize_i32(1),
9591                Self::Succeeded => serializer.serialize_i32(2),
9592                Self::UnknownValue(u) => u.0.serialize(serializer),
9593            }
9594        }
9595    }
9596
9597    impl<'de> serde::de::Deserialize<'de> for State {
9598        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9599        where
9600            D: serde::Deserializer<'de>,
9601        {
9602            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9603                ".google.cloud.retail.v2.ConversationalSearchResponse.State",
9604            ))
9605        }
9606    }
9607}
9608
9609/// The output configuration setting.
9610#[derive(Clone, Default, PartialEq)]
9611#[non_exhaustive]
9612pub struct OutputConfig {
9613    /// The configuration of destination for holding output data.
9614    pub destination: std::option::Option<crate::model::output_config::Destination>,
9615
9616    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9617}
9618
9619impl OutputConfig {
9620    pub fn new() -> Self {
9621        std::default::Default::default()
9622    }
9623
9624    /// Sets the value of [destination][crate::model::OutputConfig::destination].
9625    ///
9626    /// Note that all the setters affecting `destination` are mutually
9627    /// exclusive.
9628    ///
9629    /// # Example
9630    /// ```ignore,no_run
9631    /// # use google_cloud_retail_v2::model::OutputConfig;
9632    /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9633    /// let x = OutputConfig::new().set_destination(Some(
9634    ///     google_cloud_retail_v2::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
9635    /// ```
9636    pub fn set_destination<
9637        T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
9638    >(
9639        mut self,
9640        v: T,
9641    ) -> Self {
9642        self.destination = v.into();
9643        self
9644    }
9645
9646    /// The value of [destination][crate::model::OutputConfig::destination]
9647    /// if it holds a `GcsDestination`, `None` if the field is not set or
9648    /// holds a different branch.
9649    pub fn gcs_destination(
9650        &self,
9651    ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::GcsDestination>> {
9652        #[allow(unreachable_patterns)]
9653        self.destination.as_ref().and_then(|v| match v {
9654            crate::model::output_config::Destination::GcsDestination(v) => {
9655                std::option::Option::Some(v)
9656            }
9657            _ => std::option::Option::None,
9658        })
9659    }
9660
9661    /// Sets the value of [destination][crate::model::OutputConfig::destination]
9662    /// to hold a `GcsDestination`.
9663    ///
9664    /// Note that all the setters affecting `destination` are
9665    /// mutually exclusive.
9666    ///
9667    /// # Example
9668    /// ```ignore,no_run
9669    /// # use google_cloud_retail_v2::model::OutputConfig;
9670    /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9671    /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
9672    /// assert!(x.gcs_destination().is_some());
9673    /// assert!(x.bigquery_destination().is_none());
9674    /// ```
9675    pub fn set_gcs_destination<
9676        T: std::convert::Into<std::boxed::Box<crate::model::output_config::GcsDestination>>,
9677    >(
9678        mut self,
9679        v: T,
9680    ) -> Self {
9681        self.destination = std::option::Option::Some(
9682            crate::model::output_config::Destination::GcsDestination(v.into()),
9683        );
9684        self
9685    }
9686
9687    /// The value of [destination][crate::model::OutputConfig::destination]
9688    /// if it holds a `BigqueryDestination`, `None` if the field is not set or
9689    /// holds a different branch.
9690    pub fn bigquery_destination(
9691        &self,
9692    ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::BigQueryDestination>>
9693    {
9694        #[allow(unreachable_patterns)]
9695        self.destination.as_ref().and_then(|v| match v {
9696            crate::model::output_config::Destination::BigqueryDestination(v) => {
9697                std::option::Option::Some(v)
9698            }
9699            _ => std::option::Option::None,
9700        })
9701    }
9702
9703    /// Sets the value of [destination][crate::model::OutputConfig::destination]
9704    /// to hold a `BigqueryDestination`.
9705    ///
9706    /// Note that all the setters affecting `destination` are
9707    /// mutually exclusive.
9708    ///
9709    /// # Example
9710    /// ```ignore,no_run
9711    /// # use google_cloud_retail_v2::model::OutputConfig;
9712    /// use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9713    /// let x = OutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
9714    /// assert!(x.bigquery_destination().is_some());
9715    /// assert!(x.gcs_destination().is_none());
9716    /// ```
9717    pub fn set_bigquery_destination<
9718        T: std::convert::Into<std::boxed::Box<crate::model::output_config::BigQueryDestination>>,
9719    >(
9720        mut self,
9721        v: T,
9722    ) -> Self {
9723        self.destination = std::option::Option::Some(
9724            crate::model::output_config::Destination::BigqueryDestination(v.into()),
9725        );
9726        self
9727    }
9728}
9729
9730impl wkt::message::Message for OutputConfig {
9731    fn typename() -> &'static str {
9732        "type.googleapis.com/google.cloud.retail.v2.OutputConfig"
9733    }
9734}
9735
9736/// Defines additional types related to [OutputConfig].
9737pub mod output_config {
9738    #[allow(unused_imports)]
9739    use super::*;
9740
9741    /// The Google Cloud Storage output destination configuration.
9742    #[derive(Clone, Default, PartialEq)]
9743    #[non_exhaustive]
9744    pub struct GcsDestination {
9745        /// Required. The output uri prefix for saving output data to json files.
9746        /// Some mapping examples are as follows:
9747        /// output_uri_prefix         sample output(assuming the object is foo.json)
9748        /// ========================  =============================================
9749        /// gs://bucket/              gs://bucket/foo.json
9750        /// gs://bucket/folder/       gs://bucket/folder/foo.json
9751        /// gs://bucket/folder/item_  gs://bucket/folder/item_foo.json
9752        pub output_uri_prefix: std::string::String,
9753
9754        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9755    }
9756
9757    impl GcsDestination {
9758        pub fn new() -> Self {
9759            std::default::Default::default()
9760        }
9761
9762        /// Sets the value of [output_uri_prefix][crate::model::output_config::GcsDestination::output_uri_prefix].
9763        ///
9764        /// # Example
9765        /// ```ignore,no_run
9766        /// # use google_cloud_retail_v2::model::output_config::GcsDestination;
9767        /// let x = GcsDestination::new().set_output_uri_prefix("example");
9768        /// ```
9769        pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9770            mut self,
9771            v: T,
9772        ) -> Self {
9773            self.output_uri_prefix = v.into();
9774            self
9775        }
9776    }
9777
9778    impl wkt::message::Message for GcsDestination {
9779        fn typename() -> &'static str {
9780            "type.googleapis.com/google.cloud.retail.v2.OutputConfig.GcsDestination"
9781        }
9782    }
9783
9784    /// The BigQuery output destination configuration.
9785    #[derive(Clone, Default, PartialEq)]
9786    #[non_exhaustive]
9787    pub struct BigQueryDestination {
9788        /// Required. The ID of a BigQuery Dataset.
9789        pub dataset_id: std::string::String,
9790
9791        /// Required. The prefix of exported BigQuery tables.
9792        pub table_id_prefix: std::string::String,
9793
9794        /// Required. Describes the table type. The following values are supported:
9795        ///
9796        /// * `table`: A BigQuery native table.
9797        /// * `view`: A virtual table defined by a SQL query.
9798        pub table_type: std::string::String,
9799
9800        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9801    }
9802
9803    impl BigQueryDestination {
9804        pub fn new() -> Self {
9805            std::default::Default::default()
9806        }
9807
9808        /// Sets the value of [dataset_id][crate::model::output_config::BigQueryDestination::dataset_id].
9809        ///
9810        /// # Example
9811        /// ```ignore,no_run
9812        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9813        /// let x = BigQueryDestination::new().set_dataset_id("example");
9814        /// ```
9815        pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9816            self.dataset_id = v.into();
9817            self
9818        }
9819
9820        /// Sets the value of [table_id_prefix][crate::model::output_config::BigQueryDestination::table_id_prefix].
9821        ///
9822        /// # Example
9823        /// ```ignore,no_run
9824        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9825        /// let x = BigQueryDestination::new().set_table_id_prefix("example");
9826        /// ```
9827        pub fn set_table_id_prefix<T: std::convert::Into<std::string::String>>(
9828            mut self,
9829            v: T,
9830        ) -> Self {
9831            self.table_id_prefix = v.into();
9832            self
9833        }
9834
9835        /// Sets the value of [table_type][crate::model::output_config::BigQueryDestination::table_type].
9836        ///
9837        /// # Example
9838        /// ```ignore,no_run
9839        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9840        /// let x = BigQueryDestination::new().set_table_type("example");
9841        /// ```
9842        pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9843            self.table_type = v.into();
9844            self
9845        }
9846    }
9847
9848    impl wkt::message::Message for BigQueryDestination {
9849        fn typename() -> &'static str {
9850            "type.googleapis.com/google.cloud.retail.v2.OutputConfig.BigQueryDestination"
9851        }
9852    }
9853
9854    /// The configuration of destination for holding output data.
9855    #[derive(Clone, Debug, PartialEq)]
9856    #[non_exhaustive]
9857    pub enum Destination {
9858        /// The Google Cloud Storage location where the output is to be written to.
9859        GcsDestination(std::boxed::Box<crate::model::output_config::GcsDestination>),
9860        /// The BigQuery location where the output is to be written to.
9861        BigqueryDestination(std::boxed::Box<crate::model::output_config::BigQueryDestination>),
9862    }
9863}
9864
9865/// Configuration of destination for Export related errors.
9866#[derive(Clone, Default, PartialEq)]
9867#[non_exhaustive]
9868pub struct ExportErrorsConfig {
9869    /// Required. Errors destination.
9870    pub destination: std::option::Option<crate::model::export_errors_config::Destination>,
9871
9872    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9873}
9874
9875impl ExportErrorsConfig {
9876    pub fn new() -> Self {
9877        std::default::Default::default()
9878    }
9879
9880    /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination].
9881    ///
9882    /// Note that all the setters affecting `destination` are mutually
9883    /// exclusive.
9884    ///
9885    /// # Example
9886    /// ```ignore,no_run
9887    /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
9888    /// use google_cloud_retail_v2::model::export_errors_config::Destination;
9889    /// let x = ExportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
9890    /// ```
9891    pub fn set_destination<
9892        T: std::convert::Into<std::option::Option<crate::model::export_errors_config::Destination>>,
9893    >(
9894        mut self,
9895        v: T,
9896    ) -> Self {
9897        self.destination = v.into();
9898        self
9899    }
9900
9901    /// The value of [destination][crate::model::ExportErrorsConfig::destination]
9902    /// if it holds a `GcsPrefix`, `None` if the field is not set or
9903    /// holds a different branch.
9904    pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
9905        #[allow(unreachable_patterns)]
9906        self.destination.as_ref().and_then(|v| match v {
9907            crate::model::export_errors_config::Destination::GcsPrefix(v) => {
9908                std::option::Option::Some(v)
9909            }
9910            _ => std::option::Option::None,
9911        })
9912    }
9913
9914    /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination]
9915    /// to hold a `GcsPrefix`.
9916    ///
9917    /// Note that all the setters affecting `destination` are
9918    /// mutually exclusive.
9919    ///
9920    /// # Example
9921    /// ```ignore,no_run
9922    /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
9923    /// let x = ExportErrorsConfig::new().set_gcs_prefix("example");
9924    /// assert!(x.gcs_prefix().is_some());
9925    /// ```
9926    pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9927        self.destination = std::option::Option::Some(
9928            crate::model::export_errors_config::Destination::GcsPrefix(v.into()),
9929        );
9930        self
9931    }
9932}
9933
9934impl wkt::message::Message for ExportErrorsConfig {
9935    fn typename() -> &'static str {
9936        "type.googleapis.com/google.cloud.retail.v2.ExportErrorsConfig"
9937    }
9938}
9939
9940/// Defines additional types related to [ExportErrorsConfig].
9941pub mod export_errors_config {
9942    #[allow(unused_imports)]
9943    use super::*;
9944
9945    /// Required. Errors destination.
9946    #[derive(Clone, Debug, PartialEq)]
9947    #[non_exhaustive]
9948    pub enum Destination {
9949        /// Google Cloud Storage path for import errors. This must be an empty,
9950        /// existing Cloud Storage bucket. Export errors will be written to a file in
9951        /// this bucket, one per line, as a JSON-encoded
9952        /// `google.rpc.Status` message.
9953        GcsPrefix(std::string::String),
9954    }
9955}
9956
9957/// Request message for the `ExportAnalyticsMetrics` method.
9958#[derive(Clone, Default, PartialEq)]
9959#[non_exhaustive]
9960pub struct ExportAnalyticsMetricsRequest {
9961    /// Required. Full resource name of the parent catalog.
9962    /// Expected format: `projects/*/locations/*/catalogs/*`
9963    pub catalog: std::string::String,
9964
9965    /// Required. The output location of the data.
9966    pub output_config: std::option::Option<crate::model::OutputConfig>,
9967
9968    /// A filtering expression to specify restrictions on returned metrics.
9969    /// The expression is a sequence of terms. Each term applies a restriction to
9970    /// the returned metrics. Use this expression to restrict results to a
9971    /// specific time range.
9972    ///
9973    /// Currently we expect only one types of fields:
9974    ///
9975    /// * `timestamp`: This can be specified twice, once with a
9976    ///   less than operator and once with a greater than operator. The
9977    ///   `timestamp` restriction should result in one, contiguous, valid,
9978    ///   `timestamp` range.
9979    ///
9980    /// Some examples of valid filters expressions:
9981    ///
9982    /// * Example 1: `timestamp > "2012-04-23T18:25:43.511Z"
9983    ///   timestamp < "2012-04-23T18:30:43.511Z"`
9984    /// * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"`
9985    pub filter: std::string::String,
9986
9987    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9988}
9989
9990impl ExportAnalyticsMetricsRequest {
9991    pub fn new() -> Self {
9992        std::default::Default::default()
9993    }
9994
9995    /// Sets the value of [catalog][crate::model::ExportAnalyticsMetricsRequest::catalog].
9996    ///
9997    /// # Example
9998    /// ```ignore,no_run
9999    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10000    /// let x = ExportAnalyticsMetricsRequest::new().set_catalog("example");
10001    /// ```
10002    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10003        self.catalog = v.into();
10004        self
10005    }
10006
10007    /// Sets the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10008    ///
10009    /// # Example
10010    /// ```ignore,no_run
10011    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10012    /// use google_cloud_retail_v2::model::OutputConfig;
10013    /// let x = ExportAnalyticsMetricsRequest::new().set_output_config(OutputConfig::default()/* use setters */);
10014    /// ```
10015    pub fn set_output_config<T>(mut self, v: T) -> Self
10016    where
10017        T: std::convert::Into<crate::model::OutputConfig>,
10018    {
10019        self.output_config = std::option::Option::Some(v.into());
10020        self
10021    }
10022
10023    /// Sets or clears the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10024    ///
10025    /// # Example
10026    /// ```ignore,no_run
10027    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10028    /// use google_cloud_retail_v2::model::OutputConfig;
10029    /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
10030    /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(None::<OutputConfig>);
10031    /// ```
10032    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10033    where
10034        T: std::convert::Into<crate::model::OutputConfig>,
10035    {
10036        self.output_config = v.map(|x| x.into());
10037        self
10038    }
10039
10040    /// Sets the value of [filter][crate::model::ExportAnalyticsMetricsRequest::filter].
10041    ///
10042    /// # Example
10043    /// ```ignore,no_run
10044    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10045    /// let x = ExportAnalyticsMetricsRequest::new().set_filter("example");
10046    /// ```
10047    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10048        self.filter = v.into();
10049        self
10050    }
10051}
10052
10053impl wkt::message::Message for ExportAnalyticsMetricsRequest {
10054    fn typename() -> &'static str {
10055        "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"
10056    }
10057}
10058
10059/// Metadata related to the progress of the Export operation. This is
10060/// returned by the google.longrunning.Operation.metadata field.
10061#[derive(Clone, Default, PartialEq)]
10062#[non_exhaustive]
10063pub struct ExportMetadata {
10064    /// Operation create time.
10065    pub create_time: std::option::Option<wkt::Timestamp>,
10066
10067    /// Operation last update time. If the operation is done, this is also the
10068    /// finish time.
10069    pub update_time: std::option::Option<wkt::Timestamp>,
10070
10071    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10072}
10073
10074impl ExportMetadata {
10075    pub fn new() -> Self {
10076        std::default::Default::default()
10077    }
10078
10079    /// Sets the value of [create_time][crate::model::ExportMetadata::create_time].
10080    ///
10081    /// # Example
10082    /// ```ignore,no_run
10083    /// # use google_cloud_retail_v2::model::ExportMetadata;
10084    /// use wkt::Timestamp;
10085    /// let x = ExportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10086    /// ```
10087    pub fn set_create_time<T>(mut self, v: T) -> Self
10088    where
10089        T: std::convert::Into<wkt::Timestamp>,
10090    {
10091        self.create_time = std::option::Option::Some(v.into());
10092        self
10093    }
10094
10095    /// Sets or clears the value of [create_time][crate::model::ExportMetadata::create_time].
10096    ///
10097    /// # Example
10098    /// ```ignore,no_run
10099    /// # use google_cloud_retail_v2::model::ExportMetadata;
10100    /// use wkt::Timestamp;
10101    /// let x = ExportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10102    /// let x = ExportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10103    /// ```
10104    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10105    where
10106        T: std::convert::Into<wkt::Timestamp>,
10107    {
10108        self.create_time = v.map(|x| x.into());
10109        self
10110    }
10111
10112    /// Sets the value of [update_time][crate::model::ExportMetadata::update_time].
10113    ///
10114    /// # Example
10115    /// ```ignore,no_run
10116    /// # use google_cloud_retail_v2::model::ExportMetadata;
10117    /// use wkt::Timestamp;
10118    /// let x = ExportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10119    /// ```
10120    pub fn set_update_time<T>(mut self, v: T) -> Self
10121    where
10122        T: std::convert::Into<wkt::Timestamp>,
10123    {
10124        self.update_time = std::option::Option::Some(v.into());
10125        self
10126    }
10127
10128    /// Sets or clears the value of [update_time][crate::model::ExportMetadata::update_time].
10129    ///
10130    /// # Example
10131    /// ```ignore,no_run
10132    /// # use google_cloud_retail_v2::model::ExportMetadata;
10133    /// use wkt::Timestamp;
10134    /// let x = ExportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10135    /// let x = ExportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10136    /// ```
10137    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10138    where
10139        T: std::convert::Into<wkt::Timestamp>,
10140    {
10141        self.update_time = v.map(|x| x.into());
10142        self
10143    }
10144}
10145
10146impl wkt::message::Message for ExportMetadata {
10147    fn typename() -> &'static str {
10148        "type.googleapis.com/google.cloud.retail.v2.ExportMetadata"
10149    }
10150}
10151
10152/// Response of the ExportAnalyticsMetricsRequest. If the long running
10153/// operation was successful, then this message is returned by the
10154/// google.longrunning.Operations.response field if the operation was successful.
10155#[derive(Clone, Default, PartialEq)]
10156#[non_exhaustive]
10157pub struct ExportAnalyticsMetricsResponse {
10158    /// A sample of errors encountered while processing the request.
10159    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
10160
10161    /// This field is never set.
10162    pub errors_config: std::option::Option<crate::model::ExportErrorsConfig>,
10163
10164    /// Output result indicating where the data were exported to.
10165    pub output_result: std::option::Option<crate::model::OutputResult>,
10166
10167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10168}
10169
10170impl ExportAnalyticsMetricsResponse {
10171    pub fn new() -> Self {
10172        std::default::Default::default()
10173    }
10174
10175    /// Sets the value of [error_samples][crate::model::ExportAnalyticsMetricsResponse::error_samples].
10176    ///
10177    /// # Example
10178    /// ```ignore,no_run
10179    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10180    /// use google_cloud_rpc::model::Status;
10181    /// let x = ExportAnalyticsMetricsResponse::new()
10182    ///     .set_error_samples([
10183    ///         Status::default()/* use setters */,
10184    ///         Status::default()/* use (different) setters */,
10185    ///     ]);
10186    /// ```
10187    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
10188    where
10189        T: std::iter::IntoIterator<Item = V>,
10190        V: std::convert::Into<google_cloud_rpc::model::Status>,
10191    {
10192        use std::iter::Iterator;
10193        self.error_samples = v.into_iter().map(|i| i.into()).collect();
10194        self
10195    }
10196
10197    /// Sets the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10198    ///
10199    /// # Example
10200    /// ```ignore,no_run
10201    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10202    /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10203    /// let x = ExportAnalyticsMetricsResponse::new().set_errors_config(ExportErrorsConfig::default()/* use setters */);
10204    /// ```
10205    pub fn set_errors_config<T>(mut self, v: T) -> Self
10206    where
10207        T: std::convert::Into<crate::model::ExportErrorsConfig>,
10208    {
10209        self.errors_config = std::option::Option::Some(v.into());
10210        self
10211    }
10212
10213    /// Sets or clears the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10214    ///
10215    /// # Example
10216    /// ```ignore,no_run
10217    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10218    /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10219    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(Some(ExportErrorsConfig::default()/* use setters */));
10220    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(None::<ExportErrorsConfig>);
10221    /// ```
10222    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
10223    where
10224        T: std::convert::Into<crate::model::ExportErrorsConfig>,
10225    {
10226        self.errors_config = v.map(|x| x.into());
10227        self
10228    }
10229
10230    /// Sets the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10231    ///
10232    /// # Example
10233    /// ```ignore,no_run
10234    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10235    /// use google_cloud_retail_v2::model::OutputResult;
10236    /// let x = ExportAnalyticsMetricsResponse::new().set_output_result(OutputResult::default()/* use setters */);
10237    /// ```
10238    pub fn set_output_result<T>(mut self, v: T) -> Self
10239    where
10240        T: std::convert::Into<crate::model::OutputResult>,
10241    {
10242        self.output_result = std::option::Option::Some(v.into());
10243        self
10244    }
10245
10246    /// Sets or clears the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10247    ///
10248    /// # Example
10249    /// ```ignore,no_run
10250    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10251    /// use google_cloud_retail_v2::model::OutputResult;
10252    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(Some(OutputResult::default()/* use setters */));
10253    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(None::<OutputResult>);
10254    /// ```
10255    pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
10256    where
10257        T: std::convert::Into<crate::model::OutputResult>,
10258    {
10259        self.output_result = v.map(|x| x.into());
10260        self
10261    }
10262}
10263
10264impl wkt::message::Message for ExportAnalyticsMetricsResponse {
10265    fn typename() -> &'static str {
10266        "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"
10267    }
10268}
10269
10270/// Output result that stores the information about where the exported data is
10271/// stored.
10272#[derive(Clone, Default, PartialEq)]
10273#[non_exhaustive]
10274pub struct OutputResult {
10275    /// The BigQuery location where the result is stored.
10276    pub bigquery_result: std::vec::Vec<crate::model::BigQueryOutputResult>,
10277
10278    /// The Google Cloud Storage location where the result is stored.
10279    pub gcs_result: std::vec::Vec<crate::model::GcsOutputResult>,
10280
10281    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10282}
10283
10284impl OutputResult {
10285    pub fn new() -> Self {
10286        std::default::Default::default()
10287    }
10288
10289    /// Sets the value of [bigquery_result][crate::model::OutputResult::bigquery_result].
10290    ///
10291    /// # Example
10292    /// ```ignore,no_run
10293    /// # use google_cloud_retail_v2::model::OutputResult;
10294    /// use google_cloud_retail_v2::model::BigQueryOutputResult;
10295    /// let x = OutputResult::new()
10296    ///     .set_bigquery_result([
10297    ///         BigQueryOutputResult::default()/* use setters */,
10298    ///         BigQueryOutputResult::default()/* use (different) setters */,
10299    ///     ]);
10300    /// ```
10301    pub fn set_bigquery_result<T, V>(mut self, v: T) -> Self
10302    where
10303        T: std::iter::IntoIterator<Item = V>,
10304        V: std::convert::Into<crate::model::BigQueryOutputResult>,
10305    {
10306        use std::iter::Iterator;
10307        self.bigquery_result = v.into_iter().map(|i| i.into()).collect();
10308        self
10309    }
10310
10311    /// Sets the value of [gcs_result][crate::model::OutputResult::gcs_result].
10312    ///
10313    /// # Example
10314    /// ```ignore,no_run
10315    /// # use google_cloud_retail_v2::model::OutputResult;
10316    /// use google_cloud_retail_v2::model::GcsOutputResult;
10317    /// let x = OutputResult::new()
10318    ///     .set_gcs_result([
10319    ///         GcsOutputResult::default()/* use setters */,
10320    ///         GcsOutputResult::default()/* use (different) setters */,
10321    ///     ]);
10322    /// ```
10323    pub fn set_gcs_result<T, V>(mut self, v: T) -> Self
10324    where
10325        T: std::iter::IntoIterator<Item = V>,
10326        V: std::convert::Into<crate::model::GcsOutputResult>,
10327    {
10328        use std::iter::Iterator;
10329        self.gcs_result = v.into_iter().map(|i| i.into()).collect();
10330        self
10331    }
10332}
10333
10334impl wkt::message::Message for OutputResult {
10335    fn typename() -> &'static str {
10336        "type.googleapis.com/google.cloud.retail.v2.OutputResult"
10337    }
10338}
10339
10340/// A BigQuery output result.
10341#[derive(Clone, Default, PartialEq)]
10342#[non_exhaustive]
10343pub struct BigQueryOutputResult {
10344    /// The ID of a BigQuery Dataset.
10345    pub dataset_id: std::string::String,
10346
10347    /// The ID of a BigQuery Table.
10348    pub table_id: std::string::String,
10349
10350    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10351}
10352
10353impl BigQueryOutputResult {
10354    pub fn new() -> Self {
10355        std::default::Default::default()
10356    }
10357
10358    /// Sets the value of [dataset_id][crate::model::BigQueryOutputResult::dataset_id].
10359    ///
10360    /// # Example
10361    /// ```ignore,no_run
10362    /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10363    /// let x = BigQueryOutputResult::new().set_dataset_id("example");
10364    /// ```
10365    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10366        self.dataset_id = v.into();
10367        self
10368    }
10369
10370    /// Sets the value of [table_id][crate::model::BigQueryOutputResult::table_id].
10371    ///
10372    /// # Example
10373    /// ```ignore,no_run
10374    /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10375    /// let x = BigQueryOutputResult::new().set_table_id("example");
10376    /// ```
10377    pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10378        self.table_id = v.into();
10379        self
10380    }
10381}
10382
10383impl wkt::message::Message for BigQueryOutputResult {
10384    fn typename() -> &'static str {
10385        "type.googleapis.com/google.cloud.retail.v2.BigQueryOutputResult"
10386    }
10387}
10388
10389/// A Gcs output result.
10390#[derive(Clone, Default, PartialEq)]
10391#[non_exhaustive]
10392pub struct GcsOutputResult {
10393    /// The uri of Gcs output
10394    pub output_uri: std::string::String,
10395
10396    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10397}
10398
10399impl GcsOutputResult {
10400    pub fn new() -> Self {
10401        std::default::Default::default()
10402    }
10403
10404    /// Sets the value of [output_uri][crate::model::GcsOutputResult::output_uri].
10405    ///
10406    /// # Example
10407    /// ```ignore,no_run
10408    /// # use google_cloud_retail_v2::model::GcsOutputResult;
10409    /// let x = GcsOutputResult::new().set_output_uri("example");
10410    /// ```
10411    pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10412        self.output_uri = v.into();
10413        self
10414    }
10415}
10416
10417impl wkt::message::Message for GcsOutputResult {
10418    fn typename() -> &'static str {
10419        "type.googleapis.com/google.cloud.retail.v2.GcsOutputResult"
10420    }
10421}
10422
10423/// Configuration for overall generative question feature state.
10424#[derive(Clone, Default, PartialEq)]
10425#[non_exhaustive]
10426pub struct GenerativeQuestionsFeatureConfig {
10427    /// Required. Resource name of the affected catalog.
10428    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10429    pub catalog: std::string::String,
10430
10431    /// Optional. Determines whether questions will be used at serving time.
10432    /// Note: This feature cannot be enabled until initial data requirements are
10433    /// satisfied.
10434    pub feature_enabled: bool,
10435
10436    /// Optional. Minimum number of products in the response to trigger follow-up
10437    /// questions. Value must be 0 or positive.
10438    pub minimum_products: i32,
10439
10440    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10441}
10442
10443impl GenerativeQuestionsFeatureConfig {
10444    pub fn new() -> Self {
10445        std::default::Default::default()
10446    }
10447
10448    /// Sets the value of [catalog][crate::model::GenerativeQuestionsFeatureConfig::catalog].
10449    ///
10450    /// # Example
10451    /// ```ignore,no_run
10452    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10453    /// let x = GenerativeQuestionsFeatureConfig::new().set_catalog("example");
10454    /// ```
10455    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10456        self.catalog = v.into();
10457        self
10458    }
10459
10460    /// Sets the value of [feature_enabled][crate::model::GenerativeQuestionsFeatureConfig::feature_enabled].
10461    ///
10462    /// # Example
10463    /// ```ignore,no_run
10464    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10465    /// let x = GenerativeQuestionsFeatureConfig::new().set_feature_enabled(true);
10466    /// ```
10467    pub fn set_feature_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10468        self.feature_enabled = v.into();
10469        self
10470    }
10471
10472    /// Sets the value of [minimum_products][crate::model::GenerativeQuestionsFeatureConfig::minimum_products].
10473    ///
10474    /// # Example
10475    /// ```ignore,no_run
10476    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10477    /// let x = GenerativeQuestionsFeatureConfig::new().set_minimum_products(42);
10478    /// ```
10479    pub fn set_minimum_products<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10480        self.minimum_products = v.into();
10481        self
10482    }
10483}
10484
10485impl wkt::message::Message for GenerativeQuestionsFeatureConfig {
10486    fn typename() -> &'static str {
10487        "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionsFeatureConfig"
10488    }
10489}
10490
10491/// Configuration for a single generated question.
10492#[derive(Clone, Default, PartialEq)]
10493#[non_exhaustive]
10494pub struct GenerativeQuestionConfig {
10495    /// Required. Resource name of the catalog.
10496    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10497    pub catalog: std::string::String,
10498
10499    /// Required. The facet to which the question is associated.
10500    pub facet: std::string::String,
10501
10502    /// Output only. The LLM generated question.
10503    pub generated_question: std::string::String,
10504
10505    /// Optional. The question that will be used at serving time.
10506    /// Question can have a max length of 300 bytes.
10507    /// When not populated, generated_question should be used.
10508    pub final_question: std::string::String,
10509
10510    /// Output only. Values that can be used to answer the question.
10511    pub example_values: std::vec::Vec<std::string::String>,
10512
10513    /// Output only. The ratio of how often a question was asked.
10514    pub frequency: f32,
10515
10516    /// Optional. Whether the question is asked at serving time.
10517    pub allowed_in_conversation: bool,
10518
10519    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10520}
10521
10522impl GenerativeQuestionConfig {
10523    pub fn new() -> Self {
10524        std::default::Default::default()
10525    }
10526
10527    /// Sets the value of [catalog][crate::model::GenerativeQuestionConfig::catalog].
10528    ///
10529    /// # Example
10530    /// ```ignore,no_run
10531    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10532    /// let x = GenerativeQuestionConfig::new().set_catalog("example");
10533    /// ```
10534    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10535        self.catalog = v.into();
10536        self
10537    }
10538
10539    /// Sets the value of [facet][crate::model::GenerativeQuestionConfig::facet].
10540    ///
10541    /// # Example
10542    /// ```ignore,no_run
10543    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10544    /// let x = GenerativeQuestionConfig::new().set_facet("example");
10545    /// ```
10546    pub fn set_facet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10547        self.facet = v.into();
10548        self
10549    }
10550
10551    /// Sets the value of [generated_question][crate::model::GenerativeQuestionConfig::generated_question].
10552    ///
10553    /// # Example
10554    /// ```ignore,no_run
10555    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10556    /// let x = GenerativeQuestionConfig::new().set_generated_question("example");
10557    /// ```
10558    pub fn set_generated_question<T: std::convert::Into<std::string::String>>(
10559        mut self,
10560        v: T,
10561    ) -> Self {
10562        self.generated_question = v.into();
10563        self
10564    }
10565
10566    /// Sets the value of [final_question][crate::model::GenerativeQuestionConfig::final_question].
10567    ///
10568    /// # Example
10569    /// ```ignore,no_run
10570    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10571    /// let x = GenerativeQuestionConfig::new().set_final_question("example");
10572    /// ```
10573    pub fn set_final_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10574        self.final_question = v.into();
10575        self
10576    }
10577
10578    /// Sets the value of [example_values][crate::model::GenerativeQuestionConfig::example_values].
10579    ///
10580    /// # Example
10581    /// ```ignore,no_run
10582    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10583    /// let x = GenerativeQuestionConfig::new().set_example_values(["a", "b", "c"]);
10584    /// ```
10585    pub fn set_example_values<T, V>(mut self, v: T) -> Self
10586    where
10587        T: std::iter::IntoIterator<Item = V>,
10588        V: std::convert::Into<std::string::String>,
10589    {
10590        use std::iter::Iterator;
10591        self.example_values = v.into_iter().map(|i| i.into()).collect();
10592        self
10593    }
10594
10595    /// Sets the value of [frequency][crate::model::GenerativeQuestionConfig::frequency].
10596    ///
10597    /// # Example
10598    /// ```ignore,no_run
10599    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10600    /// let x = GenerativeQuestionConfig::new().set_frequency(42.0);
10601    /// ```
10602    pub fn set_frequency<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
10603        self.frequency = v.into();
10604        self
10605    }
10606
10607    /// Sets the value of [allowed_in_conversation][crate::model::GenerativeQuestionConfig::allowed_in_conversation].
10608    ///
10609    /// # Example
10610    /// ```ignore,no_run
10611    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10612    /// let x = GenerativeQuestionConfig::new().set_allowed_in_conversation(true);
10613    /// ```
10614    pub fn set_allowed_in_conversation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10615        self.allowed_in_conversation = v.into();
10616        self
10617    }
10618}
10619
10620impl wkt::message::Message for GenerativeQuestionConfig {
10621    fn typename() -> &'static str {
10622        "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionConfig"
10623    }
10624}
10625
10626/// Request for UpdateGenerativeQuestionsFeatureConfig method.
10627#[derive(Clone, Default, PartialEq)]
10628#[non_exhaustive]
10629pub struct UpdateGenerativeQuestionsFeatureConfigRequest {
10630    /// Required. The configuration managing the feature state.
10631    pub generative_questions_feature_config:
10632        std::option::Option<crate::model::GenerativeQuestionsFeatureConfig>,
10633
10634    /// Optional. Indicates which fields in the provided
10635    /// [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]
10636    /// to update. If not set or empty, all supported fields are updated.
10637    ///
10638    /// [google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]: crate::model::GenerativeQuestionsFeatureConfig
10639    pub update_mask: std::option::Option<wkt::FieldMask>,
10640
10641    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10642}
10643
10644impl UpdateGenerativeQuestionsFeatureConfigRequest {
10645    pub fn new() -> Self {
10646        std::default::Default::default()
10647    }
10648
10649    /// Sets the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10650    ///
10651    /// # Example
10652    /// ```ignore,no_run
10653    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10654    /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10655    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_generative_questions_feature_config(GenerativeQuestionsFeatureConfig::default()/* use setters */);
10656    /// ```
10657    pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
10658    where
10659        T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10660    {
10661        self.generative_questions_feature_config = std::option::Option::Some(v.into());
10662        self
10663    }
10664
10665    /// Sets or clears the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10666    ///
10667    /// # Example
10668    /// ```ignore,no_run
10669    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10670    /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10671    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(Some(GenerativeQuestionsFeatureConfig::default()/* use setters */));
10672    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(None::<GenerativeQuestionsFeatureConfig>);
10673    /// ```
10674    pub fn set_or_clear_generative_questions_feature_config<T>(
10675        mut self,
10676        v: std::option::Option<T>,
10677    ) -> Self
10678    where
10679        T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10680    {
10681        self.generative_questions_feature_config = v.map(|x| x.into());
10682        self
10683    }
10684
10685    /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10686    ///
10687    /// # Example
10688    /// ```ignore,no_run
10689    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10690    /// use wkt::FieldMask;
10691    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10692    /// ```
10693    pub fn set_update_mask<T>(mut self, v: T) -> Self
10694    where
10695        T: std::convert::Into<wkt::FieldMask>,
10696    {
10697        self.update_mask = std::option::Option::Some(v.into());
10698        self
10699    }
10700
10701    /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10702    ///
10703    /// # Example
10704    /// ```ignore,no_run
10705    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10706    /// use wkt::FieldMask;
10707    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10708    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10709    /// ```
10710    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10711    where
10712        T: std::convert::Into<wkt::FieldMask>,
10713    {
10714        self.update_mask = v.map(|x| x.into());
10715        self
10716    }
10717}
10718
10719impl wkt::message::Message for UpdateGenerativeQuestionsFeatureConfigRequest {
10720    fn typename() -> &'static str {
10721        "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest"
10722    }
10723}
10724
10725/// Request for GetGenerativeQuestionsFeatureConfig method.
10726#[derive(Clone, Default, PartialEq)]
10727#[non_exhaustive]
10728pub struct GetGenerativeQuestionsFeatureConfigRequest {
10729    /// Required. Resource name of the parent catalog.
10730    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10731    pub catalog: std::string::String,
10732
10733    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10734}
10735
10736impl GetGenerativeQuestionsFeatureConfigRequest {
10737    pub fn new() -> Self {
10738        std::default::Default::default()
10739    }
10740
10741    /// Sets the value of [catalog][crate::model::GetGenerativeQuestionsFeatureConfigRequest::catalog].
10742    ///
10743    /// # Example
10744    /// ```ignore,no_run
10745    /// # use google_cloud_retail_v2::model::GetGenerativeQuestionsFeatureConfigRequest;
10746    /// let x = GetGenerativeQuestionsFeatureConfigRequest::new().set_catalog("example");
10747    /// ```
10748    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10749        self.catalog = v.into();
10750        self
10751    }
10752}
10753
10754impl wkt::message::Message for GetGenerativeQuestionsFeatureConfigRequest {
10755    fn typename() -> &'static str {
10756        "type.googleapis.com/google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest"
10757    }
10758}
10759
10760/// Request for ListQuestions method.
10761#[derive(Clone, Default, PartialEq)]
10762#[non_exhaustive]
10763pub struct ListGenerativeQuestionConfigsRequest {
10764    /// Required. Resource name of the parent catalog.
10765    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10766    pub parent: std::string::String,
10767
10768    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10769}
10770
10771impl ListGenerativeQuestionConfigsRequest {
10772    pub fn new() -> Self {
10773        std::default::Default::default()
10774    }
10775
10776    /// Sets the value of [parent][crate::model::ListGenerativeQuestionConfigsRequest::parent].
10777    ///
10778    /// # Example
10779    /// ```ignore,no_run
10780    /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsRequest;
10781    /// let x = ListGenerativeQuestionConfigsRequest::new().set_parent("example");
10782    /// ```
10783    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10784        self.parent = v.into();
10785        self
10786    }
10787}
10788
10789impl wkt::message::Message for ListGenerativeQuestionConfigsRequest {
10790    fn typename() -> &'static str {
10791        "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest"
10792    }
10793}
10794
10795/// Response for ListQuestions method.
10796#[derive(Clone, Default, PartialEq)]
10797#[non_exhaustive]
10798pub struct ListGenerativeQuestionConfigsResponse {
10799    /// All the questions for a given catalog.
10800    pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
10801
10802    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10803}
10804
10805impl ListGenerativeQuestionConfigsResponse {
10806    pub fn new() -> Self {
10807        std::default::Default::default()
10808    }
10809
10810    /// Sets the value of [generative_question_configs][crate::model::ListGenerativeQuestionConfigsResponse::generative_question_configs].
10811    ///
10812    /// # Example
10813    /// ```ignore,no_run
10814    /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsResponse;
10815    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10816    /// let x = ListGenerativeQuestionConfigsResponse::new()
10817    ///     .set_generative_question_configs([
10818    ///         GenerativeQuestionConfig::default()/* use setters */,
10819    ///         GenerativeQuestionConfig::default()/* use (different) setters */,
10820    ///     ]);
10821    /// ```
10822    pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
10823    where
10824        T: std::iter::IntoIterator<Item = V>,
10825        V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10826    {
10827        use std::iter::Iterator;
10828        self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
10829        self
10830    }
10831}
10832
10833impl wkt::message::Message for ListGenerativeQuestionConfigsResponse {
10834    fn typename() -> &'static str {
10835        "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse"
10836    }
10837}
10838
10839/// Request for UpdateGenerativeQuestionConfig method.
10840#[derive(Clone, Default, PartialEq)]
10841#[non_exhaustive]
10842pub struct UpdateGenerativeQuestionConfigRequest {
10843    /// Required. The question to update.
10844    pub generative_question_config: std::option::Option<crate::model::GenerativeQuestionConfig>,
10845
10846    /// Optional. Indicates which fields in the provided
10847    /// [GenerativeQuestionConfig][google.cloud.retail.v2.GenerativeQuestionConfig]
10848    /// to update. The following are NOT supported:
10849    ///
10850    /// * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2.GenerativeQuestionConfig.frequency]
10851    ///
10852    /// If not set or empty, all supported fields are updated.
10853    ///
10854    /// [google.cloud.retail.v2.GenerativeQuestionConfig]: crate::model::GenerativeQuestionConfig
10855    /// [google.cloud.retail.v2.GenerativeQuestionConfig.frequency]: crate::model::GenerativeQuestionConfig::frequency
10856    pub update_mask: std::option::Option<wkt::FieldMask>,
10857
10858    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10859}
10860
10861impl UpdateGenerativeQuestionConfigRequest {
10862    pub fn new() -> Self {
10863        std::default::Default::default()
10864    }
10865
10866    /// Sets the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10867    ///
10868    /// # Example
10869    /// ```ignore,no_run
10870    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10871    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10872    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_generative_question_config(GenerativeQuestionConfig::default()/* use setters */);
10873    /// ```
10874    pub fn set_generative_question_config<T>(mut self, v: T) -> Self
10875    where
10876        T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10877    {
10878        self.generative_question_config = std::option::Option::Some(v.into());
10879        self
10880    }
10881
10882    /// Sets or clears the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
10883    ///
10884    /// # Example
10885    /// ```ignore,no_run
10886    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10887    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10888    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(Some(GenerativeQuestionConfig::default()/* use setters */));
10889    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(None::<GenerativeQuestionConfig>);
10890    /// ```
10891    pub fn set_or_clear_generative_question_config<T>(mut self, v: std::option::Option<T>) -> Self
10892    where
10893        T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10894    {
10895        self.generative_question_config = v.map(|x| x.into());
10896        self
10897    }
10898
10899    /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
10900    ///
10901    /// # Example
10902    /// ```ignore,no_run
10903    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10904    /// use wkt::FieldMask;
10905    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10906    /// ```
10907    pub fn set_update_mask<T>(mut self, v: T) -> Self
10908    where
10909        T: std::convert::Into<wkt::FieldMask>,
10910    {
10911        self.update_mask = std::option::Option::Some(v.into());
10912        self
10913    }
10914
10915    /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
10916    ///
10917    /// # Example
10918    /// ```ignore,no_run
10919    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10920    /// use wkt::FieldMask;
10921    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10922    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10923    /// ```
10924    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10925    where
10926        T: std::convert::Into<wkt::FieldMask>,
10927    {
10928        self.update_mask = v.map(|x| x.into());
10929        self
10930    }
10931}
10932
10933impl wkt::message::Message for UpdateGenerativeQuestionConfigRequest {
10934    fn typename() -> &'static str {
10935        "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest"
10936    }
10937}
10938
10939/// Request for BatchUpdateGenerativeQuestionConfig method.
10940#[derive(Clone, Default, PartialEq)]
10941#[non_exhaustive]
10942pub struct BatchUpdateGenerativeQuestionConfigsRequest {
10943    /// Optional. Resource name of the parent catalog.
10944    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10945    pub parent: std::string::String,
10946
10947    /// Required. The updates question configs.
10948    pub requests: std::vec::Vec<crate::model::UpdateGenerativeQuestionConfigRequest>,
10949
10950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10951}
10952
10953impl BatchUpdateGenerativeQuestionConfigsRequest {
10954    pub fn new() -> Self {
10955        std::default::Default::default()
10956    }
10957
10958    /// Sets the value of [parent][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::parent].
10959    ///
10960    /// # Example
10961    /// ```ignore,no_run
10962    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
10963    /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new().set_parent("example");
10964    /// ```
10965    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10966        self.parent = v.into();
10967        self
10968    }
10969
10970    /// Sets the value of [requests][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::requests].
10971    ///
10972    /// # Example
10973    /// ```ignore,no_run
10974    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
10975    /// use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
10976    /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new()
10977    ///     .set_requests([
10978    ///         UpdateGenerativeQuestionConfigRequest::default()/* use setters */,
10979    ///         UpdateGenerativeQuestionConfigRequest::default()/* use (different) setters */,
10980    ///     ]);
10981    /// ```
10982    pub fn set_requests<T, V>(mut self, v: T) -> Self
10983    where
10984        T: std::iter::IntoIterator<Item = V>,
10985        V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
10986    {
10987        use std::iter::Iterator;
10988        self.requests = v.into_iter().map(|i| i.into()).collect();
10989        self
10990    }
10991}
10992
10993impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsRequest {
10994    fn typename() -> &'static str {
10995        "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest"
10996    }
10997}
10998
10999/// Aggregated response for UpdateGenerativeQuestionConfig method.
11000#[derive(Clone, Default, PartialEq)]
11001#[non_exhaustive]
11002pub struct BatchUpdateGenerativeQuestionConfigsResponse {
11003    /// Optional. The updates question configs.
11004    pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
11005
11006    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11007}
11008
11009impl BatchUpdateGenerativeQuestionConfigsResponse {
11010    pub fn new() -> Self {
11011        std::default::Default::default()
11012    }
11013
11014    /// Sets the value of [generative_question_configs][crate::model::BatchUpdateGenerativeQuestionConfigsResponse::generative_question_configs].
11015    ///
11016    /// # Example
11017    /// ```ignore,no_run
11018    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsResponse;
11019    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11020    /// let x = BatchUpdateGenerativeQuestionConfigsResponse::new()
11021    ///     .set_generative_question_configs([
11022    ///         GenerativeQuestionConfig::default()/* use setters */,
11023    ///         GenerativeQuestionConfig::default()/* use (different) setters */,
11024    ///     ]);
11025    /// ```
11026    pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
11027    where
11028        T: std::iter::IntoIterator<Item = V>,
11029        V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11030    {
11031        use std::iter::Iterator;
11032        self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
11033        self
11034    }
11035}
11036
11037impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsResponse {
11038    fn typename() -> &'static str {
11039        "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse"
11040    }
11041}
11042
11043/// Google Cloud Storage location for input content.
11044#[derive(Clone, Default, PartialEq)]
11045#[non_exhaustive]
11046pub struct GcsSource {
11047    /// Required. Google Cloud Storage URIs to input files. URI can be up to
11048    /// 2000 characters long. URIs can match the full object path (for example,
11049    /// `gs://bucket/directory/object.json`) or a pattern matching one or more
11050    /// files, such as `gs://bucket/directory/*.json`. A request can
11051    /// contain at most 100 files, and each file can be up to 2 GB. See
11052    /// [Importing product
11053    /// information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
11054    /// for the expected file format and setup instructions.
11055    pub input_uris: std::vec::Vec<std::string::String>,
11056
11057    /// The schema to use when parsing the data from the source.
11058    ///
11059    /// Supported values for product imports:
11060    ///
11061    /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11062    ///   per line. Each product must
11063    ///   have a valid [Product.id][google.cloud.retail.v2.Product.id].
11064    /// * `product_merchant_center`: See [Importing catalog data from Merchant
11065    ///   Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11066    ///
11067    /// Supported values for user events imports:
11068    ///
11069    /// * `user_event` (default): One JSON
11070    ///   [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11071    /// * `user_event_ga360`: Using
11072    ///   <https://support.google.com/analytics/answer/3437719>.
11073    ///
11074    /// Supported values for control imports:
11075    ///
11076    /// * `control` (default): One JSON [Control][google.cloud.retail.v2.Control]
11077    ///   per line.
11078    ///
11079    /// Supported values for catalog attribute imports:
11080    ///
11081    /// * `catalog_attribute` (default): One CSV
11082    ///   [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line.
11083    ///
11084    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
11085    /// [google.cloud.retail.v2.Control]: crate::model::Control
11086    /// [google.cloud.retail.v2.Product]: crate::model::Product
11087    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11088    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11089    pub data_schema: std::string::String,
11090
11091    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11092}
11093
11094impl GcsSource {
11095    pub fn new() -> Self {
11096        std::default::Default::default()
11097    }
11098
11099    /// Sets the value of [input_uris][crate::model::GcsSource::input_uris].
11100    ///
11101    /// # Example
11102    /// ```ignore,no_run
11103    /// # use google_cloud_retail_v2::model::GcsSource;
11104    /// let x = GcsSource::new().set_input_uris(["a", "b", "c"]);
11105    /// ```
11106    pub fn set_input_uris<T, V>(mut self, v: T) -> Self
11107    where
11108        T: std::iter::IntoIterator<Item = V>,
11109        V: std::convert::Into<std::string::String>,
11110    {
11111        use std::iter::Iterator;
11112        self.input_uris = v.into_iter().map(|i| i.into()).collect();
11113        self
11114    }
11115
11116    /// Sets the value of [data_schema][crate::model::GcsSource::data_schema].
11117    ///
11118    /// # Example
11119    /// ```ignore,no_run
11120    /// # use google_cloud_retail_v2::model::GcsSource;
11121    /// let x = GcsSource::new().set_data_schema("example");
11122    /// ```
11123    pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11124        self.data_schema = v.into();
11125        self
11126    }
11127}
11128
11129impl wkt::message::Message for GcsSource {
11130    fn typename() -> &'static str {
11131        "type.googleapis.com/google.cloud.retail.v2.GcsSource"
11132    }
11133}
11134
11135/// BigQuery source import data from.
11136#[derive(Clone, Default, PartialEq)]
11137#[non_exhaustive]
11138pub struct BigQuerySource {
11139    /// The project ID (can be project # or ID) that the BigQuery source is in with
11140    /// a length limit of 128 characters. If not specified, inherits the project
11141    /// ID from the parent request.
11142    pub project_id: std::string::String,
11143
11144    /// Required. The BigQuery data set to copy the data from with a length limit
11145    /// of 1,024 characters.
11146    pub dataset_id: std::string::String,
11147
11148    /// Required. The BigQuery table to copy the data from with a length limit of
11149    /// 1,024 characters.
11150    pub table_id: std::string::String,
11151
11152    /// Intermediate Cloud Storage directory used for the import with a length
11153    /// limit of 2,000 characters. Can be specified if one wants to have the
11154    /// BigQuery export to a specific Cloud Storage directory.
11155    pub gcs_staging_dir: std::string::String,
11156
11157    /// The schema to use when parsing the data from the source.
11158    ///
11159    /// Supported values for product imports:
11160    ///
11161    /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11162    ///   per line. Each product must
11163    ///   have a valid [Product.id][google.cloud.retail.v2.Product.id].
11164    /// * `product_merchant_center`: See [Importing catalog data from Merchant
11165    ///   Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11166    ///
11167    /// Supported values for user events imports:
11168    ///
11169    /// * `user_event` (default): One JSON
11170    ///   [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11171    /// * `user_event_ga360`:
11172    ///   The schema is available here:
11173    ///   <https://support.google.com/analytics/answer/3437719>.
11174    /// * `user_event_ga4`:
11175    ///   The schema is available here:
11176    ///   <https://support.google.com/analytics/answer/7029846>.
11177    ///
11178    /// Supported values for autocomplete imports:
11179    ///
11180    /// * `suggestions` (default): One JSON completion suggestion per line.
11181    /// * `denylist`:  One JSON deny suggestion per line.
11182    /// * `allowlist`:  One JSON allow suggestion per line.
11183    ///
11184    /// [google.cloud.retail.v2.Product]: crate::model::Product
11185    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11186    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11187    pub data_schema: std::string::String,
11188
11189    /// BigQuery table partition info. Leave this empty if the BigQuery table
11190    /// is not partitioned.
11191    pub partition: std::option::Option<crate::model::big_query_source::Partition>,
11192
11193    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11194}
11195
11196impl BigQuerySource {
11197    pub fn new() -> Self {
11198        std::default::Default::default()
11199    }
11200
11201    /// Sets the value of [project_id][crate::model::BigQuerySource::project_id].
11202    ///
11203    /// # Example
11204    /// ```ignore,no_run
11205    /// # use google_cloud_retail_v2::model::BigQuerySource;
11206    /// let x = BigQuerySource::new().set_project_id("example");
11207    /// ```
11208    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11209        self.project_id = v.into();
11210        self
11211    }
11212
11213    /// Sets the value of [dataset_id][crate::model::BigQuerySource::dataset_id].
11214    ///
11215    /// # Example
11216    /// ```ignore,no_run
11217    /// # use google_cloud_retail_v2::model::BigQuerySource;
11218    /// let x = BigQuerySource::new().set_dataset_id("example");
11219    /// ```
11220    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11221        self.dataset_id = v.into();
11222        self
11223    }
11224
11225    /// Sets the value of [table_id][crate::model::BigQuerySource::table_id].
11226    ///
11227    /// # Example
11228    /// ```ignore,no_run
11229    /// # use google_cloud_retail_v2::model::BigQuerySource;
11230    /// let x = BigQuerySource::new().set_table_id("example");
11231    /// ```
11232    pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11233        self.table_id = v.into();
11234        self
11235    }
11236
11237    /// Sets the value of [gcs_staging_dir][crate::model::BigQuerySource::gcs_staging_dir].
11238    ///
11239    /// # Example
11240    /// ```ignore,no_run
11241    /// # use google_cloud_retail_v2::model::BigQuerySource;
11242    /// let x = BigQuerySource::new().set_gcs_staging_dir("example");
11243    /// ```
11244    pub fn set_gcs_staging_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11245        self.gcs_staging_dir = v.into();
11246        self
11247    }
11248
11249    /// Sets the value of [data_schema][crate::model::BigQuerySource::data_schema].
11250    ///
11251    /// # Example
11252    /// ```ignore,no_run
11253    /// # use google_cloud_retail_v2::model::BigQuerySource;
11254    /// let x = BigQuerySource::new().set_data_schema("example");
11255    /// ```
11256    pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11257        self.data_schema = v.into();
11258        self
11259    }
11260
11261    /// Sets the value of [partition][crate::model::BigQuerySource::partition].
11262    ///
11263    /// Note that all the setters affecting `partition` are mutually
11264    /// exclusive.
11265    ///
11266    /// # Example
11267    /// ```ignore,no_run
11268    /// # use google_cloud_retail_v2::model::BigQuerySource;
11269    /// use google_cloud_type::model::Date;
11270    /// let x = BigQuerySource::new().set_partition(Some(
11271    ///     google_cloud_retail_v2::model::big_query_source::Partition::PartitionDate(Date::default().into())));
11272    /// ```
11273    pub fn set_partition<
11274        T: std::convert::Into<std::option::Option<crate::model::big_query_source::Partition>>,
11275    >(
11276        mut self,
11277        v: T,
11278    ) -> Self {
11279        self.partition = v.into();
11280        self
11281    }
11282
11283    /// The value of [partition][crate::model::BigQuerySource::partition]
11284    /// if it holds a `PartitionDate`, `None` if the field is not set or
11285    /// holds a different branch.
11286    pub fn partition_date(
11287        &self,
11288    ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
11289        #[allow(unreachable_patterns)]
11290        self.partition.as_ref().and_then(|v| match v {
11291            crate::model::big_query_source::Partition::PartitionDate(v) => {
11292                std::option::Option::Some(v)
11293            }
11294            _ => std::option::Option::None,
11295        })
11296    }
11297
11298    /// Sets the value of [partition][crate::model::BigQuerySource::partition]
11299    /// to hold a `PartitionDate`.
11300    ///
11301    /// Note that all the setters affecting `partition` are
11302    /// mutually exclusive.
11303    ///
11304    /// # Example
11305    /// ```ignore,no_run
11306    /// # use google_cloud_retail_v2::model::BigQuerySource;
11307    /// use google_cloud_type::model::Date;
11308    /// let x = BigQuerySource::new().set_partition_date(Date::default()/* use setters */);
11309    /// assert!(x.partition_date().is_some());
11310    /// ```
11311    pub fn set_partition_date<
11312        T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
11313    >(
11314        mut self,
11315        v: T,
11316    ) -> Self {
11317        self.partition = std::option::Option::Some(
11318            crate::model::big_query_source::Partition::PartitionDate(v.into()),
11319        );
11320        self
11321    }
11322}
11323
11324impl wkt::message::Message for BigQuerySource {
11325    fn typename() -> &'static str {
11326        "type.googleapis.com/google.cloud.retail.v2.BigQuerySource"
11327    }
11328}
11329
11330/// Defines additional types related to [BigQuerySource].
11331pub mod big_query_source {
11332    #[allow(unused_imports)]
11333    use super::*;
11334
11335    /// BigQuery table partition info. Leave this empty if the BigQuery table
11336    /// is not partitioned.
11337    #[derive(Clone, Debug, PartialEq)]
11338    #[non_exhaustive]
11339    pub enum Partition {
11340        /// BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
11341        PartitionDate(std::boxed::Box<google_cloud_type::model::Date>),
11342    }
11343}
11344
11345/// The inline source for the input config for ImportProducts method.
11346#[derive(Clone, Default, PartialEq)]
11347#[non_exhaustive]
11348pub struct ProductInlineSource {
11349    /// Required. A list of products to update/create. Each product must have a
11350    /// valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
11351    /// 100 items.
11352    ///
11353    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11354    pub products: std::vec::Vec<crate::model::Product>,
11355
11356    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11357}
11358
11359impl ProductInlineSource {
11360    pub fn new() -> Self {
11361        std::default::Default::default()
11362    }
11363
11364    /// Sets the value of [products][crate::model::ProductInlineSource::products].
11365    ///
11366    /// # Example
11367    /// ```ignore,no_run
11368    /// # use google_cloud_retail_v2::model::ProductInlineSource;
11369    /// use google_cloud_retail_v2::model::Product;
11370    /// let x = ProductInlineSource::new()
11371    ///     .set_products([
11372    ///         Product::default()/* use setters */,
11373    ///         Product::default()/* use (different) setters */,
11374    ///     ]);
11375    /// ```
11376    pub fn set_products<T, V>(mut self, v: T) -> Self
11377    where
11378        T: std::iter::IntoIterator<Item = V>,
11379        V: std::convert::Into<crate::model::Product>,
11380    {
11381        use std::iter::Iterator;
11382        self.products = v.into_iter().map(|i| i.into()).collect();
11383        self
11384    }
11385}
11386
11387impl wkt::message::Message for ProductInlineSource {
11388    fn typename() -> &'static str {
11389        "type.googleapis.com/google.cloud.retail.v2.ProductInlineSource"
11390    }
11391}
11392
11393/// The inline source for the input config for ImportUserEvents method.
11394#[derive(Clone, Default, PartialEq)]
11395#[non_exhaustive]
11396pub struct UserEventInlineSource {
11397    /// Required. A list of user events to import. Recommended max of 10k items.
11398    pub user_events: std::vec::Vec<crate::model::UserEvent>,
11399
11400    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11401}
11402
11403impl UserEventInlineSource {
11404    pub fn new() -> Self {
11405        std::default::Default::default()
11406    }
11407
11408    /// Sets the value of [user_events][crate::model::UserEventInlineSource::user_events].
11409    ///
11410    /// # Example
11411    /// ```ignore,no_run
11412    /// # use google_cloud_retail_v2::model::UserEventInlineSource;
11413    /// use google_cloud_retail_v2::model::UserEvent;
11414    /// let x = UserEventInlineSource::new()
11415    ///     .set_user_events([
11416    ///         UserEvent::default()/* use setters */,
11417    ///         UserEvent::default()/* use (different) setters */,
11418    ///     ]);
11419    /// ```
11420    pub fn set_user_events<T, V>(mut self, v: T) -> Self
11421    where
11422        T: std::iter::IntoIterator<Item = V>,
11423        V: std::convert::Into<crate::model::UserEvent>,
11424    {
11425        use std::iter::Iterator;
11426        self.user_events = v.into_iter().map(|i| i.into()).collect();
11427        self
11428    }
11429}
11430
11431impl wkt::message::Message for UserEventInlineSource {
11432    fn typename() -> &'static str {
11433        "type.googleapis.com/google.cloud.retail.v2.UserEventInlineSource"
11434    }
11435}
11436
11437/// Configuration of destination for Import related errors.
11438#[derive(Clone, Default, PartialEq)]
11439#[non_exhaustive]
11440pub struct ImportErrorsConfig {
11441    /// Required. Errors destination.
11442    pub destination: std::option::Option<crate::model::import_errors_config::Destination>,
11443
11444    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11445}
11446
11447impl ImportErrorsConfig {
11448    pub fn new() -> Self {
11449        std::default::Default::default()
11450    }
11451
11452    /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination].
11453    ///
11454    /// Note that all the setters affecting `destination` are mutually
11455    /// exclusive.
11456    ///
11457    /// # Example
11458    /// ```ignore,no_run
11459    /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11460    /// use google_cloud_retail_v2::model::import_errors_config::Destination;
11461    /// let x = ImportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
11462    /// ```
11463    pub fn set_destination<
11464        T: std::convert::Into<std::option::Option<crate::model::import_errors_config::Destination>>,
11465    >(
11466        mut self,
11467        v: T,
11468    ) -> Self {
11469        self.destination = v.into();
11470        self
11471    }
11472
11473    /// The value of [destination][crate::model::ImportErrorsConfig::destination]
11474    /// if it holds a `GcsPrefix`, `None` if the field is not set or
11475    /// holds a different branch.
11476    pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
11477        #[allow(unreachable_patterns)]
11478        self.destination.as_ref().and_then(|v| match v {
11479            crate::model::import_errors_config::Destination::GcsPrefix(v) => {
11480                std::option::Option::Some(v)
11481            }
11482            _ => std::option::Option::None,
11483        })
11484    }
11485
11486    /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination]
11487    /// to hold a `GcsPrefix`.
11488    ///
11489    /// Note that all the setters affecting `destination` are
11490    /// mutually exclusive.
11491    ///
11492    /// # Example
11493    /// ```ignore,no_run
11494    /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11495    /// let x = ImportErrorsConfig::new().set_gcs_prefix("example");
11496    /// assert!(x.gcs_prefix().is_some());
11497    /// ```
11498    pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11499        self.destination = std::option::Option::Some(
11500            crate::model::import_errors_config::Destination::GcsPrefix(v.into()),
11501        );
11502        self
11503    }
11504}
11505
11506impl wkt::message::Message for ImportErrorsConfig {
11507    fn typename() -> &'static str {
11508        "type.googleapis.com/google.cloud.retail.v2.ImportErrorsConfig"
11509    }
11510}
11511
11512/// Defines additional types related to [ImportErrorsConfig].
11513pub mod import_errors_config {
11514    #[allow(unused_imports)]
11515    use super::*;
11516
11517    /// Required. Errors destination.
11518    #[derive(Clone, Debug, PartialEq)]
11519    #[non_exhaustive]
11520    pub enum Destination {
11521        /// Google Cloud Storage prefix for import errors. This must be an empty,
11522        /// existing Cloud Storage directory. Import errors are written to
11523        /// sharded files in this directory, one per line, as a JSON-encoded
11524        /// `google.rpc.Status` message.
11525        GcsPrefix(std::string::String),
11526    }
11527}
11528
11529/// Request message for Import methods.
11530#[derive(Clone, Default, PartialEq)]
11531#[non_exhaustive]
11532pub struct ImportProductsRequest {
11533    /// Required.
11534    /// `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
11535    ///
11536    /// If no updateMask is specified, requires products.create permission.
11537    /// If updateMask is specified, requires products.update permission.
11538    pub parent: std::string::String,
11539
11540    /// Deprecated. This field has no effect.
11541    #[deprecated]
11542    pub request_id: std::string::String,
11543
11544    /// Required. The desired input location of the data.
11545    pub input_config: std::option::Option<crate::model::ProductInputConfig>,
11546
11547    /// The desired location of errors incurred during the Import.
11548    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11549
11550    /// Indicates which fields in the provided imported `products` to update. If
11551    /// not set, all fields are updated. If provided, only the existing product
11552    /// fields are updated. Missing products will not be created.
11553    pub update_mask: std::option::Option<wkt::FieldMask>,
11554
11555    /// The mode of reconciliation between existing products and the products to be
11556    /// imported. Defaults to
11557    /// [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
11558    ///
11559    /// [google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]: crate::model::import_products_request::ReconciliationMode::Incremental
11560    pub reconciliation_mode: crate::model::import_products_request::ReconciliationMode,
11561
11562    /// Full Pub/Sub topic name for receiving notification. If this field is set,
11563    /// when the import is finished, a notification is sent to
11564    /// specified Pub/Sub topic. The message data is JSON string of a
11565    /// [Operation][google.longrunning.Operation].
11566    ///
11567    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
11568    /// to be within the same project as
11569    /// [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
11570    /// Make sure that both
11571    /// `cloud-retail-customer-data-access@system.gserviceaccount.com` and
11572    /// `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
11573    /// have the `pubsub.topics.publish` IAM permission on the topic.
11574    ///
11575    /// Only supported when
11576    /// [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
11577    /// is set to `FULL`.
11578    ///
11579    /// [google.cloud.retail.v2.ImportProductsRequest.parent]: crate::model::ImportProductsRequest::parent
11580    /// [google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]: crate::model::ImportProductsRequest::reconciliation_mode
11581    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
11582    pub notification_pubsub_topic: std::string::String,
11583
11584    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11585}
11586
11587impl ImportProductsRequest {
11588    pub fn new() -> Self {
11589        std::default::Default::default()
11590    }
11591
11592    /// Sets the value of [parent][crate::model::ImportProductsRequest::parent].
11593    ///
11594    /// # Example
11595    /// ```ignore,no_run
11596    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11597    /// let x = ImportProductsRequest::new().set_parent("example");
11598    /// ```
11599    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11600        self.parent = v.into();
11601        self
11602    }
11603
11604    /// Sets the value of [request_id][crate::model::ImportProductsRequest::request_id].
11605    ///
11606    /// # Example
11607    /// ```ignore,no_run
11608    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11609    /// let x = ImportProductsRequest::new().set_request_id("example");
11610    /// ```
11611    #[deprecated]
11612    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11613        self.request_id = v.into();
11614        self
11615    }
11616
11617    /// Sets the value of [input_config][crate::model::ImportProductsRequest::input_config].
11618    ///
11619    /// # Example
11620    /// ```ignore,no_run
11621    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11622    /// use google_cloud_retail_v2::model::ProductInputConfig;
11623    /// let x = ImportProductsRequest::new().set_input_config(ProductInputConfig::default()/* use setters */);
11624    /// ```
11625    pub fn set_input_config<T>(mut self, v: T) -> Self
11626    where
11627        T: std::convert::Into<crate::model::ProductInputConfig>,
11628    {
11629        self.input_config = std::option::Option::Some(v.into());
11630        self
11631    }
11632
11633    /// Sets or clears the value of [input_config][crate::model::ImportProductsRequest::input_config].
11634    ///
11635    /// # Example
11636    /// ```ignore,no_run
11637    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11638    /// use google_cloud_retail_v2::model::ProductInputConfig;
11639    /// let x = ImportProductsRequest::new().set_or_clear_input_config(Some(ProductInputConfig::default()/* use setters */));
11640    /// let x = ImportProductsRequest::new().set_or_clear_input_config(None::<ProductInputConfig>);
11641    /// ```
11642    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11643    where
11644        T: std::convert::Into<crate::model::ProductInputConfig>,
11645    {
11646        self.input_config = v.map(|x| x.into());
11647        self
11648    }
11649
11650    /// Sets the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11651    ///
11652    /// # Example
11653    /// ```ignore,no_run
11654    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11655    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11656    /// let x = ImportProductsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11657    /// ```
11658    pub fn set_errors_config<T>(mut self, v: T) -> Self
11659    where
11660        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11661    {
11662        self.errors_config = std::option::Option::Some(v.into());
11663        self
11664    }
11665
11666    /// Sets or clears the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11667    ///
11668    /// # Example
11669    /// ```ignore,no_run
11670    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11671    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11672    /// let x = ImportProductsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11673    /// let x = ImportProductsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11674    /// ```
11675    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11676    where
11677        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11678    {
11679        self.errors_config = v.map(|x| x.into());
11680        self
11681    }
11682
11683    /// Sets the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11684    ///
11685    /// # Example
11686    /// ```ignore,no_run
11687    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11688    /// use wkt::FieldMask;
11689    /// let x = ImportProductsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11690    /// ```
11691    pub fn set_update_mask<T>(mut self, v: T) -> Self
11692    where
11693        T: std::convert::Into<wkt::FieldMask>,
11694    {
11695        self.update_mask = std::option::Option::Some(v.into());
11696        self
11697    }
11698
11699    /// Sets or clears the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11700    ///
11701    /// # Example
11702    /// ```ignore,no_run
11703    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11704    /// use wkt::FieldMask;
11705    /// let x = ImportProductsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11706    /// let x = ImportProductsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11707    /// ```
11708    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11709    where
11710        T: std::convert::Into<wkt::FieldMask>,
11711    {
11712        self.update_mask = v.map(|x| x.into());
11713        self
11714    }
11715
11716    /// Sets the value of [reconciliation_mode][crate::model::ImportProductsRequest::reconciliation_mode].
11717    ///
11718    /// # Example
11719    /// ```ignore,no_run
11720    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11721    /// use google_cloud_retail_v2::model::import_products_request::ReconciliationMode;
11722    /// let x0 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Incremental);
11723    /// let x1 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Full);
11724    /// ```
11725    pub fn set_reconciliation_mode<
11726        T: std::convert::Into<crate::model::import_products_request::ReconciliationMode>,
11727    >(
11728        mut self,
11729        v: T,
11730    ) -> Self {
11731        self.reconciliation_mode = v.into();
11732        self
11733    }
11734
11735    /// Sets the value of [notification_pubsub_topic][crate::model::ImportProductsRequest::notification_pubsub_topic].
11736    ///
11737    /// # Example
11738    /// ```ignore,no_run
11739    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11740    /// let x = ImportProductsRequest::new().set_notification_pubsub_topic("example");
11741    /// ```
11742    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
11743        mut self,
11744        v: T,
11745    ) -> Self {
11746        self.notification_pubsub_topic = v.into();
11747        self
11748    }
11749}
11750
11751impl wkt::message::Message for ImportProductsRequest {
11752    fn typename() -> &'static str {
11753        "type.googleapis.com/google.cloud.retail.v2.ImportProductsRequest"
11754    }
11755}
11756
11757/// Defines additional types related to [ImportProductsRequest].
11758pub mod import_products_request {
11759    #[allow(unused_imports)]
11760    use super::*;
11761
11762    /// Indicates how imported products are reconciled with the existing products
11763    /// created or imported before.
11764    ///
11765    /// # Working with unknown values
11766    ///
11767    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11768    /// additional enum variants at any time. Adding new variants is not considered
11769    /// a breaking change. Applications should write their code in anticipation of:
11770    ///
11771    /// - New values appearing in future releases of the client library, **and**
11772    /// - New values received dynamically, without application changes.
11773    ///
11774    /// Please consult the [Working with enums] section in the user guide for some
11775    /// guidelines.
11776    ///
11777    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
11778    #[derive(Clone, Debug, PartialEq)]
11779    #[non_exhaustive]
11780    pub enum ReconciliationMode {
11781        /// Defaults to INCREMENTAL.
11782        Unspecified,
11783        /// Inserts new products or updates existing products.
11784        Incremental,
11785        /// Calculates diff and replaces the entire product dataset. Existing
11786        /// products may be deleted if they are not present in the source location.
11787        Full,
11788        /// If set, the enum was initialized with an unknown value.
11789        ///
11790        /// Applications can examine the value using [ReconciliationMode::value] or
11791        /// [ReconciliationMode::name].
11792        UnknownValue(reconciliation_mode::UnknownValue),
11793    }
11794
11795    #[doc(hidden)]
11796    pub mod reconciliation_mode {
11797        #[allow(unused_imports)]
11798        use super::*;
11799        #[derive(Clone, Debug, PartialEq)]
11800        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11801    }
11802
11803    impl ReconciliationMode {
11804        /// Gets the enum value.
11805        ///
11806        /// Returns `None` if the enum contains an unknown value deserialized from
11807        /// the string representation of enums.
11808        pub fn value(&self) -> std::option::Option<i32> {
11809            match self {
11810                Self::Unspecified => std::option::Option::Some(0),
11811                Self::Incremental => std::option::Option::Some(1),
11812                Self::Full => std::option::Option::Some(2),
11813                Self::UnknownValue(u) => u.0.value(),
11814            }
11815        }
11816
11817        /// Gets the enum value as a string.
11818        ///
11819        /// Returns `None` if the enum contains an unknown value deserialized from
11820        /// the integer representation of enums.
11821        pub fn name(&self) -> std::option::Option<&str> {
11822            match self {
11823                Self::Unspecified => std::option::Option::Some("RECONCILIATION_MODE_UNSPECIFIED"),
11824                Self::Incremental => std::option::Option::Some("INCREMENTAL"),
11825                Self::Full => std::option::Option::Some("FULL"),
11826                Self::UnknownValue(u) => u.0.name(),
11827            }
11828        }
11829    }
11830
11831    impl std::default::Default for ReconciliationMode {
11832        fn default() -> Self {
11833            use std::convert::From;
11834            Self::from(0)
11835        }
11836    }
11837
11838    impl std::fmt::Display for ReconciliationMode {
11839        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11840            wkt::internal::display_enum(f, self.name(), self.value())
11841        }
11842    }
11843
11844    impl std::convert::From<i32> for ReconciliationMode {
11845        fn from(value: i32) -> Self {
11846            match value {
11847                0 => Self::Unspecified,
11848                1 => Self::Incremental,
11849                2 => Self::Full,
11850                _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11851                    wkt::internal::UnknownEnumValue::Integer(value),
11852                )),
11853            }
11854        }
11855    }
11856
11857    impl std::convert::From<&str> for ReconciliationMode {
11858        fn from(value: &str) -> Self {
11859            use std::string::ToString;
11860            match value {
11861                "RECONCILIATION_MODE_UNSPECIFIED" => Self::Unspecified,
11862                "INCREMENTAL" => Self::Incremental,
11863                "FULL" => Self::Full,
11864                _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
11865                    wkt::internal::UnknownEnumValue::String(value.to_string()),
11866                )),
11867            }
11868        }
11869    }
11870
11871    impl serde::ser::Serialize for ReconciliationMode {
11872        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11873        where
11874            S: serde::Serializer,
11875        {
11876            match self {
11877                Self::Unspecified => serializer.serialize_i32(0),
11878                Self::Incremental => serializer.serialize_i32(1),
11879                Self::Full => serializer.serialize_i32(2),
11880                Self::UnknownValue(u) => u.0.serialize(serializer),
11881            }
11882        }
11883    }
11884
11885    impl<'de> serde::de::Deserialize<'de> for ReconciliationMode {
11886        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11887        where
11888            D: serde::Deserializer<'de>,
11889        {
11890            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReconciliationMode>::new(
11891                ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode",
11892            ))
11893        }
11894    }
11895}
11896
11897/// Request message for the ImportUserEvents request.
11898#[derive(Clone, Default, PartialEq)]
11899#[non_exhaustive]
11900pub struct ImportUserEventsRequest {
11901    /// Required. `projects/1234/locations/global/catalogs/default_catalog`
11902    pub parent: std::string::String,
11903
11904    /// Required. The desired input location of the data.
11905    pub input_config: std::option::Option<crate::model::UserEventInputConfig>,
11906
11907    /// The desired location of errors incurred during the Import. Cannot be set
11908    /// for inline user event imports.
11909    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11910
11911    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11912}
11913
11914impl ImportUserEventsRequest {
11915    pub fn new() -> Self {
11916        std::default::Default::default()
11917    }
11918
11919    /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
11920    ///
11921    /// # Example
11922    /// ```ignore,no_run
11923    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11924    /// let x = ImportUserEventsRequest::new().set_parent("example");
11925    /// ```
11926    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11927        self.parent = v.into();
11928        self
11929    }
11930
11931    /// Sets the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
11932    ///
11933    /// # Example
11934    /// ```ignore,no_run
11935    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11936    /// use google_cloud_retail_v2::model::UserEventInputConfig;
11937    /// let x = ImportUserEventsRequest::new().set_input_config(UserEventInputConfig::default()/* use setters */);
11938    /// ```
11939    pub fn set_input_config<T>(mut self, v: T) -> Self
11940    where
11941        T: std::convert::Into<crate::model::UserEventInputConfig>,
11942    {
11943        self.input_config = std::option::Option::Some(v.into());
11944        self
11945    }
11946
11947    /// Sets or clears the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
11948    ///
11949    /// # Example
11950    /// ```ignore,no_run
11951    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11952    /// use google_cloud_retail_v2::model::UserEventInputConfig;
11953    /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(Some(UserEventInputConfig::default()/* use setters */));
11954    /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(None::<UserEventInputConfig>);
11955    /// ```
11956    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11957    where
11958        T: std::convert::Into<crate::model::UserEventInputConfig>,
11959    {
11960        self.input_config = v.map(|x| x.into());
11961        self
11962    }
11963
11964    /// Sets the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
11965    ///
11966    /// # Example
11967    /// ```ignore,no_run
11968    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11969    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11970    /// let x = ImportUserEventsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11971    /// ```
11972    pub fn set_errors_config<T>(mut self, v: T) -> Self
11973    where
11974        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11975    {
11976        self.errors_config = std::option::Option::Some(v.into());
11977        self
11978    }
11979
11980    /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
11981    ///
11982    /// # Example
11983    /// ```ignore,no_run
11984    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
11985    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11986    /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11987    /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11988    /// ```
11989    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11990    where
11991        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11992    {
11993        self.errors_config = v.map(|x| x.into());
11994        self
11995    }
11996}
11997
11998impl wkt::message::Message for ImportUserEventsRequest {
11999    fn typename() -> &'static str {
12000        "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsRequest"
12001    }
12002}
12003
12004/// Request message for ImportCompletionData methods.
12005#[derive(Clone, Default, PartialEq)]
12006#[non_exhaustive]
12007pub struct ImportCompletionDataRequest {
12008    /// Required. The catalog which the suggestions dataset belongs to.
12009    ///
12010    /// Format: `projects/1234/locations/global/catalogs/default_catalog`.
12011    pub parent: std::string::String,
12012
12013    /// Required. The desired input location of the data.
12014    pub input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
12015
12016    /// Pub/Sub topic for receiving notification. If this field is set,
12017    /// when the import is finished, a notification is sent to
12018    /// specified Pub/Sub topic. The message data is JSON string of a
12019    /// [Operation][google.longrunning.Operation].
12020    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12021    ///
12022    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12023    pub notification_pubsub_topic: std::string::String,
12024
12025    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12026}
12027
12028impl ImportCompletionDataRequest {
12029    pub fn new() -> Self {
12030        std::default::Default::default()
12031    }
12032
12033    /// Sets the value of [parent][crate::model::ImportCompletionDataRequest::parent].
12034    ///
12035    /// # Example
12036    /// ```ignore,no_run
12037    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12038    /// let x = ImportCompletionDataRequest::new().set_parent("example");
12039    /// ```
12040    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12041        self.parent = v.into();
12042        self
12043    }
12044
12045    /// Sets the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12046    ///
12047    /// # Example
12048    /// ```ignore,no_run
12049    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12050    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12051    /// let x = ImportCompletionDataRequest::new().set_input_config(CompletionDataInputConfig::default()/* use setters */);
12052    /// ```
12053    pub fn set_input_config<T>(mut self, v: T) -> Self
12054    where
12055        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12056    {
12057        self.input_config = std::option::Option::Some(v.into());
12058        self
12059    }
12060
12061    /// Sets or clears the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12062    ///
12063    /// # Example
12064    /// ```ignore,no_run
12065    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12066    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12067    /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
12068    /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(None::<CompletionDataInputConfig>);
12069    /// ```
12070    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12071    where
12072        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12073    {
12074        self.input_config = v.map(|x| x.into());
12075        self
12076    }
12077
12078    /// Sets the value of [notification_pubsub_topic][crate::model::ImportCompletionDataRequest::notification_pubsub_topic].
12079    ///
12080    /// # Example
12081    /// ```ignore,no_run
12082    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12083    /// let x = ImportCompletionDataRequest::new().set_notification_pubsub_topic("example");
12084    /// ```
12085    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12086        mut self,
12087        v: T,
12088    ) -> Self {
12089        self.notification_pubsub_topic = v.into();
12090        self
12091    }
12092}
12093
12094impl wkt::message::Message for ImportCompletionDataRequest {
12095    fn typename() -> &'static str {
12096        "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataRequest"
12097    }
12098}
12099
12100/// The input config source for products.
12101#[derive(Clone, Default, PartialEq)]
12102#[non_exhaustive]
12103pub struct ProductInputConfig {
12104    /// Required. The source of the input.
12105    pub source: std::option::Option<crate::model::product_input_config::Source>,
12106
12107    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12108}
12109
12110impl ProductInputConfig {
12111    pub fn new() -> Self {
12112        std::default::Default::default()
12113    }
12114
12115    /// Sets the value of [source][crate::model::ProductInputConfig::source].
12116    ///
12117    /// Note that all the setters affecting `source` are mutually
12118    /// exclusive.
12119    ///
12120    /// # Example
12121    /// ```ignore,no_run
12122    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12123    /// use google_cloud_retail_v2::model::ProductInlineSource;
12124    /// let x = ProductInputConfig::new().set_source(Some(
12125    ///     google_cloud_retail_v2::model::product_input_config::Source::ProductInlineSource(ProductInlineSource::default().into())));
12126    /// ```
12127    pub fn set_source<
12128        T: std::convert::Into<std::option::Option<crate::model::product_input_config::Source>>,
12129    >(
12130        mut self,
12131        v: T,
12132    ) -> Self {
12133        self.source = v.into();
12134        self
12135    }
12136
12137    /// The value of [source][crate::model::ProductInputConfig::source]
12138    /// if it holds a `ProductInlineSource`, `None` if the field is not set or
12139    /// holds a different branch.
12140    pub fn product_inline_source(
12141        &self,
12142    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductInlineSource>> {
12143        #[allow(unreachable_patterns)]
12144        self.source.as_ref().and_then(|v| match v {
12145            crate::model::product_input_config::Source::ProductInlineSource(v) => {
12146                std::option::Option::Some(v)
12147            }
12148            _ => std::option::Option::None,
12149        })
12150    }
12151
12152    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12153    /// to hold a `ProductInlineSource`.
12154    ///
12155    /// Note that all the setters affecting `source` are
12156    /// mutually exclusive.
12157    ///
12158    /// # Example
12159    /// ```ignore,no_run
12160    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12161    /// use google_cloud_retail_v2::model::ProductInlineSource;
12162    /// let x = ProductInputConfig::new().set_product_inline_source(ProductInlineSource::default()/* use setters */);
12163    /// assert!(x.product_inline_source().is_some());
12164    /// assert!(x.gcs_source().is_none());
12165    /// assert!(x.big_query_source().is_none());
12166    /// ```
12167    pub fn set_product_inline_source<
12168        T: std::convert::Into<std::boxed::Box<crate::model::ProductInlineSource>>,
12169    >(
12170        mut self,
12171        v: T,
12172    ) -> Self {
12173        self.source = std::option::Option::Some(
12174            crate::model::product_input_config::Source::ProductInlineSource(v.into()),
12175        );
12176        self
12177    }
12178
12179    /// The value of [source][crate::model::ProductInputConfig::source]
12180    /// if it holds a `GcsSource`, `None` if the field is not set or
12181    /// holds a different branch.
12182    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12183        #[allow(unreachable_patterns)]
12184        self.source.as_ref().and_then(|v| match v {
12185            crate::model::product_input_config::Source::GcsSource(v) => {
12186                std::option::Option::Some(v)
12187            }
12188            _ => std::option::Option::None,
12189        })
12190    }
12191
12192    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12193    /// to hold a `GcsSource`.
12194    ///
12195    /// Note that all the setters affecting `source` are
12196    /// mutually exclusive.
12197    ///
12198    /// # Example
12199    /// ```ignore,no_run
12200    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12201    /// use google_cloud_retail_v2::model::GcsSource;
12202    /// let x = ProductInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12203    /// assert!(x.gcs_source().is_some());
12204    /// assert!(x.product_inline_source().is_none());
12205    /// assert!(x.big_query_source().is_none());
12206    /// ```
12207    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12208        mut self,
12209        v: T,
12210    ) -> Self {
12211        self.source = std::option::Option::Some(
12212            crate::model::product_input_config::Source::GcsSource(v.into()),
12213        );
12214        self
12215    }
12216
12217    /// The value of [source][crate::model::ProductInputConfig::source]
12218    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12219    /// holds a different branch.
12220    pub fn big_query_source(
12221        &self,
12222    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12223        #[allow(unreachable_patterns)]
12224        self.source.as_ref().and_then(|v| match v {
12225            crate::model::product_input_config::Source::BigQuerySource(v) => {
12226                std::option::Option::Some(v)
12227            }
12228            _ => std::option::Option::None,
12229        })
12230    }
12231
12232    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12233    /// to hold a `BigQuerySource`.
12234    ///
12235    /// Note that all the setters affecting `source` are
12236    /// mutually exclusive.
12237    ///
12238    /// # Example
12239    /// ```ignore,no_run
12240    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12241    /// use google_cloud_retail_v2::model::BigQuerySource;
12242    /// let x = ProductInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12243    /// assert!(x.big_query_source().is_some());
12244    /// assert!(x.product_inline_source().is_none());
12245    /// assert!(x.gcs_source().is_none());
12246    /// ```
12247    pub fn set_big_query_source<
12248        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12249    >(
12250        mut self,
12251        v: T,
12252    ) -> Self {
12253        self.source = std::option::Option::Some(
12254            crate::model::product_input_config::Source::BigQuerySource(v.into()),
12255        );
12256        self
12257    }
12258}
12259
12260impl wkt::message::Message for ProductInputConfig {
12261    fn typename() -> &'static str {
12262        "type.googleapis.com/google.cloud.retail.v2.ProductInputConfig"
12263    }
12264}
12265
12266/// Defines additional types related to [ProductInputConfig].
12267pub mod product_input_config {
12268    #[allow(unused_imports)]
12269    use super::*;
12270
12271    /// Required. The source of the input.
12272    #[derive(Clone, Debug, PartialEq)]
12273    #[non_exhaustive]
12274    pub enum Source {
12275        /// The Inline source for the input content for products.
12276        ProductInlineSource(std::boxed::Box<crate::model::ProductInlineSource>),
12277        /// Google Cloud Storage location for the input content.
12278        GcsSource(std::boxed::Box<crate::model::GcsSource>),
12279        /// BigQuery input source.
12280        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12281    }
12282}
12283
12284/// The input config source for user events.
12285#[derive(Clone, Default, PartialEq)]
12286#[non_exhaustive]
12287pub struct UserEventInputConfig {
12288    /// The source of the input.
12289    pub source: std::option::Option<crate::model::user_event_input_config::Source>,
12290
12291    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12292}
12293
12294impl UserEventInputConfig {
12295    pub fn new() -> Self {
12296        std::default::Default::default()
12297    }
12298
12299    /// Sets the value of [source][crate::model::UserEventInputConfig::source].
12300    ///
12301    /// Note that all the setters affecting `source` are mutually
12302    /// exclusive.
12303    ///
12304    /// # Example
12305    /// ```ignore,no_run
12306    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12307    /// use google_cloud_retail_v2::model::UserEventInlineSource;
12308    /// let x = UserEventInputConfig::new().set_source(Some(
12309    ///     google_cloud_retail_v2::model::user_event_input_config::Source::UserEventInlineSource(UserEventInlineSource::default().into())));
12310    /// ```
12311    pub fn set_source<
12312        T: std::convert::Into<std::option::Option<crate::model::user_event_input_config::Source>>,
12313    >(
12314        mut self,
12315        v: T,
12316    ) -> Self {
12317        self.source = v.into();
12318        self
12319    }
12320
12321    /// The value of [source][crate::model::UserEventInputConfig::source]
12322    /// if it holds a `UserEventInlineSource`, `None` if the field is not set or
12323    /// holds a different branch.
12324    pub fn user_event_inline_source(
12325        &self,
12326    ) -> std::option::Option<&std::boxed::Box<crate::model::UserEventInlineSource>> {
12327        #[allow(unreachable_patterns)]
12328        self.source.as_ref().and_then(|v| match v {
12329            crate::model::user_event_input_config::Source::UserEventInlineSource(v) => {
12330                std::option::Option::Some(v)
12331            }
12332            _ => std::option::Option::None,
12333        })
12334    }
12335
12336    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12337    /// to hold a `UserEventInlineSource`.
12338    ///
12339    /// Note that all the setters affecting `source` are
12340    /// mutually exclusive.
12341    ///
12342    /// # Example
12343    /// ```ignore,no_run
12344    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12345    /// use google_cloud_retail_v2::model::UserEventInlineSource;
12346    /// let x = UserEventInputConfig::new().set_user_event_inline_source(UserEventInlineSource::default()/* use setters */);
12347    /// assert!(x.user_event_inline_source().is_some());
12348    /// assert!(x.gcs_source().is_none());
12349    /// assert!(x.big_query_source().is_none());
12350    /// ```
12351    pub fn set_user_event_inline_source<
12352        T: std::convert::Into<std::boxed::Box<crate::model::UserEventInlineSource>>,
12353    >(
12354        mut self,
12355        v: T,
12356    ) -> Self {
12357        self.source = std::option::Option::Some(
12358            crate::model::user_event_input_config::Source::UserEventInlineSource(v.into()),
12359        );
12360        self
12361    }
12362
12363    /// The value of [source][crate::model::UserEventInputConfig::source]
12364    /// if it holds a `GcsSource`, `None` if the field is not set or
12365    /// holds a different branch.
12366    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12367        #[allow(unreachable_patterns)]
12368        self.source.as_ref().and_then(|v| match v {
12369            crate::model::user_event_input_config::Source::GcsSource(v) => {
12370                std::option::Option::Some(v)
12371            }
12372            _ => std::option::Option::None,
12373        })
12374    }
12375
12376    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12377    /// to hold a `GcsSource`.
12378    ///
12379    /// Note that all the setters affecting `source` are
12380    /// mutually exclusive.
12381    ///
12382    /// # Example
12383    /// ```ignore,no_run
12384    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12385    /// use google_cloud_retail_v2::model::GcsSource;
12386    /// let x = UserEventInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12387    /// assert!(x.gcs_source().is_some());
12388    /// assert!(x.user_event_inline_source().is_none());
12389    /// assert!(x.big_query_source().is_none());
12390    /// ```
12391    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12392        mut self,
12393        v: T,
12394    ) -> Self {
12395        self.source = std::option::Option::Some(
12396            crate::model::user_event_input_config::Source::GcsSource(v.into()),
12397        );
12398        self
12399    }
12400
12401    /// The value of [source][crate::model::UserEventInputConfig::source]
12402    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12403    /// holds a different branch.
12404    pub fn big_query_source(
12405        &self,
12406    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12407        #[allow(unreachable_patterns)]
12408        self.source.as_ref().and_then(|v| match v {
12409            crate::model::user_event_input_config::Source::BigQuerySource(v) => {
12410                std::option::Option::Some(v)
12411            }
12412            _ => std::option::Option::None,
12413        })
12414    }
12415
12416    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12417    /// to hold a `BigQuerySource`.
12418    ///
12419    /// Note that all the setters affecting `source` are
12420    /// mutually exclusive.
12421    ///
12422    /// # Example
12423    /// ```ignore,no_run
12424    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12425    /// use google_cloud_retail_v2::model::BigQuerySource;
12426    /// let x = UserEventInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12427    /// assert!(x.big_query_source().is_some());
12428    /// assert!(x.user_event_inline_source().is_none());
12429    /// assert!(x.gcs_source().is_none());
12430    /// ```
12431    pub fn set_big_query_source<
12432        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12433    >(
12434        mut self,
12435        v: T,
12436    ) -> Self {
12437        self.source = std::option::Option::Some(
12438            crate::model::user_event_input_config::Source::BigQuerySource(v.into()),
12439        );
12440        self
12441    }
12442}
12443
12444impl wkt::message::Message for UserEventInputConfig {
12445    fn typename() -> &'static str {
12446        "type.googleapis.com/google.cloud.retail.v2.UserEventInputConfig"
12447    }
12448}
12449
12450/// Defines additional types related to [UserEventInputConfig].
12451pub mod user_event_input_config {
12452    #[allow(unused_imports)]
12453    use super::*;
12454
12455    /// The source of the input.
12456    #[derive(Clone, Debug, PartialEq)]
12457    #[non_exhaustive]
12458    pub enum Source {
12459        /// Required. The Inline source for the input content for UserEvents.
12460        UserEventInlineSource(std::boxed::Box<crate::model::UserEventInlineSource>),
12461        /// Required. Google Cloud Storage location for the input content.
12462        GcsSource(std::boxed::Box<crate::model::GcsSource>),
12463        /// Required. BigQuery input source.
12464        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12465    }
12466}
12467
12468/// The input config source for completion data.
12469#[derive(Clone, Default, PartialEq)]
12470#[non_exhaustive]
12471pub struct CompletionDataInputConfig {
12472    /// The source of the input.
12473    ///
12474    /// Supported
12475    /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12476    /// values for suggestions imports:
12477    ///
12478    /// * `suggestions` (default): One JSON completion suggestion per line.
12479    /// * `denylist`:  One JSON deny suggestion per line.
12480    /// * `allowlist`:  One JSON allow suggestion per line.
12481    ///
12482    /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12483    pub source: std::option::Option<crate::model::completion_data_input_config::Source>,
12484
12485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12486}
12487
12488impl CompletionDataInputConfig {
12489    pub fn new() -> Self {
12490        std::default::Default::default()
12491    }
12492
12493    /// Sets the value of [source][crate::model::CompletionDataInputConfig::source].
12494    ///
12495    /// Note that all the setters affecting `source` are mutually
12496    /// exclusive.
12497    ///
12498    /// # Example
12499    /// ```ignore,no_run
12500    /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12501    /// use google_cloud_retail_v2::model::BigQuerySource;
12502    /// let x = CompletionDataInputConfig::new().set_source(Some(
12503    ///     google_cloud_retail_v2::model::completion_data_input_config::Source::BigQuerySource(BigQuerySource::default().into())));
12504    /// ```
12505    pub fn set_source<
12506        T: std::convert::Into<std::option::Option<crate::model::completion_data_input_config::Source>>,
12507    >(
12508        mut self,
12509        v: T,
12510    ) -> Self {
12511        self.source = v.into();
12512        self
12513    }
12514
12515    /// The value of [source][crate::model::CompletionDataInputConfig::source]
12516    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12517    /// holds a different branch.
12518    pub fn big_query_source(
12519        &self,
12520    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12521        #[allow(unreachable_patterns)]
12522        self.source.as_ref().and_then(|v| match v {
12523            crate::model::completion_data_input_config::Source::BigQuerySource(v) => {
12524                std::option::Option::Some(v)
12525            }
12526            _ => std::option::Option::None,
12527        })
12528    }
12529
12530    /// Sets the value of [source][crate::model::CompletionDataInputConfig::source]
12531    /// to hold a `BigQuerySource`.
12532    ///
12533    /// Note that all the setters affecting `source` are
12534    /// mutually exclusive.
12535    ///
12536    /// # Example
12537    /// ```ignore,no_run
12538    /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12539    /// use google_cloud_retail_v2::model::BigQuerySource;
12540    /// let x = CompletionDataInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12541    /// assert!(x.big_query_source().is_some());
12542    /// ```
12543    pub fn set_big_query_source<
12544        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12545    >(
12546        mut self,
12547        v: T,
12548    ) -> Self {
12549        self.source = std::option::Option::Some(
12550            crate::model::completion_data_input_config::Source::BigQuerySource(v.into()),
12551        );
12552        self
12553    }
12554}
12555
12556impl wkt::message::Message for CompletionDataInputConfig {
12557    fn typename() -> &'static str {
12558        "type.googleapis.com/google.cloud.retail.v2.CompletionDataInputConfig"
12559    }
12560}
12561
12562/// Defines additional types related to [CompletionDataInputConfig].
12563pub mod completion_data_input_config {
12564    #[allow(unused_imports)]
12565    use super::*;
12566
12567    /// The source of the input.
12568    ///
12569    /// Supported
12570    /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12571    /// values for suggestions imports:
12572    ///
12573    /// * `suggestions` (default): One JSON completion suggestion per line.
12574    /// * `denylist`:  One JSON deny suggestion per line.
12575    /// * `allowlist`:  One JSON allow suggestion per line.
12576    ///
12577    /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12578    #[derive(Clone, Debug, PartialEq)]
12579    #[non_exhaustive]
12580    pub enum Source {
12581        /// Required. BigQuery input source.
12582        ///
12583        /// Add the IAM permission "BigQuery Data Viewer" for
12584        /// cloud-retail-customer-data-access@system.gserviceaccount.com before
12585        /// using this feature otherwise an error is thrown.
12586        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12587    }
12588}
12589
12590/// Metadata related to the progress of the Import operation. This is
12591/// returned by the google.longrunning.Operation.metadata field.
12592#[derive(Clone, Default, PartialEq)]
12593#[non_exhaustive]
12594pub struct ImportMetadata {
12595    /// Operation create time.
12596    pub create_time: std::option::Option<wkt::Timestamp>,
12597
12598    /// Operation last update time. If the operation is done, this is also the
12599    /// finish time.
12600    pub update_time: std::option::Option<wkt::Timestamp>,
12601
12602    /// Count of entries that were processed successfully.
12603    pub success_count: i64,
12604
12605    /// Count of entries that encountered errors while processing.
12606    pub failure_count: i64,
12607
12608    /// Deprecated. This field is never set.
12609    #[deprecated]
12610    pub request_id: std::string::String,
12611
12612    /// Pub/Sub topic for receiving notification. If this field is set,
12613    /// when the import is finished, a notification is sent to
12614    /// specified Pub/Sub topic. The message data is JSON string of a
12615    /// [Operation][google.longrunning.Operation].
12616    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12617    ///
12618    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12619    pub notification_pubsub_topic: std::string::String,
12620
12621    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12622}
12623
12624impl ImportMetadata {
12625    pub fn new() -> Self {
12626        std::default::Default::default()
12627    }
12628
12629    /// Sets the value of [create_time][crate::model::ImportMetadata::create_time].
12630    ///
12631    /// # Example
12632    /// ```ignore,no_run
12633    /// # use google_cloud_retail_v2::model::ImportMetadata;
12634    /// use wkt::Timestamp;
12635    /// let x = ImportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
12636    /// ```
12637    pub fn set_create_time<T>(mut self, v: T) -> Self
12638    where
12639        T: std::convert::Into<wkt::Timestamp>,
12640    {
12641        self.create_time = std::option::Option::Some(v.into());
12642        self
12643    }
12644
12645    /// Sets or clears the value of [create_time][crate::model::ImportMetadata::create_time].
12646    ///
12647    /// # Example
12648    /// ```ignore,no_run
12649    /// # use google_cloud_retail_v2::model::ImportMetadata;
12650    /// use wkt::Timestamp;
12651    /// let x = ImportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12652    /// let x = ImportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
12653    /// ```
12654    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12655    where
12656        T: std::convert::Into<wkt::Timestamp>,
12657    {
12658        self.create_time = v.map(|x| x.into());
12659        self
12660    }
12661
12662    /// Sets the value of [update_time][crate::model::ImportMetadata::update_time].
12663    ///
12664    /// # Example
12665    /// ```ignore,no_run
12666    /// # use google_cloud_retail_v2::model::ImportMetadata;
12667    /// use wkt::Timestamp;
12668    /// let x = ImportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
12669    /// ```
12670    pub fn set_update_time<T>(mut self, v: T) -> Self
12671    where
12672        T: std::convert::Into<wkt::Timestamp>,
12673    {
12674        self.update_time = std::option::Option::Some(v.into());
12675        self
12676    }
12677
12678    /// Sets or clears the value of [update_time][crate::model::ImportMetadata::update_time].
12679    ///
12680    /// # Example
12681    /// ```ignore,no_run
12682    /// # use google_cloud_retail_v2::model::ImportMetadata;
12683    /// use wkt::Timestamp;
12684    /// let x = ImportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12685    /// let x = ImportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
12686    /// ```
12687    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12688    where
12689        T: std::convert::Into<wkt::Timestamp>,
12690    {
12691        self.update_time = v.map(|x| x.into());
12692        self
12693    }
12694
12695    /// Sets the value of [success_count][crate::model::ImportMetadata::success_count].
12696    ///
12697    /// # Example
12698    /// ```ignore,no_run
12699    /// # use google_cloud_retail_v2::model::ImportMetadata;
12700    /// let x = ImportMetadata::new().set_success_count(42);
12701    /// ```
12702    pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12703        self.success_count = v.into();
12704        self
12705    }
12706
12707    /// Sets the value of [failure_count][crate::model::ImportMetadata::failure_count].
12708    ///
12709    /// # Example
12710    /// ```ignore,no_run
12711    /// # use google_cloud_retail_v2::model::ImportMetadata;
12712    /// let x = ImportMetadata::new().set_failure_count(42);
12713    /// ```
12714    pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12715        self.failure_count = v.into();
12716        self
12717    }
12718
12719    /// Sets the value of [request_id][crate::model::ImportMetadata::request_id].
12720    ///
12721    /// # Example
12722    /// ```ignore,no_run
12723    /// # use google_cloud_retail_v2::model::ImportMetadata;
12724    /// let x = ImportMetadata::new().set_request_id("example");
12725    /// ```
12726    #[deprecated]
12727    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12728        self.request_id = v.into();
12729        self
12730    }
12731
12732    /// Sets the value of [notification_pubsub_topic][crate::model::ImportMetadata::notification_pubsub_topic].
12733    ///
12734    /// # Example
12735    /// ```ignore,no_run
12736    /// # use google_cloud_retail_v2::model::ImportMetadata;
12737    /// let x = ImportMetadata::new().set_notification_pubsub_topic("example");
12738    /// ```
12739    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12740        mut self,
12741        v: T,
12742    ) -> Self {
12743        self.notification_pubsub_topic = v.into();
12744        self
12745    }
12746}
12747
12748impl wkt::message::Message for ImportMetadata {
12749    fn typename() -> &'static str {
12750        "type.googleapis.com/google.cloud.retail.v2.ImportMetadata"
12751    }
12752}
12753
12754/// Response of the
12755/// [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
12756/// long running operation is done, then this message is returned by the
12757/// google.longrunning.Operations.response field if the operation was successful.
12758///
12759/// [google.cloud.retail.v2.ImportProductsRequest]: crate::model::ImportProductsRequest
12760#[derive(Clone, Default, PartialEq)]
12761#[non_exhaustive]
12762pub struct ImportProductsResponse {
12763    /// A sample of errors encountered while processing the request.
12764    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12765
12766    /// Echoes the destination for the complete errors in the request if set.
12767    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12768
12769    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12770}
12771
12772impl ImportProductsResponse {
12773    pub fn new() -> Self {
12774        std::default::Default::default()
12775    }
12776
12777    /// Sets the value of [error_samples][crate::model::ImportProductsResponse::error_samples].
12778    ///
12779    /// # Example
12780    /// ```ignore,no_run
12781    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12782    /// use google_cloud_rpc::model::Status;
12783    /// let x = ImportProductsResponse::new()
12784    ///     .set_error_samples([
12785    ///         Status::default()/* use setters */,
12786    ///         Status::default()/* use (different) setters */,
12787    ///     ]);
12788    /// ```
12789    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12790    where
12791        T: std::iter::IntoIterator<Item = V>,
12792        V: std::convert::Into<google_cloud_rpc::model::Status>,
12793    {
12794        use std::iter::Iterator;
12795        self.error_samples = v.into_iter().map(|i| i.into()).collect();
12796        self
12797    }
12798
12799    /// Sets the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12800    ///
12801    /// # Example
12802    /// ```ignore,no_run
12803    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12804    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12805    /// let x = ImportProductsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12806    /// ```
12807    pub fn set_errors_config<T>(mut self, v: T) -> Self
12808    where
12809        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12810    {
12811        self.errors_config = std::option::Option::Some(v.into());
12812        self
12813    }
12814
12815    /// Sets or clears the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12816    ///
12817    /// # Example
12818    /// ```ignore,no_run
12819    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12820    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12821    /// let x = ImportProductsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12822    /// let x = ImportProductsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12823    /// ```
12824    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12825    where
12826        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12827    {
12828        self.errors_config = v.map(|x| x.into());
12829        self
12830    }
12831}
12832
12833impl wkt::message::Message for ImportProductsResponse {
12834    fn typename() -> &'static str {
12835        "type.googleapis.com/google.cloud.retail.v2.ImportProductsResponse"
12836    }
12837}
12838
12839/// Response of the ImportUserEventsRequest. If the long running
12840/// operation was successful, then this message is returned by the
12841/// google.longrunning.Operations.response field if the operation was successful.
12842#[derive(Clone, Default, PartialEq)]
12843#[non_exhaustive]
12844pub struct ImportUserEventsResponse {
12845    /// A sample of errors encountered while processing the request.
12846    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12847
12848    /// Echoes the destination for the complete errors if this field was set in
12849    /// the request.
12850    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12851
12852    /// Aggregated statistics of user event import status.
12853    pub import_summary: std::option::Option<crate::model::UserEventImportSummary>,
12854
12855    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12856}
12857
12858impl ImportUserEventsResponse {
12859    pub fn new() -> Self {
12860        std::default::Default::default()
12861    }
12862
12863    /// Sets the value of [error_samples][crate::model::ImportUserEventsResponse::error_samples].
12864    ///
12865    /// # Example
12866    /// ```ignore,no_run
12867    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12868    /// use google_cloud_rpc::model::Status;
12869    /// let x = ImportUserEventsResponse::new()
12870    ///     .set_error_samples([
12871    ///         Status::default()/* use setters */,
12872    ///         Status::default()/* use (different) setters */,
12873    ///     ]);
12874    /// ```
12875    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12876    where
12877        T: std::iter::IntoIterator<Item = V>,
12878        V: std::convert::Into<google_cloud_rpc::model::Status>,
12879    {
12880        use std::iter::Iterator;
12881        self.error_samples = v.into_iter().map(|i| i.into()).collect();
12882        self
12883    }
12884
12885    /// Sets the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
12886    ///
12887    /// # Example
12888    /// ```ignore,no_run
12889    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12890    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12891    /// let x = ImportUserEventsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12892    /// ```
12893    pub fn set_errors_config<T>(mut self, v: T) -> Self
12894    where
12895        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12896    {
12897        self.errors_config = std::option::Option::Some(v.into());
12898        self
12899    }
12900
12901    /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
12902    ///
12903    /// # Example
12904    /// ```ignore,no_run
12905    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12906    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12907    /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12908    /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12909    /// ```
12910    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12911    where
12912        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12913    {
12914        self.errors_config = v.map(|x| x.into());
12915        self
12916    }
12917
12918    /// Sets the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
12919    ///
12920    /// # Example
12921    /// ```ignore,no_run
12922    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12923    /// use google_cloud_retail_v2::model::UserEventImportSummary;
12924    /// let x = ImportUserEventsResponse::new().set_import_summary(UserEventImportSummary::default()/* use setters */);
12925    /// ```
12926    pub fn set_import_summary<T>(mut self, v: T) -> Self
12927    where
12928        T: std::convert::Into<crate::model::UserEventImportSummary>,
12929    {
12930        self.import_summary = std::option::Option::Some(v.into());
12931        self
12932    }
12933
12934    /// Sets or clears the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
12935    ///
12936    /// # Example
12937    /// ```ignore,no_run
12938    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
12939    /// use google_cloud_retail_v2::model::UserEventImportSummary;
12940    /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(Some(UserEventImportSummary::default()/* use setters */));
12941    /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(None::<UserEventImportSummary>);
12942    /// ```
12943    pub fn set_or_clear_import_summary<T>(mut self, v: std::option::Option<T>) -> Self
12944    where
12945        T: std::convert::Into<crate::model::UserEventImportSummary>,
12946    {
12947        self.import_summary = v.map(|x| x.into());
12948        self
12949    }
12950}
12951
12952impl wkt::message::Message for ImportUserEventsResponse {
12953    fn typename() -> &'static str {
12954        "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsResponse"
12955    }
12956}
12957
12958/// A summary of import result. The UserEventImportSummary summarizes
12959/// the import status for user events.
12960#[derive(Clone, Default, PartialEq)]
12961#[non_exhaustive]
12962pub struct UserEventImportSummary {
12963    /// Count of user events imported with complete existing catalog information.
12964    pub joined_events_count: i64,
12965
12966    /// Count of user events imported, but with catalog information not found
12967    /// in the imported catalog.
12968    pub unjoined_events_count: i64,
12969
12970    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12971}
12972
12973impl UserEventImportSummary {
12974    pub fn new() -> Self {
12975        std::default::Default::default()
12976    }
12977
12978    /// Sets the value of [joined_events_count][crate::model::UserEventImportSummary::joined_events_count].
12979    ///
12980    /// # Example
12981    /// ```ignore,no_run
12982    /// # use google_cloud_retail_v2::model::UserEventImportSummary;
12983    /// let x = UserEventImportSummary::new().set_joined_events_count(42);
12984    /// ```
12985    pub fn set_joined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12986        self.joined_events_count = v.into();
12987        self
12988    }
12989
12990    /// Sets the value of [unjoined_events_count][crate::model::UserEventImportSummary::unjoined_events_count].
12991    ///
12992    /// # Example
12993    /// ```ignore,no_run
12994    /// # use google_cloud_retail_v2::model::UserEventImportSummary;
12995    /// let x = UserEventImportSummary::new().set_unjoined_events_count(42);
12996    /// ```
12997    pub fn set_unjoined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12998        self.unjoined_events_count = v.into();
12999        self
13000    }
13001}
13002
13003impl wkt::message::Message for UserEventImportSummary {
13004    fn typename() -> &'static str {
13005        "type.googleapis.com/google.cloud.retail.v2.UserEventImportSummary"
13006    }
13007}
13008
13009/// Response of the
13010/// [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest].
13011/// If the long running operation is done, this message is returned by the
13012/// google.longrunning.Operations.response field if the operation is successful.
13013///
13014/// [google.cloud.retail.v2.ImportCompletionDataRequest]: crate::model::ImportCompletionDataRequest
13015#[derive(Clone, Default, PartialEq)]
13016#[non_exhaustive]
13017pub struct ImportCompletionDataResponse {
13018    /// A sample of errors encountered while processing the request.
13019    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
13020
13021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13022}
13023
13024impl ImportCompletionDataResponse {
13025    pub fn new() -> Self {
13026        std::default::Default::default()
13027    }
13028
13029    /// Sets the value of [error_samples][crate::model::ImportCompletionDataResponse::error_samples].
13030    ///
13031    /// # Example
13032    /// ```ignore,no_run
13033    /// # use google_cloud_retail_v2::model::ImportCompletionDataResponse;
13034    /// use google_cloud_rpc::model::Status;
13035    /// let x = ImportCompletionDataResponse::new()
13036    ///     .set_error_samples([
13037    ///         Status::default()/* use setters */,
13038    ///         Status::default()/* use (different) setters */,
13039    ///     ]);
13040    /// ```
13041    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13042    where
13043        T: std::iter::IntoIterator<Item = V>,
13044        V: std::convert::Into<google_cloud_rpc::model::Status>,
13045    {
13046        use std::iter::Iterator;
13047        self.error_samples = v.into_iter().map(|i| i.into()).collect();
13048        self
13049    }
13050}
13051
13052impl wkt::message::Message for ImportCompletionDataResponse {
13053    fn typename() -> &'static str {
13054        "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataResponse"
13055    }
13056}
13057
13058/// Metadata that describes the training and serving parameters of a
13059/// [Model][google.cloud.retail.v2.Model]. A
13060/// [Model][google.cloud.retail.v2.Model] can be associated with a
13061/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and then queried
13062/// through the Predict API.
13063///
13064/// [google.cloud.retail.v2.Model]: crate::model::Model
13065/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
13066#[derive(Clone, Default, PartialEq)]
13067#[non_exhaustive]
13068pub struct Model {
13069    /// Required. The fully qualified resource name of the model.
13070    ///
13071    /// Format:
13072    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
13073    /// catalog_id has char limit of 50.
13074    /// recommendation_model_id has char limit of 40.
13075    pub name: std::string::String,
13076
13077    /// Required. The display name of the model.
13078    ///
13079    /// Should be human readable, used to display Recommendation Models in the
13080    /// Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024
13081    /// characters.
13082    pub display_name: std::string::String,
13083
13084    /// Optional. The training state that the model is in (e.g.
13085    /// `TRAINING` or `PAUSED`).
13086    ///
13087    /// Since part of the cost of running the service
13088    /// is frequency of training - this can be used to determine when to train
13089    /// model in order to control cost. If not specified: the default value for
13090    /// `CreateModel` method is `TRAINING`. The default value for
13091    /// `UpdateModel` method is to keep the state the same as before.
13092    pub training_state: crate::model::model::TrainingState,
13093
13094    /// Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`.
13095    pub serving_state: crate::model::model::ServingState,
13096
13097    /// Output only. Timestamp the Recommendation Model was created at.
13098    pub create_time: std::option::Option<wkt::Timestamp>,
13099
13100    /// Output only. Timestamp the Recommendation Model was last updated. E.g.
13101    /// if a Recommendation Model was paused - this would be the time the pause was
13102    /// initiated.
13103    pub update_time: std::option::Option<wkt::Timestamp>,
13104
13105    /// Required. The type of model e.g. `home-page`.
13106    ///
13107    /// Currently supported values: `recommended-for-you`, `others-you-may-like`,
13108    /// `frequently-bought-together`, `page-optimization`, `similar-items`,
13109    /// `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value).
13110    ///
13111    /// This field together with
13112    /// [optimization_objective][google.cloud.retail.v2.Model.optimization_objective]
13113    /// describe model metadata to use to control model training and serving.
13114    /// See <https://cloud.google.com/retail/docs/models>
13115    /// for more details on what the model metadata control and which combination
13116    /// of parameters are valid. For invalid combinations of parameters (e.g. type
13117    /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13118    /// receive an error 400 if you try to create/update a recommendation with
13119    /// this set of knobs.
13120    ///
13121    /// [google.cloud.retail.v2.Model.optimization_objective]: crate::model::Model::optimization_objective
13122    pub r#type: std::string::String,
13123
13124    /// Optional. The optimization objective e.g. `cvr`.
13125    ///
13126    /// Currently supported
13127    /// values: `ctr`, `cvr`, `revenue-per-order`.
13128    ///
13129    /// If not specified, we choose default based on model type.
13130    /// Default depends on type of recommendation:
13131    ///
13132    /// `recommended-for-you` => `ctr`
13133    ///
13134    /// `others-you-may-like` => `ctr`
13135    ///
13136    /// `frequently-bought-together` => `revenue_per_order`
13137    ///
13138    /// This field together with
13139    /// [optimization_objective][google.cloud.retail.v2.Model.type]
13140    /// describe model metadata to use to control model training and serving.
13141    /// See <https://cloud.google.com/retail/docs/models>
13142    /// for more details on what the model metadata control and which combination
13143    /// of parameters are valid. For invalid combinations of parameters (e.g. type
13144    /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13145    /// receive an error 400 if you try to create/update a recommendation with
13146    /// this set of knobs.
13147    ///
13148    /// [google.cloud.retail.v2.Model.type]: crate::model::Model::type
13149    pub optimization_objective: std::string::String,
13150
13151    /// Optional. The state of periodic tuning.
13152    ///
13153    /// The period we use is 3 months - to do a
13154    /// one-off tune earlier use the `TuneModel` method. Default value
13155    /// is `PERIODIC_TUNING_ENABLED`.
13156    pub periodic_tuning_state: crate::model::model::PeriodicTuningState,
13157
13158    /// Output only. The timestamp when the latest successful tune finished.
13159    pub last_tune_time: std::option::Option<wkt::Timestamp>,
13160
13161    /// Output only. The tune operation associated with the model.
13162    ///
13163    /// Can be used to determine if there is an ongoing tune for this
13164    /// recommendation. Empty field implies no tune is goig on.
13165    pub tuning_operation: std::string::String,
13166
13167    /// Output only. The state of data requirements for this model: `DATA_OK` and
13168    /// `DATA_ERROR`.
13169    ///
13170    /// Recommendation model cannot be trained if the data is in
13171    /// `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even
13172    /// if serving state is `ACTIVE`: models were trained successfully before, but
13173    /// cannot be refreshed because model no longer has sufficient
13174    /// data for training.
13175    pub data_state: crate::model::model::DataState,
13176
13177    /// Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering
13178    /// by attributes is enabled for the model.
13179    pub filtering_option: crate::model::RecommendationsFilteringOption,
13180
13181    /// Output only. The list of valid serving configs associated with the
13182    /// PageOptimizationConfig.
13183    pub serving_config_lists: std::vec::Vec<crate::model::model::ServingConfigList>,
13184
13185    /// Optional. Additional model features config.
13186    pub model_features_config: std::option::Option<crate::model::model::ModelFeaturesConfig>,
13187
13188    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13189}
13190
13191impl Model {
13192    pub fn new() -> Self {
13193        std::default::Default::default()
13194    }
13195
13196    /// Sets the value of [name][crate::model::Model::name].
13197    ///
13198    /// # Example
13199    /// ```ignore,no_run
13200    /// # use google_cloud_retail_v2::model::Model;
13201    /// let x = Model::new().set_name("example");
13202    /// ```
13203    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13204        self.name = v.into();
13205        self
13206    }
13207
13208    /// Sets the value of [display_name][crate::model::Model::display_name].
13209    ///
13210    /// # Example
13211    /// ```ignore,no_run
13212    /// # use google_cloud_retail_v2::model::Model;
13213    /// let x = Model::new().set_display_name("example");
13214    /// ```
13215    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13216        self.display_name = v.into();
13217        self
13218    }
13219
13220    /// Sets the value of [training_state][crate::model::Model::training_state].
13221    ///
13222    /// # Example
13223    /// ```ignore,no_run
13224    /// # use google_cloud_retail_v2::model::Model;
13225    /// use google_cloud_retail_v2::model::model::TrainingState;
13226    /// let x0 = Model::new().set_training_state(TrainingState::Paused);
13227    /// let x1 = Model::new().set_training_state(TrainingState::Training);
13228    /// ```
13229    pub fn set_training_state<T: std::convert::Into<crate::model::model::TrainingState>>(
13230        mut self,
13231        v: T,
13232    ) -> Self {
13233        self.training_state = v.into();
13234        self
13235    }
13236
13237    /// Sets the value of [serving_state][crate::model::Model::serving_state].
13238    ///
13239    /// # Example
13240    /// ```ignore,no_run
13241    /// # use google_cloud_retail_v2::model::Model;
13242    /// use google_cloud_retail_v2::model::model::ServingState;
13243    /// let x0 = Model::new().set_serving_state(ServingState::Inactive);
13244    /// let x1 = Model::new().set_serving_state(ServingState::Active);
13245    /// let x2 = Model::new().set_serving_state(ServingState::Tuned);
13246    /// ```
13247    pub fn set_serving_state<T: std::convert::Into<crate::model::model::ServingState>>(
13248        mut self,
13249        v: T,
13250    ) -> Self {
13251        self.serving_state = v.into();
13252        self
13253    }
13254
13255    /// Sets the value of [create_time][crate::model::Model::create_time].
13256    ///
13257    /// # Example
13258    /// ```ignore,no_run
13259    /// # use google_cloud_retail_v2::model::Model;
13260    /// use wkt::Timestamp;
13261    /// let x = Model::new().set_create_time(Timestamp::default()/* use setters */);
13262    /// ```
13263    pub fn set_create_time<T>(mut self, v: T) -> Self
13264    where
13265        T: std::convert::Into<wkt::Timestamp>,
13266    {
13267        self.create_time = std::option::Option::Some(v.into());
13268        self
13269    }
13270
13271    /// Sets or clears the value of [create_time][crate::model::Model::create_time].
13272    ///
13273    /// # Example
13274    /// ```ignore,no_run
13275    /// # use google_cloud_retail_v2::model::Model;
13276    /// use wkt::Timestamp;
13277    /// let x = Model::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13278    /// let x = Model::new().set_or_clear_create_time(None::<Timestamp>);
13279    /// ```
13280    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13281    where
13282        T: std::convert::Into<wkt::Timestamp>,
13283    {
13284        self.create_time = v.map(|x| x.into());
13285        self
13286    }
13287
13288    /// Sets the value of [update_time][crate::model::Model::update_time].
13289    ///
13290    /// # Example
13291    /// ```ignore,no_run
13292    /// # use google_cloud_retail_v2::model::Model;
13293    /// use wkt::Timestamp;
13294    /// let x = Model::new().set_update_time(Timestamp::default()/* use setters */);
13295    /// ```
13296    pub fn set_update_time<T>(mut self, v: T) -> Self
13297    where
13298        T: std::convert::Into<wkt::Timestamp>,
13299    {
13300        self.update_time = std::option::Option::Some(v.into());
13301        self
13302    }
13303
13304    /// Sets or clears the value of [update_time][crate::model::Model::update_time].
13305    ///
13306    /// # Example
13307    /// ```ignore,no_run
13308    /// # use google_cloud_retail_v2::model::Model;
13309    /// use wkt::Timestamp;
13310    /// let x = Model::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13311    /// let x = Model::new().set_or_clear_update_time(None::<Timestamp>);
13312    /// ```
13313    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13314    where
13315        T: std::convert::Into<wkt::Timestamp>,
13316    {
13317        self.update_time = v.map(|x| x.into());
13318        self
13319    }
13320
13321    /// Sets the value of [r#type][crate::model::Model::type].
13322    ///
13323    /// # Example
13324    /// ```ignore,no_run
13325    /// # use google_cloud_retail_v2::model::Model;
13326    /// let x = Model::new().set_type("example");
13327    /// ```
13328    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13329        self.r#type = v.into();
13330        self
13331    }
13332
13333    /// Sets the value of [optimization_objective][crate::model::Model::optimization_objective].
13334    ///
13335    /// # Example
13336    /// ```ignore,no_run
13337    /// # use google_cloud_retail_v2::model::Model;
13338    /// let x = Model::new().set_optimization_objective("example");
13339    /// ```
13340    pub fn set_optimization_objective<T: std::convert::Into<std::string::String>>(
13341        mut self,
13342        v: T,
13343    ) -> Self {
13344        self.optimization_objective = v.into();
13345        self
13346    }
13347
13348    /// Sets the value of [periodic_tuning_state][crate::model::Model::periodic_tuning_state].
13349    ///
13350    /// # Example
13351    /// ```ignore,no_run
13352    /// # use google_cloud_retail_v2::model::Model;
13353    /// use google_cloud_retail_v2::model::model::PeriodicTuningState;
13354    /// let x0 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningDisabled);
13355    /// let x1 = Model::new().set_periodic_tuning_state(PeriodicTuningState::AllTuningDisabled);
13356    /// let x2 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningEnabled);
13357    /// ```
13358    pub fn set_periodic_tuning_state<
13359        T: std::convert::Into<crate::model::model::PeriodicTuningState>,
13360    >(
13361        mut self,
13362        v: T,
13363    ) -> Self {
13364        self.periodic_tuning_state = v.into();
13365        self
13366    }
13367
13368    /// Sets the value of [last_tune_time][crate::model::Model::last_tune_time].
13369    ///
13370    /// # Example
13371    /// ```ignore,no_run
13372    /// # use google_cloud_retail_v2::model::Model;
13373    /// use wkt::Timestamp;
13374    /// let x = Model::new().set_last_tune_time(Timestamp::default()/* use setters */);
13375    /// ```
13376    pub fn set_last_tune_time<T>(mut self, v: T) -> Self
13377    where
13378        T: std::convert::Into<wkt::Timestamp>,
13379    {
13380        self.last_tune_time = std::option::Option::Some(v.into());
13381        self
13382    }
13383
13384    /// Sets or clears the value of [last_tune_time][crate::model::Model::last_tune_time].
13385    ///
13386    /// # Example
13387    /// ```ignore,no_run
13388    /// # use google_cloud_retail_v2::model::Model;
13389    /// use wkt::Timestamp;
13390    /// let x = Model::new().set_or_clear_last_tune_time(Some(Timestamp::default()/* use setters */));
13391    /// let x = Model::new().set_or_clear_last_tune_time(None::<Timestamp>);
13392    /// ```
13393    pub fn set_or_clear_last_tune_time<T>(mut self, v: std::option::Option<T>) -> Self
13394    where
13395        T: std::convert::Into<wkt::Timestamp>,
13396    {
13397        self.last_tune_time = v.map(|x| x.into());
13398        self
13399    }
13400
13401    /// Sets the value of [tuning_operation][crate::model::Model::tuning_operation].
13402    ///
13403    /// # Example
13404    /// ```ignore,no_run
13405    /// # use google_cloud_retail_v2::model::Model;
13406    /// let x = Model::new().set_tuning_operation("example");
13407    /// ```
13408    pub fn set_tuning_operation<T: std::convert::Into<std::string::String>>(
13409        mut self,
13410        v: T,
13411    ) -> Self {
13412        self.tuning_operation = v.into();
13413        self
13414    }
13415
13416    /// Sets the value of [data_state][crate::model::Model::data_state].
13417    ///
13418    /// # Example
13419    /// ```ignore,no_run
13420    /// # use google_cloud_retail_v2::model::Model;
13421    /// use google_cloud_retail_v2::model::model::DataState;
13422    /// let x0 = Model::new().set_data_state(DataState::DataOk);
13423    /// let x1 = Model::new().set_data_state(DataState::DataError);
13424    /// ```
13425    pub fn set_data_state<T: std::convert::Into<crate::model::model::DataState>>(
13426        mut self,
13427        v: T,
13428    ) -> Self {
13429        self.data_state = v.into();
13430        self
13431    }
13432
13433    /// Sets the value of [filtering_option][crate::model::Model::filtering_option].
13434    ///
13435    /// # Example
13436    /// ```ignore,no_run
13437    /// # use google_cloud_retail_v2::model::Model;
13438    /// use google_cloud_retail_v2::model::RecommendationsFilteringOption;
13439    /// let x0 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringDisabled);
13440    /// let x1 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringEnabled);
13441    /// ```
13442    pub fn set_filtering_option<
13443        T: std::convert::Into<crate::model::RecommendationsFilteringOption>,
13444    >(
13445        mut self,
13446        v: T,
13447    ) -> Self {
13448        self.filtering_option = v.into();
13449        self
13450    }
13451
13452    /// Sets the value of [serving_config_lists][crate::model::Model::serving_config_lists].
13453    ///
13454    /// # Example
13455    /// ```ignore,no_run
13456    /// # use google_cloud_retail_v2::model::Model;
13457    /// use google_cloud_retail_v2::model::model::ServingConfigList;
13458    /// let x = Model::new()
13459    ///     .set_serving_config_lists([
13460    ///         ServingConfigList::default()/* use setters */,
13461    ///         ServingConfigList::default()/* use (different) setters */,
13462    ///     ]);
13463    /// ```
13464    pub fn set_serving_config_lists<T, V>(mut self, v: T) -> Self
13465    where
13466        T: std::iter::IntoIterator<Item = V>,
13467        V: std::convert::Into<crate::model::model::ServingConfigList>,
13468    {
13469        use std::iter::Iterator;
13470        self.serving_config_lists = v.into_iter().map(|i| i.into()).collect();
13471        self
13472    }
13473
13474    /// Sets the value of [model_features_config][crate::model::Model::model_features_config].
13475    ///
13476    /// # Example
13477    /// ```ignore,no_run
13478    /// # use google_cloud_retail_v2::model::Model;
13479    /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13480    /// let x = Model::new().set_model_features_config(ModelFeaturesConfig::default()/* use setters */);
13481    /// ```
13482    pub fn set_model_features_config<T>(mut self, v: T) -> Self
13483    where
13484        T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13485    {
13486        self.model_features_config = std::option::Option::Some(v.into());
13487        self
13488    }
13489
13490    /// Sets or clears the value of [model_features_config][crate::model::Model::model_features_config].
13491    ///
13492    /// # Example
13493    /// ```ignore,no_run
13494    /// # use google_cloud_retail_v2::model::Model;
13495    /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13496    /// let x = Model::new().set_or_clear_model_features_config(Some(ModelFeaturesConfig::default()/* use setters */));
13497    /// let x = Model::new().set_or_clear_model_features_config(None::<ModelFeaturesConfig>);
13498    /// ```
13499    pub fn set_or_clear_model_features_config<T>(mut self, v: std::option::Option<T>) -> Self
13500    where
13501        T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13502    {
13503        self.model_features_config = v.map(|x| x.into());
13504        self
13505    }
13506}
13507
13508impl wkt::message::Message for Model {
13509    fn typename() -> &'static str {
13510        "type.googleapis.com/google.cloud.retail.v2.Model"
13511    }
13512}
13513
13514/// Defines additional types related to [Model].
13515pub mod model {
13516    #[allow(unused_imports)]
13517    use super::*;
13518
13519    /// Represents an ordered combination of valid serving configs, which
13520    /// can be used for `PAGE_OPTIMIZATION` recommendations.
13521    #[derive(Clone, Default, PartialEq)]
13522    #[non_exhaustive]
13523    pub struct ServingConfigList {
13524        /// Optional. A set of valid serving configs that may be used for
13525        /// `PAGE_OPTIMIZATION`.
13526        pub serving_config_ids: std::vec::Vec<std::string::String>,
13527
13528        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13529    }
13530
13531    impl ServingConfigList {
13532        pub fn new() -> Self {
13533            std::default::Default::default()
13534        }
13535
13536        /// Sets the value of [serving_config_ids][crate::model::model::ServingConfigList::serving_config_ids].
13537        ///
13538        /// # Example
13539        /// ```ignore,no_run
13540        /// # use google_cloud_retail_v2::model::model::ServingConfigList;
13541        /// let x = ServingConfigList::new().set_serving_config_ids(["a", "b", "c"]);
13542        /// ```
13543        pub fn set_serving_config_ids<T, V>(mut self, v: T) -> Self
13544        where
13545            T: std::iter::IntoIterator<Item = V>,
13546            V: std::convert::Into<std::string::String>,
13547        {
13548            use std::iter::Iterator;
13549            self.serving_config_ids = v.into_iter().map(|i| i.into()).collect();
13550            self
13551        }
13552    }
13553
13554    impl wkt::message::Message for ServingConfigList {
13555        fn typename() -> &'static str {
13556            "type.googleapis.com/google.cloud.retail.v2.Model.ServingConfigList"
13557        }
13558    }
13559
13560    /// Additional configs for the frequently-bought-together model type.
13561    #[derive(Clone, Default, PartialEq)]
13562    #[non_exhaustive]
13563    pub struct FrequentlyBoughtTogetherFeaturesConfig {
13564        /// Optional. Specifies the context of the model when it is used in predict
13565        /// requests. Can only be set for the `frequently-bought-together` type. If
13566        /// it isn't specified, it defaults to
13567        /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
13568        ///
13569        /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
13570        pub context_products_type: crate::model::model::ContextProductsType,
13571
13572        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13573    }
13574
13575    impl FrequentlyBoughtTogetherFeaturesConfig {
13576        pub fn new() -> Self {
13577            std::default::Default::default()
13578        }
13579
13580        /// Sets the value of [context_products_type][crate::model::model::FrequentlyBoughtTogetherFeaturesConfig::context_products_type].
13581        ///
13582        /// # Example
13583        /// ```ignore,no_run
13584        /// # use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13585        /// use google_cloud_retail_v2::model::model::ContextProductsType;
13586        /// let x0 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::SingleContextProduct);
13587        /// let x1 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::MultipleContextProducts);
13588        /// ```
13589        pub fn set_context_products_type<
13590            T: std::convert::Into<crate::model::model::ContextProductsType>,
13591        >(
13592            mut self,
13593            v: T,
13594        ) -> Self {
13595            self.context_products_type = v.into();
13596            self
13597        }
13598    }
13599
13600    impl wkt::message::Message for FrequentlyBoughtTogetherFeaturesConfig {
13601        fn typename() -> &'static str {
13602            "type.googleapis.com/google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig"
13603        }
13604    }
13605
13606    /// Additional model features config.
13607    #[derive(Clone, Default, PartialEq)]
13608    #[non_exhaustive]
13609    pub struct ModelFeaturesConfig {
13610        pub type_dedicated_config:
13611            std::option::Option<crate::model::model::model_features_config::TypeDedicatedConfig>,
13612
13613        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13614    }
13615
13616    impl ModelFeaturesConfig {
13617        pub fn new() -> Self {
13618            std::default::Default::default()
13619        }
13620
13621        /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config].
13622        ///
13623        /// Note that all the setters affecting `type_dedicated_config` are mutually
13624        /// exclusive.
13625        ///
13626        /// # Example
13627        /// ```ignore,no_run
13628        /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13629        /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13630        /// let x = ModelFeaturesConfig::new().set_type_dedicated_config(Some(
13631        ///     google_cloud_retail_v2::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(FrequentlyBoughtTogetherFeaturesConfig::default().into())));
13632        /// ```
13633        pub fn set_type_dedicated_config<
13634            T: std::convert::Into<
13635                    std::option::Option<
13636                        crate::model::model::model_features_config::TypeDedicatedConfig,
13637                    >,
13638                >,
13639        >(
13640            mut self,
13641            v: T,
13642        ) -> Self {
13643            self.type_dedicated_config = v.into();
13644            self
13645        }
13646
13647        /// The value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13648        /// if it holds a `FrequentlyBoughtTogetherConfig`, `None` if the field is not set or
13649        /// holds a different branch.
13650        pub fn frequently_bought_together_config(
13651            &self,
13652        ) -> std::option::Option<
13653            &std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13654        > {
13655            #[allow(unreachable_patterns)]
13656            self.type_dedicated_config.as_ref().and_then(|v| match v {
13657                crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(v) => std::option::Option::Some(v),
13658                _ => std::option::Option::None,
13659            })
13660        }
13661
13662        /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13663        /// to hold a `FrequentlyBoughtTogetherConfig`.
13664        ///
13665        /// Note that all the setters affecting `type_dedicated_config` are
13666        /// mutually exclusive.
13667        ///
13668        /// # Example
13669        /// ```ignore,no_run
13670        /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13671        /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13672        /// let x = ModelFeaturesConfig::new().set_frequently_bought_together_config(FrequentlyBoughtTogetherFeaturesConfig::default()/* use setters */);
13673        /// assert!(x.frequently_bought_together_config().is_some());
13674        /// ```
13675        pub fn set_frequently_bought_together_config<
13676            T: std::convert::Into<
13677                    std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13678                >,
13679        >(
13680            mut self,
13681            v: T,
13682        ) -> Self {
13683            self.type_dedicated_config = std::option::Option::Some(
13684                crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(
13685                    v.into()
13686                )
13687            );
13688            self
13689        }
13690    }
13691
13692    impl wkt::message::Message for ModelFeaturesConfig {
13693        fn typename() -> &'static str {
13694            "type.googleapis.com/google.cloud.retail.v2.Model.ModelFeaturesConfig"
13695        }
13696    }
13697
13698    /// Defines additional types related to [ModelFeaturesConfig].
13699    pub mod model_features_config {
13700        #[allow(unused_imports)]
13701        use super::*;
13702
13703        #[derive(Clone, Debug, PartialEq)]
13704        #[non_exhaustive]
13705        pub enum TypeDedicatedConfig {
13706            /// Additional configs for frequently-bought-together models.
13707            FrequentlyBoughtTogetherConfig(
13708                std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13709            ),
13710        }
13711    }
13712
13713    /// The serving state of the model.
13714    ///
13715    /// # Working with unknown values
13716    ///
13717    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13718    /// additional enum variants at any time. Adding new variants is not considered
13719    /// a breaking change. Applications should write their code in anticipation of:
13720    ///
13721    /// - New values appearing in future releases of the client library, **and**
13722    /// - New values received dynamically, without application changes.
13723    ///
13724    /// Please consult the [Working with enums] section in the user guide for some
13725    /// guidelines.
13726    ///
13727    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13728    #[derive(Clone, Debug, PartialEq)]
13729    #[non_exhaustive]
13730    pub enum ServingState {
13731        /// Unspecified serving state.
13732        Unspecified,
13733        /// The model is not serving.
13734        Inactive,
13735        /// The model is serving and can be queried.
13736        Active,
13737        /// The model is trained on tuned hyperparameters and can be
13738        /// queried.
13739        Tuned,
13740        /// If set, the enum was initialized with an unknown value.
13741        ///
13742        /// Applications can examine the value using [ServingState::value] or
13743        /// [ServingState::name].
13744        UnknownValue(serving_state::UnknownValue),
13745    }
13746
13747    #[doc(hidden)]
13748    pub mod serving_state {
13749        #[allow(unused_imports)]
13750        use super::*;
13751        #[derive(Clone, Debug, PartialEq)]
13752        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13753    }
13754
13755    impl ServingState {
13756        /// Gets the enum value.
13757        ///
13758        /// Returns `None` if the enum contains an unknown value deserialized from
13759        /// the string representation of enums.
13760        pub fn value(&self) -> std::option::Option<i32> {
13761            match self {
13762                Self::Unspecified => std::option::Option::Some(0),
13763                Self::Inactive => std::option::Option::Some(1),
13764                Self::Active => std::option::Option::Some(2),
13765                Self::Tuned => std::option::Option::Some(3),
13766                Self::UnknownValue(u) => u.0.value(),
13767            }
13768        }
13769
13770        /// Gets the enum value as a string.
13771        ///
13772        /// Returns `None` if the enum contains an unknown value deserialized from
13773        /// the integer representation of enums.
13774        pub fn name(&self) -> std::option::Option<&str> {
13775            match self {
13776                Self::Unspecified => std::option::Option::Some("SERVING_STATE_UNSPECIFIED"),
13777                Self::Inactive => std::option::Option::Some("INACTIVE"),
13778                Self::Active => std::option::Option::Some("ACTIVE"),
13779                Self::Tuned => std::option::Option::Some("TUNED"),
13780                Self::UnknownValue(u) => u.0.name(),
13781            }
13782        }
13783    }
13784
13785    impl std::default::Default for ServingState {
13786        fn default() -> Self {
13787            use std::convert::From;
13788            Self::from(0)
13789        }
13790    }
13791
13792    impl std::fmt::Display for ServingState {
13793        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13794            wkt::internal::display_enum(f, self.name(), self.value())
13795        }
13796    }
13797
13798    impl std::convert::From<i32> for ServingState {
13799        fn from(value: i32) -> Self {
13800            match value {
13801                0 => Self::Unspecified,
13802                1 => Self::Inactive,
13803                2 => Self::Active,
13804                3 => Self::Tuned,
13805                _ => Self::UnknownValue(serving_state::UnknownValue(
13806                    wkt::internal::UnknownEnumValue::Integer(value),
13807                )),
13808            }
13809        }
13810    }
13811
13812    impl std::convert::From<&str> for ServingState {
13813        fn from(value: &str) -> Self {
13814            use std::string::ToString;
13815            match value {
13816                "SERVING_STATE_UNSPECIFIED" => Self::Unspecified,
13817                "INACTIVE" => Self::Inactive,
13818                "ACTIVE" => Self::Active,
13819                "TUNED" => Self::Tuned,
13820                _ => Self::UnknownValue(serving_state::UnknownValue(
13821                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13822                )),
13823            }
13824        }
13825    }
13826
13827    impl serde::ser::Serialize for ServingState {
13828        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13829        where
13830            S: serde::Serializer,
13831        {
13832            match self {
13833                Self::Unspecified => serializer.serialize_i32(0),
13834                Self::Inactive => serializer.serialize_i32(1),
13835                Self::Active => serializer.serialize_i32(2),
13836                Self::Tuned => serializer.serialize_i32(3),
13837                Self::UnknownValue(u) => u.0.serialize(serializer),
13838            }
13839        }
13840    }
13841
13842    impl<'de> serde::de::Deserialize<'de> for ServingState {
13843        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13844        where
13845            D: serde::Deserializer<'de>,
13846        {
13847            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServingState>::new(
13848                ".google.cloud.retail.v2.Model.ServingState",
13849            ))
13850        }
13851    }
13852
13853    /// The training state of the model.
13854    ///
13855    /// # Working with unknown values
13856    ///
13857    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13858    /// additional enum variants at any time. Adding new variants is not considered
13859    /// a breaking change. Applications should write their code in anticipation of:
13860    ///
13861    /// - New values appearing in future releases of the client library, **and**
13862    /// - New values received dynamically, without application changes.
13863    ///
13864    /// Please consult the [Working with enums] section in the user guide for some
13865    /// guidelines.
13866    ///
13867    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13868    #[derive(Clone, Debug, PartialEq)]
13869    #[non_exhaustive]
13870    pub enum TrainingState {
13871        /// Unspecified training state.
13872        Unspecified,
13873        /// The model training is paused.
13874        Paused,
13875        /// The model is training.
13876        Training,
13877        /// If set, the enum was initialized with an unknown value.
13878        ///
13879        /// Applications can examine the value using [TrainingState::value] or
13880        /// [TrainingState::name].
13881        UnknownValue(training_state::UnknownValue),
13882    }
13883
13884    #[doc(hidden)]
13885    pub mod training_state {
13886        #[allow(unused_imports)]
13887        use super::*;
13888        #[derive(Clone, Debug, PartialEq)]
13889        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13890    }
13891
13892    impl TrainingState {
13893        /// Gets the enum value.
13894        ///
13895        /// Returns `None` if the enum contains an unknown value deserialized from
13896        /// the string representation of enums.
13897        pub fn value(&self) -> std::option::Option<i32> {
13898            match self {
13899                Self::Unspecified => std::option::Option::Some(0),
13900                Self::Paused => std::option::Option::Some(1),
13901                Self::Training => std::option::Option::Some(2),
13902                Self::UnknownValue(u) => u.0.value(),
13903            }
13904        }
13905
13906        /// Gets the enum value as a string.
13907        ///
13908        /// Returns `None` if the enum contains an unknown value deserialized from
13909        /// the integer representation of enums.
13910        pub fn name(&self) -> std::option::Option<&str> {
13911            match self {
13912                Self::Unspecified => std::option::Option::Some("TRAINING_STATE_UNSPECIFIED"),
13913                Self::Paused => std::option::Option::Some("PAUSED"),
13914                Self::Training => std::option::Option::Some("TRAINING"),
13915                Self::UnknownValue(u) => u.0.name(),
13916            }
13917        }
13918    }
13919
13920    impl std::default::Default for TrainingState {
13921        fn default() -> Self {
13922            use std::convert::From;
13923            Self::from(0)
13924        }
13925    }
13926
13927    impl std::fmt::Display for TrainingState {
13928        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13929            wkt::internal::display_enum(f, self.name(), self.value())
13930        }
13931    }
13932
13933    impl std::convert::From<i32> for TrainingState {
13934        fn from(value: i32) -> Self {
13935            match value {
13936                0 => Self::Unspecified,
13937                1 => Self::Paused,
13938                2 => Self::Training,
13939                _ => Self::UnknownValue(training_state::UnknownValue(
13940                    wkt::internal::UnknownEnumValue::Integer(value),
13941                )),
13942            }
13943        }
13944    }
13945
13946    impl std::convert::From<&str> for TrainingState {
13947        fn from(value: &str) -> Self {
13948            use std::string::ToString;
13949            match value {
13950                "TRAINING_STATE_UNSPECIFIED" => Self::Unspecified,
13951                "PAUSED" => Self::Paused,
13952                "TRAINING" => Self::Training,
13953                _ => Self::UnknownValue(training_state::UnknownValue(
13954                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13955                )),
13956            }
13957        }
13958    }
13959
13960    impl serde::ser::Serialize for TrainingState {
13961        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13962        where
13963            S: serde::Serializer,
13964        {
13965            match self {
13966                Self::Unspecified => serializer.serialize_i32(0),
13967                Self::Paused => serializer.serialize_i32(1),
13968                Self::Training => serializer.serialize_i32(2),
13969                Self::UnknownValue(u) => u.0.serialize(serializer),
13970            }
13971        }
13972    }
13973
13974    impl<'de> serde::de::Deserialize<'de> for TrainingState {
13975        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13976        where
13977            D: serde::Deserializer<'de>,
13978        {
13979            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingState>::new(
13980                ".google.cloud.retail.v2.Model.TrainingState",
13981            ))
13982        }
13983    }
13984
13985    /// Describes whether periodic tuning is enabled for this model
13986    /// or not. Periodic tuning is scheduled at most every three months. You can
13987    /// start a tuning process manually by using the `TuneModel`
13988    /// method, which starts a tuning process immediately and resets the quarterly
13989    /// schedule. Enabling or disabling periodic tuning does not affect any
13990    /// current tuning processes.
13991    ///
13992    /// # Working with unknown values
13993    ///
13994    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13995    /// additional enum variants at any time. Adding new variants is not considered
13996    /// a breaking change. Applications should write their code in anticipation of:
13997    ///
13998    /// - New values appearing in future releases of the client library, **and**
13999    /// - New values received dynamically, without application changes.
14000    ///
14001    /// Please consult the [Working with enums] section in the user guide for some
14002    /// guidelines.
14003    ///
14004    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14005    #[derive(Clone, Debug, PartialEq)]
14006    #[non_exhaustive]
14007    pub enum PeriodicTuningState {
14008        /// Unspecified default value, should never be explicitly set.
14009        Unspecified,
14010        /// The model has periodic tuning disabled. Tuning
14011        /// can be reenabled by calling the `EnableModelPeriodicTuning`
14012        /// method or by calling the `TuneModel` method.
14013        PeriodicTuningDisabled,
14014        /// The model cannot be tuned with periodic tuning OR the
14015        /// `TuneModel` method. Hide the options in customer UI and
14016        /// reject any requests through the backend self serve API.
14017        AllTuningDisabled,
14018        /// The model has periodic tuning enabled. Tuning
14019        /// can be disabled by calling the `DisableModelPeriodicTuning`
14020        /// method.
14021        PeriodicTuningEnabled,
14022        /// If set, the enum was initialized with an unknown value.
14023        ///
14024        /// Applications can examine the value using [PeriodicTuningState::value] or
14025        /// [PeriodicTuningState::name].
14026        UnknownValue(periodic_tuning_state::UnknownValue),
14027    }
14028
14029    #[doc(hidden)]
14030    pub mod periodic_tuning_state {
14031        #[allow(unused_imports)]
14032        use super::*;
14033        #[derive(Clone, Debug, PartialEq)]
14034        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14035    }
14036
14037    impl PeriodicTuningState {
14038        /// Gets the enum value.
14039        ///
14040        /// Returns `None` if the enum contains an unknown value deserialized from
14041        /// the string representation of enums.
14042        pub fn value(&self) -> std::option::Option<i32> {
14043            match self {
14044                Self::Unspecified => std::option::Option::Some(0),
14045                Self::PeriodicTuningDisabled => std::option::Option::Some(1),
14046                Self::AllTuningDisabled => std::option::Option::Some(3),
14047                Self::PeriodicTuningEnabled => std::option::Option::Some(2),
14048                Self::UnknownValue(u) => u.0.value(),
14049            }
14050        }
14051
14052        /// Gets the enum value as a string.
14053        ///
14054        /// Returns `None` if the enum contains an unknown value deserialized from
14055        /// the integer representation of enums.
14056        pub fn name(&self) -> std::option::Option<&str> {
14057            match self {
14058                Self::Unspecified => std::option::Option::Some("PERIODIC_TUNING_STATE_UNSPECIFIED"),
14059                Self::PeriodicTuningDisabled => {
14060                    std::option::Option::Some("PERIODIC_TUNING_DISABLED")
14061                }
14062                Self::AllTuningDisabled => std::option::Option::Some("ALL_TUNING_DISABLED"),
14063                Self::PeriodicTuningEnabled => std::option::Option::Some("PERIODIC_TUNING_ENABLED"),
14064                Self::UnknownValue(u) => u.0.name(),
14065            }
14066        }
14067    }
14068
14069    impl std::default::Default for PeriodicTuningState {
14070        fn default() -> Self {
14071            use std::convert::From;
14072            Self::from(0)
14073        }
14074    }
14075
14076    impl std::fmt::Display for PeriodicTuningState {
14077        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14078            wkt::internal::display_enum(f, self.name(), self.value())
14079        }
14080    }
14081
14082    impl std::convert::From<i32> for PeriodicTuningState {
14083        fn from(value: i32) -> Self {
14084            match value {
14085                0 => Self::Unspecified,
14086                1 => Self::PeriodicTuningDisabled,
14087                2 => Self::PeriodicTuningEnabled,
14088                3 => Self::AllTuningDisabled,
14089                _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14090                    wkt::internal::UnknownEnumValue::Integer(value),
14091                )),
14092            }
14093        }
14094    }
14095
14096    impl std::convert::From<&str> for PeriodicTuningState {
14097        fn from(value: &str) -> Self {
14098            use std::string::ToString;
14099            match value {
14100                "PERIODIC_TUNING_STATE_UNSPECIFIED" => Self::Unspecified,
14101                "PERIODIC_TUNING_DISABLED" => Self::PeriodicTuningDisabled,
14102                "ALL_TUNING_DISABLED" => Self::AllTuningDisabled,
14103                "PERIODIC_TUNING_ENABLED" => Self::PeriodicTuningEnabled,
14104                _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14105                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14106                )),
14107            }
14108        }
14109    }
14110
14111    impl serde::ser::Serialize for PeriodicTuningState {
14112        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14113        where
14114            S: serde::Serializer,
14115        {
14116            match self {
14117                Self::Unspecified => serializer.serialize_i32(0),
14118                Self::PeriodicTuningDisabled => serializer.serialize_i32(1),
14119                Self::AllTuningDisabled => serializer.serialize_i32(3),
14120                Self::PeriodicTuningEnabled => serializer.serialize_i32(2),
14121                Self::UnknownValue(u) => u.0.serialize(serializer),
14122            }
14123        }
14124    }
14125
14126    impl<'de> serde::de::Deserialize<'de> for PeriodicTuningState {
14127        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14128        where
14129            D: serde::Deserializer<'de>,
14130        {
14131            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PeriodicTuningState>::new(
14132                ".google.cloud.retail.v2.Model.PeriodicTuningState",
14133            ))
14134        }
14135    }
14136
14137    /// Describes whether this model have sufficient training data
14138    /// to be continuously trained.
14139    ///
14140    /// # Working with unknown values
14141    ///
14142    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14143    /// additional enum variants at any time. Adding new variants is not considered
14144    /// a breaking change. Applications should write their code in anticipation of:
14145    ///
14146    /// - New values appearing in future releases of the client library, **and**
14147    /// - New values received dynamically, without application changes.
14148    ///
14149    /// Please consult the [Working with enums] section in the user guide for some
14150    /// guidelines.
14151    ///
14152    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14153    #[derive(Clone, Debug, PartialEq)]
14154    #[non_exhaustive]
14155    pub enum DataState {
14156        /// Unspecified default value, should never be explicitly set.
14157        Unspecified,
14158        /// The model has sufficient training data.
14159        DataOk,
14160        /// The model does not have sufficient training data. Error
14161        /// messages can be queried via Stackdriver.
14162        DataError,
14163        /// If set, the enum was initialized with an unknown value.
14164        ///
14165        /// Applications can examine the value using [DataState::value] or
14166        /// [DataState::name].
14167        UnknownValue(data_state::UnknownValue),
14168    }
14169
14170    #[doc(hidden)]
14171    pub mod data_state {
14172        #[allow(unused_imports)]
14173        use super::*;
14174        #[derive(Clone, Debug, PartialEq)]
14175        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14176    }
14177
14178    impl DataState {
14179        /// Gets the enum value.
14180        ///
14181        /// Returns `None` if the enum contains an unknown value deserialized from
14182        /// the string representation of enums.
14183        pub fn value(&self) -> std::option::Option<i32> {
14184            match self {
14185                Self::Unspecified => std::option::Option::Some(0),
14186                Self::DataOk => std::option::Option::Some(1),
14187                Self::DataError => std::option::Option::Some(2),
14188                Self::UnknownValue(u) => u.0.value(),
14189            }
14190        }
14191
14192        /// Gets the enum value as a string.
14193        ///
14194        /// Returns `None` if the enum contains an unknown value deserialized from
14195        /// the integer representation of enums.
14196        pub fn name(&self) -> std::option::Option<&str> {
14197            match self {
14198                Self::Unspecified => std::option::Option::Some("DATA_STATE_UNSPECIFIED"),
14199                Self::DataOk => std::option::Option::Some("DATA_OK"),
14200                Self::DataError => std::option::Option::Some("DATA_ERROR"),
14201                Self::UnknownValue(u) => u.0.name(),
14202            }
14203        }
14204    }
14205
14206    impl std::default::Default for DataState {
14207        fn default() -> Self {
14208            use std::convert::From;
14209            Self::from(0)
14210        }
14211    }
14212
14213    impl std::fmt::Display for DataState {
14214        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14215            wkt::internal::display_enum(f, self.name(), self.value())
14216        }
14217    }
14218
14219    impl std::convert::From<i32> for DataState {
14220        fn from(value: i32) -> Self {
14221            match value {
14222                0 => Self::Unspecified,
14223                1 => Self::DataOk,
14224                2 => Self::DataError,
14225                _ => Self::UnknownValue(data_state::UnknownValue(
14226                    wkt::internal::UnknownEnumValue::Integer(value),
14227                )),
14228            }
14229        }
14230    }
14231
14232    impl std::convert::From<&str> for DataState {
14233        fn from(value: &str) -> Self {
14234            use std::string::ToString;
14235            match value {
14236                "DATA_STATE_UNSPECIFIED" => Self::Unspecified,
14237                "DATA_OK" => Self::DataOk,
14238                "DATA_ERROR" => Self::DataError,
14239                _ => Self::UnknownValue(data_state::UnknownValue(
14240                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14241                )),
14242            }
14243        }
14244    }
14245
14246    impl serde::ser::Serialize for DataState {
14247        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14248        where
14249            S: serde::Serializer,
14250        {
14251            match self {
14252                Self::Unspecified => serializer.serialize_i32(0),
14253                Self::DataOk => serializer.serialize_i32(1),
14254                Self::DataError => serializer.serialize_i32(2),
14255                Self::UnknownValue(u) => u.0.serialize(serializer),
14256            }
14257        }
14258    }
14259
14260    impl<'de> serde::de::Deserialize<'de> for DataState {
14261        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14262        where
14263            D: serde::Deserializer<'de>,
14264        {
14265            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataState>::new(
14266                ".google.cloud.retail.v2.Model.DataState",
14267            ))
14268        }
14269    }
14270
14271    /// Use single or multiple context products for recommendations.
14272    ///
14273    /// # Working with unknown values
14274    ///
14275    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14276    /// additional enum variants at any time. Adding new variants is not considered
14277    /// a breaking change. Applications should write their code in anticipation of:
14278    ///
14279    /// - New values appearing in future releases of the client library, **and**
14280    /// - New values received dynamically, without application changes.
14281    ///
14282    /// Please consult the [Working with enums] section in the user guide for some
14283    /// guidelines.
14284    ///
14285    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14286    #[derive(Clone, Debug, PartialEq)]
14287    #[non_exhaustive]
14288    pub enum ContextProductsType {
14289        /// Unspecified default value, should never be explicitly set.
14290        /// Defaults to
14291        /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
14292        ///
14293        /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
14294        Unspecified,
14295        /// Use only a single product as context for the recommendation. Typically
14296        /// used on pages like add-to-cart or product details.
14297        SingleContextProduct,
14298        /// Use one or multiple products as context for the recommendation. Typically
14299        /// used on shopping cart pages.
14300        MultipleContextProducts,
14301        /// If set, the enum was initialized with an unknown value.
14302        ///
14303        /// Applications can examine the value using [ContextProductsType::value] or
14304        /// [ContextProductsType::name].
14305        UnknownValue(context_products_type::UnknownValue),
14306    }
14307
14308    #[doc(hidden)]
14309    pub mod context_products_type {
14310        #[allow(unused_imports)]
14311        use super::*;
14312        #[derive(Clone, Debug, PartialEq)]
14313        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14314    }
14315
14316    impl ContextProductsType {
14317        /// Gets the enum value.
14318        ///
14319        /// Returns `None` if the enum contains an unknown value deserialized from
14320        /// the string representation of enums.
14321        pub fn value(&self) -> std::option::Option<i32> {
14322            match self {
14323                Self::Unspecified => std::option::Option::Some(0),
14324                Self::SingleContextProduct => std::option::Option::Some(1),
14325                Self::MultipleContextProducts => std::option::Option::Some(2),
14326                Self::UnknownValue(u) => u.0.value(),
14327            }
14328        }
14329
14330        /// Gets the enum value as a string.
14331        ///
14332        /// Returns `None` if the enum contains an unknown value deserialized from
14333        /// the integer representation of enums.
14334        pub fn name(&self) -> std::option::Option<&str> {
14335            match self {
14336                Self::Unspecified => std::option::Option::Some("CONTEXT_PRODUCTS_TYPE_UNSPECIFIED"),
14337                Self::SingleContextProduct => std::option::Option::Some("SINGLE_CONTEXT_PRODUCT"),
14338                Self::MultipleContextProducts => {
14339                    std::option::Option::Some("MULTIPLE_CONTEXT_PRODUCTS")
14340                }
14341                Self::UnknownValue(u) => u.0.name(),
14342            }
14343        }
14344    }
14345
14346    impl std::default::Default for ContextProductsType {
14347        fn default() -> Self {
14348            use std::convert::From;
14349            Self::from(0)
14350        }
14351    }
14352
14353    impl std::fmt::Display for ContextProductsType {
14354        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14355            wkt::internal::display_enum(f, self.name(), self.value())
14356        }
14357    }
14358
14359    impl std::convert::From<i32> for ContextProductsType {
14360        fn from(value: i32) -> Self {
14361            match value {
14362                0 => Self::Unspecified,
14363                1 => Self::SingleContextProduct,
14364                2 => Self::MultipleContextProducts,
14365                _ => Self::UnknownValue(context_products_type::UnknownValue(
14366                    wkt::internal::UnknownEnumValue::Integer(value),
14367                )),
14368            }
14369        }
14370    }
14371
14372    impl std::convert::From<&str> for ContextProductsType {
14373        fn from(value: &str) -> Self {
14374            use std::string::ToString;
14375            match value {
14376                "CONTEXT_PRODUCTS_TYPE_UNSPECIFIED" => Self::Unspecified,
14377                "SINGLE_CONTEXT_PRODUCT" => Self::SingleContextProduct,
14378                "MULTIPLE_CONTEXT_PRODUCTS" => Self::MultipleContextProducts,
14379                _ => Self::UnknownValue(context_products_type::UnknownValue(
14380                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14381                )),
14382            }
14383        }
14384    }
14385
14386    impl serde::ser::Serialize for ContextProductsType {
14387        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14388        where
14389            S: serde::Serializer,
14390        {
14391            match self {
14392                Self::Unspecified => serializer.serialize_i32(0),
14393                Self::SingleContextProduct => serializer.serialize_i32(1),
14394                Self::MultipleContextProducts => serializer.serialize_i32(2),
14395                Self::UnknownValue(u) => u.0.serialize(serializer),
14396            }
14397        }
14398    }
14399
14400    impl<'de> serde::de::Deserialize<'de> for ContextProductsType {
14401        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14402        where
14403            D: serde::Deserializer<'de>,
14404        {
14405            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContextProductsType>::new(
14406                ".google.cloud.retail.v2.Model.ContextProductsType",
14407            ))
14408        }
14409    }
14410}
14411
14412/// Request for creating a model.
14413#[derive(Clone, Default, PartialEq)]
14414#[non_exhaustive]
14415pub struct CreateModelRequest {
14416    /// Required. The parent resource under which to create the model. Format:
14417    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14418    pub parent: std::string::String,
14419
14420    /// Required. The payload of the [Model][google.cloud.retail.v2.Model]  to
14421    /// create.
14422    ///
14423    /// [google.cloud.retail.v2.Model]: crate::model::Model
14424    pub model: std::option::Option<crate::model::Model>,
14425
14426    /// Optional. Whether to run a dry run to validate the request (without
14427    /// actually creating the model).
14428    pub dry_run: bool,
14429
14430    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14431}
14432
14433impl CreateModelRequest {
14434    pub fn new() -> Self {
14435        std::default::Default::default()
14436    }
14437
14438    /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
14439    ///
14440    /// # Example
14441    /// ```ignore,no_run
14442    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14443    /// let x = CreateModelRequest::new().set_parent("example");
14444    /// ```
14445    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14446        self.parent = v.into();
14447        self
14448    }
14449
14450    /// Sets the value of [model][crate::model::CreateModelRequest::model].
14451    ///
14452    /// # Example
14453    /// ```ignore,no_run
14454    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14455    /// use google_cloud_retail_v2::model::Model;
14456    /// let x = CreateModelRequest::new().set_model(Model::default()/* use setters */);
14457    /// ```
14458    pub fn set_model<T>(mut self, v: T) -> Self
14459    where
14460        T: std::convert::Into<crate::model::Model>,
14461    {
14462        self.model = std::option::Option::Some(v.into());
14463        self
14464    }
14465
14466    /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
14467    ///
14468    /// # Example
14469    /// ```ignore,no_run
14470    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14471    /// use google_cloud_retail_v2::model::Model;
14472    /// let x = CreateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14473    /// let x = CreateModelRequest::new().set_or_clear_model(None::<Model>);
14474    /// ```
14475    pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14476    where
14477        T: std::convert::Into<crate::model::Model>,
14478    {
14479        self.model = v.map(|x| x.into());
14480        self
14481    }
14482
14483    /// Sets the value of [dry_run][crate::model::CreateModelRequest::dry_run].
14484    ///
14485    /// # Example
14486    /// ```ignore,no_run
14487    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14488    /// let x = CreateModelRequest::new().set_dry_run(true);
14489    /// ```
14490    pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14491        self.dry_run = v.into();
14492        self
14493    }
14494}
14495
14496impl wkt::message::Message for CreateModelRequest {
14497    fn typename() -> &'static str {
14498        "type.googleapis.com/google.cloud.retail.v2.CreateModelRequest"
14499    }
14500}
14501
14502/// Request for updating an existing model.
14503#[derive(Clone, Default, PartialEq)]
14504#[non_exhaustive]
14505pub struct UpdateModelRequest {
14506    /// Required. The body of the updated [Model][google.cloud.retail.v2.Model].
14507    ///
14508    /// [google.cloud.retail.v2.Model]: crate::model::Model
14509    pub model: std::option::Option<crate::model::Model>,
14510
14511    /// Optional. Indicates which fields in the provided 'model' to
14512    /// update. If not set, by default updates all fields.
14513    pub update_mask: std::option::Option<wkt::FieldMask>,
14514
14515    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14516}
14517
14518impl UpdateModelRequest {
14519    pub fn new() -> Self {
14520        std::default::Default::default()
14521    }
14522
14523    /// Sets the value of [model][crate::model::UpdateModelRequest::model].
14524    ///
14525    /// # Example
14526    /// ```ignore,no_run
14527    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14528    /// use google_cloud_retail_v2::model::Model;
14529    /// let x = UpdateModelRequest::new().set_model(Model::default()/* use setters */);
14530    /// ```
14531    pub fn set_model<T>(mut self, v: T) -> Self
14532    where
14533        T: std::convert::Into<crate::model::Model>,
14534    {
14535        self.model = std::option::Option::Some(v.into());
14536        self
14537    }
14538
14539    /// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
14540    ///
14541    /// # Example
14542    /// ```ignore,no_run
14543    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14544    /// use google_cloud_retail_v2::model::Model;
14545    /// let x = UpdateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14546    /// let x = UpdateModelRequest::new().set_or_clear_model(None::<Model>);
14547    /// ```
14548    pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14549    where
14550        T: std::convert::Into<crate::model::Model>,
14551    {
14552        self.model = v.map(|x| x.into());
14553        self
14554    }
14555
14556    /// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14557    ///
14558    /// # Example
14559    /// ```ignore,no_run
14560    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14561    /// use wkt::FieldMask;
14562    /// let x = UpdateModelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14563    /// ```
14564    pub fn set_update_mask<T>(mut self, v: T) -> Self
14565    where
14566        T: std::convert::Into<wkt::FieldMask>,
14567    {
14568        self.update_mask = std::option::Option::Some(v.into());
14569        self
14570    }
14571
14572    /// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14573    ///
14574    /// # Example
14575    /// ```ignore,no_run
14576    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14577    /// use wkt::FieldMask;
14578    /// let x = UpdateModelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14579    /// let x = UpdateModelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14580    /// ```
14581    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14582    where
14583        T: std::convert::Into<wkt::FieldMask>,
14584    {
14585        self.update_mask = v.map(|x| x.into());
14586        self
14587    }
14588}
14589
14590impl wkt::message::Message for UpdateModelRequest {
14591    fn typename() -> &'static str {
14592        "type.googleapis.com/google.cloud.retail.v2.UpdateModelRequest"
14593    }
14594}
14595
14596/// Request for getting a model.
14597#[derive(Clone, Default, PartialEq)]
14598#[non_exhaustive]
14599pub struct GetModelRequest {
14600    /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14601    /// get. Format:
14602    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}`
14603    ///
14604    /// [google.cloud.retail.v2.Model]: crate::model::Model
14605    pub name: std::string::String,
14606
14607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14608}
14609
14610impl GetModelRequest {
14611    pub fn new() -> Self {
14612        std::default::Default::default()
14613    }
14614
14615    /// Sets the value of [name][crate::model::GetModelRequest::name].
14616    ///
14617    /// # Example
14618    /// ```ignore,no_run
14619    /// # use google_cloud_retail_v2::model::GetModelRequest;
14620    /// let x = GetModelRequest::new().set_name("example");
14621    /// ```
14622    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14623        self.name = v.into();
14624        self
14625    }
14626}
14627
14628impl wkt::message::Message for GetModelRequest {
14629    fn typename() -> &'static str {
14630        "type.googleapis.com/google.cloud.retail.v2.GetModelRequest"
14631    }
14632}
14633
14634/// Request for pausing training of a model.
14635#[derive(Clone, Default, PartialEq)]
14636#[non_exhaustive]
14637pub struct PauseModelRequest {
14638    /// Required. The name of the model to pause.
14639    /// Format:
14640    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14641    pub name: std::string::String,
14642
14643    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14644}
14645
14646impl PauseModelRequest {
14647    pub fn new() -> Self {
14648        std::default::Default::default()
14649    }
14650
14651    /// Sets the value of [name][crate::model::PauseModelRequest::name].
14652    ///
14653    /// # Example
14654    /// ```ignore,no_run
14655    /// # use google_cloud_retail_v2::model::PauseModelRequest;
14656    /// let x = PauseModelRequest::new().set_name("example");
14657    /// ```
14658    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14659        self.name = v.into();
14660        self
14661    }
14662}
14663
14664impl wkt::message::Message for PauseModelRequest {
14665    fn typename() -> &'static str {
14666        "type.googleapis.com/google.cloud.retail.v2.PauseModelRequest"
14667    }
14668}
14669
14670/// Request for resuming training of a model.
14671#[derive(Clone, Default, PartialEq)]
14672#[non_exhaustive]
14673pub struct ResumeModelRequest {
14674    /// Required. The name of the model to resume.
14675    /// Format:
14676    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14677    pub name: std::string::String,
14678
14679    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14680}
14681
14682impl ResumeModelRequest {
14683    pub fn new() -> Self {
14684        std::default::Default::default()
14685    }
14686
14687    /// Sets the value of [name][crate::model::ResumeModelRequest::name].
14688    ///
14689    /// # Example
14690    /// ```ignore,no_run
14691    /// # use google_cloud_retail_v2::model::ResumeModelRequest;
14692    /// let x = ResumeModelRequest::new().set_name("example");
14693    /// ```
14694    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14695        self.name = v.into();
14696        self
14697    }
14698}
14699
14700impl wkt::message::Message for ResumeModelRequest {
14701    fn typename() -> &'static str {
14702        "type.googleapis.com/google.cloud.retail.v2.ResumeModelRequest"
14703    }
14704}
14705
14706/// Request for listing models associated with a resource.
14707#[derive(Clone, Default, PartialEq)]
14708#[non_exhaustive]
14709pub struct ListModelsRequest {
14710    /// Required. The parent for which to list models.
14711    /// Format:
14712    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14713    pub parent: std::string::String,
14714
14715    /// Optional. Maximum number of results to return. If unspecified, defaults
14716    /// to 50. Max allowed value is 1000.
14717    pub page_size: i32,
14718
14719    /// Optional. A page token, received from a previous `ListModels`
14720    /// call. Provide this to retrieve the subsequent page.
14721    pub page_token: std::string::String,
14722
14723    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14724}
14725
14726impl ListModelsRequest {
14727    pub fn new() -> Self {
14728        std::default::Default::default()
14729    }
14730
14731    /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
14732    ///
14733    /// # Example
14734    /// ```ignore,no_run
14735    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14736    /// let x = ListModelsRequest::new().set_parent("example");
14737    /// ```
14738    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14739        self.parent = v.into();
14740        self
14741    }
14742
14743    /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
14744    ///
14745    /// # Example
14746    /// ```ignore,no_run
14747    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14748    /// let x = ListModelsRequest::new().set_page_size(42);
14749    /// ```
14750    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14751        self.page_size = v.into();
14752        self
14753    }
14754
14755    /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
14756    ///
14757    /// # Example
14758    /// ```ignore,no_run
14759    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14760    /// let x = ListModelsRequest::new().set_page_token("example");
14761    /// ```
14762    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14763        self.page_token = v.into();
14764        self
14765    }
14766}
14767
14768impl wkt::message::Message for ListModelsRequest {
14769    fn typename() -> &'static str {
14770        "type.googleapis.com/google.cloud.retail.v2.ListModelsRequest"
14771    }
14772}
14773
14774/// Request for deleting a model.
14775#[derive(Clone, Default, PartialEq)]
14776#[non_exhaustive]
14777pub struct DeleteModelRequest {
14778    /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14779    /// delete. Format:
14780    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14781    ///
14782    /// [google.cloud.retail.v2.Model]: crate::model::Model
14783    pub name: std::string::String,
14784
14785    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14786}
14787
14788impl DeleteModelRequest {
14789    pub fn new() -> Self {
14790        std::default::Default::default()
14791    }
14792
14793    /// Sets the value of [name][crate::model::DeleteModelRequest::name].
14794    ///
14795    /// # Example
14796    /// ```ignore,no_run
14797    /// # use google_cloud_retail_v2::model::DeleteModelRequest;
14798    /// let x = DeleteModelRequest::new().set_name("example");
14799    /// ```
14800    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14801        self.name = v.into();
14802        self
14803    }
14804}
14805
14806impl wkt::message::Message for DeleteModelRequest {
14807    fn typename() -> &'static str {
14808        "type.googleapis.com/google.cloud.retail.v2.DeleteModelRequest"
14809    }
14810}
14811
14812/// Response to a ListModelRequest.
14813#[derive(Clone, Default, PartialEq)]
14814#[non_exhaustive]
14815pub struct ListModelsResponse {
14816    /// List of Models.
14817    pub models: std::vec::Vec<crate::model::Model>,
14818
14819    /// Pagination token, if not returned indicates the last page.
14820    pub next_page_token: std::string::String,
14821
14822    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14823}
14824
14825impl ListModelsResponse {
14826    pub fn new() -> Self {
14827        std::default::Default::default()
14828    }
14829
14830    /// Sets the value of [models][crate::model::ListModelsResponse::models].
14831    ///
14832    /// # Example
14833    /// ```ignore,no_run
14834    /// # use google_cloud_retail_v2::model::ListModelsResponse;
14835    /// use google_cloud_retail_v2::model::Model;
14836    /// let x = ListModelsResponse::new()
14837    ///     .set_models([
14838    ///         Model::default()/* use setters */,
14839    ///         Model::default()/* use (different) setters */,
14840    ///     ]);
14841    /// ```
14842    pub fn set_models<T, V>(mut self, v: T) -> Self
14843    where
14844        T: std::iter::IntoIterator<Item = V>,
14845        V: std::convert::Into<crate::model::Model>,
14846    {
14847        use std::iter::Iterator;
14848        self.models = v.into_iter().map(|i| i.into()).collect();
14849        self
14850    }
14851
14852    /// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
14853    ///
14854    /// # Example
14855    /// ```ignore,no_run
14856    /// # use google_cloud_retail_v2::model::ListModelsResponse;
14857    /// let x = ListModelsResponse::new().set_next_page_token("example");
14858    /// ```
14859    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14860        self.next_page_token = v.into();
14861        self
14862    }
14863}
14864
14865impl wkt::message::Message for ListModelsResponse {
14866    fn typename() -> &'static str {
14867        "type.googleapis.com/google.cloud.retail.v2.ListModelsResponse"
14868    }
14869}
14870
14871#[doc(hidden)]
14872impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
14873    type PageItem = crate::model::Model;
14874
14875    fn items(self) -> std::vec::Vec<Self::PageItem> {
14876        self.models
14877    }
14878
14879    fn next_page_token(&self) -> std::string::String {
14880        use std::clone::Clone;
14881        self.next_page_token.clone()
14882    }
14883}
14884
14885/// Request to manually start a tuning process now (instead of waiting for
14886/// the periodically scheduled tuning to happen).
14887#[derive(Clone, Default, PartialEq)]
14888#[non_exhaustive]
14889pub struct TuneModelRequest {
14890    /// Required. The resource name of the model to tune.
14891    /// Format:
14892    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14893    pub name: std::string::String,
14894
14895    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14896}
14897
14898impl TuneModelRequest {
14899    pub fn new() -> Self {
14900        std::default::Default::default()
14901    }
14902
14903    /// Sets the value of [name][crate::model::TuneModelRequest::name].
14904    ///
14905    /// # Example
14906    /// ```ignore,no_run
14907    /// # use google_cloud_retail_v2::model::TuneModelRequest;
14908    /// let x = TuneModelRequest::new().set_name("example");
14909    /// ```
14910    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14911        self.name = v.into();
14912        self
14913    }
14914}
14915
14916impl wkt::message::Message for TuneModelRequest {
14917    fn typename() -> &'static str {
14918        "type.googleapis.com/google.cloud.retail.v2.TuneModelRequest"
14919    }
14920}
14921
14922/// Metadata associated with a create operation.
14923#[derive(Clone, Default, PartialEq)]
14924#[non_exhaustive]
14925pub struct CreateModelMetadata {
14926    /// The resource name of the model that this create applies to.
14927    /// Format:
14928    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14929    pub model: std::string::String,
14930
14931    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14932}
14933
14934impl CreateModelMetadata {
14935    pub fn new() -> Self {
14936        std::default::Default::default()
14937    }
14938
14939    /// Sets the value of [model][crate::model::CreateModelMetadata::model].
14940    ///
14941    /// # Example
14942    /// ```ignore,no_run
14943    /// # use google_cloud_retail_v2::model::CreateModelMetadata;
14944    /// let x = CreateModelMetadata::new().set_model("example");
14945    /// ```
14946    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14947        self.model = v.into();
14948        self
14949    }
14950}
14951
14952impl wkt::message::Message for CreateModelMetadata {
14953    fn typename() -> &'static str {
14954        "type.googleapis.com/google.cloud.retail.v2.CreateModelMetadata"
14955    }
14956}
14957
14958/// Metadata associated with a tune operation.
14959#[derive(Clone, Default, PartialEq)]
14960#[non_exhaustive]
14961pub struct TuneModelMetadata {
14962    /// The resource name of the model that this tune applies to.
14963    /// Format:
14964    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14965    pub model: std::string::String,
14966
14967    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14968}
14969
14970impl TuneModelMetadata {
14971    pub fn new() -> Self {
14972        std::default::Default::default()
14973    }
14974
14975    /// Sets the value of [model][crate::model::TuneModelMetadata::model].
14976    ///
14977    /// # Example
14978    /// ```ignore,no_run
14979    /// # use google_cloud_retail_v2::model::TuneModelMetadata;
14980    /// let x = TuneModelMetadata::new().set_model("example");
14981    /// ```
14982    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14983        self.model = v.into();
14984        self
14985    }
14986}
14987
14988impl wkt::message::Message for TuneModelMetadata {
14989    fn typename() -> &'static str {
14990        "type.googleapis.com/google.cloud.retail.v2.TuneModelMetadata"
14991    }
14992}
14993
14994/// Response associated with a tune operation.
14995#[derive(Clone, Default, PartialEq)]
14996#[non_exhaustive]
14997pub struct TuneModelResponse {
14998    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14999}
15000
15001impl TuneModelResponse {
15002    pub fn new() -> Self {
15003        std::default::Default::default()
15004    }
15005}
15006
15007impl wkt::message::Message for TuneModelResponse {
15008    fn typename() -> &'static str {
15009        "type.googleapis.com/google.cloud.retail.v2.TuneModelResponse"
15010    }
15011}
15012
15013/// Request message for Predict method.
15014#[derive(Clone, Default, PartialEq)]
15015#[non_exhaustive]
15016pub struct PredictRequest {
15017    /// Required. Full resource name of the format:
15018    /// `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}`
15019    /// or
15020    /// `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`.
15021    /// We recommend using the `servingConfigs` resource. `placements` is a legacy
15022    /// resource.
15023    /// The ID of the Recommendations AI serving config or placement.
15024    /// Before you can request predictions from your model, you must create at
15025    /// least one serving config or placement for it. For more information, see
15026    /// [Manage serving configs]
15027    /// (<https://cloud.google.com/retail/docs/manage-configs>).
15028    ///
15029    /// The full list of available serving configs can be seen at
15030    /// <https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs>
15031    pub placement: std::string::String,
15032
15033    /// Required. Context about the user, what they are looking at and what action
15034    /// they took to trigger the predict request. Note that this user event detail
15035    /// won't be ingested to userEvent logs. Thus, a separate userEvent write
15036    /// request is required for event logging.
15037    ///
15038    /// Don't set
15039    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or
15040    /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same
15041    /// fixed ID for different users. If you are trying to receive non-personalized
15042    /// recommendations (not recommended; this can negatively impact model
15043    /// performance), instead set
15044    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a
15045    /// random unique ID and leave
15046    /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset.
15047    ///
15048    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
15049    /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
15050    pub user_event: std::option::Option<crate::model::UserEvent>,
15051
15052    /// Maximum number of results to return. Set this property to the number of
15053    /// prediction results needed. If zero, the service will choose a reasonable
15054    /// default. The maximum allowed value is 100. Values above 100 will be coerced
15055    /// to 100.
15056    pub page_size: i32,
15057
15058    /// This field is not used; leave it unset.
15059    #[deprecated]
15060    pub page_token: std::string::String,
15061
15062    /// Filter for restricting prediction results with a length limit of 5,000
15063    /// characters. Accepts values for tags and the `filterOutOfStockItems` flag.
15064    ///
15065    /// * Tag expressions. Restricts predictions to products that match all of the
15066    ///   specified tags. Boolean operators `OR` and `NOT` are supported if the
15067    ///   expression is enclosed in parentheses, and must be separated from the
15068    ///   tag values by a space. `-"tagA"` is also supported and is equivalent to
15069    ///   `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
15070    ///   with a size limit of 1,000 characters.
15071    ///
15072    ///   Note: "Recently viewed" models don't support tag filtering at the
15073    ///   moment.
15074    ///
15075    /// * filterOutOfStockItems. Restricts predictions to products that do not
15076    ///   have a
15077    ///   stockState value of OUT_OF_STOCK.
15078    ///
15079    ///
15080    /// Examples:
15081    ///
15082    /// * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
15083    /// * filterOutOfStockItems  tag=(-"promotional")
15084    /// * filterOutOfStockItems
15085    ///
15086    /// If your filter blocks all prediction results, the API will return *no*
15087    /// results. If instead you want empty result sets to return generic
15088    /// (unfiltered) popular products, set `strictFiltering` to False in
15089    /// `PredictRequest.params`. Note that the API will never return items with
15090    /// storageStatus of "EXPIRED" or "DELETED" regardless of filter choices.
15091    ///
15092    /// If `filterSyntaxV2` is set to true under the `params` field, then
15093    /// attribute-based expressions are expected instead of the above described
15094    /// tag-based syntax. Examples:
15095    ///
15096    /// * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones"))
15097    /// * (availability: ANY("IN_STOCK")) AND
15098    ///   (colors: ANY("Red") OR categories: ANY("Phones"))
15099    ///
15100    /// For more information, see
15101    /// [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs).
15102    pub filter: std::string::String,
15103
15104    /// Use validate only mode for this prediction query. If set to true, a
15105    /// dummy model will be used that returns arbitrary products.
15106    /// Note that the validate only mode should only be used for testing the API,
15107    /// or if the model is not ready.
15108    pub validate_only: bool,
15109
15110    /// Additional domain specific parameters for the predictions.
15111    ///
15112    /// Allowed values:
15113    ///
15114    /// * `returnProduct`: Boolean. If set to true, the associated product
15115    ///   object will be returned in the `results.metadata` field in the
15116    ///   prediction response.
15117    /// * `returnScore`: Boolean. If set to true, the prediction 'score'
15118    ///   corresponding to each returned product will be set in the
15119    ///   `results.metadata` field in the prediction response. The given
15120    ///   'score' indicates the probability of a product being clicked/purchased
15121    ///   given the user's context and history.
15122    /// * `strictFiltering`: Boolean. True by default. If set to false, the service
15123    ///   will return generic (unfiltered) popular products instead of empty if
15124    ///   your filter blocks all prediction results.
15125    /// * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
15126    ///   it needs to be one of {'no-price-reranking', 'low-price-reranking',
15127    ///   'medium-price-reranking', 'high-price-reranking'}. This gives
15128    ///   request-level control and adjusts prediction results based on product
15129    ///   price.
15130    /// * `diversityLevel`: String. Default empty. If set to be non-empty, then
15131    ///   it needs to be one of {'no-diversity', 'low-diversity',
15132    ///   'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
15133    ///   request-level control and adjusts prediction results based on product
15134    ///   category.
15135    /// * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter`
15136    ///   field is interpreteted according to the new, attribute-based syntax.
15137    pub params: std::collections::HashMap<std::string::String, wkt::Value>,
15138
15139    /// The labels applied to a resource must meet the following requirements:
15140    ///
15141    /// * Each resource can have multiple labels, up to a maximum of 64.
15142    /// * Each label must be a key-value pair.
15143    /// * Keys have a minimum length of 1 character and a maximum length of 63
15144    ///   characters and cannot be empty. Values can be empty and have a maximum
15145    ///   length of 63 characters.
15146    /// * Keys and values can contain only lowercase letters, numeric characters,
15147    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
15148    ///   international characters are allowed.
15149    /// * The key portion of a label must be unique. However, you can use the same
15150    ///   key with multiple resources.
15151    /// * Keys must start with a lowercase letter or international character.
15152    ///
15153    /// See [Google Cloud
15154    /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
15155    /// for more details.
15156    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15157
15158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15159}
15160
15161impl PredictRequest {
15162    pub fn new() -> Self {
15163        std::default::Default::default()
15164    }
15165
15166    /// Sets the value of [placement][crate::model::PredictRequest::placement].
15167    ///
15168    /// # Example
15169    /// ```ignore,no_run
15170    /// # use google_cloud_retail_v2::model::PredictRequest;
15171    /// let x = PredictRequest::new().set_placement("example");
15172    /// ```
15173    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15174        self.placement = v.into();
15175        self
15176    }
15177
15178    /// Sets the value of [user_event][crate::model::PredictRequest::user_event].
15179    ///
15180    /// # Example
15181    /// ```ignore,no_run
15182    /// # use google_cloud_retail_v2::model::PredictRequest;
15183    /// use google_cloud_retail_v2::model::UserEvent;
15184    /// let x = PredictRequest::new().set_user_event(UserEvent::default()/* use setters */);
15185    /// ```
15186    pub fn set_user_event<T>(mut self, v: T) -> Self
15187    where
15188        T: std::convert::Into<crate::model::UserEvent>,
15189    {
15190        self.user_event = std::option::Option::Some(v.into());
15191        self
15192    }
15193
15194    /// Sets or clears the value of [user_event][crate::model::PredictRequest::user_event].
15195    ///
15196    /// # Example
15197    /// ```ignore,no_run
15198    /// # use google_cloud_retail_v2::model::PredictRequest;
15199    /// use google_cloud_retail_v2::model::UserEvent;
15200    /// let x = PredictRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
15201    /// let x = PredictRequest::new().set_or_clear_user_event(None::<UserEvent>);
15202    /// ```
15203    pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15204    where
15205        T: std::convert::Into<crate::model::UserEvent>,
15206    {
15207        self.user_event = v.map(|x| x.into());
15208        self
15209    }
15210
15211    /// Sets the value of [page_size][crate::model::PredictRequest::page_size].
15212    ///
15213    /// # Example
15214    /// ```ignore,no_run
15215    /// # use google_cloud_retail_v2::model::PredictRequest;
15216    /// let x = PredictRequest::new().set_page_size(42);
15217    /// ```
15218    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15219        self.page_size = v.into();
15220        self
15221    }
15222
15223    /// Sets the value of [page_token][crate::model::PredictRequest::page_token].
15224    ///
15225    /// # Example
15226    /// ```ignore,no_run
15227    /// # use google_cloud_retail_v2::model::PredictRequest;
15228    /// let x = PredictRequest::new().set_page_token("example");
15229    /// ```
15230    #[deprecated]
15231    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15232        self.page_token = v.into();
15233        self
15234    }
15235
15236    /// Sets the value of [filter][crate::model::PredictRequest::filter].
15237    ///
15238    /// # Example
15239    /// ```ignore,no_run
15240    /// # use google_cloud_retail_v2::model::PredictRequest;
15241    /// let x = PredictRequest::new().set_filter("example");
15242    /// ```
15243    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15244        self.filter = v.into();
15245        self
15246    }
15247
15248    /// Sets the value of [validate_only][crate::model::PredictRequest::validate_only].
15249    ///
15250    /// # Example
15251    /// ```ignore,no_run
15252    /// # use google_cloud_retail_v2::model::PredictRequest;
15253    /// let x = PredictRequest::new().set_validate_only(true);
15254    /// ```
15255    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15256        self.validate_only = v.into();
15257        self
15258    }
15259
15260    /// Sets the value of [params][crate::model::PredictRequest::params].
15261    ///
15262    /// # Example
15263    /// ```ignore,no_run
15264    /// # use google_cloud_retail_v2::model::PredictRequest;
15265    /// use wkt::Value;
15266    /// let x = PredictRequest::new().set_params([
15267    ///     ("key0", Value::default()/* use setters */),
15268    ///     ("key1", Value::default()/* use (different) setters */),
15269    /// ]);
15270    /// ```
15271    pub fn set_params<T, K, V>(mut self, v: T) -> Self
15272    where
15273        T: std::iter::IntoIterator<Item = (K, V)>,
15274        K: std::convert::Into<std::string::String>,
15275        V: std::convert::Into<wkt::Value>,
15276    {
15277        use std::iter::Iterator;
15278        self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15279        self
15280    }
15281
15282    /// Sets the value of [labels][crate::model::PredictRequest::labels].
15283    ///
15284    /// # Example
15285    /// ```ignore,no_run
15286    /// # use google_cloud_retail_v2::model::PredictRequest;
15287    /// let x = PredictRequest::new().set_labels([
15288    ///     ("key0", "abc"),
15289    ///     ("key1", "xyz"),
15290    /// ]);
15291    /// ```
15292    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15293    where
15294        T: std::iter::IntoIterator<Item = (K, V)>,
15295        K: std::convert::Into<std::string::String>,
15296        V: std::convert::Into<std::string::String>,
15297    {
15298        use std::iter::Iterator;
15299        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15300        self
15301    }
15302}
15303
15304impl wkt::message::Message for PredictRequest {
15305    fn typename() -> &'static str {
15306        "type.googleapis.com/google.cloud.retail.v2.PredictRequest"
15307    }
15308}
15309
15310/// Response message for predict method.
15311#[derive(Clone, Default, PartialEq)]
15312#[non_exhaustive]
15313pub struct PredictResponse {
15314    /// A list of recommended products. The order represents the ranking (from the
15315    /// most relevant product to the least).
15316    pub results: std::vec::Vec<crate::model::predict_response::PredictionResult>,
15317
15318    /// A unique attribution token. This should be included in the
15319    /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
15320    /// recommendation, which enables accurate attribution of recommendation model
15321    /// performance.
15322    ///
15323    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
15324    pub attribution_token: std::string::String,
15325
15326    /// IDs of products in the request that were missing from the inventory.
15327    pub missing_ids: std::vec::Vec<std::string::String>,
15328
15329    /// True if the validateOnly property was set in the request.
15330    pub validate_only: bool,
15331
15332    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15333}
15334
15335impl PredictResponse {
15336    pub fn new() -> Self {
15337        std::default::Default::default()
15338    }
15339
15340    /// Sets the value of [results][crate::model::PredictResponse::results].
15341    ///
15342    /// # Example
15343    /// ```ignore,no_run
15344    /// # use google_cloud_retail_v2::model::PredictResponse;
15345    /// use google_cloud_retail_v2::model::predict_response::PredictionResult;
15346    /// let x = PredictResponse::new()
15347    ///     .set_results([
15348    ///         PredictionResult::default()/* use setters */,
15349    ///         PredictionResult::default()/* use (different) setters */,
15350    ///     ]);
15351    /// ```
15352    pub fn set_results<T, V>(mut self, v: T) -> Self
15353    where
15354        T: std::iter::IntoIterator<Item = V>,
15355        V: std::convert::Into<crate::model::predict_response::PredictionResult>,
15356    {
15357        use std::iter::Iterator;
15358        self.results = v.into_iter().map(|i| i.into()).collect();
15359        self
15360    }
15361
15362    /// Sets the value of [attribution_token][crate::model::PredictResponse::attribution_token].
15363    ///
15364    /// # Example
15365    /// ```ignore,no_run
15366    /// # use google_cloud_retail_v2::model::PredictResponse;
15367    /// let x = PredictResponse::new().set_attribution_token("example");
15368    /// ```
15369    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
15370        mut self,
15371        v: T,
15372    ) -> Self {
15373        self.attribution_token = v.into();
15374        self
15375    }
15376
15377    /// Sets the value of [missing_ids][crate::model::PredictResponse::missing_ids].
15378    ///
15379    /// # Example
15380    /// ```ignore,no_run
15381    /// # use google_cloud_retail_v2::model::PredictResponse;
15382    /// let x = PredictResponse::new().set_missing_ids(["a", "b", "c"]);
15383    /// ```
15384    pub fn set_missing_ids<T, V>(mut self, v: T) -> Self
15385    where
15386        T: std::iter::IntoIterator<Item = V>,
15387        V: std::convert::Into<std::string::String>,
15388    {
15389        use std::iter::Iterator;
15390        self.missing_ids = v.into_iter().map(|i| i.into()).collect();
15391        self
15392    }
15393
15394    /// Sets the value of [validate_only][crate::model::PredictResponse::validate_only].
15395    ///
15396    /// # Example
15397    /// ```ignore,no_run
15398    /// # use google_cloud_retail_v2::model::PredictResponse;
15399    /// let x = PredictResponse::new().set_validate_only(true);
15400    /// ```
15401    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15402        self.validate_only = v.into();
15403        self
15404    }
15405}
15406
15407impl wkt::message::Message for PredictResponse {
15408    fn typename() -> &'static str {
15409        "type.googleapis.com/google.cloud.retail.v2.PredictResponse"
15410    }
15411}
15412
15413/// Defines additional types related to [PredictResponse].
15414pub mod predict_response {
15415    #[allow(unused_imports)]
15416    use super::*;
15417
15418    /// PredictionResult represents the recommendation prediction results.
15419    #[derive(Clone, Default, PartialEq)]
15420    #[non_exhaustive]
15421    pub struct PredictionResult {
15422        /// ID of the recommended product
15423        pub id: std::string::String,
15424
15425        /// Additional product metadata / annotations.
15426        ///
15427        /// Possible values:
15428        ///
15429        /// * `product`: JSON representation of the product. Is set if
15430        ///   `returnProduct` is set to true in `PredictRequest.params`.
15431        /// * `score`: Prediction score in double value. Is set if
15432        ///   `returnScore` is set to true in `PredictRequest.params`.
15433        pub metadata: std::collections::HashMap<std::string::String, wkt::Value>,
15434
15435        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15436    }
15437
15438    impl PredictionResult {
15439        pub fn new() -> Self {
15440            std::default::Default::default()
15441        }
15442
15443        /// Sets the value of [id][crate::model::predict_response::PredictionResult::id].
15444        ///
15445        /// # Example
15446        /// ```ignore,no_run
15447        /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15448        /// let x = PredictionResult::new().set_id("example");
15449        /// ```
15450        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15451            self.id = v.into();
15452            self
15453        }
15454
15455        /// Sets the value of [metadata][crate::model::predict_response::PredictionResult::metadata].
15456        ///
15457        /// # Example
15458        /// ```ignore,no_run
15459        /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15460        /// use wkt::Value;
15461        /// let x = PredictionResult::new().set_metadata([
15462        ///     ("key0", Value::default()/* use setters */),
15463        ///     ("key1", Value::default()/* use (different) setters */),
15464        /// ]);
15465        /// ```
15466        pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
15467        where
15468            T: std::iter::IntoIterator<Item = (K, V)>,
15469            K: std::convert::Into<std::string::String>,
15470            V: std::convert::Into<wkt::Value>,
15471        {
15472            use std::iter::Iterator;
15473            self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15474            self
15475        }
15476    }
15477
15478    impl wkt::message::Message for PredictionResult {
15479        fn typename() -> &'static str {
15480            "type.googleapis.com/google.cloud.retail.v2.PredictResponse.PredictionResult"
15481        }
15482    }
15483}
15484
15485/// Product captures all metadata information of items to be recommended or
15486/// searched.
15487#[derive(Clone, Default, PartialEq)]
15488#[non_exhaustive]
15489pub struct Product {
15490    /// Immutable. Full resource name of the product, such as
15491    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`.
15492    pub name: std::string::String,
15493
15494    /// Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
15495    /// the final component of [name][google.cloud.retail.v2.Product.name]. For
15496    /// example, this field is "id_1", if
15497    /// [name][google.cloud.retail.v2.Product.name] is
15498    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`.
15499    ///
15500    /// This field must be a UTF-8 encoded string with a length limit of 128
15501    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15502    ///
15503    /// Corresponding properties: Google Merchant Center property
15504    /// [id](https://support.google.com/merchants/answer/6324405). Schema.org
15505    /// property [Product.sku](https://schema.org/sku).
15506    ///
15507    /// [google.cloud.retail.v2.Product]: crate::model::Product
15508    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15509    pub id: std::string::String,
15510
15511    /// Immutable. The type of the product. Default to
15512    /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
15513    /// if unset.
15514    ///
15515    /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
15516    pub r#type: crate::model::product::Type,
15517
15518    /// Variant group identifier. Must be an
15519    /// [id][google.cloud.retail.v2.Product.id], with the same parent branch with
15520    /// this product. Otherwise, an error is thrown.
15521    ///
15522    /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15523    /// [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
15524    /// set to the same value as [id][google.cloud.retail.v2.Product.id].
15525    ///
15526    /// For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
15527    /// be empty. A maximum of 2,000 products are allowed to share the same
15528    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15529    /// [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
15530    /// error is returned.
15531    ///
15532    /// Corresponding properties: Google Merchant Center property
15533    /// [item_group_id](https://support.google.com/merchants/answer/6324507).
15534    /// Schema.org property
15535    /// [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
15536    ///
15537    /// [google.cloud.retail.v2.Product]: crate::model::Product
15538    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15539    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15540    pub primary_product_id: std::string::String,
15541
15542    /// The [id][google.cloud.retail.v2.Product.id] of the collection members when
15543    /// [type][google.cloud.retail.v2.Product.type] is
15544    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION].
15545    ///
15546    /// Non-existent product ids are allowed.
15547    /// The [type][google.cloud.retail.v2.Product.type] of the members must be
15548    /// either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or
15549    /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an
15550    /// INVALID_ARGUMENT error is thrown. Should not set it for other types. A
15551    /// maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is
15552    /// return.
15553    ///
15554    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15555    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15556    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15557    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15558    /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15559    pub collection_member_ids: std::vec::Vec<std::string::String>,
15560
15561    /// The Global Trade Item Number (GTIN) of the product.
15562    ///
15563    /// This field must be a UTF-8 encoded string with a length limit of 128
15564    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15565    ///
15566    /// This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is
15567    /// returned.
15568    ///
15569    /// Corresponding properties: Google Merchant Center property
15570    /// [gtin](https://support.google.com/merchants/answer/6324461).
15571    /// Schema.org property
15572    /// [Product.isbn](https://schema.org/isbn),
15573    /// [Product.gtin8](https://schema.org/gtin8),
15574    /// [Product.gtin12](https://schema.org/gtin12),
15575    /// [Product.gtin13](https://schema.org/gtin13), or
15576    /// [Product.gtin14](https://schema.org/gtin14).
15577    ///
15578    /// If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.
15579    pub gtin: std::string::String,
15580
15581    /// Product categories. This field is repeated for supporting one product
15582    /// belonging to several parallel categories. Strongly recommended using the
15583    /// full path for better search / recommendation quality.
15584    ///
15585    /// To represent full path of category, use '>' sign to separate different
15586    /// hierarchies. If '>' is part of the category name, replace it with
15587    /// other character(s).
15588    ///
15589    /// For example, if a shoes product belongs to both
15590    /// ["Shoes & Accessories" -> "Shoes"] and
15591    /// ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
15592    /// represented as:
15593    ///
15594    /// ```norust
15595    ///  "categories": [
15596    ///    "Shoes & Accessories > Shoes",
15597    ///    "Sports & Fitness > Athletic Clothing > Shoes"
15598    ///  ]
15599    /// ```
15600    ///
15601    /// Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15602    /// [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
15603    /// error is returned.
15604    ///
15605    /// At most 250 values are allowed per
15606    /// [Product][google.cloud.retail.v2.Product] unless overridden through the
15607    /// Google Cloud console. Empty values are not allowed. Each value must be a
15608    /// UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an
15609    /// INVALID_ARGUMENT error is returned.
15610    ///
15611    /// Corresponding properties: Google Merchant Center property
15612    /// [google_product_category][mc_google_product_category]. Schema.org property
15613    /// [Product.category] (<https://schema.org/category>).
15614    ///
15615    /// [google.cloud.retail.v2.Product]: crate::model::Product
15616    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15617    pub categories: std::vec::Vec<std::string::String>,
15618
15619    /// Required. Product title.
15620    ///
15621    /// This field must be a UTF-8 encoded string with a length limit of 1,000
15622    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15623    ///
15624    /// Corresponding properties: Google Merchant Center property
15625    /// [title](https://support.google.com/merchants/answer/6324415). Schema.org
15626    /// property [Product.name](https://schema.org/name).
15627    pub title: std::string::String,
15628
15629    /// The brands of the product.
15630    ///
15631    /// A maximum of 30 brands are allowed unless overridden through the Google
15632    /// Cloud console. Each
15633    /// brand must be a UTF-8 encoded string with a length limit of 1,000
15634    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15635    ///
15636    /// Corresponding properties: Google Merchant Center property
15637    /// [brand](https://support.google.com/merchants/answer/6324351). Schema.org
15638    /// property [Product.brand](https://schema.org/brand).
15639    pub brands: std::vec::Vec<std::string::String>,
15640
15641    /// Product description.
15642    ///
15643    /// This field must be a UTF-8 encoded string with a length limit of 5,000
15644    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15645    ///
15646    /// Corresponding properties: Google Merchant Center property
15647    /// [description](https://support.google.com/merchants/answer/6324468).
15648    /// Schema.org property [Product.description](https://schema.org/description).
15649    pub description: std::string::String,
15650
15651    /// Language of the title/description and other string attributes. Use language
15652    /// tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
15653    ///
15654    /// For product prediction, this field is ignored and the model automatically
15655    /// detects the text language. The [Product][google.cloud.retail.v2.Product]
15656    /// can include text in different languages, but duplicating
15657    /// [Product][google.cloud.retail.v2.Product]s to provide text in multiple
15658    /// languages can result in degraded model performance.
15659    ///
15660    /// For product search this field is in use. It defaults to "en-US" if unset.
15661    ///
15662    /// [google.cloud.retail.v2.Product]: crate::model::Product
15663    pub language_code: std::string::String,
15664
15665    /// Highly encouraged. Extra product attributes to be included. For example,
15666    /// for products, this could include the store name, vendor, style, color, etc.
15667    /// These are very strong signals for recommendation model, thus we highly
15668    /// recommend providing the attributes here.
15669    ///
15670    /// Features that can take on one of a limited number of possible values. Two
15671    /// types of features can be set are:
15672    ///
15673    /// Textual features. some examples would be the brand/maker of a product, or
15674    /// country of a customer. Numerical features. Some examples would be the
15675    /// height/weight of a product, or age of a customer.
15676    ///
15677    /// For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
15678    /// "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
15679    /// }`.
15680    ///
15681    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
15682    /// error is returned:
15683    ///
15684    /// * Max entries count: 200.
15685    /// * The key must be a UTF-8 encoded string with a length limit of 128
15686    ///   characters.
15687    /// * For indexable attribute, the key must match the pattern:
15688    ///   `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or
15689    ///   `KEY_1_LIKE_THIS`.
15690    /// * For text attributes, at most 400 values are allowed. Empty values are not
15691    ///   allowed. Each value must be a non-empty UTF-8 encoded string with a
15692    ///   length limit of 256 characters.
15693    /// * For number attributes, at most 400 values are allowed.
15694    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
15695
15696    /// Custom tags associated with the product.
15697    ///
15698    /// At most 250 values are allowed per
15699    /// [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
15700    /// encoded string with a length limit of 1,000 characters. Otherwise, an
15701    /// INVALID_ARGUMENT error is returned.
15702    ///
15703    /// This tag can be used for filtering recommendation results by passing the
15704    /// tag as part of the
15705    /// [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
15706    ///
15707    /// Corresponding properties: Google Merchant Center property
15708    /// [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
15709    ///
15710    /// [google.cloud.retail.v2.PredictRequest.filter]: crate::model::PredictRequest::filter
15711    /// [google.cloud.retail.v2.Product]: crate::model::Product
15712    pub tags: std::vec::Vec<std::string::String>,
15713
15714    /// Product price and cost information.
15715    ///
15716    /// Corresponding properties: Google Merchant Center property
15717    /// [price](https://support.google.com/merchants/answer/6324371).
15718    pub price_info: std::option::Option<crate::model::PriceInfo>,
15719
15720    /// The rating of this product.
15721    pub rating: std::option::Option<crate::model::Rating>,
15722
15723    /// The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
15724    /// available for
15725    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. Note
15726    /// that this is only applicable to
15727    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15728    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], and
15729    /// ignored for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT].
15730    ///
15731    /// [google.cloud.retail.v2.Product]: crate::model::Product
15732    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15733    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15734    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15735    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
15736    pub available_time: std::option::Option<wkt::Timestamp>,
15737
15738    /// The online availability of the [Product][google.cloud.retail.v2.Product].
15739    /// Default to
15740    /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
15741    ///
15742    /// For primary products with variants set the availability of the primary as
15743    /// [Availability.OUT_OF_STOCK][google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]
15744    /// and set the true availability at the variant level. This way the primary
15745    /// product will be considered "in stock" as long as it has at least one
15746    /// variant in stock.
15747    ///
15748    /// For primary products with no variants set the true availability at the
15749    /// primary level.
15750    ///
15751    /// Corresponding properties: Google Merchant Center property
15752    /// [availability](https://support.google.com/merchants/answer/6324448).
15753    /// Schema.org property [Offer.availability](https://schema.org/availability).
15754    ///
15755    /// [google.cloud.retail.v2.Product]: crate::model::Product
15756    /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
15757    /// [google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]: crate::model::product::Availability::OutOfStock
15758    pub availability: crate::model::product::Availability,
15759
15760    /// The available quantity of the item.
15761    pub available_quantity: std::option::Option<wkt::Int32Value>,
15762
15763    /// Fulfillment information, such as the store IDs for in-store pickup or
15764    /// region IDs for different shipping methods.
15765    ///
15766    /// All the elements must have distinct
15767    /// [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type].
15768    /// Otherwise, an INVALID_ARGUMENT error is returned.
15769    ///
15770    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
15771    pub fulfillment_info: std::vec::Vec<crate::model::FulfillmentInfo>,
15772
15773    /// Canonical URL directly linking to the product detail page.
15774    ///
15775    /// It is strongly recommended to provide a valid uri for the product,
15776    /// otherwise the service performance could be significantly degraded.
15777    ///
15778    /// This field must be a UTF-8 encoded string with a length limit of 5,000
15779    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15780    ///
15781    /// Corresponding properties: Google Merchant Center property
15782    /// [link](https://support.google.com/merchants/answer/6324416). Schema.org
15783    /// property [Offer.url](https://schema.org/url).
15784    pub uri: std::string::String,
15785
15786    /// Product images for the product. We highly recommend putting the main
15787    /// image first.
15788    ///
15789    /// A maximum of 300 images are allowed.
15790    ///
15791    /// Corresponding properties: Google Merchant Center property
15792    /// [image_link](https://support.google.com/merchants/answer/6324350).
15793    /// Schema.org property [Product.image](https://schema.org/image).
15794    pub images: std::vec::Vec<crate::model::Image>,
15795
15796    /// The target group associated with a given audience (e.g. male, veterans,
15797    /// car owners, musicians, etc.) of the product.
15798    pub audience: std::option::Option<crate::model::Audience>,
15799
15800    /// The color of the product.
15801    ///
15802    /// Corresponding properties: Google Merchant Center property
15803    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
15804    /// property [Product.color](https://schema.org/color).
15805    pub color_info: std::option::Option<crate::model::ColorInfo>,
15806
15807    /// The size of the product. To represent different size systems or size types,
15808    /// consider using this format: [[[size_system:]size_type:]size_value].
15809    ///
15810    /// For example, in "US:MENS:M", "US" represents size system; "MENS" represents
15811    /// size type; "M" represents size value. In "GIRLS:27", size system is empty;
15812    /// "GIRLS" represents size type; "27" represents size value. In "32 inches",
15813    /// both size system and size type are empty, while size value is "32 inches".
15814    ///
15815    /// A maximum of 20 values are allowed per
15816    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15817    /// encoded string with a length limit of 128 characters. Otherwise, an
15818    /// INVALID_ARGUMENT error is returned.
15819    ///
15820    /// Corresponding properties: Google Merchant Center property
15821    /// [size](https://support.google.com/merchants/answer/6324492),
15822    /// [size_type](https://support.google.com/merchants/answer/6324497), and
15823    /// [size_system](https://support.google.com/merchants/answer/6324502).
15824    /// Schema.org property [Product.size](https://schema.org/size).
15825    ///
15826    /// [google.cloud.retail.v2.Product]: crate::model::Product
15827    pub sizes: std::vec::Vec<std::string::String>,
15828
15829    /// The material of the product. For example, "leather", "wooden".
15830    ///
15831    /// A maximum of 20 values are allowed. Each value must be a UTF-8 encoded
15832    /// string with a length limit of 200 characters. Otherwise, an
15833    /// INVALID_ARGUMENT error is returned.
15834    ///
15835    /// Corresponding properties: Google Merchant Center property
15836    /// [material](https://support.google.com/merchants/answer/6324410). Schema.org
15837    /// property [Product.material](https://schema.org/material).
15838    pub materials: std::vec::Vec<std::string::String>,
15839
15840    /// The pattern or graphic print of the product. For example, "striped", "polka
15841    /// dot", "paisley".
15842    ///
15843    /// A maximum of 20 values are allowed per
15844    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15845    /// encoded string with a length limit of 128 characters. Otherwise, an
15846    /// INVALID_ARGUMENT error is returned.
15847    ///
15848    /// Corresponding properties: Google Merchant Center property
15849    /// [pattern](https://support.google.com/merchants/answer/6324483). Schema.org
15850    /// property [Product.pattern](https://schema.org/pattern).
15851    ///
15852    /// [google.cloud.retail.v2.Product]: crate::model::Product
15853    pub patterns: std::vec::Vec<std::string::String>,
15854
15855    /// The condition of the product. Strongly encouraged to use the standard
15856    /// values: "new", "refurbished", "used".
15857    ///
15858    /// A maximum of 1 value is allowed per
15859    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
15860    /// encoded string with a length limit of 128 characters. Otherwise, an
15861    /// INVALID_ARGUMENT error is returned.
15862    ///
15863    /// Corresponding properties: Google Merchant Center property
15864    /// [condition](https://support.google.com/merchants/answer/6324469).
15865    /// Schema.org property
15866    /// [Offer.itemCondition](https://schema.org/itemCondition).
15867    ///
15868    /// [google.cloud.retail.v2.Product]: crate::model::Product
15869    pub conditions: std::vec::Vec<std::string::String>,
15870
15871    /// The promotions applied to the product. A maximum of 10 values are allowed
15872    /// per [Product][google.cloud.retail.v2.Product]. Only
15873    /// [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id]
15874    /// will be used, other fields will be ignored if set.
15875    ///
15876    /// [google.cloud.retail.v2.Product]: crate::model::Product
15877    /// [google.cloud.retail.v2.Promotion.promotion_id]: crate::model::Promotion::promotion_id
15878    pub promotions: std::vec::Vec<crate::model::Promotion>,
15879
15880    /// The timestamp when the product is published by the retailer for the first
15881    /// time, which indicates the freshness of the products. Note that this field
15882    /// is different from
15883    /// [available_time][google.cloud.retail.v2.Product.available_time], given it
15884    /// purely describes product freshness regardless of when it is available on
15885    /// search and recommendation.
15886    ///
15887    /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
15888    pub publish_time: std::option::Option<wkt::Timestamp>,
15889
15890    /// Indicates which fields in the [Product][google.cloud.retail.v2.Product]s
15891    /// are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse].
15892    ///
15893    /// Supported fields for all [type][google.cloud.retail.v2.Product.type]s:
15894    ///
15895    /// * [audience][google.cloud.retail.v2.Product.audience]
15896    /// * [availability][google.cloud.retail.v2.Product.availability]
15897    /// * [brands][google.cloud.retail.v2.Product.brands]
15898    /// * [color_info][google.cloud.retail.v2.Product.color_info]
15899    /// * [conditions][google.cloud.retail.v2.Product.conditions]
15900    /// * [gtin][google.cloud.retail.v2.Product.gtin]
15901    /// * [materials][google.cloud.retail.v2.Product.materials]
15902    /// * [name][google.cloud.retail.v2.Product.name]
15903    /// * [patterns][google.cloud.retail.v2.Product.patterns]
15904    /// * [price_info][google.cloud.retail.v2.Product.price_info]
15905    /// * [rating][google.cloud.retail.v2.Product.rating]
15906    /// * [sizes][google.cloud.retail.v2.Product.sizes]
15907    /// * [title][google.cloud.retail.v2.Product.title]
15908    /// * [uri][google.cloud.retail.v2.Product.uri]
15909    ///
15910    /// Supported fields only for
15911    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15912    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]:
15913    ///
15914    /// * [categories][google.cloud.retail.v2.Product.categories]
15915    /// * [description][google.cloud.retail.v2.Product.description]
15916    /// * [images][google.cloud.retail.v2.Product.images]
15917    ///
15918    /// Supported fields only for
15919    /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]:
15920    ///
15921    /// * Only the first image in [images][google.cloud.retail.v2.Product.images]
15922    ///
15923    /// To mark [attributes][google.cloud.retail.v2.Product.attributes] as
15924    /// retrievable, include paths of the form "attributes.key" where "key" is the
15925    /// key of a custom attribute, as specified in
15926    /// [attributes][google.cloud.retail.v2.Product.attributes].
15927    ///
15928    /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15929    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the
15930    /// following fields are always returned in
15931    /// [SearchResponse][google.cloud.retail.v2.SearchResponse] by default:
15932    ///
15933    /// * [name][google.cloud.retail.v2.Product.name]
15934    ///
15935    /// For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the
15936    /// following fields are always returned in by default:
15937    ///
15938    /// * [name][google.cloud.retail.v2.Product.name]
15939    /// * [color_info][google.cloud.retail.v2.Product.color_info]
15940    ///
15941    /// Note: Returning more fields in
15942    /// [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase
15943    /// response payload size and serving latency.
15944    ///
15945    /// This field is deprecated. Use the retrievable site-wide control instead.
15946    ///
15947    /// [google.cloud.retail.v2.Product]: crate::model::Product
15948    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15949    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15950    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15951    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
15952    /// [google.cloud.retail.v2.Product.audience]: crate::model::Product::audience
15953    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
15954    /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
15955    /// [google.cloud.retail.v2.Product.categories]: crate::model::Product::categories
15956    /// [google.cloud.retail.v2.Product.color_info]: crate::model::Product::color_info
15957    /// [google.cloud.retail.v2.Product.conditions]: crate::model::Product::conditions
15958    /// [google.cloud.retail.v2.Product.description]: crate::model::Product::description
15959    /// [google.cloud.retail.v2.Product.gtin]: crate::model::Product::gtin
15960    /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
15961    /// [google.cloud.retail.v2.Product.materials]: crate::model::Product::materials
15962    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15963    /// [google.cloud.retail.v2.Product.patterns]: crate::model::Product::patterns
15964    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
15965    /// [google.cloud.retail.v2.Product.rating]: crate::model::Product::rating
15966    /// [google.cloud.retail.v2.Product.sizes]: crate::model::Product::sizes
15967    /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
15968    /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15969    /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
15970    /// [google.cloud.retail.v2.SearchResponse]: crate::model::SearchResponse
15971    #[deprecated]
15972    pub retrievable_fields: std::option::Option<wkt::FieldMask>,
15973
15974    /// Output only. Product variants grouped together on primary product which
15975    /// share similar product attributes. It's automatically grouped by
15976    /// [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for
15977    /// all the product variants. Only populated for
15978    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15979    /// [Product][google.cloud.retail.v2.Product]s.
15980    ///
15981    /// Note: This field is OUTPUT_ONLY for
15982    /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
15983    /// Do not set this field in API requests.
15984    ///
15985    /// [google.cloud.retail.v2.Product]: crate::model::Product
15986    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15987    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
15988    /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
15989    pub variants: std::vec::Vec<crate::model::Product>,
15990
15991    /// Output only. A list of local inventories specific to different places.
15992    ///
15993    /// This field can be managed by
15994    /// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
15995    /// and
15996    /// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
15997    /// APIs if fine-grained, high-volume updates are necessary.
15998    ///
15999    /// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
16000    /// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
16001    pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
16002
16003    pub expiration: std::option::Option<crate::model::product::Expiration>,
16004
16005    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16006}
16007
16008impl Product {
16009    pub fn new() -> Self {
16010        std::default::Default::default()
16011    }
16012
16013    /// Sets the value of [name][crate::model::Product::name].
16014    ///
16015    /// # Example
16016    /// ```ignore,no_run
16017    /// # use google_cloud_retail_v2::model::Product;
16018    /// let x = Product::new().set_name("example");
16019    /// ```
16020    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16021        self.name = v.into();
16022        self
16023    }
16024
16025    /// Sets the value of [id][crate::model::Product::id].
16026    ///
16027    /// # Example
16028    /// ```ignore,no_run
16029    /// # use google_cloud_retail_v2::model::Product;
16030    /// let x = Product::new().set_id("example");
16031    /// ```
16032    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16033        self.id = v.into();
16034        self
16035    }
16036
16037    /// Sets the value of [r#type][crate::model::Product::type].
16038    ///
16039    /// # Example
16040    /// ```ignore,no_run
16041    /// # use google_cloud_retail_v2::model::Product;
16042    /// use google_cloud_retail_v2::model::product::Type;
16043    /// let x0 = Product::new().set_type(Type::Primary);
16044    /// let x1 = Product::new().set_type(Type::Variant);
16045    /// let x2 = Product::new().set_type(Type::Collection);
16046    /// ```
16047    pub fn set_type<T: std::convert::Into<crate::model::product::Type>>(mut self, v: T) -> Self {
16048        self.r#type = v.into();
16049        self
16050    }
16051
16052    /// Sets the value of [primary_product_id][crate::model::Product::primary_product_id].
16053    ///
16054    /// # Example
16055    /// ```ignore,no_run
16056    /// # use google_cloud_retail_v2::model::Product;
16057    /// let x = Product::new().set_primary_product_id("example");
16058    /// ```
16059    pub fn set_primary_product_id<T: std::convert::Into<std::string::String>>(
16060        mut self,
16061        v: T,
16062    ) -> Self {
16063        self.primary_product_id = v.into();
16064        self
16065    }
16066
16067    /// Sets the value of [collection_member_ids][crate::model::Product::collection_member_ids].
16068    ///
16069    /// # Example
16070    /// ```ignore,no_run
16071    /// # use google_cloud_retail_v2::model::Product;
16072    /// let x = Product::new().set_collection_member_ids(["a", "b", "c"]);
16073    /// ```
16074    pub fn set_collection_member_ids<T, V>(mut self, v: T) -> Self
16075    where
16076        T: std::iter::IntoIterator<Item = V>,
16077        V: std::convert::Into<std::string::String>,
16078    {
16079        use std::iter::Iterator;
16080        self.collection_member_ids = v.into_iter().map(|i| i.into()).collect();
16081        self
16082    }
16083
16084    /// Sets the value of [gtin][crate::model::Product::gtin].
16085    ///
16086    /// # Example
16087    /// ```ignore,no_run
16088    /// # use google_cloud_retail_v2::model::Product;
16089    /// let x = Product::new().set_gtin("example");
16090    /// ```
16091    pub fn set_gtin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16092        self.gtin = v.into();
16093        self
16094    }
16095
16096    /// Sets the value of [categories][crate::model::Product::categories].
16097    ///
16098    /// # Example
16099    /// ```ignore,no_run
16100    /// # use google_cloud_retail_v2::model::Product;
16101    /// let x = Product::new().set_categories(["a", "b", "c"]);
16102    /// ```
16103    pub fn set_categories<T, V>(mut self, v: T) -> Self
16104    where
16105        T: std::iter::IntoIterator<Item = V>,
16106        V: std::convert::Into<std::string::String>,
16107    {
16108        use std::iter::Iterator;
16109        self.categories = v.into_iter().map(|i| i.into()).collect();
16110        self
16111    }
16112
16113    /// Sets the value of [title][crate::model::Product::title].
16114    ///
16115    /// # Example
16116    /// ```ignore,no_run
16117    /// # use google_cloud_retail_v2::model::Product;
16118    /// let x = Product::new().set_title("example");
16119    /// ```
16120    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16121        self.title = v.into();
16122        self
16123    }
16124
16125    /// Sets the value of [brands][crate::model::Product::brands].
16126    ///
16127    /// # Example
16128    /// ```ignore,no_run
16129    /// # use google_cloud_retail_v2::model::Product;
16130    /// let x = Product::new().set_brands(["a", "b", "c"]);
16131    /// ```
16132    pub fn set_brands<T, V>(mut self, v: T) -> Self
16133    where
16134        T: std::iter::IntoIterator<Item = V>,
16135        V: std::convert::Into<std::string::String>,
16136    {
16137        use std::iter::Iterator;
16138        self.brands = v.into_iter().map(|i| i.into()).collect();
16139        self
16140    }
16141
16142    /// Sets the value of [description][crate::model::Product::description].
16143    ///
16144    /// # Example
16145    /// ```ignore,no_run
16146    /// # use google_cloud_retail_v2::model::Product;
16147    /// let x = Product::new().set_description("example");
16148    /// ```
16149    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16150        self.description = v.into();
16151        self
16152    }
16153
16154    /// Sets the value of [language_code][crate::model::Product::language_code].
16155    ///
16156    /// # Example
16157    /// ```ignore,no_run
16158    /// # use google_cloud_retail_v2::model::Product;
16159    /// let x = Product::new().set_language_code("example");
16160    /// ```
16161    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16162        self.language_code = v.into();
16163        self
16164    }
16165
16166    /// Sets the value of [attributes][crate::model::Product::attributes].
16167    ///
16168    /// # Example
16169    /// ```ignore,no_run
16170    /// # use google_cloud_retail_v2::model::Product;
16171    /// use google_cloud_retail_v2::model::CustomAttribute;
16172    /// let x = Product::new().set_attributes([
16173    ///     ("key0", CustomAttribute::default()/* use setters */),
16174    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
16175    /// ]);
16176    /// ```
16177    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
16178    where
16179        T: std::iter::IntoIterator<Item = (K, V)>,
16180        K: std::convert::Into<std::string::String>,
16181        V: std::convert::Into<crate::model::CustomAttribute>,
16182    {
16183        use std::iter::Iterator;
16184        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16185        self
16186    }
16187
16188    /// Sets the value of [tags][crate::model::Product::tags].
16189    ///
16190    /// # Example
16191    /// ```ignore,no_run
16192    /// # use google_cloud_retail_v2::model::Product;
16193    /// let x = Product::new().set_tags(["a", "b", "c"]);
16194    /// ```
16195    pub fn set_tags<T, V>(mut self, v: T) -> Self
16196    where
16197        T: std::iter::IntoIterator<Item = V>,
16198        V: std::convert::Into<std::string::String>,
16199    {
16200        use std::iter::Iterator;
16201        self.tags = v.into_iter().map(|i| i.into()).collect();
16202        self
16203    }
16204
16205    /// Sets the value of [price_info][crate::model::Product::price_info].
16206    ///
16207    /// # Example
16208    /// ```ignore,no_run
16209    /// # use google_cloud_retail_v2::model::Product;
16210    /// use google_cloud_retail_v2::model::PriceInfo;
16211    /// let x = Product::new().set_price_info(PriceInfo::default()/* use setters */);
16212    /// ```
16213    pub fn set_price_info<T>(mut self, v: T) -> Self
16214    where
16215        T: std::convert::Into<crate::model::PriceInfo>,
16216    {
16217        self.price_info = std::option::Option::Some(v.into());
16218        self
16219    }
16220
16221    /// Sets or clears the value of [price_info][crate::model::Product::price_info].
16222    ///
16223    /// # Example
16224    /// ```ignore,no_run
16225    /// # use google_cloud_retail_v2::model::Product;
16226    /// use google_cloud_retail_v2::model::PriceInfo;
16227    /// let x = Product::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
16228    /// let x = Product::new().set_or_clear_price_info(None::<PriceInfo>);
16229    /// ```
16230    pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
16231    where
16232        T: std::convert::Into<crate::model::PriceInfo>,
16233    {
16234        self.price_info = v.map(|x| x.into());
16235        self
16236    }
16237
16238    /// Sets the value of [rating][crate::model::Product::rating].
16239    ///
16240    /// # Example
16241    /// ```ignore,no_run
16242    /// # use google_cloud_retail_v2::model::Product;
16243    /// use google_cloud_retail_v2::model::Rating;
16244    /// let x = Product::new().set_rating(Rating::default()/* use setters */);
16245    /// ```
16246    pub fn set_rating<T>(mut self, v: T) -> Self
16247    where
16248        T: std::convert::Into<crate::model::Rating>,
16249    {
16250        self.rating = std::option::Option::Some(v.into());
16251        self
16252    }
16253
16254    /// Sets or clears the value of [rating][crate::model::Product::rating].
16255    ///
16256    /// # Example
16257    /// ```ignore,no_run
16258    /// # use google_cloud_retail_v2::model::Product;
16259    /// use google_cloud_retail_v2::model::Rating;
16260    /// let x = Product::new().set_or_clear_rating(Some(Rating::default()/* use setters */));
16261    /// let x = Product::new().set_or_clear_rating(None::<Rating>);
16262    /// ```
16263    pub fn set_or_clear_rating<T>(mut self, v: std::option::Option<T>) -> Self
16264    where
16265        T: std::convert::Into<crate::model::Rating>,
16266    {
16267        self.rating = v.map(|x| x.into());
16268        self
16269    }
16270
16271    /// Sets the value of [available_time][crate::model::Product::available_time].
16272    ///
16273    /// # Example
16274    /// ```ignore,no_run
16275    /// # use google_cloud_retail_v2::model::Product;
16276    /// use wkt::Timestamp;
16277    /// let x = Product::new().set_available_time(Timestamp::default()/* use setters */);
16278    /// ```
16279    pub fn set_available_time<T>(mut self, v: T) -> Self
16280    where
16281        T: std::convert::Into<wkt::Timestamp>,
16282    {
16283        self.available_time = std::option::Option::Some(v.into());
16284        self
16285    }
16286
16287    /// Sets or clears the value of [available_time][crate::model::Product::available_time].
16288    ///
16289    /// # Example
16290    /// ```ignore,no_run
16291    /// # use google_cloud_retail_v2::model::Product;
16292    /// use wkt::Timestamp;
16293    /// let x = Product::new().set_or_clear_available_time(Some(Timestamp::default()/* use setters */));
16294    /// let x = Product::new().set_or_clear_available_time(None::<Timestamp>);
16295    /// ```
16296    pub fn set_or_clear_available_time<T>(mut self, v: std::option::Option<T>) -> Self
16297    where
16298        T: std::convert::Into<wkt::Timestamp>,
16299    {
16300        self.available_time = v.map(|x| x.into());
16301        self
16302    }
16303
16304    /// Sets the value of [availability][crate::model::Product::availability].
16305    ///
16306    /// # Example
16307    /// ```ignore,no_run
16308    /// # use google_cloud_retail_v2::model::Product;
16309    /// use google_cloud_retail_v2::model::product::Availability;
16310    /// let x0 = Product::new().set_availability(Availability::InStock);
16311    /// let x1 = Product::new().set_availability(Availability::OutOfStock);
16312    /// let x2 = Product::new().set_availability(Availability::Preorder);
16313    /// ```
16314    pub fn set_availability<T: std::convert::Into<crate::model::product::Availability>>(
16315        mut self,
16316        v: T,
16317    ) -> Self {
16318        self.availability = v.into();
16319        self
16320    }
16321
16322    /// Sets the value of [available_quantity][crate::model::Product::available_quantity].
16323    ///
16324    /// # Example
16325    /// ```ignore,no_run
16326    /// # use google_cloud_retail_v2::model::Product;
16327    /// use wkt::Int32Value;
16328    /// let x = Product::new().set_available_quantity(Int32Value::default()/* use setters */);
16329    /// ```
16330    pub fn set_available_quantity<T>(mut self, v: T) -> Self
16331    where
16332        T: std::convert::Into<wkt::Int32Value>,
16333    {
16334        self.available_quantity = std::option::Option::Some(v.into());
16335        self
16336    }
16337
16338    /// Sets or clears the value of [available_quantity][crate::model::Product::available_quantity].
16339    ///
16340    /// # Example
16341    /// ```ignore,no_run
16342    /// # use google_cloud_retail_v2::model::Product;
16343    /// use wkt::Int32Value;
16344    /// let x = Product::new().set_or_clear_available_quantity(Some(Int32Value::default()/* use setters */));
16345    /// let x = Product::new().set_or_clear_available_quantity(None::<Int32Value>);
16346    /// ```
16347    pub fn set_or_clear_available_quantity<T>(mut self, v: std::option::Option<T>) -> Self
16348    where
16349        T: std::convert::Into<wkt::Int32Value>,
16350    {
16351        self.available_quantity = v.map(|x| x.into());
16352        self
16353    }
16354
16355    /// Sets the value of [fulfillment_info][crate::model::Product::fulfillment_info].
16356    ///
16357    /// # Example
16358    /// ```ignore,no_run
16359    /// # use google_cloud_retail_v2::model::Product;
16360    /// use google_cloud_retail_v2::model::FulfillmentInfo;
16361    /// let x = Product::new()
16362    ///     .set_fulfillment_info([
16363    ///         FulfillmentInfo::default()/* use setters */,
16364    ///         FulfillmentInfo::default()/* use (different) setters */,
16365    ///     ]);
16366    /// ```
16367    pub fn set_fulfillment_info<T, V>(mut self, v: T) -> Self
16368    where
16369        T: std::iter::IntoIterator<Item = V>,
16370        V: std::convert::Into<crate::model::FulfillmentInfo>,
16371    {
16372        use std::iter::Iterator;
16373        self.fulfillment_info = v.into_iter().map(|i| i.into()).collect();
16374        self
16375    }
16376
16377    /// Sets the value of [uri][crate::model::Product::uri].
16378    ///
16379    /// # Example
16380    /// ```ignore,no_run
16381    /// # use google_cloud_retail_v2::model::Product;
16382    /// let x = Product::new().set_uri("example");
16383    /// ```
16384    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16385        self.uri = v.into();
16386        self
16387    }
16388
16389    /// Sets the value of [images][crate::model::Product::images].
16390    ///
16391    /// # Example
16392    /// ```ignore,no_run
16393    /// # use google_cloud_retail_v2::model::Product;
16394    /// use google_cloud_retail_v2::model::Image;
16395    /// let x = Product::new()
16396    ///     .set_images([
16397    ///         Image::default()/* use setters */,
16398    ///         Image::default()/* use (different) setters */,
16399    ///     ]);
16400    /// ```
16401    pub fn set_images<T, V>(mut self, v: T) -> Self
16402    where
16403        T: std::iter::IntoIterator<Item = V>,
16404        V: std::convert::Into<crate::model::Image>,
16405    {
16406        use std::iter::Iterator;
16407        self.images = v.into_iter().map(|i| i.into()).collect();
16408        self
16409    }
16410
16411    /// Sets the value of [audience][crate::model::Product::audience].
16412    ///
16413    /// # Example
16414    /// ```ignore,no_run
16415    /// # use google_cloud_retail_v2::model::Product;
16416    /// use google_cloud_retail_v2::model::Audience;
16417    /// let x = Product::new().set_audience(Audience::default()/* use setters */);
16418    /// ```
16419    pub fn set_audience<T>(mut self, v: T) -> Self
16420    where
16421        T: std::convert::Into<crate::model::Audience>,
16422    {
16423        self.audience = std::option::Option::Some(v.into());
16424        self
16425    }
16426
16427    /// Sets or clears the value of [audience][crate::model::Product::audience].
16428    ///
16429    /// # Example
16430    /// ```ignore,no_run
16431    /// # use google_cloud_retail_v2::model::Product;
16432    /// use google_cloud_retail_v2::model::Audience;
16433    /// let x = Product::new().set_or_clear_audience(Some(Audience::default()/* use setters */));
16434    /// let x = Product::new().set_or_clear_audience(None::<Audience>);
16435    /// ```
16436    pub fn set_or_clear_audience<T>(mut self, v: std::option::Option<T>) -> Self
16437    where
16438        T: std::convert::Into<crate::model::Audience>,
16439    {
16440        self.audience = v.map(|x| x.into());
16441        self
16442    }
16443
16444    /// Sets the value of [color_info][crate::model::Product::color_info].
16445    ///
16446    /// # Example
16447    /// ```ignore,no_run
16448    /// # use google_cloud_retail_v2::model::Product;
16449    /// use google_cloud_retail_v2::model::ColorInfo;
16450    /// let x = Product::new().set_color_info(ColorInfo::default()/* use setters */);
16451    /// ```
16452    pub fn set_color_info<T>(mut self, v: T) -> Self
16453    where
16454        T: std::convert::Into<crate::model::ColorInfo>,
16455    {
16456        self.color_info = std::option::Option::Some(v.into());
16457        self
16458    }
16459
16460    /// Sets or clears the value of [color_info][crate::model::Product::color_info].
16461    ///
16462    /// # Example
16463    /// ```ignore,no_run
16464    /// # use google_cloud_retail_v2::model::Product;
16465    /// use google_cloud_retail_v2::model::ColorInfo;
16466    /// let x = Product::new().set_or_clear_color_info(Some(ColorInfo::default()/* use setters */));
16467    /// let x = Product::new().set_or_clear_color_info(None::<ColorInfo>);
16468    /// ```
16469    pub fn set_or_clear_color_info<T>(mut self, v: std::option::Option<T>) -> Self
16470    where
16471        T: std::convert::Into<crate::model::ColorInfo>,
16472    {
16473        self.color_info = v.map(|x| x.into());
16474        self
16475    }
16476
16477    /// Sets the value of [sizes][crate::model::Product::sizes].
16478    ///
16479    /// # Example
16480    /// ```ignore,no_run
16481    /// # use google_cloud_retail_v2::model::Product;
16482    /// let x = Product::new().set_sizes(["a", "b", "c"]);
16483    /// ```
16484    pub fn set_sizes<T, V>(mut self, v: T) -> Self
16485    where
16486        T: std::iter::IntoIterator<Item = V>,
16487        V: std::convert::Into<std::string::String>,
16488    {
16489        use std::iter::Iterator;
16490        self.sizes = v.into_iter().map(|i| i.into()).collect();
16491        self
16492    }
16493
16494    /// Sets the value of [materials][crate::model::Product::materials].
16495    ///
16496    /// # Example
16497    /// ```ignore,no_run
16498    /// # use google_cloud_retail_v2::model::Product;
16499    /// let x = Product::new().set_materials(["a", "b", "c"]);
16500    /// ```
16501    pub fn set_materials<T, V>(mut self, v: T) -> Self
16502    where
16503        T: std::iter::IntoIterator<Item = V>,
16504        V: std::convert::Into<std::string::String>,
16505    {
16506        use std::iter::Iterator;
16507        self.materials = v.into_iter().map(|i| i.into()).collect();
16508        self
16509    }
16510
16511    /// Sets the value of [patterns][crate::model::Product::patterns].
16512    ///
16513    /// # Example
16514    /// ```ignore,no_run
16515    /// # use google_cloud_retail_v2::model::Product;
16516    /// let x = Product::new().set_patterns(["a", "b", "c"]);
16517    /// ```
16518    pub fn set_patterns<T, V>(mut self, v: T) -> Self
16519    where
16520        T: std::iter::IntoIterator<Item = V>,
16521        V: std::convert::Into<std::string::String>,
16522    {
16523        use std::iter::Iterator;
16524        self.patterns = v.into_iter().map(|i| i.into()).collect();
16525        self
16526    }
16527
16528    /// Sets the value of [conditions][crate::model::Product::conditions].
16529    ///
16530    /// # Example
16531    /// ```ignore,no_run
16532    /// # use google_cloud_retail_v2::model::Product;
16533    /// let x = Product::new().set_conditions(["a", "b", "c"]);
16534    /// ```
16535    pub fn set_conditions<T, V>(mut self, v: T) -> Self
16536    where
16537        T: std::iter::IntoIterator<Item = V>,
16538        V: std::convert::Into<std::string::String>,
16539    {
16540        use std::iter::Iterator;
16541        self.conditions = v.into_iter().map(|i| i.into()).collect();
16542        self
16543    }
16544
16545    /// Sets the value of [promotions][crate::model::Product::promotions].
16546    ///
16547    /// # Example
16548    /// ```ignore,no_run
16549    /// # use google_cloud_retail_v2::model::Product;
16550    /// use google_cloud_retail_v2::model::Promotion;
16551    /// let x = Product::new()
16552    ///     .set_promotions([
16553    ///         Promotion::default()/* use setters */,
16554    ///         Promotion::default()/* use (different) setters */,
16555    ///     ]);
16556    /// ```
16557    pub fn set_promotions<T, V>(mut self, v: T) -> Self
16558    where
16559        T: std::iter::IntoIterator<Item = V>,
16560        V: std::convert::Into<crate::model::Promotion>,
16561    {
16562        use std::iter::Iterator;
16563        self.promotions = v.into_iter().map(|i| i.into()).collect();
16564        self
16565    }
16566
16567    /// Sets the value of [publish_time][crate::model::Product::publish_time].
16568    ///
16569    /// # Example
16570    /// ```ignore,no_run
16571    /// # use google_cloud_retail_v2::model::Product;
16572    /// use wkt::Timestamp;
16573    /// let x = Product::new().set_publish_time(Timestamp::default()/* use setters */);
16574    /// ```
16575    pub fn set_publish_time<T>(mut self, v: T) -> Self
16576    where
16577        T: std::convert::Into<wkt::Timestamp>,
16578    {
16579        self.publish_time = std::option::Option::Some(v.into());
16580        self
16581    }
16582
16583    /// Sets or clears the value of [publish_time][crate::model::Product::publish_time].
16584    ///
16585    /// # Example
16586    /// ```ignore,no_run
16587    /// # use google_cloud_retail_v2::model::Product;
16588    /// use wkt::Timestamp;
16589    /// let x = Product::new().set_or_clear_publish_time(Some(Timestamp::default()/* use setters */));
16590    /// let x = Product::new().set_or_clear_publish_time(None::<Timestamp>);
16591    /// ```
16592    pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
16593    where
16594        T: std::convert::Into<wkt::Timestamp>,
16595    {
16596        self.publish_time = v.map(|x| x.into());
16597        self
16598    }
16599
16600    /// Sets the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16601    ///
16602    /// # Example
16603    /// ```ignore,no_run
16604    /// # use google_cloud_retail_v2::model::Product;
16605    /// use wkt::FieldMask;
16606    /// let x = Product::new().set_retrievable_fields(FieldMask::default()/* use setters */);
16607    /// ```
16608    #[deprecated]
16609    pub fn set_retrievable_fields<T>(mut self, v: T) -> Self
16610    where
16611        T: std::convert::Into<wkt::FieldMask>,
16612    {
16613        self.retrievable_fields = std::option::Option::Some(v.into());
16614        self
16615    }
16616
16617    /// Sets or clears the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16618    ///
16619    /// # Example
16620    /// ```ignore,no_run
16621    /// # use google_cloud_retail_v2::model::Product;
16622    /// use wkt::FieldMask;
16623    /// let x = Product::new().set_or_clear_retrievable_fields(Some(FieldMask::default()/* use setters */));
16624    /// let x = Product::new().set_or_clear_retrievable_fields(None::<FieldMask>);
16625    /// ```
16626    #[deprecated]
16627    pub fn set_or_clear_retrievable_fields<T>(mut self, v: std::option::Option<T>) -> Self
16628    where
16629        T: std::convert::Into<wkt::FieldMask>,
16630    {
16631        self.retrievable_fields = v.map(|x| x.into());
16632        self
16633    }
16634
16635    /// Sets the value of [variants][crate::model::Product::variants].
16636    ///
16637    /// # Example
16638    /// ```ignore,no_run
16639    /// # use google_cloud_retail_v2::model::Product;
16640    /// let x = Product::new()
16641    ///     .set_variants([
16642    ///         Product::default()/* use setters */,
16643    ///         Product::default()/* use (different) setters */,
16644    ///     ]);
16645    /// ```
16646    pub fn set_variants<T, V>(mut self, v: T) -> Self
16647    where
16648        T: std::iter::IntoIterator<Item = V>,
16649        V: std::convert::Into<crate::model::Product>,
16650    {
16651        use std::iter::Iterator;
16652        self.variants = v.into_iter().map(|i| i.into()).collect();
16653        self
16654    }
16655
16656    /// Sets the value of [local_inventories][crate::model::Product::local_inventories].
16657    ///
16658    /// # Example
16659    /// ```ignore,no_run
16660    /// # use google_cloud_retail_v2::model::Product;
16661    /// use google_cloud_retail_v2::model::LocalInventory;
16662    /// let x = Product::new()
16663    ///     .set_local_inventories([
16664    ///         LocalInventory::default()/* use setters */,
16665    ///         LocalInventory::default()/* use (different) setters */,
16666    ///     ]);
16667    /// ```
16668    pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
16669    where
16670        T: std::iter::IntoIterator<Item = V>,
16671        V: std::convert::Into<crate::model::LocalInventory>,
16672    {
16673        use std::iter::Iterator;
16674        self.local_inventories = v.into_iter().map(|i| i.into()).collect();
16675        self
16676    }
16677
16678    /// Sets the value of [expiration][crate::model::Product::expiration].
16679    ///
16680    /// Note that all the setters affecting `expiration` are mutually
16681    /// exclusive.
16682    ///
16683    /// # Example
16684    /// ```ignore,no_run
16685    /// # use google_cloud_retail_v2::model::Product;
16686    /// use wkt::Timestamp;
16687    /// let x = Product::new().set_expiration(Some(
16688    ///     google_cloud_retail_v2::model::product::Expiration::ExpireTime(Timestamp::default().into())));
16689    /// ```
16690    pub fn set_expiration<
16691        T: std::convert::Into<std::option::Option<crate::model::product::Expiration>>,
16692    >(
16693        mut self,
16694        v: T,
16695    ) -> Self {
16696        self.expiration = v.into();
16697        self
16698    }
16699
16700    /// The value of [expiration][crate::model::Product::expiration]
16701    /// if it holds a `ExpireTime`, `None` if the field is not set or
16702    /// holds a different branch.
16703    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
16704        #[allow(unreachable_patterns)]
16705        self.expiration.as_ref().and_then(|v| match v {
16706            crate::model::product::Expiration::ExpireTime(v) => std::option::Option::Some(v),
16707            _ => std::option::Option::None,
16708        })
16709    }
16710
16711    /// Sets the value of [expiration][crate::model::Product::expiration]
16712    /// to hold a `ExpireTime`.
16713    ///
16714    /// Note that all the setters affecting `expiration` are
16715    /// mutually exclusive.
16716    ///
16717    /// # Example
16718    /// ```ignore,no_run
16719    /// # use google_cloud_retail_v2::model::Product;
16720    /// use wkt::Timestamp;
16721    /// let x = Product::new().set_expire_time(Timestamp::default()/* use setters */);
16722    /// assert!(x.expire_time().is_some());
16723    /// assert!(x.ttl().is_none());
16724    /// ```
16725    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
16726        mut self,
16727        v: T,
16728    ) -> Self {
16729        self.expiration =
16730            std::option::Option::Some(crate::model::product::Expiration::ExpireTime(v.into()));
16731        self
16732    }
16733
16734    /// The value of [expiration][crate::model::Product::expiration]
16735    /// if it holds a `Ttl`, `None` if the field is not set or
16736    /// holds a different branch.
16737    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
16738        #[allow(unreachable_patterns)]
16739        self.expiration.as_ref().and_then(|v| match v {
16740            crate::model::product::Expiration::Ttl(v) => std::option::Option::Some(v),
16741            _ => std::option::Option::None,
16742        })
16743    }
16744
16745    /// Sets the value of [expiration][crate::model::Product::expiration]
16746    /// to hold a `Ttl`.
16747    ///
16748    /// Note that all the setters affecting `expiration` are
16749    /// mutually exclusive.
16750    ///
16751    /// # Example
16752    /// ```ignore,no_run
16753    /// # use google_cloud_retail_v2::model::Product;
16754    /// use wkt::Duration;
16755    /// let x = Product::new().set_ttl(Duration::default()/* use setters */);
16756    /// assert!(x.ttl().is_some());
16757    /// assert!(x.expire_time().is_none());
16758    /// ```
16759    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
16760        self.expiration =
16761            std::option::Option::Some(crate::model::product::Expiration::Ttl(v.into()));
16762        self
16763    }
16764}
16765
16766impl wkt::message::Message for Product {
16767    fn typename() -> &'static str {
16768        "type.googleapis.com/google.cloud.retail.v2.Product"
16769    }
16770}
16771
16772/// Defines additional types related to [Product].
16773pub mod product {
16774    #[allow(unused_imports)]
16775    use super::*;
16776
16777    /// The type of this product.
16778    ///
16779    /// # Working with unknown values
16780    ///
16781    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16782    /// additional enum variants at any time. Adding new variants is not considered
16783    /// a breaking change. Applications should write their code in anticipation of:
16784    ///
16785    /// - New values appearing in future releases of the client library, **and**
16786    /// - New values received dynamically, without application changes.
16787    ///
16788    /// Please consult the [Working with enums] section in the user guide for some
16789    /// guidelines.
16790    ///
16791    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16792    #[derive(Clone, Debug, PartialEq)]
16793    #[non_exhaustive]
16794    pub enum Type {
16795        /// Default value. Default to
16796        /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
16797        /// if unset.
16798        ///
16799        /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
16800        Unspecified,
16801        /// The primary type.
16802        ///
16803        /// As the primary unit for predicting, indexing and search serving, a
16804        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16805        /// [Product][google.cloud.retail.v2.Product] is grouped with multiple
16806        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16807        /// [Product][google.cloud.retail.v2.Product]s.
16808        ///
16809        /// [google.cloud.retail.v2.Product]: crate::model::Product
16810        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16811        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16812        Primary,
16813        /// The variant type.
16814        ///
16815        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16816        /// [Product][google.cloud.retail.v2.Product]s usually share some common
16817        /// attributes on the same
16818        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16819        /// [Product][google.cloud.retail.v2.Product]s, but they have variant
16820        /// attributes like different colors, sizes and prices, etc.
16821        ///
16822        /// [google.cloud.retail.v2.Product]: crate::model::Product
16823        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16824        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16825        Variant,
16826        /// The collection type. Collection products are bundled
16827        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16828        /// [Product][google.cloud.retail.v2.Product]s or
16829        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
16830        /// [Product][google.cloud.retail.v2.Product]s that are sold together, such
16831        /// as a jewelry set with necklaces, earrings and rings, etc.
16832        ///
16833        /// [google.cloud.retail.v2.Product]: crate::model::Product
16834        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16835        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16836        Collection,
16837        /// If set, the enum was initialized with an unknown value.
16838        ///
16839        /// Applications can examine the value using [Type::value] or
16840        /// [Type::name].
16841        UnknownValue(r#type::UnknownValue),
16842    }
16843
16844    #[doc(hidden)]
16845    pub mod r#type {
16846        #[allow(unused_imports)]
16847        use super::*;
16848        #[derive(Clone, Debug, PartialEq)]
16849        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16850    }
16851
16852    impl Type {
16853        /// Gets the enum value.
16854        ///
16855        /// Returns `None` if the enum contains an unknown value deserialized from
16856        /// the string representation of enums.
16857        pub fn value(&self) -> std::option::Option<i32> {
16858            match self {
16859                Self::Unspecified => std::option::Option::Some(0),
16860                Self::Primary => std::option::Option::Some(1),
16861                Self::Variant => std::option::Option::Some(2),
16862                Self::Collection => std::option::Option::Some(3),
16863                Self::UnknownValue(u) => u.0.value(),
16864            }
16865        }
16866
16867        /// Gets the enum value as a string.
16868        ///
16869        /// Returns `None` if the enum contains an unknown value deserialized from
16870        /// the integer representation of enums.
16871        pub fn name(&self) -> std::option::Option<&str> {
16872            match self {
16873                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
16874                Self::Primary => std::option::Option::Some("PRIMARY"),
16875                Self::Variant => std::option::Option::Some("VARIANT"),
16876                Self::Collection => std::option::Option::Some("COLLECTION"),
16877                Self::UnknownValue(u) => u.0.name(),
16878            }
16879        }
16880    }
16881
16882    impl std::default::Default for Type {
16883        fn default() -> Self {
16884            use std::convert::From;
16885            Self::from(0)
16886        }
16887    }
16888
16889    impl std::fmt::Display for Type {
16890        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16891            wkt::internal::display_enum(f, self.name(), self.value())
16892        }
16893    }
16894
16895    impl std::convert::From<i32> for Type {
16896        fn from(value: i32) -> Self {
16897            match value {
16898                0 => Self::Unspecified,
16899                1 => Self::Primary,
16900                2 => Self::Variant,
16901                3 => Self::Collection,
16902                _ => Self::UnknownValue(r#type::UnknownValue(
16903                    wkt::internal::UnknownEnumValue::Integer(value),
16904                )),
16905            }
16906        }
16907    }
16908
16909    impl std::convert::From<&str> for Type {
16910        fn from(value: &str) -> Self {
16911            use std::string::ToString;
16912            match value {
16913                "TYPE_UNSPECIFIED" => Self::Unspecified,
16914                "PRIMARY" => Self::Primary,
16915                "VARIANT" => Self::Variant,
16916                "COLLECTION" => Self::Collection,
16917                _ => Self::UnknownValue(r#type::UnknownValue(
16918                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16919                )),
16920            }
16921        }
16922    }
16923
16924    impl serde::ser::Serialize for Type {
16925        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16926        where
16927            S: serde::Serializer,
16928        {
16929            match self {
16930                Self::Unspecified => serializer.serialize_i32(0),
16931                Self::Primary => serializer.serialize_i32(1),
16932                Self::Variant => serializer.serialize_i32(2),
16933                Self::Collection => serializer.serialize_i32(3),
16934                Self::UnknownValue(u) => u.0.serialize(serializer),
16935            }
16936        }
16937    }
16938
16939    impl<'de> serde::de::Deserialize<'de> for Type {
16940        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16941        where
16942            D: serde::Deserializer<'de>,
16943        {
16944            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
16945                ".google.cloud.retail.v2.Product.Type",
16946            ))
16947        }
16948    }
16949
16950    /// Product availability. If this field is unspecified, the product is
16951    /// assumed to be in stock.
16952    ///
16953    /// # Working with unknown values
16954    ///
16955    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16956    /// additional enum variants at any time. Adding new variants is not considered
16957    /// a breaking change. Applications should write their code in anticipation of:
16958    ///
16959    /// - New values appearing in future releases of the client library, **and**
16960    /// - New values received dynamically, without application changes.
16961    ///
16962    /// Please consult the [Working with enums] section in the user guide for some
16963    /// guidelines.
16964    ///
16965    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16966    #[derive(Clone, Debug, PartialEq)]
16967    #[non_exhaustive]
16968    pub enum Availability {
16969        /// Default product availability. Default to
16970        /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
16971        /// if unset.
16972        ///
16973        /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
16974        Unspecified,
16975        /// Product in stock.
16976        InStock,
16977        /// Product out of stock.
16978        OutOfStock,
16979        /// Product that is in pre-order state.
16980        Preorder,
16981        /// Product that is back-ordered (i.e. temporarily out of stock).
16982        Backorder,
16983        /// If set, the enum was initialized with an unknown value.
16984        ///
16985        /// Applications can examine the value using [Availability::value] or
16986        /// [Availability::name].
16987        UnknownValue(availability::UnknownValue),
16988    }
16989
16990    #[doc(hidden)]
16991    pub mod availability {
16992        #[allow(unused_imports)]
16993        use super::*;
16994        #[derive(Clone, Debug, PartialEq)]
16995        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16996    }
16997
16998    impl Availability {
16999        /// Gets the enum value.
17000        ///
17001        /// Returns `None` if the enum contains an unknown value deserialized from
17002        /// the string representation of enums.
17003        pub fn value(&self) -> std::option::Option<i32> {
17004            match self {
17005                Self::Unspecified => std::option::Option::Some(0),
17006                Self::InStock => std::option::Option::Some(1),
17007                Self::OutOfStock => std::option::Option::Some(2),
17008                Self::Preorder => std::option::Option::Some(3),
17009                Self::Backorder => std::option::Option::Some(4),
17010                Self::UnknownValue(u) => u.0.value(),
17011            }
17012        }
17013
17014        /// Gets the enum value as a string.
17015        ///
17016        /// Returns `None` if the enum contains an unknown value deserialized from
17017        /// the integer representation of enums.
17018        pub fn name(&self) -> std::option::Option<&str> {
17019            match self {
17020                Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
17021                Self::InStock => std::option::Option::Some("IN_STOCK"),
17022                Self::OutOfStock => std::option::Option::Some("OUT_OF_STOCK"),
17023                Self::Preorder => std::option::Option::Some("PREORDER"),
17024                Self::Backorder => std::option::Option::Some("BACKORDER"),
17025                Self::UnknownValue(u) => u.0.name(),
17026            }
17027        }
17028    }
17029
17030    impl std::default::Default for Availability {
17031        fn default() -> Self {
17032            use std::convert::From;
17033            Self::from(0)
17034        }
17035    }
17036
17037    impl std::fmt::Display for Availability {
17038        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17039            wkt::internal::display_enum(f, self.name(), self.value())
17040        }
17041    }
17042
17043    impl std::convert::From<i32> for Availability {
17044        fn from(value: i32) -> Self {
17045            match value {
17046                0 => Self::Unspecified,
17047                1 => Self::InStock,
17048                2 => Self::OutOfStock,
17049                3 => Self::Preorder,
17050                4 => Self::Backorder,
17051                _ => Self::UnknownValue(availability::UnknownValue(
17052                    wkt::internal::UnknownEnumValue::Integer(value),
17053                )),
17054            }
17055        }
17056    }
17057
17058    impl std::convert::From<&str> for Availability {
17059        fn from(value: &str) -> Self {
17060            use std::string::ToString;
17061            match value {
17062                "AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
17063                "IN_STOCK" => Self::InStock,
17064                "OUT_OF_STOCK" => Self::OutOfStock,
17065                "PREORDER" => Self::Preorder,
17066                "BACKORDER" => Self::Backorder,
17067                _ => Self::UnknownValue(availability::UnknownValue(
17068                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17069                )),
17070            }
17071        }
17072    }
17073
17074    impl serde::ser::Serialize for Availability {
17075        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17076        where
17077            S: serde::Serializer,
17078        {
17079            match self {
17080                Self::Unspecified => serializer.serialize_i32(0),
17081                Self::InStock => serializer.serialize_i32(1),
17082                Self::OutOfStock => serializer.serialize_i32(2),
17083                Self::Preorder => serializer.serialize_i32(3),
17084                Self::Backorder => serializer.serialize_i32(4),
17085                Self::UnknownValue(u) => u.0.serialize(serializer),
17086            }
17087        }
17088    }
17089
17090    impl<'de> serde::de::Deserialize<'de> for Availability {
17091        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17092        where
17093            D: serde::Deserializer<'de>,
17094        {
17095            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
17096                ".google.cloud.retail.v2.Product.Availability",
17097            ))
17098        }
17099    }
17100
17101    #[derive(Clone, Debug, PartialEq)]
17102    #[non_exhaustive]
17103    pub enum Expiration {
17104        /// Note that this field is applied in the following ways:
17105        ///
17106        /// * If the [Product][google.cloud.retail.v2.Product] is already expired
17107        ///   when it is uploaded, this product
17108        ///   is not indexed for search.
17109        ///
17110        /// * If the [Product][google.cloud.retail.v2.Product] is not expired when it
17111        ///   is uploaded, only the
17112        ///   [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]'s and
17113        ///   [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]'s
17114        ///   expireTime is respected, and
17115        ///   [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]'s
17116        ///   expireTime is not used.
17117        ///
17118        ///
17119        /// In general, we suggest the users to delete the stale
17120        /// products explicitly, instead of using this field to determine staleness.
17121        ///
17122        /// [expire_time][google.cloud.retail.v2.Product.expire_time] must be later
17123        /// than [available_time][google.cloud.retail.v2.Product.available_time] and
17124        /// [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an
17125        /// INVALID_ARGUMENT error is thrown.
17126        ///
17127        /// Corresponding properties: Google Merchant Center property
17128        /// [expiration_date](https://support.google.com/merchants/answer/6324499).
17129        ///
17130        /// [google.cloud.retail.v2.Product]: crate::model::Product
17131        /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17132        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17133        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17134        /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
17135        /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17136        /// [google.cloud.retail.v2.Product.publish_time]: crate::model::Product::publish_time
17137        ExpireTime(std::boxed::Box<wkt::Timestamp>),
17138        /// Input only. The TTL (time to live) of the product. Note that this is only
17139        /// applicable to [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17140        /// and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION],
17141        /// and ignored for
17142        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. In general,
17143        /// we suggest the users to delete the stale products explicitly, instead of
17144        /// using this field to determine staleness.
17145        ///
17146        /// If it is set, it must be a non-negative value, and
17147        /// [expire_time][google.cloud.retail.v2.Product.expire_time] is set as
17148        /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The
17149        /// derived [expire_time][google.cloud.retail.v2.Product.expire_time] is
17150        /// returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is
17151        /// left blank when retrieving the [Product][google.cloud.retail.v2.Product].
17152        ///
17153        /// If it is set, the product is not available for
17154        /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after
17155        /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl].
17156        /// However, the product can still be retrieved by
17157        /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17158        /// and
17159        /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
17160        ///
17161        /// [google.cloud.retail.v2.Product]: crate::model::Product
17162        /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17163        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17164        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17165        /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17166        /// [google.cloud.retail.v2.Product.ttl]: crate::model::Product::expiration
17167        /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17168        /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17169        /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
17170        Ttl(std::boxed::Box<wkt::Duration>),
17171    }
17172}
17173
17174/// Request message for
17175/// [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
17176/// method.
17177///
17178/// [google.cloud.retail.v2.ProductService.CreateProduct]: crate::client::ProductService::create_product
17179#[derive(Clone, Default, PartialEq)]
17180#[non_exhaustive]
17181pub struct CreateProductRequest {
17182    /// Required. The parent catalog resource name, such as
17183    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
17184    pub parent: std::string::String,
17185
17186    /// Required. The [Product][google.cloud.retail.v2.Product] to create.
17187    ///
17188    /// [google.cloud.retail.v2.Product]: crate::model::Product
17189    pub product: std::option::Option<crate::model::Product>,
17190
17191    /// Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
17192    /// which will become the final component of the
17193    /// [Product.name][google.cloud.retail.v2.Product.name].
17194    ///
17195    /// If the caller does not have permission to create the
17196    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17197    /// exists, a PERMISSION_DENIED error is returned.
17198    ///
17199    /// This field must be unique among all
17200    /// [Product][google.cloud.retail.v2.Product]s with the same
17201    /// [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
17202    /// ALREADY_EXISTS error is returned.
17203    ///
17204    /// This field must be a UTF-8 encoded string with a length limit of 128
17205    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
17206    ///
17207    /// [google.cloud.retail.v2.CreateProductRequest.parent]: crate::model::CreateProductRequest::parent
17208    /// [google.cloud.retail.v2.Product]: crate::model::Product
17209    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17210    pub product_id: std::string::String,
17211
17212    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17213}
17214
17215impl CreateProductRequest {
17216    pub fn new() -> Self {
17217        std::default::Default::default()
17218    }
17219
17220    /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
17221    ///
17222    /// # Example
17223    /// ```ignore,no_run
17224    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17225    /// let x = CreateProductRequest::new().set_parent("example");
17226    /// ```
17227    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17228        self.parent = v.into();
17229        self
17230    }
17231
17232    /// Sets the value of [product][crate::model::CreateProductRequest::product].
17233    ///
17234    /// # Example
17235    /// ```ignore,no_run
17236    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17237    /// use google_cloud_retail_v2::model::Product;
17238    /// let x = CreateProductRequest::new().set_product(Product::default()/* use setters */);
17239    /// ```
17240    pub fn set_product<T>(mut self, v: T) -> Self
17241    where
17242        T: std::convert::Into<crate::model::Product>,
17243    {
17244        self.product = std::option::Option::Some(v.into());
17245        self
17246    }
17247
17248    /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
17249    ///
17250    /// # Example
17251    /// ```ignore,no_run
17252    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17253    /// use google_cloud_retail_v2::model::Product;
17254    /// let x = CreateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17255    /// let x = CreateProductRequest::new().set_or_clear_product(None::<Product>);
17256    /// ```
17257    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17258    where
17259        T: std::convert::Into<crate::model::Product>,
17260    {
17261        self.product = v.map(|x| x.into());
17262        self
17263    }
17264
17265    /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
17266    ///
17267    /// # Example
17268    /// ```ignore,no_run
17269    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17270    /// let x = CreateProductRequest::new().set_product_id("example");
17271    /// ```
17272    pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17273        self.product_id = v.into();
17274        self
17275    }
17276}
17277
17278impl wkt::message::Message for CreateProductRequest {
17279    fn typename() -> &'static str {
17280        "type.googleapis.com/google.cloud.retail.v2.CreateProductRequest"
17281    }
17282}
17283
17284/// Request message for
17285/// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17286/// method.
17287///
17288/// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17289#[derive(Clone, Default, PartialEq)]
17290#[non_exhaustive]
17291pub struct GetProductRequest {
17292    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17293    /// such as
17294    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17295    ///
17296    /// If the caller does not have permission to access the
17297    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17298    /// exists, a PERMISSION_DENIED error is returned.
17299    ///
17300    /// If the requested [Product][google.cloud.retail.v2.Product] does not exist,
17301    /// a NOT_FOUND error is returned.
17302    ///
17303    /// [google.cloud.retail.v2.Product]: crate::model::Product
17304    pub name: std::string::String,
17305
17306    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17307}
17308
17309impl GetProductRequest {
17310    pub fn new() -> Self {
17311        std::default::Default::default()
17312    }
17313
17314    /// Sets the value of [name][crate::model::GetProductRequest::name].
17315    ///
17316    /// # Example
17317    /// ```ignore,no_run
17318    /// # use google_cloud_retail_v2::model::GetProductRequest;
17319    /// let x = GetProductRequest::new().set_name("example");
17320    /// ```
17321    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17322        self.name = v.into();
17323        self
17324    }
17325}
17326
17327impl wkt::message::Message for GetProductRequest {
17328    fn typename() -> &'static str {
17329        "type.googleapis.com/google.cloud.retail.v2.GetProductRequest"
17330    }
17331}
17332
17333/// Request message for
17334/// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17335/// method.
17336///
17337/// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17338#[derive(Clone, Default, PartialEq)]
17339#[non_exhaustive]
17340pub struct UpdateProductRequest {
17341    /// Required. The product to update/create.
17342    ///
17343    /// If the caller does not have permission to update the
17344    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17345    /// exists, a PERMISSION_DENIED error is returned.
17346    ///
17347    /// If the [Product][google.cloud.retail.v2.Product] to update does not exist
17348    /// and
17349    /// [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing]
17350    /// is not set, a NOT_FOUND error is returned.
17351    ///
17352    /// [google.cloud.retail.v2.Product]: crate::model::Product
17353    /// [google.cloud.retail.v2.UpdateProductRequest.allow_missing]: crate::model::UpdateProductRequest::allow_missing
17354    pub product: std::option::Option<crate::model::Product>,
17355
17356    /// Indicates which fields in the provided
17357    /// [Product][google.cloud.retail.v2.Product] to update. The immutable and
17358    /// output only fields are NOT supported. If not set, all supported fields (the
17359    /// fields that are neither immutable nor output only) are updated.
17360    ///
17361    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17362    /// is returned.
17363    ///
17364    /// The attribute key can be updated by setting the mask path as
17365    /// "attributes.${key_name}". If a key name is present in the mask but not in
17366    /// the patching product from the request, this key will be deleted after the
17367    /// update.
17368    ///
17369    /// [google.cloud.retail.v2.Product]: crate::model::Product
17370    pub update_mask: std::option::Option<wkt::FieldMask>,
17371
17372    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
17373    /// found, a new [Product][google.cloud.retail.v2.Product] will be created. In
17374    /// this situation, `update_mask` is ignored.
17375    ///
17376    /// [google.cloud.retail.v2.Product]: crate::model::Product
17377    pub allow_missing: bool,
17378
17379    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17380}
17381
17382impl UpdateProductRequest {
17383    pub fn new() -> Self {
17384        std::default::Default::default()
17385    }
17386
17387    /// Sets the value of [product][crate::model::UpdateProductRequest::product].
17388    ///
17389    /// # Example
17390    /// ```ignore,no_run
17391    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17392    /// use google_cloud_retail_v2::model::Product;
17393    /// let x = UpdateProductRequest::new().set_product(Product::default()/* use setters */);
17394    /// ```
17395    pub fn set_product<T>(mut self, v: T) -> Self
17396    where
17397        T: std::convert::Into<crate::model::Product>,
17398    {
17399        self.product = std::option::Option::Some(v.into());
17400        self
17401    }
17402
17403    /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
17404    ///
17405    /// # Example
17406    /// ```ignore,no_run
17407    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17408    /// use google_cloud_retail_v2::model::Product;
17409    /// let x = UpdateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17410    /// let x = UpdateProductRequest::new().set_or_clear_product(None::<Product>);
17411    /// ```
17412    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17413    where
17414        T: std::convert::Into<crate::model::Product>,
17415    {
17416        self.product = v.map(|x| x.into());
17417        self
17418    }
17419
17420    /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17421    ///
17422    /// # Example
17423    /// ```ignore,no_run
17424    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17425    /// use wkt::FieldMask;
17426    /// let x = UpdateProductRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17427    /// ```
17428    pub fn set_update_mask<T>(mut self, v: T) -> Self
17429    where
17430        T: std::convert::Into<wkt::FieldMask>,
17431    {
17432        self.update_mask = std::option::Option::Some(v.into());
17433        self
17434    }
17435
17436    /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17437    ///
17438    /// # Example
17439    /// ```ignore,no_run
17440    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17441    /// use wkt::FieldMask;
17442    /// let x = UpdateProductRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17443    /// let x = UpdateProductRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17444    /// ```
17445    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17446    where
17447        T: std::convert::Into<wkt::FieldMask>,
17448    {
17449        self.update_mask = v.map(|x| x.into());
17450        self
17451    }
17452
17453    /// Sets the value of [allow_missing][crate::model::UpdateProductRequest::allow_missing].
17454    ///
17455    /// # Example
17456    /// ```ignore,no_run
17457    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17458    /// let x = UpdateProductRequest::new().set_allow_missing(true);
17459    /// ```
17460    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17461        self.allow_missing = v.into();
17462        self
17463    }
17464}
17465
17466impl wkt::message::Message for UpdateProductRequest {
17467    fn typename() -> &'static str {
17468        "type.googleapis.com/google.cloud.retail.v2.UpdateProductRequest"
17469    }
17470}
17471
17472/// Request message for
17473/// [ProductService.DeleteProduct][google.cloud.retail.v2.ProductService.DeleteProduct]
17474/// method.
17475///
17476/// [google.cloud.retail.v2.ProductService.DeleteProduct]: crate::client::ProductService::delete_product
17477#[derive(Clone, Default, PartialEq)]
17478#[non_exhaustive]
17479pub struct DeleteProductRequest {
17480    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17481    /// such as
17482    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17483    ///
17484    /// If the caller does not have permission to delete the
17485    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17486    /// exists, a PERMISSION_DENIED error is returned.
17487    ///
17488    /// If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
17489    /// a NOT_FOUND error is returned.
17490    ///
17491    /// The [Product][google.cloud.retail.v2.Product] to delete can neither be a
17492    /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17493    /// [Product][google.cloud.retail.v2.Product] member nor a
17494    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17495    /// [Product][google.cloud.retail.v2.Product] with more than one
17496    /// [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an
17497    /// INVALID_ARGUMENT error is returned.
17498    ///
17499    /// All inventory information for the named
17500    /// [Product][google.cloud.retail.v2.Product] will be deleted.
17501    ///
17502    /// [google.cloud.retail.v2.Product]: crate::model::Product
17503    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17504    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17505    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17506    pub name: std::string::String,
17507
17508    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17509}
17510
17511impl DeleteProductRequest {
17512    pub fn new() -> Self {
17513        std::default::Default::default()
17514    }
17515
17516    /// Sets the value of [name][crate::model::DeleteProductRequest::name].
17517    ///
17518    /// # Example
17519    /// ```ignore,no_run
17520    /// # use google_cloud_retail_v2::model::DeleteProductRequest;
17521    /// let x = DeleteProductRequest::new().set_name("example");
17522    /// ```
17523    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17524        self.name = v.into();
17525        self
17526    }
17527}
17528
17529impl wkt::message::Message for DeleteProductRequest {
17530    fn typename() -> &'static str {
17531        "type.googleapis.com/google.cloud.retail.v2.DeleteProductRequest"
17532    }
17533}
17534
17535/// Request message for
17536/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17537/// method.
17538///
17539/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17540#[derive(Clone, Default, PartialEq)]
17541#[non_exhaustive]
17542pub struct ListProductsRequest {
17543    /// Required. The parent branch resource name, such as
17544    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
17545    /// `default_branch` as the branch ID, to list products under the default
17546    /// branch.
17547    ///
17548    /// If the caller does not have permission to list
17549    /// [Product][google.cloud.retail.v2.Product]s under this branch, regardless of
17550    /// whether or not this branch exists, a PERMISSION_DENIED error is returned.
17551    ///
17552    /// [google.cloud.retail.v2.Product]: crate::model::Product
17553    pub parent: std::string::String,
17554
17555    /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
17556    /// unspecified, defaults to 100. The maximum allowed value is 1000. Values
17557    /// above 1000 will be coerced to 1000.
17558    ///
17559    /// If this field is negative, an INVALID_ARGUMENT error is returned.
17560    ///
17561    /// [google.cloud.retail.v2.Product]: crate::model::Product
17562    pub page_size: i32,
17563
17564    /// A page token
17565    /// [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token],
17566    /// received from a previous
17567    /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17568    /// call. Provide this to retrieve the subsequent page.
17569    ///
17570    /// When paginating, all other parameters provided to
17571    /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17572    /// must match the call that provided the page token. Otherwise, an
17573    /// INVALID_ARGUMENT error is returned.
17574    ///
17575    /// [google.cloud.retail.v2.ListProductsResponse.next_page_token]: crate::model::ListProductsResponse::next_page_token
17576    /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17577    pub page_token: std::string::String,
17578
17579    /// A filter to apply on the list results. Supported features:
17580    ///
17581    /// * List all the products under the parent branch if
17582    ///   [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset.
17583    /// * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17584    ///   [Product][google.cloud.retail.v2.Product]s sharing the same
17585    ///   [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17586    ///   [Product][google.cloud.retail.v2.Product]. For example:
17587    ///   `primary_product_id = "some_product_id"`
17588    /// * List [Product][google.cloud.retail.v2.Product]s bundled in a
17589    ///   [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17590    ///   [Product][google.cloud.retail.v2.Product].
17591    ///   For example:
17592    ///   `collection_product_id = "some_product_id"`
17593    /// * List [Product][google.cloud.retail.v2.Product]s with a partibular type.
17594    ///   For example:
17595    ///   `type = "PRIMARY"`
17596    ///   `type = "VARIANT"`
17597    ///   `type = "COLLECTION"`
17598    ///
17599    /// If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
17600    ///
17601    /// If the specified
17602    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17603    /// [Product][google.cloud.retail.v2.Product] or
17604    /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17605    /// [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error
17606    /// is returned.
17607    ///
17608    /// [google.cloud.retail.v2.ListProductsRequest.filter]: crate::model::ListProductsRequest::filter
17609    /// [google.cloud.retail.v2.Product]: crate::model::Product
17610    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17611    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17612    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17613    pub filter: std::string::String,
17614
17615    /// The fields of [Product][google.cloud.retail.v2.Product] to return in the
17616    /// responses. If not set or empty, the following fields are returned:
17617    ///
17618    /// * [Product.name][google.cloud.retail.v2.Product.name]
17619    /// * [Product.id][google.cloud.retail.v2.Product.id]
17620    /// * [Product.title][google.cloud.retail.v2.Product.title]
17621    /// * [Product.uri][google.cloud.retail.v2.Product.uri]
17622    /// * [Product.images][google.cloud.retail.v2.Product.images]
17623    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17624    /// * [Product.brands][google.cloud.retail.v2.Product.brands]
17625    ///
17626    /// If "*" is provided, all fields are returned.
17627    /// [Product.name][google.cloud.retail.v2.Product.name] is always returned no
17628    /// matter what mask is set.
17629    ///
17630    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17631    /// is returned.
17632    ///
17633    /// [google.cloud.retail.v2.Product]: crate::model::Product
17634    /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
17635    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
17636    /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
17637    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17638    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17639    /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
17640    /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
17641    pub read_mask: std::option::Option<wkt::FieldMask>,
17642
17643    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17644}
17645
17646impl ListProductsRequest {
17647    pub fn new() -> Self {
17648        std::default::Default::default()
17649    }
17650
17651    /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
17652    ///
17653    /// # Example
17654    /// ```ignore,no_run
17655    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17656    /// let x = ListProductsRequest::new().set_parent("example");
17657    /// ```
17658    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17659        self.parent = v.into();
17660        self
17661    }
17662
17663    /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
17664    ///
17665    /// # Example
17666    /// ```ignore,no_run
17667    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17668    /// let x = ListProductsRequest::new().set_page_size(42);
17669    /// ```
17670    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17671        self.page_size = v.into();
17672        self
17673    }
17674
17675    /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
17676    ///
17677    /// # Example
17678    /// ```ignore,no_run
17679    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17680    /// let x = ListProductsRequest::new().set_page_token("example");
17681    /// ```
17682    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17683        self.page_token = v.into();
17684        self
17685    }
17686
17687    /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
17688    ///
17689    /// # Example
17690    /// ```ignore,no_run
17691    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17692    /// let x = ListProductsRequest::new().set_filter("example");
17693    /// ```
17694    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17695        self.filter = v.into();
17696        self
17697    }
17698
17699    /// Sets the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17700    ///
17701    /// # Example
17702    /// ```ignore,no_run
17703    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17704    /// use wkt::FieldMask;
17705    /// let x = ListProductsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
17706    /// ```
17707    pub fn set_read_mask<T>(mut self, v: T) -> Self
17708    where
17709        T: std::convert::Into<wkt::FieldMask>,
17710    {
17711        self.read_mask = std::option::Option::Some(v.into());
17712        self
17713    }
17714
17715    /// Sets or clears the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17716    ///
17717    /// # Example
17718    /// ```ignore,no_run
17719    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17720    /// use wkt::FieldMask;
17721    /// let x = ListProductsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
17722    /// let x = ListProductsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
17723    /// ```
17724    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
17725    where
17726        T: std::convert::Into<wkt::FieldMask>,
17727    {
17728        self.read_mask = v.map(|x| x.into());
17729        self
17730    }
17731}
17732
17733impl wkt::message::Message for ListProductsRequest {
17734    fn typename() -> &'static str {
17735        "type.googleapis.com/google.cloud.retail.v2.ListProductsRequest"
17736    }
17737}
17738
17739/// Response message for
17740/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17741/// method.
17742///
17743/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17744#[derive(Clone, Default, PartialEq)]
17745#[non_exhaustive]
17746pub struct ListProductsResponse {
17747    /// The [Product][google.cloud.retail.v2.Product]s.
17748    ///
17749    /// [google.cloud.retail.v2.Product]: crate::model::Product
17750    pub products: std::vec::Vec<crate::model::Product>,
17751
17752    /// A token that can be sent as
17753    /// [ListProductsRequest.page_token][google.cloud.retail.v2.ListProductsRequest.page_token]
17754    /// to retrieve the next page. If this field is omitted, there are no
17755    /// subsequent pages.
17756    ///
17757    /// [google.cloud.retail.v2.ListProductsRequest.page_token]: crate::model::ListProductsRequest::page_token
17758    pub next_page_token: std::string::String,
17759
17760    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17761}
17762
17763impl ListProductsResponse {
17764    pub fn new() -> Self {
17765        std::default::Default::default()
17766    }
17767
17768    /// Sets the value of [products][crate::model::ListProductsResponse::products].
17769    ///
17770    /// # Example
17771    /// ```ignore,no_run
17772    /// # use google_cloud_retail_v2::model::ListProductsResponse;
17773    /// use google_cloud_retail_v2::model::Product;
17774    /// let x = ListProductsResponse::new()
17775    ///     .set_products([
17776    ///         Product::default()/* use setters */,
17777    ///         Product::default()/* use (different) setters */,
17778    ///     ]);
17779    /// ```
17780    pub fn set_products<T, V>(mut self, v: T) -> Self
17781    where
17782        T: std::iter::IntoIterator<Item = V>,
17783        V: std::convert::Into<crate::model::Product>,
17784    {
17785        use std::iter::Iterator;
17786        self.products = v.into_iter().map(|i| i.into()).collect();
17787        self
17788    }
17789
17790    /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
17791    ///
17792    /// # Example
17793    /// ```ignore,no_run
17794    /// # use google_cloud_retail_v2::model::ListProductsResponse;
17795    /// let x = ListProductsResponse::new().set_next_page_token("example");
17796    /// ```
17797    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17798        self.next_page_token = v.into();
17799        self
17800    }
17801}
17802
17803impl wkt::message::Message for ListProductsResponse {
17804    fn typename() -> &'static str {
17805        "type.googleapis.com/google.cloud.retail.v2.ListProductsResponse"
17806    }
17807}
17808
17809#[doc(hidden)]
17810impl google_cloud_gax::paginator::internal::PageableResponse for ListProductsResponse {
17811    type PageItem = crate::model::Product;
17812
17813    fn items(self) -> std::vec::Vec<Self::PageItem> {
17814        self.products
17815    }
17816
17817    fn next_page_token(&self) -> std::string::String {
17818        use std::clone::Clone;
17819        self.next_page_token.clone()
17820    }
17821}
17822
17823/// Request message for
17824/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
17825/// method.
17826///
17827/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
17828#[derive(Clone, Default, PartialEq)]
17829#[non_exhaustive]
17830pub struct SetInventoryRequest {
17831    /// Required. The inventory information to update. The allowable fields to
17832    /// update are:
17833    ///
17834    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17835    /// * [Product.availability][google.cloud.retail.v2.Product.availability]
17836    /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
17837    /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17838    ///   The updated inventory fields must be specified in
17839    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask].
17840    ///
17841    /// If
17842    /// [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name]
17843    /// is empty or invalid, an INVALID_ARGUMENT error is returned.
17844    ///
17845    /// If the caller does not have permission to update the
17846    /// [Product][google.cloud.retail.v2.Product] named in
17847    /// [Product.name][google.cloud.retail.v2.Product.name], regardless of whether
17848    /// or not it exists, a PERMISSION_DENIED error is returned.
17849    ///
17850    /// If the [Product][google.cloud.retail.v2.Product] to update does not have
17851    /// existing inventory information, the provided inventory information will be
17852    /// inserted.
17853    ///
17854    /// If the [Product][google.cloud.retail.v2.Product] to update has existing
17855    /// inventory information, the provided inventory information will be merged
17856    /// while respecting the last update time for each inventory field, using the
17857    /// provided or default value for
17858    /// [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time].
17859    ///
17860    /// The caller can replace place IDs for a subset of fulfillment types in the
17861    /// following ways:
17862    ///
17863    /// * Adds "fulfillment_info" in
17864    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
17865    /// * Specifies only the desired fulfillment types and corresponding place IDs
17866    ///   to update in
17867    ///   [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17868    ///
17869    /// The caller can clear all place IDs from a subset of fulfillment types in
17870    /// the following ways:
17871    ///
17872    /// * Adds "fulfillment_info" in
17873    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
17874    /// * Specifies only the desired fulfillment types to clear in
17875    ///   [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17876    /// * Checks that only the desired fulfillment info types have empty
17877    ///   [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
17878    ///
17879    /// The last update time is recorded for the following inventory fields:
17880    ///
17881    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17882    /// * [Product.availability][google.cloud.retail.v2.Product.availability]
17883    /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
17884    /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
17885    ///
17886    /// If a full overwrite of inventory information while ignoring timestamps is
17887    /// needed,
17888    /// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17889    /// should be invoked instead.
17890    ///
17891    /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
17892    /// [google.cloud.retail.v2.Product]: crate::model::Product
17893    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
17894    /// [google.cloud.retail.v2.Product.available_quantity]: crate::model::Product::available_quantity
17895    /// [google.cloud.retail.v2.Product.fulfillment_info]: crate::model::Product::fulfillment_info
17896    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17897    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17898    /// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17899    /// [google.cloud.retail.v2.SetInventoryRequest.set_mask]: crate::model::SetInventoryRequest::set_mask
17900    /// [google.cloud.retail.v2.SetInventoryRequest.set_time]: crate::model::SetInventoryRequest::set_time
17901    pub inventory: std::option::Option<crate::model::Product>,
17902
17903    /// Indicates which inventory fields in the provided
17904    /// [Product][google.cloud.retail.v2.Product] to update.
17905    ///
17906    /// At least one field must be provided.
17907    ///
17908    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17909    /// is returned and the entire update will be ignored.
17910    ///
17911    /// [google.cloud.retail.v2.Product]: crate::model::Product
17912    pub set_mask: std::option::Option<wkt::FieldMask>,
17913
17914    /// The time when the request is issued, used to prevent
17915    /// out-of-order updates on inventory fields with the last update time
17916    /// recorded. If not provided, the internal system time will be used.
17917    pub set_time: std::option::Option<wkt::Timestamp>,
17918
17919    /// If set to true, and the [Product][google.cloud.retail.v2.Product] with name
17920    /// [Product.name][google.cloud.retail.v2.Product.name] is not found, the
17921    /// inventory update will still be processed and retained for at most 1 day
17922    /// until the [Product][google.cloud.retail.v2.Product] is created. If set to
17923    /// false, a NOT_FOUND error is returned if the
17924    /// [Product][google.cloud.retail.v2.Product] is not found.
17925    ///
17926    /// [google.cloud.retail.v2.Product]: crate::model::Product
17927    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17928    pub allow_missing: bool,
17929
17930    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17931}
17932
17933impl SetInventoryRequest {
17934    pub fn new() -> Self {
17935        std::default::Default::default()
17936    }
17937
17938    /// Sets the value of [inventory][crate::model::SetInventoryRequest::inventory].
17939    ///
17940    /// # Example
17941    /// ```ignore,no_run
17942    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17943    /// use google_cloud_retail_v2::model::Product;
17944    /// let x = SetInventoryRequest::new().set_inventory(Product::default()/* use setters */);
17945    /// ```
17946    pub fn set_inventory<T>(mut self, v: T) -> Self
17947    where
17948        T: std::convert::Into<crate::model::Product>,
17949    {
17950        self.inventory = std::option::Option::Some(v.into());
17951        self
17952    }
17953
17954    /// Sets or clears the value of [inventory][crate::model::SetInventoryRequest::inventory].
17955    ///
17956    /// # Example
17957    /// ```ignore,no_run
17958    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17959    /// use google_cloud_retail_v2::model::Product;
17960    /// let x = SetInventoryRequest::new().set_or_clear_inventory(Some(Product::default()/* use setters */));
17961    /// let x = SetInventoryRequest::new().set_or_clear_inventory(None::<Product>);
17962    /// ```
17963    pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
17964    where
17965        T: std::convert::Into<crate::model::Product>,
17966    {
17967        self.inventory = v.map(|x| x.into());
17968        self
17969    }
17970
17971    /// Sets the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
17972    ///
17973    /// # Example
17974    /// ```ignore,no_run
17975    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17976    /// use wkt::FieldMask;
17977    /// let x = SetInventoryRequest::new().set_set_mask(FieldMask::default()/* use setters */);
17978    /// ```
17979    pub fn set_set_mask<T>(mut self, v: T) -> Self
17980    where
17981        T: std::convert::Into<wkt::FieldMask>,
17982    {
17983        self.set_mask = std::option::Option::Some(v.into());
17984        self
17985    }
17986
17987    /// Sets or clears the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
17988    ///
17989    /// # Example
17990    /// ```ignore,no_run
17991    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
17992    /// use wkt::FieldMask;
17993    /// let x = SetInventoryRequest::new().set_or_clear_set_mask(Some(FieldMask::default()/* use setters */));
17994    /// let x = SetInventoryRequest::new().set_or_clear_set_mask(None::<FieldMask>);
17995    /// ```
17996    pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
17997    where
17998        T: std::convert::Into<wkt::FieldMask>,
17999    {
18000        self.set_mask = v.map(|x| x.into());
18001        self
18002    }
18003
18004    /// Sets the value of [set_time][crate::model::SetInventoryRequest::set_time].
18005    ///
18006    /// # Example
18007    /// ```ignore,no_run
18008    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18009    /// use wkt::Timestamp;
18010    /// let x = SetInventoryRequest::new().set_set_time(Timestamp::default()/* use setters */);
18011    /// ```
18012    pub fn set_set_time<T>(mut self, v: T) -> Self
18013    where
18014        T: std::convert::Into<wkt::Timestamp>,
18015    {
18016        self.set_time = std::option::Option::Some(v.into());
18017        self
18018    }
18019
18020    /// Sets or clears the value of [set_time][crate::model::SetInventoryRequest::set_time].
18021    ///
18022    /// # Example
18023    /// ```ignore,no_run
18024    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18025    /// use wkt::Timestamp;
18026    /// let x = SetInventoryRequest::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
18027    /// let x = SetInventoryRequest::new().set_or_clear_set_time(None::<Timestamp>);
18028    /// ```
18029    pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
18030    where
18031        T: std::convert::Into<wkt::Timestamp>,
18032    {
18033        self.set_time = v.map(|x| x.into());
18034        self
18035    }
18036
18037    /// Sets the value of [allow_missing][crate::model::SetInventoryRequest::allow_missing].
18038    ///
18039    /// # Example
18040    /// ```ignore,no_run
18041    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18042    /// let x = SetInventoryRequest::new().set_allow_missing(true);
18043    /// ```
18044    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18045        self.allow_missing = v.into();
18046        self
18047    }
18048}
18049
18050impl wkt::message::Message for SetInventoryRequest {
18051    fn typename() -> &'static str {
18052        "type.googleapis.com/google.cloud.retail.v2.SetInventoryRequest"
18053    }
18054}
18055
18056/// Metadata related to the progress of the SetInventory operation.
18057/// Currently empty because there is no meaningful metadata populated from the
18058/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18059/// method.
18060///
18061/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18062#[derive(Clone, Default, PartialEq)]
18063#[non_exhaustive]
18064pub struct SetInventoryMetadata {
18065    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18066}
18067
18068impl SetInventoryMetadata {
18069    pub fn new() -> Self {
18070        std::default::Default::default()
18071    }
18072}
18073
18074impl wkt::message::Message for SetInventoryMetadata {
18075    fn typename() -> &'static str {
18076        "type.googleapis.com/google.cloud.retail.v2.SetInventoryMetadata"
18077    }
18078}
18079
18080/// Response of the SetInventoryRequest.  Currently empty because
18081/// there is no meaningful response populated from the
18082/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18083/// method.
18084///
18085/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18086#[derive(Clone, Default, PartialEq)]
18087#[non_exhaustive]
18088pub struct SetInventoryResponse {
18089    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18090}
18091
18092impl SetInventoryResponse {
18093    pub fn new() -> Self {
18094        std::default::Default::default()
18095    }
18096}
18097
18098impl wkt::message::Message for SetInventoryResponse {
18099    fn typename() -> &'static str {
18100        "type.googleapis.com/google.cloud.retail.v2.SetInventoryResponse"
18101    }
18102}
18103
18104/// Request message for
18105/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18106/// method.
18107///
18108/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18109#[derive(Clone, Default, PartialEq)]
18110#[non_exhaustive]
18111pub struct AddFulfillmentPlacesRequest {
18112    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18113    /// such as
18114    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18115    ///
18116    /// If the caller does not have permission to access the
18117    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18118    /// exists, a PERMISSION_DENIED error is returned.
18119    ///
18120    /// [google.cloud.retail.v2.Product]: crate::model::Product
18121    pub product: std::string::String,
18122
18123    /// Required. The fulfillment type, including commonly used types (such as
18124    /// pickup in store and same day delivery), and custom types.
18125    ///
18126    /// Supported values:
18127    ///
18128    /// * "pickup-in-store"
18129    /// * "ship-to-store"
18130    /// * "same-day-delivery"
18131    /// * "next-day-delivery"
18132    /// * "custom-type-1"
18133    /// * "custom-type-2"
18134    /// * "custom-type-3"
18135    /// * "custom-type-4"
18136    /// * "custom-type-5"
18137    ///
18138    /// If this field is set to an invalid value other than these, an
18139    /// INVALID_ARGUMENT error is returned.
18140    ///
18141    /// This field directly corresponds to
18142    /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18143    ///
18144    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18145    pub r#type: std::string::String,
18146
18147    /// Required. The IDs for this
18148    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as
18149    /// the store IDs for "pickup-in-store" or the region IDs for
18150    /// "same-day-delivery" to be added for this
18151    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate
18152    /// IDs will be automatically ignored.
18153    ///
18154    /// At least 1 value is required, and a maximum of 2000 values are allowed.
18155    /// Each value must be a string with a length limit of 10 characters, matching
18156    /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18157    /// INVALID_ARGUMENT error is returned.
18158    ///
18159    /// If the total number of place IDs exceeds 2000 for this
18160    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after
18161    /// adding, then the update will be rejected.
18162    ///
18163    /// [google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]: crate::model::AddFulfillmentPlacesRequest::type
18164    pub place_ids: std::vec::Vec<std::string::String>,
18165
18166    /// The time when the fulfillment updates are issued, used to prevent
18167    /// out-of-order updates on fulfillment information. If not provided, the
18168    /// internal system time will be used.
18169    pub add_time: std::option::Option<wkt::Timestamp>,
18170
18171    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18172    /// found, the fulfillment information will still be processed and retained for
18173    /// at most 1 day and processed once the
18174    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18175    /// NOT_FOUND error is returned if the
18176    /// [Product][google.cloud.retail.v2.Product] is not found.
18177    ///
18178    /// [google.cloud.retail.v2.Product]: crate::model::Product
18179    pub allow_missing: bool,
18180
18181    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18182}
18183
18184impl AddFulfillmentPlacesRequest {
18185    pub fn new() -> Self {
18186        std::default::Default::default()
18187    }
18188
18189    /// Sets the value of [product][crate::model::AddFulfillmentPlacesRequest::product].
18190    ///
18191    /// # Example
18192    /// ```ignore,no_run
18193    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18194    /// let x = AddFulfillmentPlacesRequest::new().set_product("example");
18195    /// ```
18196    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18197        self.product = v.into();
18198        self
18199    }
18200
18201    /// Sets the value of [r#type][crate::model::AddFulfillmentPlacesRequest::type].
18202    ///
18203    /// # Example
18204    /// ```ignore,no_run
18205    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18206    /// let x = AddFulfillmentPlacesRequest::new().set_type("example");
18207    /// ```
18208    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18209        self.r#type = v.into();
18210        self
18211    }
18212
18213    /// Sets the value of [place_ids][crate::model::AddFulfillmentPlacesRequest::place_ids].
18214    ///
18215    /// # Example
18216    /// ```ignore,no_run
18217    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18218    /// let x = AddFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18219    /// ```
18220    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18221    where
18222        T: std::iter::IntoIterator<Item = V>,
18223        V: std::convert::Into<std::string::String>,
18224    {
18225        use std::iter::Iterator;
18226        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18227        self
18228    }
18229
18230    /// Sets the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18231    ///
18232    /// # Example
18233    /// ```ignore,no_run
18234    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18235    /// use wkt::Timestamp;
18236    /// let x = AddFulfillmentPlacesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18237    /// ```
18238    pub fn set_add_time<T>(mut self, v: T) -> Self
18239    where
18240        T: std::convert::Into<wkt::Timestamp>,
18241    {
18242        self.add_time = std::option::Option::Some(v.into());
18243        self
18244    }
18245
18246    /// Sets or clears the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18247    ///
18248    /// # Example
18249    /// ```ignore,no_run
18250    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18251    /// use wkt::Timestamp;
18252    /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18253    /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18254    /// ```
18255    pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18256    where
18257        T: std::convert::Into<wkt::Timestamp>,
18258    {
18259        self.add_time = v.map(|x| x.into());
18260        self
18261    }
18262
18263    /// Sets the value of [allow_missing][crate::model::AddFulfillmentPlacesRequest::allow_missing].
18264    ///
18265    /// # Example
18266    /// ```ignore,no_run
18267    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18268    /// let x = AddFulfillmentPlacesRequest::new().set_allow_missing(true);
18269    /// ```
18270    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18271        self.allow_missing = v.into();
18272        self
18273    }
18274}
18275
18276impl wkt::message::Message for AddFulfillmentPlacesRequest {
18277    fn typename() -> &'static str {
18278        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesRequest"
18279    }
18280}
18281
18282/// Metadata related to the progress of the AddFulfillmentPlaces operation.
18283/// Currently empty because there is no meaningful metadata populated from the
18284/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18285/// method.
18286///
18287/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18288#[derive(Clone, Default, PartialEq)]
18289#[non_exhaustive]
18290pub struct AddFulfillmentPlacesMetadata {
18291    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18292}
18293
18294impl AddFulfillmentPlacesMetadata {
18295    pub fn new() -> Self {
18296        std::default::Default::default()
18297    }
18298}
18299
18300impl wkt::message::Message for AddFulfillmentPlacesMetadata {
18301    fn typename() -> &'static str {
18302        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"
18303    }
18304}
18305
18306/// Response of the AddFulfillmentPlacesRequest.  Currently empty because
18307/// there is no meaningful response populated from the
18308/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18309/// method.
18310///
18311/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18312#[derive(Clone, Default, PartialEq)]
18313#[non_exhaustive]
18314pub struct AddFulfillmentPlacesResponse {
18315    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18316}
18317
18318impl AddFulfillmentPlacesResponse {
18319    pub fn new() -> Self {
18320        std::default::Default::default()
18321    }
18322}
18323
18324impl wkt::message::Message for AddFulfillmentPlacesResponse {
18325    fn typename() -> &'static str {
18326        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesResponse"
18327    }
18328}
18329
18330/// Request message for
18331/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18332/// method.
18333///
18334/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18335#[derive(Clone, Default, PartialEq)]
18336#[non_exhaustive]
18337pub struct AddLocalInventoriesRequest {
18338    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18339    /// such as
18340    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18341    ///
18342    /// If the caller does not have permission to access the
18343    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18344    /// exists, a PERMISSION_DENIED error is returned.
18345    ///
18346    /// [google.cloud.retail.v2.Product]: crate::model::Product
18347    pub product: std::string::String,
18348
18349    /// Required. A list of inventory information at difference places. Each place
18350    /// is identified by its place ID. At most 3000 inventories are allowed per
18351    /// request.
18352    pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
18353
18354    /// Indicates which inventory fields in the provided list of
18355    /// [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The
18356    /// field is updated to the provided value.
18357    ///
18358    /// If a field is set while the place does not have a previous local inventory,
18359    /// the local inventory at that store is created.
18360    ///
18361    /// If a field is set while the value of that field is not provided, the
18362    /// original field value, if it exists, is deleted.
18363    ///
18364    /// If the mask is not set or set with empty paths, all inventory fields will
18365    /// be updated.
18366    ///
18367    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18368    /// is returned and the entire update will be ignored.
18369    ///
18370    /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
18371    pub add_mask: std::option::Option<wkt::FieldMask>,
18372
18373    /// The time when the inventory updates are issued. Used to prevent
18374    /// out-of-order updates on local inventory fields. If not provided, the
18375    /// internal system time will be used.
18376    pub add_time: std::option::Option<wkt::Timestamp>,
18377
18378    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18379    /// found, the local inventory will still be processed and retained for at most
18380    /// 1 day and processed once the [Product][google.cloud.retail.v2.Product] is
18381    /// created. If set to false, a NOT_FOUND error is returned if the
18382    /// [Product][google.cloud.retail.v2.Product] is not found.
18383    ///
18384    /// [google.cloud.retail.v2.Product]: crate::model::Product
18385    pub allow_missing: bool,
18386
18387    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18388}
18389
18390impl AddLocalInventoriesRequest {
18391    pub fn new() -> Self {
18392        std::default::Default::default()
18393    }
18394
18395    /// Sets the value of [product][crate::model::AddLocalInventoriesRequest::product].
18396    ///
18397    /// # Example
18398    /// ```ignore,no_run
18399    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18400    /// let x = AddLocalInventoriesRequest::new().set_product("example");
18401    /// ```
18402    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18403        self.product = v.into();
18404        self
18405    }
18406
18407    /// Sets the value of [local_inventories][crate::model::AddLocalInventoriesRequest::local_inventories].
18408    ///
18409    /// # Example
18410    /// ```ignore,no_run
18411    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18412    /// use google_cloud_retail_v2::model::LocalInventory;
18413    /// let x = AddLocalInventoriesRequest::new()
18414    ///     .set_local_inventories([
18415    ///         LocalInventory::default()/* use setters */,
18416    ///         LocalInventory::default()/* use (different) setters */,
18417    ///     ]);
18418    /// ```
18419    pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
18420    where
18421        T: std::iter::IntoIterator<Item = V>,
18422        V: std::convert::Into<crate::model::LocalInventory>,
18423    {
18424        use std::iter::Iterator;
18425        self.local_inventories = v.into_iter().map(|i| i.into()).collect();
18426        self
18427    }
18428
18429    /// Sets the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18430    ///
18431    /// # Example
18432    /// ```ignore,no_run
18433    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18434    /// use wkt::FieldMask;
18435    /// let x = AddLocalInventoriesRequest::new().set_add_mask(FieldMask::default()/* use setters */);
18436    /// ```
18437    pub fn set_add_mask<T>(mut self, v: T) -> Self
18438    where
18439        T: std::convert::Into<wkt::FieldMask>,
18440    {
18441        self.add_mask = std::option::Option::Some(v.into());
18442        self
18443    }
18444
18445    /// Sets or clears the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18446    ///
18447    /// # Example
18448    /// ```ignore,no_run
18449    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18450    /// use wkt::FieldMask;
18451    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(Some(FieldMask::default()/* use setters */));
18452    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(None::<FieldMask>);
18453    /// ```
18454    pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
18455    where
18456        T: std::convert::Into<wkt::FieldMask>,
18457    {
18458        self.add_mask = v.map(|x| x.into());
18459        self
18460    }
18461
18462    /// Sets the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18463    ///
18464    /// # Example
18465    /// ```ignore,no_run
18466    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18467    /// use wkt::Timestamp;
18468    /// let x = AddLocalInventoriesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18469    /// ```
18470    pub fn set_add_time<T>(mut self, v: T) -> Self
18471    where
18472        T: std::convert::Into<wkt::Timestamp>,
18473    {
18474        self.add_time = std::option::Option::Some(v.into());
18475        self
18476    }
18477
18478    /// Sets or clears the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18479    ///
18480    /// # Example
18481    /// ```ignore,no_run
18482    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18483    /// use wkt::Timestamp;
18484    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18485    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18486    /// ```
18487    pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18488    where
18489        T: std::convert::Into<wkt::Timestamp>,
18490    {
18491        self.add_time = v.map(|x| x.into());
18492        self
18493    }
18494
18495    /// Sets the value of [allow_missing][crate::model::AddLocalInventoriesRequest::allow_missing].
18496    ///
18497    /// # Example
18498    /// ```ignore,no_run
18499    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18500    /// let x = AddLocalInventoriesRequest::new().set_allow_missing(true);
18501    /// ```
18502    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18503        self.allow_missing = v.into();
18504        self
18505    }
18506}
18507
18508impl wkt::message::Message for AddLocalInventoriesRequest {
18509    fn typename() -> &'static str {
18510        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
18511    }
18512}
18513
18514/// Metadata related to the progress of the AddLocalInventories operation.
18515/// Currently empty because there is no meaningful metadata populated from the
18516/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18517/// method.
18518///
18519/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18520#[derive(Clone, Default, PartialEq)]
18521#[non_exhaustive]
18522pub struct AddLocalInventoriesMetadata {
18523    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18524}
18525
18526impl AddLocalInventoriesMetadata {
18527    pub fn new() -> Self {
18528        std::default::Default::default()
18529    }
18530}
18531
18532impl wkt::message::Message for AddLocalInventoriesMetadata {
18533    fn typename() -> &'static str {
18534        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesMetadata"
18535    }
18536}
18537
18538/// Response of the
18539/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18540/// API.  Currently empty because there is no meaningful response populated from
18541/// the
18542/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18543/// method.
18544///
18545/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18546#[derive(Clone, Default, PartialEq)]
18547#[non_exhaustive]
18548pub struct AddLocalInventoriesResponse {
18549    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18550}
18551
18552impl AddLocalInventoriesResponse {
18553    pub fn new() -> Self {
18554        std::default::Default::default()
18555    }
18556}
18557
18558impl wkt::message::Message for AddLocalInventoriesResponse {
18559    fn typename() -> &'static str {
18560        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesResponse"
18561    }
18562}
18563
18564/// Request message for
18565/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18566/// method.
18567///
18568/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18569#[derive(Clone, Default, PartialEq)]
18570#[non_exhaustive]
18571pub struct RemoveLocalInventoriesRequest {
18572    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18573    /// such as
18574    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18575    ///
18576    /// If the caller does not have permission to access the
18577    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18578    /// exists, a PERMISSION_DENIED error is returned.
18579    ///
18580    /// [google.cloud.retail.v2.Product]: crate::model::Product
18581    pub product: std::string::String,
18582
18583    /// Required. A list of place IDs to have their inventory deleted.
18584    /// At most 3000 place IDs are allowed per request.
18585    pub place_ids: std::vec::Vec<std::string::String>,
18586
18587    /// The time when the inventory deletions are issued. Used to prevent
18588    /// out-of-order updates and deletions on local inventory fields. If not
18589    /// provided, the internal system time will be used.
18590    pub remove_time: std::option::Option<wkt::Timestamp>,
18591
18592    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18593    /// found, the local inventory removal request will still be processed and
18594    /// retained for at most 1 day and processed once the
18595    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18596    /// NOT_FOUND error is returned if the
18597    /// [Product][google.cloud.retail.v2.Product] is not found.
18598    ///
18599    /// [google.cloud.retail.v2.Product]: crate::model::Product
18600    pub allow_missing: bool,
18601
18602    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18603}
18604
18605impl RemoveLocalInventoriesRequest {
18606    pub fn new() -> Self {
18607        std::default::Default::default()
18608    }
18609
18610    /// Sets the value of [product][crate::model::RemoveLocalInventoriesRequest::product].
18611    ///
18612    /// # Example
18613    /// ```ignore,no_run
18614    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18615    /// let x = RemoveLocalInventoriesRequest::new().set_product("example");
18616    /// ```
18617    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18618        self.product = v.into();
18619        self
18620    }
18621
18622    /// Sets the value of [place_ids][crate::model::RemoveLocalInventoriesRequest::place_ids].
18623    ///
18624    /// # Example
18625    /// ```ignore,no_run
18626    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18627    /// let x = RemoveLocalInventoriesRequest::new().set_place_ids(["a", "b", "c"]);
18628    /// ```
18629    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18630    where
18631        T: std::iter::IntoIterator<Item = V>,
18632        V: std::convert::Into<std::string::String>,
18633    {
18634        use std::iter::Iterator;
18635        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18636        self
18637    }
18638
18639    /// Sets the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18640    ///
18641    /// # Example
18642    /// ```ignore,no_run
18643    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18644    /// use wkt::Timestamp;
18645    /// let x = RemoveLocalInventoriesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18646    /// ```
18647    pub fn set_remove_time<T>(mut self, v: T) -> Self
18648    where
18649        T: std::convert::Into<wkt::Timestamp>,
18650    {
18651        self.remove_time = std::option::Option::Some(v.into());
18652        self
18653    }
18654
18655    /// Sets or clears the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18656    ///
18657    /// # Example
18658    /// ```ignore,no_run
18659    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18660    /// use wkt::Timestamp;
18661    /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18662    /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18663    /// ```
18664    pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18665    where
18666        T: std::convert::Into<wkt::Timestamp>,
18667    {
18668        self.remove_time = v.map(|x| x.into());
18669        self
18670    }
18671
18672    /// Sets the value of [allow_missing][crate::model::RemoveLocalInventoriesRequest::allow_missing].
18673    ///
18674    /// # Example
18675    /// ```ignore,no_run
18676    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18677    /// let x = RemoveLocalInventoriesRequest::new().set_allow_missing(true);
18678    /// ```
18679    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18680        self.allow_missing = v.into();
18681        self
18682    }
18683}
18684
18685impl wkt::message::Message for RemoveLocalInventoriesRequest {
18686    fn typename() -> &'static str {
18687        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesRequest"
18688    }
18689}
18690
18691/// Metadata related to the progress of the RemoveLocalInventories operation.
18692/// Currently empty because there is no meaningful metadata populated from the
18693/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18694/// method.
18695///
18696/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18697#[derive(Clone, Default, PartialEq)]
18698#[non_exhaustive]
18699pub struct RemoveLocalInventoriesMetadata {
18700    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18701}
18702
18703impl RemoveLocalInventoriesMetadata {
18704    pub fn new() -> Self {
18705        std::default::Default::default()
18706    }
18707}
18708
18709impl wkt::message::Message for RemoveLocalInventoriesMetadata {
18710    fn typename() -> &'static str {
18711        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"
18712    }
18713}
18714
18715/// Response of the
18716/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18717/// API.  Currently empty because there is no meaningful response populated from
18718/// the
18719/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18720/// method.
18721///
18722/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18723#[derive(Clone, Default, PartialEq)]
18724#[non_exhaustive]
18725pub struct RemoveLocalInventoriesResponse {
18726    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18727}
18728
18729impl RemoveLocalInventoriesResponse {
18730    pub fn new() -> Self {
18731        std::default::Default::default()
18732    }
18733}
18734
18735impl wkt::message::Message for RemoveLocalInventoriesResponse {
18736    fn typename() -> &'static str {
18737        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesResponse"
18738    }
18739}
18740
18741/// Request message for
18742/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18743/// method.
18744///
18745/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18746#[derive(Clone, Default, PartialEq)]
18747#[non_exhaustive]
18748pub struct RemoveFulfillmentPlacesRequest {
18749    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18750    /// such as
18751    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18752    ///
18753    /// If the caller does not have permission to access the
18754    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18755    /// exists, a PERMISSION_DENIED error is returned.
18756    ///
18757    /// [google.cloud.retail.v2.Product]: crate::model::Product
18758    pub product: std::string::String,
18759
18760    /// Required. The fulfillment type, including commonly used types (such as
18761    /// pickup in store and same day delivery), and custom types.
18762    ///
18763    /// Supported values:
18764    ///
18765    /// * "pickup-in-store"
18766    /// * "ship-to-store"
18767    /// * "same-day-delivery"
18768    /// * "next-day-delivery"
18769    /// * "custom-type-1"
18770    /// * "custom-type-2"
18771    /// * "custom-type-3"
18772    /// * "custom-type-4"
18773    /// * "custom-type-5"
18774    ///
18775    /// If this field is set to an invalid value other than these, an
18776    /// INVALID_ARGUMENT error is returned.
18777    ///
18778    /// This field directly corresponds to
18779    /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18780    ///
18781    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18782    pub r#type: std::string::String,
18783
18784    /// Required. The IDs for this
18785    /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as
18786    /// the store IDs for "pickup-in-store" or the region IDs for
18787    /// "same-day-delivery", to be removed for this
18788    /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type].
18789    ///
18790    /// At least 1 value is required, and a maximum of 2000 values are allowed.
18791    /// Each value must be a string with a length limit of 10 characters, matching
18792    /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18793    /// INVALID_ARGUMENT error is returned.
18794    ///
18795    /// [google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]: crate::model::RemoveFulfillmentPlacesRequest::type
18796    pub place_ids: std::vec::Vec<std::string::String>,
18797
18798    /// The time when the fulfillment updates are issued, used to prevent
18799    /// out-of-order updates on fulfillment information. If not provided, the
18800    /// internal system time will be used.
18801    pub remove_time: std::option::Option<wkt::Timestamp>,
18802
18803    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18804    /// found, the fulfillment information will still be processed and retained for
18805    /// at most 1 day and processed once the
18806    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18807    /// NOT_FOUND error is returned if the
18808    /// [Product][google.cloud.retail.v2.Product] is not found.
18809    ///
18810    /// [google.cloud.retail.v2.Product]: crate::model::Product
18811    pub allow_missing: bool,
18812
18813    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18814}
18815
18816impl RemoveFulfillmentPlacesRequest {
18817    pub fn new() -> Self {
18818        std::default::Default::default()
18819    }
18820
18821    /// Sets the value of [product][crate::model::RemoveFulfillmentPlacesRequest::product].
18822    ///
18823    /// # Example
18824    /// ```ignore,no_run
18825    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18826    /// let x = RemoveFulfillmentPlacesRequest::new().set_product("example");
18827    /// ```
18828    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18829        self.product = v.into();
18830        self
18831    }
18832
18833    /// Sets the value of [r#type][crate::model::RemoveFulfillmentPlacesRequest::type].
18834    ///
18835    /// # Example
18836    /// ```ignore,no_run
18837    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18838    /// let x = RemoveFulfillmentPlacesRequest::new().set_type("example");
18839    /// ```
18840    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18841        self.r#type = v.into();
18842        self
18843    }
18844
18845    /// Sets the value of [place_ids][crate::model::RemoveFulfillmentPlacesRequest::place_ids].
18846    ///
18847    /// # Example
18848    /// ```ignore,no_run
18849    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18850    /// let x = RemoveFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18851    /// ```
18852    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18853    where
18854        T: std::iter::IntoIterator<Item = V>,
18855        V: std::convert::Into<std::string::String>,
18856    {
18857        use std::iter::Iterator;
18858        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18859        self
18860    }
18861
18862    /// Sets the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
18863    ///
18864    /// # Example
18865    /// ```ignore,no_run
18866    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18867    /// use wkt::Timestamp;
18868    /// let x = RemoveFulfillmentPlacesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18869    /// ```
18870    pub fn set_remove_time<T>(mut self, v: T) -> Self
18871    where
18872        T: std::convert::Into<wkt::Timestamp>,
18873    {
18874        self.remove_time = std::option::Option::Some(v.into());
18875        self
18876    }
18877
18878    /// Sets or clears the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
18879    ///
18880    /// # Example
18881    /// ```ignore,no_run
18882    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18883    /// use wkt::Timestamp;
18884    /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18885    /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18886    /// ```
18887    pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18888    where
18889        T: std::convert::Into<wkt::Timestamp>,
18890    {
18891        self.remove_time = v.map(|x| x.into());
18892        self
18893    }
18894
18895    /// Sets the value of [allow_missing][crate::model::RemoveFulfillmentPlacesRequest::allow_missing].
18896    ///
18897    /// # Example
18898    /// ```ignore,no_run
18899    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
18900    /// let x = RemoveFulfillmentPlacesRequest::new().set_allow_missing(true);
18901    /// ```
18902    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18903        self.allow_missing = v.into();
18904        self
18905    }
18906}
18907
18908impl wkt::message::Message for RemoveFulfillmentPlacesRequest {
18909    fn typename() -> &'static str {
18910        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"
18911    }
18912}
18913
18914/// Metadata related to the progress of the RemoveFulfillmentPlaces operation.
18915/// Currently empty because there is no meaningful metadata populated from the
18916/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18917/// method.
18918///
18919/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18920#[derive(Clone, Default, PartialEq)]
18921#[non_exhaustive]
18922pub struct RemoveFulfillmentPlacesMetadata {
18923    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18924}
18925
18926impl RemoveFulfillmentPlacesMetadata {
18927    pub fn new() -> Self {
18928        std::default::Default::default()
18929    }
18930}
18931
18932impl wkt::message::Message for RemoveFulfillmentPlacesMetadata {
18933    fn typename() -> &'static str {
18934        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"
18935    }
18936}
18937
18938/// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there
18939/// is no meaningful response populated from the
18940/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
18941/// method.
18942///
18943/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
18944#[derive(Clone, Default, PartialEq)]
18945#[non_exhaustive]
18946pub struct RemoveFulfillmentPlacesResponse {
18947    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18948}
18949
18950impl RemoveFulfillmentPlacesResponse {
18951    pub fn new() -> Self {
18952        std::default::Default::default()
18953    }
18954}
18955
18956impl wkt::message::Message for RemoveFulfillmentPlacesResponse {
18957    fn typename() -> &'static str {
18958        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"
18959    }
18960}
18961
18962/// Promotion information.
18963#[derive(Clone, Default, PartialEq)]
18964#[non_exhaustive]
18965pub struct Promotion {
18966    /// ID of the promotion. For example, "free gift".
18967    ///
18968    /// The value must be a UTF-8 encoded string with a length limit of 128
18969    /// characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example,
18970    /// id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
18971    /// returned.
18972    ///
18973    /// Corresponds to Google Merchant Center property
18974    /// [promotion_id](https://support.google.com/merchants/answer/7050148).
18975    pub promotion_id: std::string::String,
18976
18977    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18978}
18979
18980impl Promotion {
18981    pub fn new() -> Self {
18982        std::default::Default::default()
18983    }
18984
18985    /// Sets the value of [promotion_id][crate::model::Promotion::promotion_id].
18986    ///
18987    /// # Example
18988    /// ```ignore,no_run
18989    /// # use google_cloud_retail_v2::model::Promotion;
18990    /// let x = Promotion::new().set_promotion_id("example");
18991    /// ```
18992    pub fn set_promotion_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18993        self.promotion_id = v.into();
18994        self
18995    }
18996}
18997
18998impl wkt::message::Message for Promotion {
18999    fn typename() -> &'static str {
19000        "type.googleapis.com/google.cloud.retail.v2.Promotion"
19001    }
19002}
19003
19004/// Metadata related to the progress of the Purge operation.
19005/// This will be returned by the google.longrunning.Operation.metadata field.
19006#[derive(Clone, Default, PartialEq)]
19007#[non_exhaustive]
19008pub struct PurgeMetadata {
19009    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19010}
19011
19012impl PurgeMetadata {
19013    pub fn new() -> Self {
19014        std::default::Default::default()
19015    }
19016}
19017
19018impl wkt::message::Message for PurgeMetadata {
19019    fn typename() -> &'static str {
19020        "type.googleapis.com/google.cloud.retail.v2.PurgeMetadata"
19021    }
19022}
19023
19024/// Metadata related to the progress of the PurgeProducts operation.
19025/// This will be returned by the google.longrunning.Operation.metadata field.
19026#[derive(Clone, Default, PartialEq)]
19027#[non_exhaustive]
19028pub struct PurgeProductsMetadata {
19029    /// Operation create time.
19030    pub create_time: std::option::Option<wkt::Timestamp>,
19031
19032    /// Operation last update time. If the operation is done, this is also the
19033    /// finish time.
19034    pub update_time: std::option::Option<wkt::Timestamp>,
19035
19036    /// Count of entries that were deleted successfully.
19037    pub success_count: i64,
19038
19039    /// Count of entries that encountered errors while processing.
19040    pub failure_count: i64,
19041
19042    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19043}
19044
19045impl PurgeProductsMetadata {
19046    pub fn new() -> Self {
19047        std::default::Default::default()
19048    }
19049
19050    /// Sets the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19051    ///
19052    /// # Example
19053    /// ```ignore,no_run
19054    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19055    /// use wkt::Timestamp;
19056    /// let x = PurgeProductsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
19057    /// ```
19058    pub fn set_create_time<T>(mut self, v: T) -> Self
19059    where
19060        T: std::convert::Into<wkt::Timestamp>,
19061    {
19062        self.create_time = std::option::Option::Some(v.into());
19063        self
19064    }
19065
19066    /// Sets or clears the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19067    ///
19068    /// # Example
19069    /// ```ignore,no_run
19070    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19071    /// use wkt::Timestamp;
19072    /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19073    /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
19074    /// ```
19075    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19076    where
19077        T: std::convert::Into<wkt::Timestamp>,
19078    {
19079        self.create_time = v.map(|x| x.into());
19080        self
19081    }
19082
19083    /// Sets the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19084    ///
19085    /// # Example
19086    /// ```ignore,no_run
19087    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19088    /// use wkt::Timestamp;
19089    /// let x = PurgeProductsMetadata::new().set_update_time(Timestamp::default()/* use setters */);
19090    /// ```
19091    pub fn set_update_time<T>(mut self, v: T) -> Self
19092    where
19093        T: std::convert::Into<wkt::Timestamp>,
19094    {
19095        self.update_time = std::option::Option::Some(v.into());
19096        self
19097    }
19098
19099    /// Sets or clears the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19100    ///
19101    /// # Example
19102    /// ```ignore,no_run
19103    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19104    /// use wkt::Timestamp;
19105    /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19106    /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(None::<Timestamp>);
19107    /// ```
19108    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19109    where
19110        T: std::convert::Into<wkt::Timestamp>,
19111    {
19112        self.update_time = v.map(|x| x.into());
19113        self
19114    }
19115
19116    /// Sets the value of [success_count][crate::model::PurgeProductsMetadata::success_count].
19117    ///
19118    /// # Example
19119    /// ```ignore,no_run
19120    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19121    /// let x = PurgeProductsMetadata::new().set_success_count(42);
19122    /// ```
19123    pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19124        self.success_count = v.into();
19125        self
19126    }
19127
19128    /// Sets the value of [failure_count][crate::model::PurgeProductsMetadata::failure_count].
19129    ///
19130    /// # Example
19131    /// ```ignore,no_run
19132    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19133    /// let x = PurgeProductsMetadata::new().set_failure_count(42);
19134    /// ```
19135    pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19136        self.failure_count = v.into();
19137        self
19138    }
19139}
19140
19141impl wkt::message::Message for PurgeProductsMetadata {
19142    fn typename() -> &'static str {
19143        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsMetadata"
19144    }
19145}
19146
19147/// Request message for PurgeProducts method.
19148#[derive(Clone, Default, PartialEq)]
19149#[non_exhaustive]
19150pub struct PurgeProductsRequest {
19151    /// Required. The resource name of the branch under which the products are
19152    /// created. The format is
19153    /// `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
19154    pub parent: std::string::String,
19155
19156    /// Required. The filter string to specify the products to be deleted with a
19157    /// length limit of 5,000 characters.
19158    ///
19159    /// Empty string filter is not allowed. "*" implies delete all items in a
19160    /// branch.
19161    ///
19162    /// The eligible fields for filtering are:
19163    ///
19164    /// * `availability`: Double quoted
19165    ///   [Product.availability][google.cloud.retail.v2.Product.availability] string.
19166    /// * `create_time` : in ISO 8601 "zulu" format.
19167    ///
19168    /// Supported syntax:
19169    ///
19170    /// * Comparators (">", "<", ">=", "<=", "=").
19171    ///   Examples:
19172    ///
19173    ///   * create_time <= "2015-02-13T17:05:46Z"
19174    ///   * availability = "IN_STOCK"
19175    /// * Conjunctions ("AND")
19176    ///   Examples:
19177    ///
19178    ///   * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
19179    /// * Disjunctions ("OR")
19180    ///   Examples:
19181    ///
19182    ///   * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
19183    /// * Can support nested queries.
19184    ///   Examples:
19185    ///
19186    ///   * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
19187    ///     OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
19188    /// * Filter Limits:
19189    ///
19190    ///   * Filter should not contain more than 6 conditions.
19191    ///   * Max nesting depth should not exceed 2 levels.
19192    ///
19193    /// Examples queries:
19194    ///
19195    /// * Delete back order products created before a timestamp.
19196    ///   create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
19197    ///
19198    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
19199    pub filter: std::string::String,
19200
19201    /// Actually perform the purge.
19202    /// If `force` is set to false, the method will return the expected purge count
19203    /// without deleting any products.
19204    pub force: bool,
19205
19206    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19207}
19208
19209impl PurgeProductsRequest {
19210    pub fn new() -> Self {
19211        std::default::Default::default()
19212    }
19213
19214    /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
19215    ///
19216    /// # Example
19217    /// ```ignore,no_run
19218    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19219    /// let x = PurgeProductsRequest::new().set_parent("example");
19220    /// ```
19221    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19222        self.parent = v.into();
19223        self
19224    }
19225
19226    /// Sets the value of [filter][crate::model::PurgeProductsRequest::filter].
19227    ///
19228    /// # Example
19229    /// ```ignore,no_run
19230    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19231    /// let x = PurgeProductsRequest::new().set_filter("example");
19232    /// ```
19233    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19234        self.filter = v.into();
19235        self
19236    }
19237
19238    /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
19239    ///
19240    /// # Example
19241    /// ```ignore,no_run
19242    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19243    /// let x = PurgeProductsRequest::new().set_force(true);
19244    /// ```
19245    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19246        self.force = v.into();
19247        self
19248    }
19249}
19250
19251impl wkt::message::Message for PurgeProductsRequest {
19252    fn typename() -> &'static str {
19253        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsRequest"
19254    }
19255}
19256
19257/// Response of the PurgeProductsRequest. If the long running operation is
19258/// successfully done, then this message is returned by the
19259/// google.longrunning.Operations.response field.
19260#[derive(Clone, Default, PartialEq)]
19261#[non_exhaustive]
19262pub struct PurgeProductsResponse {
19263    /// The total count of products purged as a result of the operation.
19264    pub purge_count: i64,
19265
19266    /// A sample of the product names that will be deleted.
19267    /// Only populated if `force` is set to false. A max of 100 names will be
19268    /// returned and the names are chosen at random.
19269    pub purge_sample: std::vec::Vec<std::string::String>,
19270
19271    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19272}
19273
19274impl PurgeProductsResponse {
19275    pub fn new() -> Self {
19276        std::default::Default::default()
19277    }
19278
19279    /// Sets the value of [purge_count][crate::model::PurgeProductsResponse::purge_count].
19280    ///
19281    /// # Example
19282    /// ```ignore,no_run
19283    /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19284    /// let x = PurgeProductsResponse::new().set_purge_count(42);
19285    /// ```
19286    pub fn set_purge_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19287        self.purge_count = v.into();
19288        self
19289    }
19290
19291    /// Sets the value of [purge_sample][crate::model::PurgeProductsResponse::purge_sample].
19292    ///
19293    /// # Example
19294    /// ```ignore,no_run
19295    /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19296    /// let x = PurgeProductsResponse::new().set_purge_sample(["a", "b", "c"]);
19297    /// ```
19298    pub fn set_purge_sample<T, V>(mut self, v: T) -> Self
19299    where
19300        T: std::iter::IntoIterator<Item = V>,
19301        V: std::convert::Into<std::string::String>,
19302    {
19303        use std::iter::Iterator;
19304        self.purge_sample = v.into_iter().map(|i| i.into()).collect();
19305        self
19306    }
19307}
19308
19309impl wkt::message::Message for PurgeProductsResponse {
19310    fn typename() -> &'static str {
19311        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsResponse"
19312    }
19313}
19314
19315/// Request message for PurgeUserEvents method.
19316#[derive(Clone, Default, PartialEq)]
19317#[non_exhaustive]
19318pub struct PurgeUserEventsRequest {
19319    /// Required. The resource name of the catalog under which the events are
19320    /// created. The format is
19321    /// `projects/${projectId}/locations/global/catalogs/${catalogId}`
19322    pub parent: std::string::String,
19323
19324    /// Required. The filter string to specify the events to be deleted with a
19325    /// length limit of 5,000 characters. Empty string filter is not allowed. The
19326    /// eligible fields for filtering are:
19327    ///
19328    /// * `eventType`: Double quoted
19329    ///   [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
19330    /// * `eventTime`: in ISO 8601 "zulu" format.
19331    /// * `visitorId`: Double quoted string. Specifying this will delete all
19332    ///   events associated with a visitor.
19333    /// * `userId`: Double quoted string. Specifying this will delete all events
19334    ///   associated with a user.
19335    ///
19336    /// Examples:
19337    ///
19338    /// * Deleting all events in a time range:
19339    ///   `eventTime > "2012-04-23T18:25:43.511Z"
19340    ///   eventTime < "2012-04-23T18:30:43.511Z"`
19341    /// * Deleting specific eventType in time range:
19342    ///   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
19343    /// * Deleting all events for a specific visitor:
19344    ///   `visitorId = "visitor1024"`
19345    ///
19346    /// The filtering fields are assumed to have an implicit AND.
19347    ///
19348    /// [google.cloud.retail.v2.UserEvent.event_type]: crate::model::UserEvent::event_type
19349    pub filter: std::string::String,
19350
19351    /// Actually perform the purge.
19352    /// If `force` is set to false, the method will return the expected purge count
19353    /// without deleting any user events.
19354    pub force: bool,
19355
19356    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19357}
19358
19359impl PurgeUserEventsRequest {
19360    pub fn new() -> Self {
19361        std::default::Default::default()
19362    }
19363
19364    /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
19365    ///
19366    /// # Example
19367    /// ```ignore,no_run
19368    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19369    /// let x = PurgeUserEventsRequest::new().set_parent("example");
19370    /// ```
19371    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19372        self.parent = v.into();
19373        self
19374    }
19375
19376    /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
19377    ///
19378    /// # Example
19379    /// ```ignore,no_run
19380    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19381    /// let x = PurgeUserEventsRequest::new().set_filter("example");
19382    /// ```
19383    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19384        self.filter = v.into();
19385        self
19386    }
19387
19388    /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
19389    ///
19390    /// # Example
19391    /// ```ignore,no_run
19392    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19393    /// let x = PurgeUserEventsRequest::new().set_force(true);
19394    /// ```
19395    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19396        self.force = v.into();
19397        self
19398    }
19399}
19400
19401impl wkt::message::Message for PurgeUserEventsRequest {
19402    fn typename() -> &'static str {
19403        "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsRequest"
19404    }
19405}
19406
19407/// Response of the PurgeUserEventsRequest. If the long running operation is
19408/// successfully done, then this message is returned by the
19409/// google.longrunning.Operations.response field.
19410#[derive(Clone, Default, PartialEq)]
19411#[non_exhaustive]
19412pub struct PurgeUserEventsResponse {
19413    /// The total count of events purged as a result of the operation.
19414    pub purged_events_count: i64,
19415
19416    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19417}
19418
19419impl PurgeUserEventsResponse {
19420    pub fn new() -> Self {
19421        std::default::Default::default()
19422    }
19423
19424    /// Sets the value of [purged_events_count][crate::model::PurgeUserEventsResponse::purged_events_count].
19425    ///
19426    /// # Example
19427    /// ```ignore,no_run
19428    /// # use google_cloud_retail_v2::model::PurgeUserEventsResponse;
19429    /// let x = PurgeUserEventsResponse::new().set_purged_events_count(42);
19430    /// ```
19431    pub fn set_purged_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19432        self.purged_events_count = v.into();
19433        self
19434    }
19435}
19436
19437impl wkt::message::Message for PurgeUserEventsResponse {
19438    fn typename() -> &'static str {
19439        "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsResponse"
19440    }
19441}
19442
19443/// Safety settings.
19444#[derive(Clone, Default, PartialEq)]
19445#[non_exhaustive]
19446pub struct SafetySetting {
19447    /// Harm category.
19448    pub category: crate::model::HarmCategory,
19449
19450    /// The harm block threshold.
19451    pub threshold: crate::model::safety_setting::HarmBlockThreshold,
19452
19453    /// Optional. Specify if the threshold is used for probability or severity
19454    /// score. If not specified, the threshold is used for probability score.
19455    pub method: crate::model::safety_setting::HarmBlockMethod,
19456
19457    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19458}
19459
19460impl SafetySetting {
19461    pub fn new() -> Self {
19462        std::default::Default::default()
19463    }
19464
19465    /// Sets the value of [category][crate::model::SafetySetting::category].
19466    ///
19467    /// # Example
19468    /// ```ignore,no_run
19469    /// # use google_cloud_retail_v2::model::SafetySetting;
19470    /// use google_cloud_retail_v2::model::HarmCategory;
19471    /// let x0 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
19472    /// let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
19473    /// let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);
19474    /// ```
19475    pub fn set_category<T: std::convert::Into<crate::model::HarmCategory>>(mut self, v: T) -> Self {
19476        self.category = v.into();
19477        self
19478    }
19479
19480    /// Sets the value of [threshold][crate::model::SafetySetting::threshold].
19481    ///
19482    /// # Example
19483    /// ```ignore,no_run
19484    /// # use google_cloud_retail_v2::model::SafetySetting;
19485    /// use google_cloud_retail_v2::model::safety_setting::HarmBlockThreshold;
19486    /// let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
19487    /// let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
19488    /// let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);
19489    /// ```
19490    pub fn set_threshold<
19491        T: std::convert::Into<crate::model::safety_setting::HarmBlockThreshold>,
19492    >(
19493        mut self,
19494        v: T,
19495    ) -> Self {
19496        self.threshold = v.into();
19497        self
19498    }
19499
19500    /// Sets the value of [method][crate::model::SafetySetting::method].
19501    ///
19502    /// # Example
19503    /// ```ignore,no_run
19504    /// # use google_cloud_retail_v2::model::SafetySetting;
19505    /// use google_cloud_retail_v2::model::safety_setting::HarmBlockMethod;
19506    /// let x0 = SafetySetting::new().set_method(HarmBlockMethod::Severity);
19507    /// let x1 = SafetySetting::new().set_method(HarmBlockMethod::Probability);
19508    /// ```
19509    pub fn set_method<T: std::convert::Into<crate::model::safety_setting::HarmBlockMethod>>(
19510        mut self,
19511        v: T,
19512    ) -> Self {
19513        self.method = v.into();
19514        self
19515    }
19516}
19517
19518impl wkt::message::Message for SafetySetting {
19519    fn typename() -> &'static str {
19520        "type.googleapis.com/google.cloud.retail.v2.SafetySetting"
19521    }
19522}
19523
19524/// Defines additional types related to [SafetySetting].
19525pub mod safety_setting {
19526    #[allow(unused_imports)]
19527    use super::*;
19528
19529    /// Probability based thresholds levels for blocking.
19530    ///
19531    /// # Working with unknown values
19532    ///
19533    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19534    /// additional enum variants at any time. Adding new variants is not considered
19535    /// a breaking change. Applications should write their code in anticipation of:
19536    ///
19537    /// - New values appearing in future releases of the client library, **and**
19538    /// - New values received dynamically, without application changes.
19539    ///
19540    /// Please consult the [Working with enums] section in the user guide for some
19541    /// guidelines.
19542    ///
19543    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19544    #[derive(Clone, Debug, PartialEq)]
19545    #[non_exhaustive]
19546    pub enum HarmBlockThreshold {
19547        /// Unspecified harm block threshold.
19548        Unspecified,
19549        /// Block low threshold and above (i.e. block more).
19550        BlockLowAndAbove,
19551        /// Block medium threshold and above.
19552        BlockMediumAndAbove,
19553        /// Block only high threshold (i.e. block less).
19554        BlockOnlyHigh,
19555        /// Block none.
19556        BlockNone,
19557        /// Turn off the safety filter.
19558        Off,
19559        /// If set, the enum was initialized with an unknown value.
19560        ///
19561        /// Applications can examine the value using [HarmBlockThreshold::value] or
19562        /// [HarmBlockThreshold::name].
19563        UnknownValue(harm_block_threshold::UnknownValue),
19564    }
19565
19566    #[doc(hidden)]
19567    pub mod harm_block_threshold {
19568        #[allow(unused_imports)]
19569        use super::*;
19570        #[derive(Clone, Debug, PartialEq)]
19571        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19572    }
19573
19574    impl HarmBlockThreshold {
19575        /// Gets the enum value.
19576        ///
19577        /// Returns `None` if the enum contains an unknown value deserialized from
19578        /// the string representation of enums.
19579        pub fn value(&self) -> std::option::Option<i32> {
19580            match self {
19581                Self::Unspecified => std::option::Option::Some(0),
19582                Self::BlockLowAndAbove => std::option::Option::Some(1),
19583                Self::BlockMediumAndAbove => std::option::Option::Some(2),
19584                Self::BlockOnlyHigh => std::option::Option::Some(3),
19585                Self::BlockNone => std::option::Option::Some(4),
19586                Self::Off => std::option::Option::Some(5),
19587                Self::UnknownValue(u) => u.0.value(),
19588            }
19589        }
19590
19591        /// Gets the enum value as a string.
19592        ///
19593        /// Returns `None` if the enum contains an unknown value deserialized from
19594        /// the integer representation of enums.
19595        pub fn name(&self) -> std::option::Option<&str> {
19596            match self {
19597                Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
19598                Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
19599                Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
19600                Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
19601                Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
19602                Self::Off => std::option::Option::Some("OFF"),
19603                Self::UnknownValue(u) => u.0.name(),
19604            }
19605        }
19606    }
19607
19608    impl std::default::Default for HarmBlockThreshold {
19609        fn default() -> Self {
19610            use std::convert::From;
19611            Self::from(0)
19612        }
19613    }
19614
19615    impl std::fmt::Display for HarmBlockThreshold {
19616        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19617            wkt::internal::display_enum(f, self.name(), self.value())
19618        }
19619    }
19620
19621    impl std::convert::From<i32> for HarmBlockThreshold {
19622        fn from(value: i32) -> Self {
19623            match value {
19624                0 => Self::Unspecified,
19625                1 => Self::BlockLowAndAbove,
19626                2 => Self::BlockMediumAndAbove,
19627                3 => Self::BlockOnlyHigh,
19628                4 => Self::BlockNone,
19629                5 => Self::Off,
19630                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19631                    wkt::internal::UnknownEnumValue::Integer(value),
19632                )),
19633            }
19634        }
19635    }
19636
19637    impl std::convert::From<&str> for HarmBlockThreshold {
19638        fn from(value: &str) -> Self {
19639            use std::string::ToString;
19640            match value {
19641                "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
19642                "BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
19643                "BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
19644                "BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
19645                "BLOCK_NONE" => Self::BlockNone,
19646                "OFF" => Self::Off,
19647                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19648                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19649                )),
19650            }
19651        }
19652    }
19653
19654    impl serde::ser::Serialize for HarmBlockThreshold {
19655        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19656        where
19657            S: serde::Serializer,
19658        {
19659            match self {
19660                Self::Unspecified => serializer.serialize_i32(0),
19661                Self::BlockLowAndAbove => serializer.serialize_i32(1),
19662                Self::BlockMediumAndAbove => serializer.serialize_i32(2),
19663                Self::BlockOnlyHigh => serializer.serialize_i32(3),
19664                Self::BlockNone => serializer.serialize_i32(4),
19665                Self::Off => serializer.serialize_i32(5),
19666                Self::UnknownValue(u) => u.0.serialize(serializer),
19667            }
19668        }
19669    }
19670
19671    impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
19672        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19673        where
19674            D: serde::Deserializer<'de>,
19675        {
19676            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
19677                ".google.cloud.retail.v2.SafetySetting.HarmBlockThreshold",
19678            ))
19679        }
19680    }
19681
19682    /// Probability vs severity.
19683    ///
19684    /// # Working with unknown values
19685    ///
19686    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19687    /// additional enum variants at any time. Adding new variants is not considered
19688    /// a breaking change. Applications should write their code in anticipation of:
19689    ///
19690    /// - New values appearing in future releases of the client library, **and**
19691    /// - New values received dynamically, without application changes.
19692    ///
19693    /// Please consult the [Working with enums] section in the user guide for some
19694    /// guidelines.
19695    ///
19696    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
19697    #[derive(Clone, Debug, PartialEq)]
19698    #[non_exhaustive]
19699    pub enum HarmBlockMethod {
19700        /// The harm block method is unspecified.
19701        Unspecified,
19702        /// The harm block method uses both probability and severity scores.
19703        Severity,
19704        /// The harm block method uses the probability score.
19705        Probability,
19706        /// If set, the enum was initialized with an unknown value.
19707        ///
19708        /// Applications can examine the value using [HarmBlockMethod::value] or
19709        /// [HarmBlockMethod::name].
19710        UnknownValue(harm_block_method::UnknownValue),
19711    }
19712
19713    #[doc(hidden)]
19714    pub mod harm_block_method {
19715        #[allow(unused_imports)]
19716        use super::*;
19717        #[derive(Clone, Debug, PartialEq)]
19718        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19719    }
19720
19721    impl HarmBlockMethod {
19722        /// Gets the enum value.
19723        ///
19724        /// Returns `None` if the enum contains an unknown value deserialized from
19725        /// the string representation of enums.
19726        pub fn value(&self) -> std::option::Option<i32> {
19727            match self {
19728                Self::Unspecified => std::option::Option::Some(0),
19729                Self::Severity => std::option::Option::Some(1),
19730                Self::Probability => std::option::Option::Some(2),
19731                Self::UnknownValue(u) => u.0.value(),
19732            }
19733        }
19734
19735        /// Gets the enum value as a string.
19736        ///
19737        /// Returns `None` if the enum contains an unknown value deserialized from
19738        /// the integer representation of enums.
19739        pub fn name(&self) -> std::option::Option<&str> {
19740            match self {
19741                Self::Unspecified => std::option::Option::Some("HARM_BLOCK_METHOD_UNSPECIFIED"),
19742                Self::Severity => std::option::Option::Some("SEVERITY"),
19743                Self::Probability => std::option::Option::Some("PROBABILITY"),
19744                Self::UnknownValue(u) => u.0.name(),
19745            }
19746        }
19747    }
19748
19749    impl std::default::Default for HarmBlockMethod {
19750        fn default() -> Self {
19751            use std::convert::From;
19752            Self::from(0)
19753        }
19754    }
19755
19756    impl std::fmt::Display for HarmBlockMethod {
19757        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19758            wkt::internal::display_enum(f, self.name(), self.value())
19759        }
19760    }
19761
19762    impl std::convert::From<i32> for HarmBlockMethod {
19763        fn from(value: i32) -> Self {
19764            match value {
19765                0 => Self::Unspecified,
19766                1 => Self::Severity,
19767                2 => Self::Probability,
19768                _ => Self::UnknownValue(harm_block_method::UnknownValue(
19769                    wkt::internal::UnknownEnumValue::Integer(value),
19770                )),
19771            }
19772        }
19773    }
19774
19775    impl std::convert::From<&str> for HarmBlockMethod {
19776        fn from(value: &str) -> Self {
19777            use std::string::ToString;
19778            match value {
19779                "HARM_BLOCK_METHOD_UNSPECIFIED" => Self::Unspecified,
19780                "SEVERITY" => Self::Severity,
19781                "PROBABILITY" => Self::Probability,
19782                _ => Self::UnknownValue(harm_block_method::UnknownValue(
19783                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19784                )),
19785            }
19786        }
19787    }
19788
19789    impl serde::ser::Serialize for HarmBlockMethod {
19790        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19791        where
19792            S: serde::Serializer,
19793        {
19794            match self {
19795                Self::Unspecified => serializer.serialize_i32(0),
19796                Self::Severity => serializer.serialize_i32(1),
19797                Self::Probability => serializer.serialize_i32(2),
19798                Self::UnknownValue(u) => u.0.serialize(serializer),
19799            }
19800        }
19801    }
19802
19803    impl<'de> serde::de::Deserialize<'de> for HarmBlockMethod {
19804        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19805        where
19806            D: serde::Deserializer<'de>,
19807        {
19808            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockMethod>::new(
19809                ".google.cloud.retail.v2.SafetySetting.HarmBlockMethod",
19810            ))
19811        }
19812    }
19813}
19814
19815/// Product attribute which structured by an attribute name and value. This
19816/// structure is used in conversational search filters and answers. For example,
19817/// if we have `name=color` and `value=red`, this means that the color is `red`.
19818#[derive(Clone, Default, PartialEq)]
19819#[non_exhaustive]
19820pub struct ProductAttributeValue {
19821    /// The attribute name.
19822    pub name: std::string::String,
19823
19824    /// The attribute value.
19825    pub value: std::string::String,
19826
19827    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19828}
19829
19830impl ProductAttributeValue {
19831    pub fn new() -> Self {
19832        std::default::Default::default()
19833    }
19834
19835    /// Sets the value of [name][crate::model::ProductAttributeValue::name].
19836    ///
19837    /// # Example
19838    /// ```ignore,no_run
19839    /// # use google_cloud_retail_v2::model::ProductAttributeValue;
19840    /// let x = ProductAttributeValue::new().set_name("example");
19841    /// ```
19842    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19843        self.name = v.into();
19844        self
19845    }
19846
19847    /// Sets the value of [value][crate::model::ProductAttributeValue::value].
19848    ///
19849    /// # Example
19850    /// ```ignore,no_run
19851    /// # use google_cloud_retail_v2::model::ProductAttributeValue;
19852    /// let x = ProductAttributeValue::new().set_value("example");
19853    /// ```
19854    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19855        self.value = v.into();
19856        self
19857    }
19858}
19859
19860impl wkt::message::Message for ProductAttributeValue {
19861    fn typename() -> &'static str {
19862        "type.googleapis.com/google.cloud.retail.v2.ProductAttributeValue"
19863    }
19864}
19865
19866/// Product attribute name and numeric interval.
19867#[derive(Clone, Default, PartialEq)]
19868#[non_exhaustive]
19869pub struct ProductAttributeInterval {
19870    /// The attribute name (e.g. "length")
19871    pub name: std::string::String,
19872
19873    /// The numeric interval (e.g. [10, 20))
19874    pub interval: std::option::Option<crate::model::Interval>,
19875
19876    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19877}
19878
19879impl ProductAttributeInterval {
19880    pub fn new() -> Self {
19881        std::default::Default::default()
19882    }
19883
19884    /// Sets the value of [name][crate::model::ProductAttributeInterval::name].
19885    ///
19886    /// # Example
19887    /// ```ignore,no_run
19888    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19889    /// let x = ProductAttributeInterval::new().set_name("example");
19890    /// ```
19891    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19892        self.name = v.into();
19893        self
19894    }
19895
19896    /// Sets the value of [interval][crate::model::ProductAttributeInterval::interval].
19897    ///
19898    /// # Example
19899    /// ```ignore,no_run
19900    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19901    /// use google_cloud_retail_v2::model::Interval;
19902    /// let x = ProductAttributeInterval::new().set_interval(Interval::default()/* use setters */);
19903    /// ```
19904    pub fn set_interval<T>(mut self, v: T) -> Self
19905    where
19906        T: std::convert::Into<crate::model::Interval>,
19907    {
19908        self.interval = std::option::Option::Some(v.into());
19909        self
19910    }
19911
19912    /// Sets or clears the value of [interval][crate::model::ProductAttributeInterval::interval].
19913    ///
19914    /// # Example
19915    /// ```ignore,no_run
19916    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
19917    /// use google_cloud_retail_v2::model::Interval;
19918    /// let x = ProductAttributeInterval::new().set_or_clear_interval(Some(Interval::default()/* use setters */));
19919    /// let x = ProductAttributeInterval::new().set_or_clear_interval(None::<Interval>);
19920    /// ```
19921    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
19922    where
19923        T: std::convert::Into<crate::model::Interval>,
19924    {
19925        self.interval = v.map(|x| x.into());
19926        self
19927    }
19928}
19929
19930impl wkt::message::Message for ProductAttributeInterval {
19931    fn typename() -> &'static str {
19932        "type.googleapis.com/google.cloud.retail.v2.ProductAttributeInterval"
19933    }
19934}
19935
19936/// This field specifies the tile information including an attribute key,
19937/// attribute value. More fields will be added in the future, eg: product id
19938/// or product counts, etc.
19939#[derive(Clone, Default, PartialEq)]
19940#[non_exhaustive]
19941pub struct Tile {
19942    /// The representative product id for this tile.
19943    pub representative_product_id: std::string::String,
19944
19945    /// The attribute key and value for the tile.
19946    pub product_attribute: std::option::Option<crate::model::tile::ProductAttribute>,
19947
19948    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19949}
19950
19951impl Tile {
19952    pub fn new() -> Self {
19953        std::default::Default::default()
19954    }
19955
19956    /// Sets the value of [representative_product_id][crate::model::Tile::representative_product_id].
19957    ///
19958    /// # Example
19959    /// ```ignore,no_run
19960    /// # use google_cloud_retail_v2::model::Tile;
19961    /// let x = Tile::new().set_representative_product_id("example");
19962    /// ```
19963    pub fn set_representative_product_id<T: std::convert::Into<std::string::String>>(
19964        mut self,
19965        v: T,
19966    ) -> Self {
19967        self.representative_product_id = v.into();
19968        self
19969    }
19970
19971    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute].
19972    ///
19973    /// Note that all the setters affecting `product_attribute` are mutually
19974    /// exclusive.
19975    ///
19976    /// # Example
19977    /// ```ignore,no_run
19978    /// # use google_cloud_retail_v2::model::Tile;
19979    /// use google_cloud_retail_v2::model::ProductAttributeValue;
19980    /// let x = Tile::new().set_product_attribute(Some(
19981    ///     google_cloud_retail_v2::model::tile::ProductAttribute::ProductAttributeValue(ProductAttributeValue::default().into())));
19982    /// ```
19983    pub fn set_product_attribute<
19984        T: std::convert::Into<std::option::Option<crate::model::tile::ProductAttribute>>,
19985    >(
19986        mut self,
19987        v: T,
19988    ) -> Self {
19989        self.product_attribute = v.into();
19990        self
19991    }
19992
19993    /// The value of [product_attribute][crate::model::Tile::product_attribute]
19994    /// if it holds a `ProductAttributeValue`, `None` if the field is not set or
19995    /// holds a different branch.
19996    pub fn product_attribute_value(
19997        &self,
19998    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeValue>> {
19999        #[allow(unreachable_patterns)]
20000        self.product_attribute.as_ref().and_then(|v| match v {
20001            crate::model::tile::ProductAttribute::ProductAttributeValue(v) => {
20002                std::option::Option::Some(v)
20003            }
20004            _ => std::option::Option::None,
20005        })
20006    }
20007
20008    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20009    /// to hold a `ProductAttributeValue`.
20010    ///
20011    /// Note that all the setters affecting `product_attribute` are
20012    /// mutually exclusive.
20013    ///
20014    /// # Example
20015    /// ```ignore,no_run
20016    /// # use google_cloud_retail_v2::model::Tile;
20017    /// use google_cloud_retail_v2::model::ProductAttributeValue;
20018    /// let x = Tile::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
20019    /// assert!(x.product_attribute_value().is_some());
20020    /// assert!(x.product_attribute_interval().is_none());
20021    /// ```
20022    pub fn set_product_attribute_value<
20023        T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeValue>>,
20024    >(
20025        mut self,
20026        v: T,
20027    ) -> Self {
20028        self.product_attribute = std::option::Option::Some(
20029            crate::model::tile::ProductAttribute::ProductAttributeValue(v.into()),
20030        );
20031        self
20032    }
20033
20034    /// The value of [product_attribute][crate::model::Tile::product_attribute]
20035    /// if it holds a `ProductAttributeInterval`, `None` if the field is not set or
20036    /// holds a different branch.
20037    pub fn product_attribute_interval(
20038        &self,
20039    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeInterval>> {
20040        #[allow(unreachable_patterns)]
20041        self.product_attribute.as_ref().and_then(|v| match v {
20042            crate::model::tile::ProductAttribute::ProductAttributeInterval(v) => {
20043                std::option::Option::Some(v)
20044            }
20045            _ => std::option::Option::None,
20046        })
20047    }
20048
20049    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20050    /// to hold a `ProductAttributeInterval`.
20051    ///
20052    /// Note that all the setters affecting `product_attribute` are
20053    /// mutually exclusive.
20054    ///
20055    /// # Example
20056    /// ```ignore,no_run
20057    /// # use google_cloud_retail_v2::model::Tile;
20058    /// use google_cloud_retail_v2::model::ProductAttributeInterval;
20059    /// let x = Tile::new().set_product_attribute_interval(ProductAttributeInterval::default()/* use setters */);
20060    /// assert!(x.product_attribute_interval().is_some());
20061    /// assert!(x.product_attribute_value().is_none());
20062    /// ```
20063    pub fn set_product_attribute_interval<
20064        T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeInterval>>,
20065    >(
20066        mut self,
20067        v: T,
20068    ) -> Self {
20069        self.product_attribute = std::option::Option::Some(
20070            crate::model::tile::ProductAttribute::ProductAttributeInterval(v.into()),
20071        );
20072        self
20073    }
20074}
20075
20076impl wkt::message::Message for Tile {
20077    fn typename() -> &'static str {
20078        "type.googleapis.com/google.cloud.retail.v2.Tile"
20079    }
20080}
20081
20082/// Defines additional types related to [Tile].
20083pub mod tile {
20084    #[allow(unused_imports)]
20085    use super::*;
20086
20087    /// The attribute key and value for the tile.
20088    #[derive(Clone, Debug, PartialEq)]
20089    #[non_exhaustive]
20090    pub enum ProductAttribute {
20091        /// The product attribute key-value.
20092        ProductAttributeValue(std::boxed::Box<crate::model::ProductAttributeValue>),
20093        /// The product attribute key-numeric interval.
20094        ProductAttributeInterval(std::boxed::Box<crate::model::ProductAttributeInterval>),
20095    }
20096}
20097
20098/// Request message for
20099/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
20100///
20101/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20102#[derive(Clone, Default, PartialEq)]
20103#[non_exhaustive]
20104pub struct SearchRequest {
20105    /// Required. The resource name of the Retail Search serving config, such as
20106    /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
20107    /// or the name of the legacy placement resource, such as
20108    /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
20109    /// This field is used to identify the serving config name and the set
20110    /// of models that are used to make the search.
20111    pub placement: std::string::String,
20112
20113    /// The branch resource name, such as
20114    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
20115    ///
20116    /// Use "default_branch" as the branch ID or leave this field empty, to search
20117    /// products under the default branch.
20118    pub branch: std::string::String,
20119
20120    /// Raw search query.
20121    ///
20122    /// If this field is empty, the request is considered a category browsing
20123    /// request and returned results are based on
20124    /// [filter][google.cloud.retail.v2.SearchRequest.filter] and
20125    /// [page_categories][google.cloud.retail.v2.SearchRequest.page_categories].
20126    ///
20127    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20128    /// [google.cloud.retail.v2.SearchRequest.page_categories]: crate::model::SearchRequest::page_categories
20129    pub query: std::string::String,
20130
20131    /// Required. A unique identifier for tracking visitors. For example, this
20132    /// could be implemented with an HTTP cookie, which should be able to uniquely
20133    /// identify a visitor on a single device. This unique identifier should not
20134    /// change if the visitor logs in or out of the website.
20135    ///
20136    /// This should be the same identifier as
20137    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
20138    ///
20139    /// The field must be a UTF-8 encoded string with a length limit of 128
20140    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
20141    ///
20142    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
20143    pub visitor_id: std::string::String,
20144
20145    /// User information.
20146    pub user_info: std::option::Option<crate::model::UserInfo>,
20147
20148    /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
20149    /// unspecified, defaults to a reasonable value. The maximum allowed value is
20150    /// 120. Values above 120 will be coerced to 120.
20151    ///
20152    /// If this field is negative, an INVALID_ARGUMENT is returned.
20153    ///
20154    /// [google.cloud.retail.v2.Product]: crate::model::Product
20155    pub page_size: i32,
20156
20157    /// A page token
20158    /// [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token],
20159    /// received from a previous
20160    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call.
20161    /// Provide this to retrieve the subsequent page.
20162    ///
20163    /// When paginating, all other parameters provided to
20164    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must
20165    /// match the call that provided the page token. Otherwise, an INVALID_ARGUMENT
20166    /// error is returned.
20167    ///
20168    /// [google.cloud.retail.v2.SearchResponse.next_page_token]: crate::model::SearchResponse::next_page_token
20169    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20170    pub page_token: std::string::String,
20171
20172    /// A 0-indexed integer that specifies the current offset (that is, starting
20173    /// result location, amongst the [Product][google.cloud.retail.v2.Product]s
20174    /// deemed by the API as relevant) in search results. This field is only
20175    /// considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token]
20176    /// is unset.
20177    ///
20178    /// If this field is negative, an INVALID_ARGUMENT is returned.
20179    ///
20180    /// [google.cloud.retail.v2.Product]: crate::model::Product
20181    /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
20182    pub offset: i32,
20183
20184    /// The filter syntax consists of an expression language for constructing a
20185    /// predicate from one or more fields of the products being filtered. Filter
20186    /// expression is case-sensitive. For more information, see
20187    /// [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter).
20188    ///
20189    /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20190    pub filter: std::string::String,
20191
20192    /// The default filter that is applied when a user performs a search without
20193    /// checking any filters on the search page.
20194    ///
20195    /// The filter applied to every search request when quality improvement such as
20196    /// query expansion is needed. In the case a query does not have a sufficient
20197    /// amount of results this filter will be used to determine whether or not to
20198    /// enable the query expansion flow. The original filter will still be used for
20199    /// the query expanded search.
20200    /// This field is strongly recommended to achieve high search quality.
20201    ///
20202    /// For more information about filter syntax, see
20203    /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
20204    ///
20205    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20206    pub canonical_filter: std::string::String,
20207
20208    /// The order in which products are returned. Products can be ordered by
20209    /// a field in an [Product][google.cloud.retail.v2.Product] object. Leave it
20210    /// unset if ordered by relevance. OrderBy expression is case-sensitive. For
20211    /// more information, see
20212    /// [Order](https://cloud.google.com/retail/docs/filter-and-order#order).
20213    ///
20214    /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20215    ///
20216    /// [google.cloud.retail.v2.Product]: crate::model::Product
20217    pub order_by: std::string::String,
20218
20219    /// Facet specifications for faceted search. If empty, no facets are returned.
20220    ///
20221    /// A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error
20222    /// is returned.
20223    pub facet_specs: std::vec::Vec<crate::model::search_request::FacetSpec>,
20224
20225    /// Deprecated. Refer to <https://cloud.google.com/retail/docs/configs#dynamic>
20226    /// to enable dynamic facets. Do not set this field.
20227    ///
20228    /// The specification for dynamically generated facets. Notice that only
20229    /// textual facets can be dynamically generated.
20230    #[deprecated]
20231    pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
20232
20233    /// Boost specification to boost certain products. For more information, see
20234    /// [Boost results](https://cloud.google.com/retail/docs/boosting).
20235    ///
20236    /// Notice that if both
20237    /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
20238    /// and
20239    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
20240    /// are set, the boost conditions from both places are evaluated. If a search
20241    /// request matches multiple boost conditions, the final boost score is equal
20242    /// to the sum of the boost scores from all matched boost conditions.
20243    ///
20244    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
20245    /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
20246    pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
20247
20248    /// The query expansion specification that specifies the conditions under which
20249    /// query expansion occurs. For more information, see [Query
20250    /// expansion](https://cloud.google.com/retail/docs/result-size#query_expansion).
20251    pub query_expansion_spec: std::option::Option<crate::model::search_request::QueryExpansionSpec>,
20252
20253    /// The keys to fetch and rollup the matching
20254    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20255    /// [Product][google.cloud.retail.v2.Product]s attributes,
20256    /// [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo] or
20257    /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s attributes. The
20258    /// attributes from all the matching
20259    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20260    /// [Product][google.cloud.retail.v2.Product]s or
20261    /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s are merged and
20262    /// de-duplicated. Notice that rollup attributes will lead to extra query
20263    /// latency. Maximum number of keys is 30.
20264    ///
20265    /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a
20266    /// fulfillment type and a fulfillment ID must be provided in the format of
20267    /// "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123",
20268    /// "pickupInStore" is fulfillment type and "store123" is the store ID.
20269    ///
20270    /// Supported keys are:
20271    ///
20272    /// * colorFamilies
20273    /// * price
20274    /// * originalPrice
20275    /// * discount
20276    /// * variantId
20277    /// * inventory(place_id,price)
20278    /// * inventory(place_id,original_price)
20279    /// * inventory(place_id,attributes.key), where key is any key in the
20280    ///   [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes]
20281    ///   map.
20282    /// * attributes.key, where key is any key in the
20283    ///   [Product.attributes][google.cloud.retail.v2.Product.attributes] map.
20284    /// * pickupInStore.id, where id is any
20285    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20286    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20287    ///   "pickup-in-store".
20288    /// * shipToStore.id, where id is any
20289    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20290    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20291    ///   "ship-to-store".
20292    /// * sameDayDelivery.id, where id is any
20293    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20294    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20295    ///   "same-day-delivery".
20296    /// * nextDayDelivery.id, where id is any
20297    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20298    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20299    ///   "next-day-delivery".
20300    /// * customFulfillment1.id, where id is any
20301    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20302    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20303    ///   "custom-type-1".
20304    /// * customFulfillment2.id, where id is any
20305    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20306    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20307    ///   "custom-type-2".
20308    /// * customFulfillment3.id, where id is any
20309    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20310    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20311    ///   "custom-type-3".
20312    /// * customFulfillment4.id, where id is any
20313    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20314    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20315    ///   "custom-type-4".
20316    /// * customFulfillment5.id, where id is any
20317    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20318    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20319    ///   "custom-type-5".
20320    ///
20321    /// If this field is set to an invalid value other than these, an
20322    /// INVALID_ARGUMENT error is returned.
20323    ///
20324    /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
20325    /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
20326    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
20327    /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
20328    /// [google.cloud.retail.v2.LocalInventory.attributes]: crate::model::LocalInventory::attributes
20329    /// [google.cloud.retail.v2.Product]: crate::model::Product
20330    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
20331    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
20332    pub variant_rollup_keys: std::vec::Vec<std::string::String>,
20333
20334    /// The categories associated with a category page. Must be set for category
20335    /// navigation queries to achieve good search quality. The format should be
20336    /// the same as
20337    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
20338    ///
20339    /// To represent full path of category, use '>' sign to separate different
20340    /// hierarchies. If '>' is part of the category name, replace it with
20341    /// other character(s).
20342    ///
20343    /// Category pages include special pages such as sales or promotions. For
20344    /// instance, a special sale page may have the category hierarchy:
20345    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
20346    ///
20347    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
20348    pub page_categories: std::vec::Vec<std::string::String>,
20349
20350    /// The search mode of the search request. If not specified, a single search
20351    /// request triggers both product search and faceted search.
20352    pub search_mode: crate::model::search_request::SearchMode,
20353
20354    /// The specification for personalization.
20355    ///
20356    /// Notice that if both
20357    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
20358    /// and
20359    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20360    /// are set.
20361    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20362    /// will override
20363    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
20364    ///
20365    /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
20366    /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
20367    pub personalization_spec:
20368        std::option::Option<crate::model::search_request::PersonalizationSpec>,
20369
20370    /// The labels applied to a resource must meet the following requirements:
20371    ///
20372    /// * Each resource can have multiple labels, up to a maximum of 64.
20373    /// * Each label must be a key-value pair.
20374    /// * Keys have a minimum length of 1 character and a maximum length of 63
20375    ///   characters and cannot be empty. Values can be empty and have a maximum
20376    ///   length of 63 characters.
20377    /// * Keys and values can contain only lowercase letters, numeric characters,
20378    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
20379    ///   international characters are allowed.
20380    /// * The key portion of a label must be unique. However, you can use the same
20381    ///   key with multiple resources.
20382    /// * Keys must start with a lowercase letter or international character.
20383    ///
20384    /// For more information, see [Requirements for
20385    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
20386    /// in the Resource Manager documentation.
20387    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
20388
20389    /// The spell correction specification that specifies the mode under
20390    /// which spell correction will take effect.
20391    pub spell_correction_spec:
20392        std::option::Option<crate::model::search_request::SpellCorrectionSpec>,
20393
20394    /// The entity for customers that may run multiple different entities, domains,
20395    /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
20396    /// `google.com`, `youtube.com`, etc.
20397    /// If this is set, it should be exactly matched with
20398    /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get search
20399    /// results boosted by entity.
20400    ///
20401    /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
20402    pub entity: std::string::String,
20403
20404    /// Optional. This field specifies all conversational related parameters
20405    /// addition to traditional retail search.
20406    pub conversational_search_spec:
20407        std::option::Option<crate::model::search_request::ConversationalSearchSpec>,
20408
20409    /// Optional. This field specifies tile navigation related parameters.
20410    pub tile_navigation_spec: std::option::Option<crate::model::search_request::TileNavigationSpec>,
20411
20412    /// Optional. The BCP-47 language code, such as "en-US" or "sr-Latn"
20413    /// [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more
20414    /// information, see [Standardized codes](https://google.aip.dev/143). This
20415    /// field helps to better interpret the query. If a value isn't specified, the
20416    /// query language code is automatically detected, which may not be accurate.
20417    pub language_code: std::string::String,
20418
20419    /// Optional. The Unicode country/region code (CLDR) of a location, such as
20420    /// "US" and "419"
20421    /// [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html).
20422    /// For more information, see [Standardized codes](https://google.aip.dev/143).
20423    /// If set, then results will be boosted based on the region_code provided.
20424    pub region_code: std::string::String,
20425
20426    /// Optional. An id corresponding to a place, such as a store id or region id.
20427    /// When specified, we use the price from the local inventory with the matching
20428    /// product's
20429    /// [LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
20430    /// for revenue optimization.
20431    ///
20432    /// [google.cloud.retail.v2.LocalInventory.place_id]: crate::model::LocalInventory::place_id
20433    pub place_id: std::string::String,
20434
20435    /// Optional. The user attributes that could be used for personalization of
20436    /// search results.
20437    ///
20438    /// * Populate at most 100 key-value pairs per query.
20439    /// * Only supports string keys and repeated string values.
20440    /// * Duplicate keys are not allowed within a single query.
20441    ///
20442    /// Example:
20443    /// user_attributes: [
20444    /// { key: "pets"
20445    /// value {
20446    /// values: "dog"
20447    /// values: "cat"
20448    /// }
20449    /// },
20450    /// { key: "state"
20451    /// value {
20452    /// values: "CA"
20453    /// }
20454    /// }
20455    /// ]
20456    pub user_attributes: std::collections::HashMap<std::string::String, crate::model::StringList>,
20457
20458    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20459}
20460
20461impl SearchRequest {
20462    pub fn new() -> Self {
20463        std::default::Default::default()
20464    }
20465
20466    /// Sets the value of [placement][crate::model::SearchRequest::placement].
20467    ///
20468    /// # Example
20469    /// ```ignore,no_run
20470    /// # use google_cloud_retail_v2::model::SearchRequest;
20471    /// let x = SearchRequest::new().set_placement("example");
20472    /// ```
20473    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20474        self.placement = v.into();
20475        self
20476    }
20477
20478    /// Sets the value of [branch][crate::model::SearchRequest::branch].
20479    ///
20480    /// # Example
20481    /// ```ignore,no_run
20482    /// # use google_cloud_retail_v2::model::SearchRequest;
20483    /// let x = SearchRequest::new().set_branch("example");
20484    /// ```
20485    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20486        self.branch = v.into();
20487        self
20488    }
20489
20490    /// Sets the value of [query][crate::model::SearchRequest::query].
20491    ///
20492    /// # Example
20493    /// ```ignore,no_run
20494    /// # use google_cloud_retail_v2::model::SearchRequest;
20495    /// let x = SearchRequest::new().set_query("example");
20496    /// ```
20497    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20498        self.query = v.into();
20499        self
20500    }
20501
20502    /// Sets the value of [visitor_id][crate::model::SearchRequest::visitor_id].
20503    ///
20504    /// # Example
20505    /// ```ignore,no_run
20506    /// # use google_cloud_retail_v2::model::SearchRequest;
20507    /// let x = SearchRequest::new().set_visitor_id("example");
20508    /// ```
20509    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20510        self.visitor_id = v.into();
20511        self
20512    }
20513
20514    /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
20515    ///
20516    /// # Example
20517    /// ```ignore,no_run
20518    /// # use google_cloud_retail_v2::model::SearchRequest;
20519    /// use google_cloud_retail_v2::model::UserInfo;
20520    /// let x = SearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
20521    /// ```
20522    pub fn set_user_info<T>(mut self, v: T) -> Self
20523    where
20524        T: std::convert::Into<crate::model::UserInfo>,
20525    {
20526        self.user_info = std::option::Option::Some(v.into());
20527        self
20528    }
20529
20530    /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
20531    ///
20532    /// # Example
20533    /// ```ignore,no_run
20534    /// # use google_cloud_retail_v2::model::SearchRequest;
20535    /// use google_cloud_retail_v2::model::UserInfo;
20536    /// let x = SearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
20537    /// let x = SearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
20538    /// ```
20539    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
20540    where
20541        T: std::convert::Into<crate::model::UserInfo>,
20542    {
20543        self.user_info = v.map(|x| x.into());
20544        self
20545    }
20546
20547    /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
20548    ///
20549    /// # Example
20550    /// ```ignore,no_run
20551    /// # use google_cloud_retail_v2::model::SearchRequest;
20552    /// let x = SearchRequest::new().set_page_size(42);
20553    /// ```
20554    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20555        self.page_size = v.into();
20556        self
20557    }
20558
20559    /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
20560    ///
20561    /// # Example
20562    /// ```ignore,no_run
20563    /// # use google_cloud_retail_v2::model::SearchRequest;
20564    /// let x = SearchRequest::new().set_page_token("example");
20565    /// ```
20566    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20567        self.page_token = v.into();
20568        self
20569    }
20570
20571    /// Sets the value of [offset][crate::model::SearchRequest::offset].
20572    ///
20573    /// # Example
20574    /// ```ignore,no_run
20575    /// # use google_cloud_retail_v2::model::SearchRequest;
20576    /// let x = SearchRequest::new().set_offset(42);
20577    /// ```
20578    pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20579        self.offset = v.into();
20580        self
20581    }
20582
20583    /// Sets the value of [filter][crate::model::SearchRequest::filter].
20584    ///
20585    /// # Example
20586    /// ```ignore,no_run
20587    /// # use google_cloud_retail_v2::model::SearchRequest;
20588    /// let x = SearchRequest::new().set_filter("example");
20589    /// ```
20590    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20591        self.filter = v.into();
20592        self
20593    }
20594
20595    /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
20596    ///
20597    /// # Example
20598    /// ```ignore,no_run
20599    /// # use google_cloud_retail_v2::model::SearchRequest;
20600    /// let x = SearchRequest::new().set_canonical_filter("example");
20601    /// ```
20602    pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
20603        mut self,
20604        v: T,
20605    ) -> Self {
20606        self.canonical_filter = v.into();
20607        self
20608    }
20609
20610    /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
20611    ///
20612    /// # Example
20613    /// ```ignore,no_run
20614    /// # use google_cloud_retail_v2::model::SearchRequest;
20615    /// let x = SearchRequest::new().set_order_by("example");
20616    /// ```
20617    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20618        self.order_by = v.into();
20619        self
20620    }
20621
20622    /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
20623    ///
20624    /// # Example
20625    /// ```ignore,no_run
20626    /// # use google_cloud_retail_v2::model::SearchRequest;
20627    /// use google_cloud_retail_v2::model::search_request::FacetSpec;
20628    /// let x = SearchRequest::new()
20629    ///     .set_facet_specs([
20630    ///         FacetSpec::default()/* use setters */,
20631    ///         FacetSpec::default()/* use (different) setters */,
20632    ///     ]);
20633    /// ```
20634    pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
20635    where
20636        T: std::iter::IntoIterator<Item = V>,
20637        V: std::convert::Into<crate::model::search_request::FacetSpec>,
20638    {
20639        use std::iter::Iterator;
20640        self.facet_specs = v.into_iter().map(|i| i.into()).collect();
20641        self
20642    }
20643
20644    /// Sets the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20645    ///
20646    /// # Example
20647    /// ```ignore,no_run
20648    /// # use google_cloud_retail_v2::model::SearchRequest;
20649    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20650    /// let x = SearchRequest::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
20651    /// ```
20652    #[deprecated]
20653    pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
20654    where
20655        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20656    {
20657        self.dynamic_facet_spec = std::option::Option::Some(v.into());
20658        self
20659    }
20660
20661    /// Sets or clears the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20662    ///
20663    /// # Example
20664    /// ```ignore,no_run
20665    /// # use google_cloud_retail_v2::model::SearchRequest;
20666    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20667    /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
20668    /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
20669    /// ```
20670    #[deprecated]
20671    pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
20672    where
20673        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20674    {
20675        self.dynamic_facet_spec = v.map(|x| x.into());
20676        self
20677    }
20678
20679    /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20680    ///
20681    /// # Example
20682    /// ```ignore,no_run
20683    /// # use google_cloud_retail_v2::model::SearchRequest;
20684    /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20685    /// let x = SearchRequest::new().set_boost_spec(BoostSpec::default()/* use setters */);
20686    /// ```
20687    pub fn set_boost_spec<T>(mut self, v: T) -> Self
20688    where
20689        T: std::convert::Into<crate::model::search_request::BoostSpec>,
20690    {
20691        self.boost_spec = std::option::Option::Some(v.into());
20692        self
20693    }
20694
20695    /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20696    ///
20697    /// # Example
20698    /// ```ignore,no_run
20699    /// # use google_cloud_retail_v2::model::SearchRequest;
20700    /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20701    /// let x = SearchRequest::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
20702    /// let x = SearchRequest::new().set_or_clear_boost_spec(None::<BoostSpec>);
20703    /// ```
20704    pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
20705    where
20706        T: std::convert::Into<crate::model::search_request::BoostSpec>,
20707    {
20708        self.boost_spec = v.map(|x| x.into());
20709        self
20710    }
20711
20712    /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20713    ///
20714    /// # Example
20715    /// ```ignore,no_run
20716    /// # use google_cloud_retail_v2::model::SearchRequest;
20717    /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20718    /// let x = SearchRequest::new().set_query_expansion_spec(QueryExpansionSpec::default()/* use setters */);
20719    /// ```
20720    pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
20721    where
20722        T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20723    {
20724        self.query_expansion_spec = std::option::Option::Some(v.into());
20725        self
20726    }
20727
20728    /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
20729    ///
20730    /// # Example
20731    /// ```ignore,no_run
20732    /// # use google_cloud_retail_v2::model::SearchRequest;
20733    /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
20734    /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(Some(QueryExpansionSpec::default()/* use setters */));
20735    /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(None::<QueryExpansionSpec>);
20736    /// ```
20737    pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
20738    where
20739        T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
20740    {
20741        self.query_expansion_spec = v.map(|x| x.into());
20742        self
20743    }
20744
20745    /// Sets the value of [variant_rollup_keys][crate::model::SearchRequest::variant_rollup_keys].
20746    ///
20747    /// # Example
20748    /// ```ignore,no_run
20749    /// # use google_cloud_retail_v2::model::SearchRequest;
20750    /// let x = SearchRequest::new().set_variant_rollup_keys(["a", "b", "c"]);
20751    /// ```
20752    pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
20753    where
20754        T: std::iter::IntoIterator<Item = V>,
20755        V: std::convert::Into<std::string::String>,
20756    {
20757        use std::iter::Iterator;
20758        self.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
20759        self
20760    }
20761
20762    /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
20763    ///
20764    /// # Example
20765    /// ```ignore,no_run
20766    /// # use google_cloud_retail_v2::model::SearchRequest;
20767    /// let x = SearchRequest::new().set_page_categories(["a", "b", "c"]);
20768    /// ```
20769    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
20770    where
20771        T: std::iter::IntoIterator<Item = V>,
20772        V: std::convert::Into<std::string::String>,
20773    {
20774        use std::iter::Iterator;
20775        self.page_categories = v.into_iter().map(|i| i.into()).collect();
20776        self
20777    }
20778
20779    /// Sets the value of [search_mode][crate::model::SearchRequest::search_mode].
20780    ///
20781    /// # Example
20782    /// ```ignore,no_run
20783    /// # use google_cloud_retail_v2::model::SearchRequest;
20784    /// use google_cloud_retail_v2::model::search_request::SearchMode;
20785    /// let x0 = SearchRequest::new().set_search_mode(SearchMode::ProductSearchOnly);
20786    /// let x1 = SearchRequest::new().set_search_mode(SearchMode::FacetedSearchOnly);
20787    /// ```
20788    pub fn set_search_mode<T: std::convert::Into<crate::model::search_request::SearchMode>>(
20789        mut self,
20790        v: T,
20791    ) -> Self {
20792        self.search_mode = v.into();
20793        self
20794    }
20795
20796    /// Sets the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20797    ///
20798    /// # Example
20799    /// ```ignore,no_run
20800    /// # use google_cloud_retail_v2::model::SearchRequest;
20801    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20802    /// let x = SearchRequest::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
20803    /// ```
20804    pub fn set_personalization_spec<T>(mut self, v: T) -> Self
20805    where
20806        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20807    {
20808        self.personalization_spec = std::option::Option::Some(v.into());
20809        self
20810    }
20811
20812    /// Sets or clears the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
20813    ///
20814    /// # Example
20815    /// ```ignore,no_run
20816    /// # use google_cloud_retail_v2::model::SearchRequest;
20817    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
20818    /// let x = SearchRequest::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
20819    /// let x = SearchRequest::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
20820    /// ```
20821    pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
20822    where
20823        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
20824    {
20825        self.personalization_spec = v.map(|x| x.into());
20826        self
20827    }
20828
20829    /// Sets the value of [labels][crate::model::SearchRequest::labels].
20830    ///
20831    /// # Example
20832    /// ```ignore,no_run
20833    /// # use google_cloud_retail_v2::model::SearchRequest;
20834    /// let x = SearchRequest::new().set_labels([
20835    ///     ("key0", "abc"),
20836    ///     ("key1", "xyz"),
20837    /// ]);
20838    /// ```
20839    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
20840    where
20841        T: std::iter::IntoIterator<Item = (K, V)>,
20842        K: std::convert::Into<std::string::String>,
20843        V: std::convert::Into<std::string::String>,
20844    {
20845        use std::iter::Iterator;
20846        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
20847        self
20848    }
20849
20850    /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
20851    ///
20852    /// # Example
20853    /// ```ignore,no_run
20854    /// # use google_cloud_retail_v2::model::SearchRequest;
20855    /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
20856    /// let x = SearchRequest::new().set_spell_correction_spec(SpellCorrectionSpec::default()/* use setters */);
20857    /// ```
20858    pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
20859    where
20860        T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
20861    {
20862        self.spell_correction_spec = std::option::Option::Some(v.into());
20863        self
20864    }
20865
20866    /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
20867    ///
20868    /// # Example
20869    /// ```ignore,no_run
20870    /// # use google_cloud_retail_v2::model::SearchRequest;
20871    /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
20872    /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(Some(SpellCorrectionSpec::default()/* use setters */));
20873    /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(None::<SpellCorrectionSpec>);
20874    /// ```
20875    pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
20876    where
20877        T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
20878    {
20879        self.spell_correction_spec = v.map(|x| x.into());
20880        self
20881    }
20882
20883    /// Sets the value of [entity][crate::model::SearchRequest::entity].
20884    ///
20885    /// # Example
20886    /// ```ignore,no_run
20887    /// # use google_cloud_retail_v2::model::SearchRequest;
20888    /// let x = SearchRequest::new().set_entity("example");
20889    /// ```
20890    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20891        self.entity = v.into();
20892        self
20893    }
20894
20895    /// Sets the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
20896    ///
20897    /// # Example
20898    /// ```ignore,no_run
20899    /// # use google_cloud_retail_v2::model::SearchRequest;
20900    /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
20901    /// let x = SearchRequest::new().set_conversational_search_spec(ConversationalSearchSpec::default()/* use setters */);
20902    /// ```
20903    pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
20904    where
20905        T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
20906    {
20907        self.conversational_search_spec = std::option::Option::Some(v.into());
20908        self
20909    }
20910
20911    /// Sets or clears the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
20912    ///
20913    /// # Example
20914    /// ```ignore,no_run
20915    /// # use google_cloud_retail_v2::model::SearchRequest;
20916    /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
20917    /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(Some(ConversationalSearchSpec::default()/* use setters */));
20918    /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(None::<ConversationalSearchSpec>);
20919    /// ```
20920    pub fn set_or_clear_conversational_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
20921    where
20922        T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
20923    {
20924        self.conversational_search_spec = v.map(|x| x.into());
20925        self
20926    }
20927
20928    /// Sets the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
20929    ///
20930    /// # Example
20931    /// ```ignore,no_run
20932    /// # use google_cloud_retail_v2::model::SearchRequest;
20933    /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
20934    /// let x = SearchRequest::new().set_tile_navigation_spec(TileNavigationSpec::default()/* use setters */);
20935    /// ```
20936    pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
20937    where
20938        T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
20939    {
20940        self.tile_navigation_spec = std::option::Option::Some(v.into());
20941        self
20942    }
20943
20944    /// Sets or clears the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
20945    ///
20946    /// # Example
20947    /// ```ignore,no_run
20948    /// # use google_cloud_retail_v2::model::SearchRequest;
20949    /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
20950    /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(Some(TileNavigationSpec::default()/* use setters */));
20951    /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(None::<TileNavigationSpec>);
20952    /// ```
20953    pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
20954    where
20955        T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
20956    {
20957        self.tile_navigation_spec = v.map(|x| x.into());
20958        self
20959    }
20960
20961    /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
20962    ///
20963    /// # Example
20964    /// ```ignore,no_run
20965    /// # use google_cloud_retail_v2::model::SearchRequest;
20966    /// let x = SearchRequest::new().set_language_code("example");
20967    /// ```
20968    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20969        self.language_code = v.into();
20970        self
20971    }
20972
20973    /// Sets the value of [region_code][crate::model::SearchRequest::region_code].
20974    ///
20975    /// # Example
20976    /// ```ignore,no_run
20977    /// # use google_cloud_retail_v2::model::SearchRequest;
20978    /// let x = SearchRequest::new().set_region_code("example");
20979    /// ```
20980    pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20981        self.region_code = v.into();
20982        self
20983    }
20984
20985    /// Sets the value of [place_id][crate::model::SearchRequest::place_id].
20986    ///
20987    /// # Example
20988    /// ```ignore,no_run
20989    /// # use google_cloud_retail_v2::model::SearchRequest;
20990    /// let x = SearchRequest::new().set_place_id("example");
20991    /// ```
20992    pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20993        self.place_id = v.into();
20994        self
20995    }
20996
20997    /// Sets the value of [user_attributes][crate::model::SearchRequest::user_attributes].
20998    ///
20999    /// # Example
21000    /// ```ignore,no_run
21001    /// # use google_cloud_retail_v2::model::SearchRequest;
21002    /// use google_cloud_retail_v2::model::StringList;
21003    /// let x = SearchRequest::new().set_user_attributes([
21004    ///     ("key0", StringList::default()/* use setters */),
21005    ///     ("key1", StringList::default()/* use (different) setters */),
21006    /// ]);
21007    /// ```
21008    pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
21009    where
21010        T: std::iter::IntoIterator<Item = (K, V)>,
21011        K: std::convert::Into<std::string::String>,
21012        V: std::convert::Into<crate::model::StringList>,
21013    {
21014        use std::iter::Iterator;
21015        self.user_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21016        self
21017    }
21018}
21019
21020impl wkt::message::Message for SearchRequest {
21021    fn typename() -> &'static str {
21022        "type.googleapis.com/google.cloud.retail.v2.SearchRequest"
21023    }
21024}
21025
21026/// Defines additional types related to [SearchRequest].
21027pub mod search_request {
21028    #[allow(unused_imports)]
21029    use super::*;
21030
21031    /// A facet specification to perform faceted search.
21032    #[derive(Clone, Default, PartialEq)]
21033    #[non_exhaustive]
21034    pub struct FacetSpec {
21035        /// Required. The facet key specification.
21036        pub facet_key: std::option::Option<crate::model::search_request::facet_spec::FacetKey>,
21037
21038        /// Maximum of facet values that should be returned for this facet. If
21039        /// unspecified, defaults to 50. The maximum allowed value is 300. Values
21040        /// above 300 will be coerced to 300.
21041        ///
21042        /// If this field is negative, an INVALID_ARGUMENT is returned.
21043        pub limit: i32,
21044
21045        /// List of keys to exclude when faceting.
21046        ///
21047        /// By default,
21048        /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21049        /// is not excluded from the filter unless it is listed in this field.
21050        ///
21051        /// Listing a facet key in this field allows its values to appear as facet
21052        /// results, even when they are filtered out of search results. Using this
21053        /// field does not affect what search results are returned.
21054        ///
21055        /// For example, suppose there are 100 products with the color facet "Red"
21056        /// and 200 products with the color facet "Blue". A query containing the
21057        /// filter "colorFamilies:ANY("Red")" and having "colorFamilies" as
21058        /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21059        /// would by default return only "Red" products in the search results, and
21060        /// also return "Red" with count 100 as the only color facet. Although there
21061        /// are also blue products available, "Blue" would not be shown as an
21062        /// available facet value.
21063        ///
21064        /// If "colorFamilies" is listed in "excludedFilterKeys", then the query
21065        /// returns the facet values "Red" with count 100 and "Blue" with count
21066        /// 200, because the "colorFamilies" key is now excluded from the filter.
21067        /// Because this field doesn't affect search results, the search results
21068        /// are still correctly filtered to return only "Red" products.
21069        ///
21070        /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
21071        /// is returned.
21072        ///
21073        /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21074        pub excluded_filter_keys: std::vec::Vec<std::string::String>,
21075
21076        /// Enables dynamic position for this facet. If set to true, the position of
21077        /// this facet among all facets in the response is determined by Google
21078        /// Retail Search. It is ordered together with dynamic facets if dynamic
21079        /// facets is enabled. If set to false, the position of this facet in the
21080        /// response is the same as in the request, and it is ranked before
21081        /// the facets with dynamic position enable and all dynamic facets.
21082        ///
21083        /// For example, you may always want to have rating facet returned in
21084        /// the response, but it's not necessarily to always display the rating facet
21085        /// at the top. In that case, you can set enable_dynamic_position to true so
21086        /// that the position of rating facet in response is determined by
21087        /// Google Retail Search.
21088        ///
21089        /// Another example, assuming you have the following facets in the request:
21090        ///
21091        /// * "rating", enable_dynamic_position = true
21092        ///
21093        /// * "price", enable_dynamic_position = false
21094        ///
21095        /// * "brands", enable_dynamic_position = false
21096        ///
21097        ///
21098        /// And also you have a dynamic facets enable, which generates a facet
21099        /// "gender". Then, the final order of the facets in the response can be
21100        /// ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
21101        /// "rating") depends on how Google Retail Search orders "gender" and
21102        /// "rating" facets. However, notice that "price" and "brands" are always
21103        /// ranked at first and second position because their enable_dynamic_position
21104        /// values are false.
21105        pub enable_dynamic_position: bool,
21106
21107        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21108    }
21109
21110    impl FacetSpec {
21111        pub fn new() -> Self {
21112            std::default::Default::default()
21113        }
21114
21115        /// Sets the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21116        ///
21117        /// # Example
21118        /// ```ignore,no_run
21119        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21120        /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21121        /// let x = FacetSpec::new().set_facet_key(FacetKey::default()/* use setters */);
21122        /// ```
21123        pub fn set_facet_key<T>(mut self, v: T) -> Self
21124        where
21125            T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21126        {
21127            self.facet_key = std::option::Option::Some(v.into());
21128            self
21129        }
21130
21131        /// Sets or clears the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21132        ///
21133        /// # Example
21134        /// ```ignore,no_run
21135        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21136        /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21137        /// let x = FacetSpec::new().set_or_clear_facet_key(Some(FacetKey::default()/* use setters */));
21138        /// let x = FacetSpec::new().set_or_clear_facet_key(None::<FacetKey>);
21139        /// ```
21140        pub fn set_or_clear_facet_key<T>(mut self, v: std::option::Option<T>) -> Self
21141        where
21142            T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21143        {
21144            self.facet_key = v.map(|x| x.into());
21145            self
21146        }
21147
21148        /// Sets the value of [limit][crate::model::search_request::FacetSpec::limit].
21149        ///
21150        /// # Example
21151        /// ```ignore,no_run
21152        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21153        /// let x = FacetSpec::new().set_limit(42);
21154        /// ```
21155        pub fn set_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21156            self.limit = v.into();
21157            self
21158        }
21159
21160        /// Sets the value of [excluded_filter_keys][crate::model::search_request::FacetSpec::excluded_filter_keys].
21161        ///
21162        /// # Example
21163        /// ```ignore,no_run
21164        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21165        /// let x = FacetSpec::new().set_excluded_filter_keys(["a", "b", "c"]);
21166        /// ```
21167        pub fn set_excluded_filter_keys<T, V>(mut self, v: T) -> Self
21168        where
21169            T: std::iter::IntoIterator<Item = V>,
21170            V: std::convert::Into<std::string::String>,
21171        {
21172            use std::iter::Iterator;
21173            self.excluded_filter_keys = v.into_iter().map(|i| i.into()).collect();
21174            self
21175        }
21176
21177        /// Sets the value of [enable_dynamic_position][crate::model::search_request::FacetSpec::enable_dynamic_position].
21178        ///
21179        /// # Example
21180        /// ```ignore,no_run
21181        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21182        /// let x = FacetSpec::new().set_enable_dynamic_position(true);
21183        /// ```
21184        pub fn set_enable_dynamic_position<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21185            self.enable_dynamic_position = v.into();
21186            self
21187        }
21188    }
21189
21190    impl wkt::message::Message for FacetSpec {
21191        fn typename() -> &'static str {
21192            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec"
21193        }
21194    }
21195
21196    /// Defines additional types related to [FacetSpec].
21197    pub mod facet_spec {
21198        #[allow(unused_imports)]
21199        use super::*;
21200
21201        /// Specifies how a facet is computed.
21202        #[derive(Clone, Default, PartialEq)]
21203        #[non_exhaustive]
21204        pub struct FacetKey {
21205            /// Required. Supported textual and numerical facet keys in
21206            /// [Product][google.cloud.retail.v2.Product] object, over which the facet
21207            /// values are computed. Facet key is case-sensitive.
21208            ///
21209            /// Allowed facet keys when
21210            /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21211            /// is not specified:
21212            ///
21213            /// * textual_field =
21214            ///
21215            ///   * "brands"
21216            ///   * "categories"
21217            ///   * "genders"
21218            ///   * "ageGroups"
21219            ///   * "availability"
21220            ///   * "colorFamilies"
21221            ///   * "colors"
21222            ///   * "sizes"
21223            ///   * "materials"
21224            ///   * "patterns"
21225            ///   * "conditions"
21226            ///   * "attributes.key"
21227            ///   * "pickupInStore"
21228            ///   * "shipToStore"
21229            ///   * "sameDayDelivery"
21230            ///   * "nextDayDelivery"
21231            ///   * "customFulfillment1"
21232            ///   * "customFulfillment2"
21233            ///   * "customFulfillment3"
21234            ///   * "customFulfillment4"
21235            ///   * "customFulfillment5"
21236            ///   * "inventory(place_id,attributes.key)"
21237            /// * numerical_field =
21238            ///
21239            ///   * "price"
21240            ///   * "discount"
21241            ///   * "rating"
21242            ///   * "ratingCount"
21243            ///   * "attributes.key"
21244            ///   * "inventory(place_id,price)"
21245            ///   * "inventory(place_id,original_price)"
21246            ///   * "inventory(place_id,attributes.key)"
21247            ///
21248            /// [google.cloud.retail.v2.Product]: crate::model::Product
21249            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21250            pub key: std::string::String,
21251
21252            /// Set only if values should be bucketized into intervals. Must be set
21253            /// for facets with numerical values. Must not be set for facet with text
21254            /// values. Maximum number of intervals is 40.
21255            ///
21256            /// For all numerical facet keys that appear in the list of products from
21257            /// the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
21258            /// computed from their distribution weekly. If the model assigns a high
21259            /// score to a numerical facet key and its intervals are not specified in
21260            /// the search request, these percentiles become the bounds
21261            /// for its intervals and are returned in the response. If the
21262            /// facet key intervals are specified in the request, then the specified
21263            /// intervals are returned instead.
21264            pub intervals: std::vec::Vec<crate::model::Interval>,
21265
21266            /// Only get facet for the given restricted values. For example, when using
21267            /// "pickupInStore" as key and set restricted values to
21268            /// ["store123", "store456"], only facets for "store123" and "store456" are
21269            /// returned. Only supported on predefined textual fields, custom textual
21270            /// attributes and fulfillments. Maximum is 20.
21271            ///
21272            /// Must be set for the fulfillment facet keys:
21273            ///
21274            /// * pickupInStore
21275            ///
21276            /// * shipToStore
21277            ///
21278            /// * sameDayDelivery
21279            ///
21280            /// * nextDayDelivery
21281            ///
21282            /// * customFulfillment1
21283            ///
21284            /// * customFulfillment2
21285            ///
21286            /// * customFulfillment3
21287            ///
21288            /// * customFulfillment4
21289            ///
21290            /// * customFulfillment5
21291            ///
21292            pub restricted_values: std::vec::Vec<std::string::String>,
21293
21294            /// Only get facet values that start with the given string prefix. For
21295            /// example, suppose "categories" has three values "Women > Shoe",
21296            /// "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
21297            /// "categories" facet gives only "Women > Shoe" and "Women > Dress".
21298            /// Only supported on textual fields. Maximum is 10.
21299            pub prefixes: std::vec::Vec<std::string::String>,
21300
21301            /// Only get facet values that contains the given strings. For example,
21302            /// suppose "categories" has three values "Women > Shoe",
21303            /// "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
21304            /// "categories" facet gives only "Women > Shoe" and "Men > Shoe".
21305            /// Only supported on textual fields. Maximum is 10.
21306            pub contains: std::vec::Vec<std::string::String>,
21307
21308            /// True to make facet keys case insensitive when getting faceting
21309            /// values with prefixes or contains; false otherwise.
21310            pub case_insensitive: bool,
21311
21312            /// The order in which
21313            /// [SearchResponse.Facet.values][google.cloud.retail.v2.SearchResponse.Facet.values]
21314            /// are returned.
21315            ///
21316            /// Allowed values are:
21317            ///
21318            /// * "count desc", which means order by
21319            ///   [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21320            ///   descending.
21321            ///
21322            /// * "value desc", which means order by
21323            ///   [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21324            ///   descending.
21325            ///   Only applies to textual facets.
21326            ///
21327            ///
21328            /// If not set, textual values are sorted in [natural
21329            /// order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
21330            /// intervals are sorted in the order given by
21331            /// [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals];
21332            /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
21333            /// are sorted in the order given by
21334            /// [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values].
21335            ///
21336            /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
21337            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
21338            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]: crate::model::search_request::facet_spec::FacetKey::restricted_values
21339            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21340            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21341            /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
21342            pub order_by: std::string::String,
21343
21344            /// The query that is used to compute facet for the given facet key.
21345            /// When provided, it overrides the default behavior of facet
21346            /// computation. The query syntax is the same as a filter expression. See
21347            /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21348            /// detail syntax and limitations. Notice that there is no limitation on
21349            /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21350            /// when query is specified.
21351            ///
21352            /// In the response,
21353            /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21354            /// is always "1" and
21355            /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21356            /// is the number of results that match the query.
21357            ///
21358            /// For example, you can set a customized facet for "shipToStore",
21359            /// where
21360            /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21361            /// is "customizedShipToStore", and
21362            /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21363            /// is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
21364            /// Then the facet counts the products that are both in stock and ship
21365            /// to store "123".
21366            ///
21367            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21368            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21369            /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21370            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21371            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21372            pub query: std::string::String,
21373
21374            /// Returns the min and max value for each numerical facet intervals.
21375            /// Ignored for textual facets.
21376            pub return_min_max: bool,
21377
21378            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21379        }
21380
21381        impl FacetKey {
21382            pub fn new() -> Self {
21383                std::default::Default::default()
21384            }
21385
21386            /// Sets the value of [key][crate::model::search_request::facet_spec::FacetKey::key].
21387            ///
21388            /// # Example
21389            /// ```ignore,no_run
21390            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21391            /// let x = FacetKey::new().set_key("example");
21392            /// ```
21393            pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21394                self.key = v.into();
21395                self
21396            }
21397
21398            /// Sets the value of [intervals][crate::model::search_request::facet_spec::FacetKey::intervals].
21399            ///
21400            /// # Example
21401            /// ```ignore,no_run
21402            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21403            /// use google_cloud_retail_v2::model::Interval;
21404            /// let x = FacetKey::new()
21405            ///     .set_intervals([
21406            ///         Interval::default()/* use setters */,
21407            ///         Interval::default()/* use (different) setters */,
21408            ///     ]);
21409            /// ```
21410            pub fn set_intervals<T, V>(mut self, v: T) -> Self
21411            where
21412                T: std::iter::IntoIterator<Item = V>,
21413                V: std::convert::Into<crate::model::Interval>,
21414            {
21415                use std::iter::Iterator;
21416                self.intervals = v.into_iter().map(|i| i.into()).collect();
21417                self
21418            }
21419
21420            /// Sets the value of [restricted_values][crate::model::search_request::facet_spec::FacetKey::restricted_values].
21421            ///
21422            /// # Example
21423            /// ```ignore,no_run
21424            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21425            /// let x = FacetKey::new().set_restricted_values(["a", "b", "c"]);
21426            /// ```
21427            pub fn set_restricted_values<T, V>(mut self, v: T) -> Self
21428            where
21429                T: std::iter::IntoIterator<Item = V>,
21430                V: std::convert::Into<std::string::String>,
21431            {
21432                use std::iter::Iterator;
21433                self.restricted_values = v.into_iter().map(|i| i.into()).collect();
21434                self
21435            }
21436
21437            /// Sets the value of [prefixes][crate::model::search_request::facet_spec::FacetKey::prefixes].
21438            ///
21439            /// # Example
21440            /// ```ignore,no_run
21441            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21442            /// let x = FacetKey::new().set_prefixes(["a", "b", "c"]);
21443            /// ```
21444            pub fn set_prefixes<T, V>(mut self, v: T) -> Self
21445            where
21446                T: std::iter::IntoIterator<Item = V>,
21447                V: std::convert::Into<std::string::String>,
21448            {
21449                use std::iter::Iterator;
21450                self.prefixes = v.into_iter().map(|i| i.into()).collect();
21451                self
21452            }
21453
21454            /// Sets the value of [contains][crate::model::search_request::facet_spec::FacetKey::contains].
21455            ///
21456            /// # Example
21457            /// ```ignore,no_run
21458            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21459            /// let x = FacetKey::new().set_contains(["a", "b", "c"]);
21460            /// ```
21461            pub fn set_contains<T, V>(mut self, v: T) -> Self
21462            where
21463                T: std::iter::IntoIterator<Item = V>,
21464                V: std::convert::Into<std::string::String>,
21465            {
21466                use std::iter::Iterator;
21467                self.contains = v.into_iter().map(|i| i.into()).collect();
21468                self
21469            }
21470
21471            /// Sets the value of [case_insensitive][crate::model::search_request::facet_spec::FacetKey::case_insensitive].
21472            ///
21473            /// # Example
21474            /// ```ignore,no_run
21475            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21476            /// let x = FacetKey::new().set_case_insensitive(true);
21477            /// ```
21478            pub fn set_case_insensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21479                self.case_insensitive = v.into();
21480                self
21481            }
21482
21483            /// Sets the value of [order_by][crate::model::search_request::facet_spec::FacetKey::order_by].
21484            ///
21485            /// # Example
21486            /// ```ignore,no_run
21487            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21488            /// let x = FacetKey::new().set_order_by("example");
21489            /// ```
21490            pub fn set_order_by<T: std::convert::Into<std::string::String>>(
21491                mut self,
21492                v: T,
21493            ) -> Self {
21494                self.order_by = v.into();
21495                self
21496            }
21497
21498            /// Sets the value of [query][crate::model::search_request::facet_spec::FacetKey::query].
21499            ///
21500            /// # Example
21501            /// ```ignore,no_run
21502            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21503            /// let x = FacetKey::new().set_query("example");
21504            /// ```
21505            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21506                self.query = v.into();
21507                self
21508            }
21509
21510            /// Sets the value of [return_min_max][crate::model::search_request::facet_spec::FacetKey::return_min_max].
21511            ///
21512            /// # Example
21513            /// ```ignore,no_run
21514            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21515            /// let x = FacetKey::new().set_return_min_max(true);
21516            /// ```
21517            pub fn set_return_min_max<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21518                self.return_min_max = v.into();
21519                self
21520            }
21521        }
21522
21523        impl wkt::message::Message for FacetKey {
21524            fn typename() -> &'static str {
21525                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"
21526            }
21527        }
21528    }
21529
21530    /// The specifications of dynamically generated facets.
21531    #[derive(Clone, Default, PartialEq)]
21532    #[non_exhaustive]
21533    pub struct DynamicFacetSpec {
21534        /// Mode of the DynamicFacet feature.
21535        /// Defaults to
21536        /// [Mode.DISABLED][google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]
21537        /// if it's unset.
21538        ///
21539        /// [google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]: crate::model::search_request::dynamic_facet_spec::Mode::Disabled
21540        pub mode: crate::model::search_request::dynamic_facet_spec::Mode,
21541
21542        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21543    }
21544
21545    impl DynamicFacetSpec {
21546        pub fn new() -> Self {
21547            std::default::Default::default()
21548        }
21549
21550        /// Sets the value of [mode][crate::model::search_request::DynamicFacetSpec::mode].
21551        ///
21552        /// # Example
21553        /// ```ignore,no_run
21554        /// # use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
21555        /// use google_cloud_retail_v2::model::search_request::dynamic_facet_spec::Mode;
21556        /// let x0 = DynamicFacetSpec::new().set_mode(Mode::Disabled);
21557        /// let x1 = DynamicFacetSpec::new().set_mode(Mode::Enabled);
21558        /// ```
21559        pub fn set_mode<
21560            T: std::convert::Into<crate::model::search_request::dynamic_facet_spec::Mode>,
21561        >(
21562            mut self,
21563            v: T,
21564        ) -> Self {
21565            self.mode = v.into();
21566            self
21567        }
21568    }
21569
21570    impl wkt::message::Message for DynamicFacetSpec {
21571        fn typename() -> &'static str {
21572            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"
21573        }
21574    }
21575
21576    /// Defines additional types related to [DynamicFacetSpec].
21577    pub mod dynamic_facet_spec {
21578        #[allow(unused_imports)]
21579        use super::*;
21580
21581        /// Enum to control DynamicFacet mode
21582        ///
21583        /// # Working with unknown values
21584        ///
21585        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21586        /// additional enum variants at any time. Adding new variants is not considered
21587        /// a breaking change. Applications should write their code in anticipation of:
21588        ///
21589        /// - New values appearing in future releases of the client library, **and**
21590        /// - New values received dynamically, without application changes.
21591        ///
21592        /// Please consult the [Working with enums] section in the user guide for some
21593        /// guidelines.
21594        ///
21595        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21596        #[derive(Clone, Debug, PartialEq)]
21597        #[non_exhaustive]
21598        pub enum Mode {
21599            /// Default value.
21600            Unspecified,
21601            /// Disable Dynamic Facet.
21602            Disabled,
21603            /// Automatic mode built by Google Retail Search.
21604            Enabled,
21605            /// If set, the enum was initialized with an unknown value.
21606            ///
21607            /// Applications can examine the value using [Mode::value] or
21608            /// [Mode::name].
21609            UnknownValue(mode::UnknownValue),
21610        }
21611
21612        #[doc(hidden)]
21613        pub mod mode {
21614            #[allow(unused_imports)]
21615            use super::*;
21616            #[derive(Clone, Debug, PartialEq)]
21617            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21618        }
21619
21620        impl Mode {
21621            /// Gets the enum value.
21622            ///
21623            /// Returns `None` if the enum contains an unknown value deserialized from
21624            /// the string representation of enums.
21625            pub fn value(&self) -> std::option::Option<i32> {
21626                match self {
21627                    Self::Unspecified => std::option::Option::Some(0),
21628                    Self::Disabled => std::option::Option::Some(1),
21629                    Self::Enabled => std::option::Option::Some(2),
21630                    Self::UnknownValue(u) => u.0.value(),
21631                }
21632            }
21633
21634            /// Gets the enum value as a string.
21635            ///
21636            /// Returns `None` if the enum contains an unknown value deserialized from
21637            /// the integer representation of enums.
21638            pub fn name(&self) -> std::option::Option<&str> {
21639                match self {
21640                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
21641                    Self::Disabled => std::option::Option::Some("DISABLED"),
21642                    Self::Enabled => std::option::Option::Some("ENABLED"),
21643                    Self::UnknownValue(u) => u.0.name(),
21644                }
21645            }
21646        }
21647
21648        impl std::default::Default for Mode {
21649            fn default() -> Self {
21650                use std::convert::From;
21651                Self::from(0)
21652            }
21653        }
21654
21655        impl std::fmt::Display for Mode {
21656            fn fmt(
21657                &self,
21658                f: &mut std::fmt::Formatter<'_>,
21659            ) -> std::result::Result<(), std::fmt::Error> {
21660                wkt::internal::display_enum(f, self.name(), self.value())
21661            }
21662        }
21663
21664        impl std::convert::From<i32> for Mode {
21665            fn from(value: i32) -> Self {
21666                match value {
21667                    0 => Self::Unspecified,
21668                    1 => Self::Disabled,
21669                    2 => Self::Enabled,
21670                    _ => Self::UnknownValue(mode::UnknownValue(
21671                        wkt::internal::UnknownEnumValue::Integer(value),
21672                    )),
21673                }
21674            }
21675        }
21676
21677        impl std::convert::From<&str> for Mode {
21678            fn from(value: &str) -> Self {
21679                use std::string::ToString;
21680                match value {
21681                    "MODE_UNSPECIFIED" => Self::Unspecified,
21682                    "DISABLED" => Self::Disabled,
21683                    "ENABLED" => Self::Enabled,
21684                    _ => Self::UnknownValue(mode::UnknownValue(
21685                        wkt::internal::UnknownEnumValue::String(value.to_string()),
21686                    )),
21687                }
21688            }
21689        }
21690
21691        impl serde::ser::Serialize for Mode {
21692            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21693            where
21694                S: serde::Serializer,
21695            {
21696                match self {
21697                    Self::Unspecified => serializer.serialize_i32(0),
21698                    Self::Disabled => serializer.serialize_i32(1),
21699                    Self::Enabled => serializer.serialize_i32(2),
21700                    Self::UnknownValue(u) => u.0.serialize(serializer),
21701                }
21702            }
21703        }
21704
21705        impl<'de> serde::de::Deserialize<'de> for Mode {
21706            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
21707            where
21708                D: serde::Deserializer<'de>,
21709            {
21710                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
21711                    ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode",
21712                ))
21713            }
21714        }
21715    }
21716
21717    /// Boost specification to boost certain items.
21718    #[derive(Clone, Default, PartialEq)]
21719    #[non_exhaustive]
21720    pub struct BoostSpec {
21721        /// Condition boost specifications. If a product matches multiple conditions
21722        /// in the specifications, boost scores from these specifications are all
21723        /// applied and combined in a non-linear way. Maximum number of
21724        /// specifications is 20.
21725        pub condition_boost_specs:
21726            std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21727
21728        /// Whether to skip boostspec validation. If this field is set to true,
21729        /// invalid
21730        /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21731        /// will be ignored and valid
21732        /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
21733        /// will still be applied.
21734        ///
21735        /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
21736        pub skip_boost_spec_validation: std::option::Option<bool>,
21737
21738        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21739    }
21740
21741    impl BoostSpec {
21742        pub fn new() -> Self {
21743            std::default::Default::default()
21744        }
21745
21746        /// Sets the value of [condition_boost_specs][crate::model::search_request::BoostSpec::condition_boost_specs].
21747        ///
21748        /// # Example
21749        /// ```ignore,no_run
21750        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21751        /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21752        /// let x = BoostSpec::new()
21753        ///     .set_condition_boost_specs([
21754        ///         ConditionBoostSpec::default()/* use setters */,
21755        ///         ConditionBoostSpec::default()/* use (different) setters */,
21756        ///     ]);
21757        /// ```
21758        pub fn set_condition_boost_specs<T, V>(mut self, v: T) -> Self
21759        where
21760            T: std::iter::IntoIterator<Item = V>,
21761            V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
21762        {
21763            use std::iter::Iterator;
21764            self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
21765            self
21766        }
21767
21768        /// Sets the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21769        ///
21770        /// # Example
21771        /// ```ignore,no_run
21772        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21773        /// let x = BoostSpec::new().set_skip_boost_spec_validation(true);
21774        /// ```
21775        pub fn set_skip_boost_spec_validation<T>(mut self, v: T) -> Self
21776        where
21777            T: std::convert::Into<bool>,
21778        {
21779            self.skip_boost_spec_validation = std::option::Option::Some(v.into());
21780            self
21781        }
21782
21783        /// Sets or clears the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
21784        ///
21785        /// # Example
21786        /// ```ignore,no_run
21787        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
21788        /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(Some(false));
21789        /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(None::<bool>);
21790        /// ```
21791        pub fn set_or_clear_skip_boost_spec_validation<T>(
21792            mut self,
21793            v: std::option::Option<T>,
21794        ) -> Self
21795        where
21796            T: std::convert::Into<bool>,
21797        {
21798            self.skip_boost_spec_validation = v.map(|x| x.into());
21799            self
21800        }
21801    }
21802
21803    impl wkt::message::Message for BoostSpec {
21804        fn typename() -> &'static str {
21805            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec"
21806        }
21807    }
21808
21809    /// Defines additional types related to [BoostSpec].
21810    pub mod boost_spec {
21811        #[allow(unused_imports)]
21812        use super::*;
21813
21814        /// Boost applies to products which match a condition.
21815        #[derive(Clone, Default, PartialEq)]
21816        #[non_exhaustive]
21817        pub struct ConditionBoostSpec {
21818            /// An expression which specifies a boost condition. The syntax and
21819            /// supported fields are the same as a filter expression. See
21820            /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21821            /// detail syntax and limitations.
21822            ///
21823            /// Examples:
21824            ///
21825            /// * To boost products with product ID "product_1" or "product_2", and
21826            ///   color
21827            ///   "Red" or "Blue":
21828            ///   * (id: ANY("product_1", "product_2")) AND (colorFamilies:
21829            ///     ANY("Red","Blue"))
21830            ///
21831            /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21832            pub condition: std::string::String,
21833
21834            /// Strength of the condition boost, which should be in [-1, 1]. Negative
21835            /// boost means demotion. Default is 0.0.
21836            ///
21837            /// Setting to 1.0 gives the item a big promotion. However, it does not
21838            /// necessarily mean that the boosted item will be the top result at all
21839            /// times, nor that other items will be excluded. Results could still be
21840            /// shown even when none of them matches the condition. And results that
21841            /// are significantly more relevant to the search query can still trump
21842            /// your heavily favored but irrelevant items.
21843            ///
21844            /// Setting to -1.0 gives the item a big demotion. However, results that
21845            /// are deeply relevant might still be shown. The item will have an
21846            /// upstream battle to get a fairly high ranking, but it is not blocked out
21847            /// completely.
21848            ///
21849            /// Setting to 0.0 means no boost applied. The boosting condition is
21850            /// ignored.
21851            pub boost: f32,
21852
21853            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21854        }
21855
21856        impl ConditionBoostSpec {
21857            pub fn new() -> Self {
21858                std::default::Default::default()
21859            }
21860
21861            /// Sets the value of [condition][crate::model::search_request::boost_spec::ConditionBoostSpec::condition].
21862            ///
21863            /// # Example
21864            /// ```ignore,no_run
21865            /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21866            /// let x = ConditionBoostSpec::new().set_condition("example");
21867            /// ```
21868            pub fn set_condition<T: std::convert::Into<std::string::String>>(
21869                mut self,
21870                v: T,
21871            ) -> Self {
21872                self.condition = v.into();
21873                self
21874            }
21875
21876            /// Sets the value of [boost][crate::model::search_request::boost_spec::ConditionBoostSpec::boost].
21877            ///
21878            /// # Example
21879            /// ```ignore,no_run
21880            /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
21881            /// let x = ConditionBoostSpec::new().set_boost(42.0);
21882            /// ```
21883            pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
21884                self.boost = v.into();
21885                self
21886            }
21887        }
21888
21889        impl wkt::message::Message for ConditionBoostSpec {
21890            fn typename() -> &'static str {
21891                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"
21892            }
21893        }
21894    }
21895
21896    /// Specification to determine under which conditions query expansion should
21897    /// occur.
21898    #[derive(Clone, Default, PartialEq)]
21899    #[non_exhaustive]
21900    pub struct QueryExpansionSpec {
21901        /// The condition under which query expansion should occur. Default to
21902        /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
21903        ///
21904        /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
21905        pub condition: crate::model::search_request::query_expansion_spec::Condition,
21906
21907        /// Whether to pin unexpanded results. The default value is false. If this
21908        /// field is set to true,
21909        /// unexpanded products are always at the top of the search results, followed
21910        /// by the expanded results.
21911        pub pin_unexpanded_results: bool,
21912
21913        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21914    }
21915
21916    impl QueryExpansionSpec {
21917        pub fn new() -> Self {
21918            std::default::Default::default()
21919        }
21920
21921        /// Sets the value of [condition][crate::model::search_request::QueryExpansionSpec::condition].
21922        ///
21923        /// # Example
21924        /// ```ignore,no_run
21925        /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21926        /// use google_cloud_retail_v2::model::search_request::query_expansion_spec::Condition;
21927        /// let x0 = QueryExpansionSpec::new().set_condition(Condition::Disabled);
21928        /// let x1 = QueryExpansionSpec::new().set_condition(Condition::Auto);
21929        /// ```
21930        pub fn set_condition<
21931            T: std::convert::Into<crate::model::search_request::query_expansion_spec::Condition>,
21932        >(
21933            mut self,
21934            v: T,
21935        ) -> Self {
21936            self.condition = v.into();
21937            self
21938        }
21939
21940        /// Sets the value of [pin_unexpanded_results][crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results].
21941        ///
21942        /// # Example
21943        /// ```ignore,no_run
21944        /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21945        /// let x = QueryExpansionSpec::new().set_pin_unexpanded_results(true);
21946        /// ```
21947        pub fn set_pin_unexpanded_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21948            self.pin_unexpanded_results = v.into();
21949            self
21950        }
21951    }
21952
21953    impl wkt::message::Message for QueryExpansionSpec {
21954        fn typename() -> &'static str {
21955            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"
21956        }
21957    }
21958
21959    /// Defines additional types related to [QueryExpansionSpec].
21960    pub mod query_expansion_spec {
21961        #[allow(unused_imports)]
21962        use super::*;
21963
21964        /// Enum describing under which condition query expansion should occur.
21965        ///
21966        /// # Working with unknown values
21967        ///
21968        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21969        /// additional enum variants at any time. Adding new variants is not considered
21970        /// a breaking change. Applications should write their code in anticipation of:
21971        ///
21972        /// - New values appearing in future releases of the client library, **and**
21973        /// - New values received dynamically, without application changes.
21974        ///
21975        /// Please consult the [Working with enums] section in the user guide for some
21976        /// guidelines.
21977        ///
21978        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
21979        #[derive(Clone, Debug, PartialEq)]
21980        #[non_exhaustive]
21981        pub enum Condition {
21982            /// Unspecified query expansion condition. In this case, server behavior
21983            /// defaults to
21984            /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
21985            ///
21986            /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
21987            Unspecified,
21988            /// Disabled query expansion. Only the exact search query is used, even if
21989            /// [SearchResponse.total_size][google.cloud.retail.v2.SearchResponse.total_size]
21990            /// is zero.
21991            ///
21992            /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
21993            Disabled,
21994            /// Automatic query expansion built by Google Retail Search.
21995            Auto,
21996            /// If set, the enum was initialized with an unknown value.
21997            ///
21998            /// Applications can examine the value using [Condition::value] or
21999            /// [Condition::name].
22000            UnknownValue(condition::UnknownValue),
22001        }
22002
22003        #[doc(hidden)]
22004        pub mod condition {
22005            #[allow(unused_imports)]
22006            use super::*;
22007            #[derive(Clone, Debug, PartialEq)]
22008            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22009        }
22010
22011        impl Condition {
22012            /// Gets the enum value.
22013            ///
22014            /// Returns `None` if the enum contains an unknown value deserialized from
22015            /// the string representation of enums.
22016            pub fn value(&self) -> std::option::Option<i32> {
22017                match self {
22018                    Self::Unspecified => std::option::Option::Some(0),
22019                    Self::Disabled => std::option::Option::Some(1),
22020                    Self::Auto => std::option::Option::Some(3),
22021                    Self::UnknownValue(u) => u.0.value(),
22022                }
22023            }
22024
22025            /// Gets the enum value as a string.
22026            ///
22027            /// Returns `None` if the enum contains an unknown value deserialized from
22028            /// the integer representation of enums.
22029            pub fn name(&self) -> std::option::Option<&str> {
22030                match self {
22031                    Self::Unspecified => std::option::Option::Some("CONDITION_UNSPECIFIED"),
22032                    Self::Disabled => std::option::Option::Some("DISABLED"),
22033                    Self::Auto => std::option::Option::Some("AUTO"),
22034                    Self::UnknownValue(u) => u.0.name(),
22035                }
22036            }
22037        }
22038
22039        impl std::default::Default for Condition {
22040            fn default() -> Self {
22041                use std::convert::From;
22042                Self::from(0)
22043            }
22044        }
22045
22046        impl std::fmt::Display for Condition {
22047            fn fmt(
22048                &self,
22049                f: &mut std::fmt::Formatter<'_>,
22050            ) -> std::result::Result<(), std::fmt::Error> {
22051                wkt::internal::display_enum(f, self.name(), self.value())
22052            }
22053        }
22054
22055        impl std::convert::From<i32> for Condition {
22056            fn from(value: i32) -> Self {
22057                match value {
22058                    0 => Self::Unspecified,
22059                    1 => Self::Disabled,
22060                    3 => Self::Auto,
22061                    _ => Self::UnknownValue(condition::UnknownValue(
22062                        wkt::internal::UnknownEnumValue::Integer(value),
22063                    )),
22064                }
22065            }
22066        }
22067
22068        impl std::convert::From<&str> for Condition {
22069            fn from(value: &str) -> Self {
22070                use std::string::ToString;
22071                match value {
22072                    "CONDITION_UNSPECIFIED" => Self::Unspecified,
22073                    "DISABLED" => Self::Disabled,
22074                    "AUTO" => Self::Auto,
22075                    _ => Self::UnknownValue(condition::UnknownValue(
22076                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22077                    )),
22078                }
22079            }
22080        }
22081
22082        impl serde::ser::Serialize for Condition {
22083            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22084            where
22085                S: serde::Serializer,
22086            {
22087                match self {
22088                    Self::Unspecified => serializer.serialize_i32(0),
22089                    Self::Disabled => serializer.serialize_i32(1),
22090                    Self::Auto => serializer.serialize_i32(3),
22091                    Self::UnknownValue(u) => u.0.serialize(serializer),
22092                }
22093            }
22094        }
22095
22096        impl<'de> serde::de::Deserialize<'de> for Condition {
22097            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22098            where
22099                D: serde::Deserializer<'de>,
22100            {
22101                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Condition>::new(
22102                    ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition",
22103                ))
22104            }
22105        }
22106    }
22107
22108    /// The specification for personalization.
22109    #[derive(Clone, Default, PartialEq)]
22110    #[non_exhaustive]
22111    pub struct PersonalizationSpec {
22112        /// Defaults to
22113        /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22114        ///
22115        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22116        pub mode: crate::model::search_request::personalization_spec::Mode,
22117
22118        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22119    }
22120
22121    impl PersonalizationSpec {
22122        pub fn new() -> Self {
22123            std::default::Default::default()
22124        }
22125
22126        /// Sets the value of [mode][crate::model::search_request::PersonalizationSpec::mode].
22127        ///
22128        /// # Example
22129        /// ```ignore,no_run
22130        /// # use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
22131        /// use google_cloud_retail_v2::model::search_request::personalization_spec::Mode;
22132        /// let x0 = PersonalizationSpec::new().set_mode(Mode::Auto);
22133        /// let x1 = PersonalizationSpec::new().set_mode(Mode::Disabled);
22134        /// ```
22135        pub fn set_mode<
22136            T: std::convert::Into<crate::model::search_request::personalization_spec::Mode>,
22137        >(
22138            mut self,
22139            v: T,
22140        ) -> Self {
22141            self.mode = v.into();
22142            self
22143        }
22144    }
22145
22146    impl wkt::message::Message for PersonalizationSpec {
22147        fn typename() -> &'static str {
22148            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"
22149        }
22150    }
22151
22152    /// Defines additional types related to [PersonalizationSpec].
22153    pub mod personalization_spec {
22154        #[allow(unused_imports)]
22155        use super::*;
22156
22157        /// The personalization mode of each search request.
22158        ///
22159        /// # Working with unknown values
22160        ///
22161        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22162        /// additional enum variants at any time. Adding new variants is not considered
22163        /// a breaking change. Applications should write their code in anticipation of:
22164        ///
22165        /// - New values appearing in future releases of the client library, **and**
22166        /// - New values received dynamically, without application changes.
22167        ///
22168        /// Please consult the [Working with enums] section in the user guide for some
22169        /// guidelines.
22170        ///
22171        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22172        #[derive(Clone, Debug, PartialEq)]
22173        #[non_exhaustive]
22174        pub enum Mode {
22175            /// Default value. In this case, server behavior defaults to
22176            /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22177            ///
22178            /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22179            Unspecified,
22180            /// Let CRS decide whether to use personalization based on quality of user
22181            /// event data.
22182            Auto,
22183            /// Disable personalization.
22184            Disabled,
22185            /// If set, the enum was initialized with an unknown value.
22186            ///
22187            /// Applications can examine the value using [Mode::value] or
22188            /// [Mode::name].
22189            UnknownValue(mode::UnknownValue),
22190        }
22191
22192        #[doc(hidden)]
22193        pub mod mode {
22194            #[allow(unused_imports)]
22195            use super::*;
22196            #[derive(Clone, Debug, PartialEq)]
22197            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22198        }
22199
22200        impl Mode {
22201            /// Gets the enum value.
22202            ///
22203            /// Returns `None` if the enum contains an unknown value deserialized from
22204            /// the string representation of enums.
22205            pub fn value(&self) -> std::option::Option<i32> {
22206                match self {
22207                    Self::Unspecified => std::option::Option::Some(0),
22208                    Self::Auto => std::option::Option::Some(1),
22209                    Self::Disabled => std::option::Option::Some(2),
22210                    Self::UnknownValue(u) => u.0.value(),
22211                }
22212            }
22213
22214            /// Gets the enum value as a string.
22215            ///
22216            /// Returns `None` if the enum contains an unknown value deserialized from
22217            /// the integer representation of enums.
22218            pub fn name(&self) -> std::option::Option<&str> {
22219                match self {
22220                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22221                    Self::Auto => std::option::Option::Some("AUTO"),
22222                    Self::Disabled => std::option::Option::Some("DISABLED"),
22223                    Self::UnknownValue(u) => u.0.name(),
22224                }
22225            }
22226        }
22227
22228        impl std::default::Default for Mode {
22229            fn default() -> Self {
22230                use std::convert::From;
22231                Self::from(0)
22232            }
22233        }
22234
22235        impl std::fmt::Display for Mode {
22236            fn fmt(
22237                &self,
22238                f: &mut std::fmt::Formatter<'_>,
22239            ) -> std::result::Result<(), std::fmt::Error> {
22240                wkt::internal::display_enum(f, self.name(), self.value())
22241            }
22242        }
22243
22244        impl std::convert::From<i32> for Mode {
22245            fn from(value: i32) -> Self {
22246                match value {
22247                    0 => Self::Unspecified,
22248                    1 => Self::Auto,
22249                    2 => Self::Disabled,
22250                    _ => Self::UnknownValue(mode::UnknownValue(
22251                        wkt::internal::UnknownEnumValue::Integer(value),
22252                    )),
22253                }
22254            }
22255        }
22256
22257        impl std::convert::From<&str> for Mode {
22258            fn from(value: &str) -> Self {
22259                use std::string::ToString;
22260                match value {
22261                    "MODE_UNSPECIFIED" => Self::Unspecified,
22262                    "AUTO" => Self::Auto,
22263                    "DISABLED" => Self::Disabled,
22264                    _ => Self::UnknownValue(mode::UnknownValue(
22265                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22266                    )),
22267                }
22268            }
22269        }
22270
22271        impl serde::ser::Serialize for Mode {
22272            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22273            where
22274                S: serde::Serializer,
22275            {
22276                match self {
22277                    Self::Unspecified => serializer.serialize_i32(0),
22278                    Self::Auto => serializer.serialize_i32(1),
22279                    Self::Disabled => serializer.serialize_i32(2),
22280                    Self::UnknownValue(u) => u.0.serialize(serializer),
22281                }
22282            }
22283        }
22284
22285        impl<'de> serde::de::Deserialize<'de> for Mode {
22286            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22287            where
22288                D: serde::Deserializer<'de>,
22289            {
22290                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22291                    ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode",
22292                ))
22293            }
22294        }
22295    }
22296
22297    /// The specification for query spell correction.
22298    #[derive(Clone, Default, PartialEq)]
22299    #[non_exhaustive]
22300    pub struct SpellCorrectionSpec {
22301        /// The mode under which spell correction should take effect to
22302        /// replace the original search query. Default to
22303        /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22304        ///
22305        /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22306        pub mode: crate::model::search_request::spell_correction_spec::Mode,
22307
22308        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22309    }
22310
22311    impl SpellCorrectionSpec {
22312        pub fn new() -> Self {
22313            std::default::Default::default()
22314        }
22315
22316        /// Sets the value of [mode][crate::model::search_request::SpellCorrectionSpec::mode].
22317        ///
22318        /// # Example
22319        /// ```ignore,no_run
22320        /// # use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
22321        /// use google_cloud_retail_v2::model::search_request::spell_correction_spec::Mode;
22322        /// let x0 = SpellCorrectionSpec::new().set_mode(Mode::SuggestionOnly);
22323        /// let x1 = SpellCorrectionSpec::new().set_mode(Mode::Auto);
22324        /// ```
22325        pub fn set_mode<
22326            T: std::convert::Into<crate::model::search_request::spell_correction_spec::Mode>,
22327        >(
22328            mut self,
22329            v: T,
22330        ) -> Self {
22331            self.mode = v.into();
22332            self
22333        }
22334    }
22335
22336    impl wkt::message::Message for SpellCorrectionSpec {
22337        fn typename() -> &'static str {
22338            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"
22339        }
22340    }
22341
22342    /// Defines additional types related to [SpellCorrectionSpec].
22343    pub mod spell_correction_spec {
22344        #[allow(unused_imports)]
22345        use super::*;
22346
22347        /// Enum describing under which mode spell correction should occur.
22348        ///
22349        /// # Working with unknown values
22350        ///
22351        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22352        /// additional enum variants at any time. Adding new variants is not considered
22353        /// a breaking change. Applications should write their code in anticipation of:
22354        ///
22355        /// - New values appearing in future releases of the client library, **and**
22356        /// - New values received dynamically, without application changes.
22357        ///
22358        /// Please consult the [Working with enums] section in the user guide for some
22359        /// guidelines.
22360        ///
22361        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22362        #[derive(Clone, Debug, PartialEq)]
22363        #[non_exhaustive]
22364        pub enum Mode {
22365            /// Unspecified spell correction mode. In this case, server behavior
22366            /// defaults to
22367            /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22368            ///
22369            /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22370            Unspecified,
22371            /// Google Retail Search will try to find a spell suggestion if there
22372            /// is any and put in the
22373            /// [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query].
22374            /// The spell suggestion will not be used as the search query.
22375            ///
22376            /// [google.cloud.retail.v2.SearchResponse.corrected_query]: crate::model::SearchResponse::corrected_query
22377            SuggestionOnly,
22378            /// Automatic spell correction built by Google Retail Search. Search will
22379            /// be based on the corrected query if found.
22380            Auto,
22381            /// If set, the enum was initialized with an unknown value.
22382            ///
22383            /// Applications can examine the value using [Mode::value] or
22384            /// [Mode::name].
22385            UnknownValue(mode::UnknownValue),
22386        }
22387
22388        #[doc(hidden)]
22389        pub mod mode {
22390            #[allow(unused_imports)]
22391            use super::*;
22392            #[derive(Clone, Debug, PartialEq)]
22393            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22394        }
22395
22396        impl Mode {
22397            /// Gets the enum value.
22398            ///
22399            /// Returns `None` if the enum contains an unknown value deserialized from
22400            /// the string representation of enums.
22401            pub fn value(&self) -> std::option::Option<i32> {
22402                match self {
22403                    Self::Unspecified => std::option::Option::Some(0),
22404                    Self::SuggestionOnly => std::option::Option::Some(1),
22405                    Self::Auto => std::option::Option::Some(2),
22406                    Self::UnknownValue(u) => u.0.value(),
22407                }
22408            }
22409
22410            /// Gets the enum value as a string.
22411            ///
22412            /// Returns `None` if the enum contains an unknown value deserialized from
22413            /// the integer representation of enums.
22414            pub fn name(&self) -> std::option::Option<&str> {
22415                match self {
22416                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22417                    Self::SuggestionOnly => std::option::Option::Some("SUGGESTION_ONLY"),
22418                    Self::Auto => std::option::Option::Some("AUTO"),
22419                    Self::UnknownValue(u) => u.0.name(),
22420                }
22421            }
22422        }
22423
22424        impl std::default::Default for Mode {
22425            fn default() -> Self {
22426                use std::convert::From;
22427                Self::from(0)
22428            }
22429        }
22430
22431        impl std::fmt::Display for Mode {
22432            fn fmt(
22433                &self,
22434                f: &mut std::fmt::Formatter<'_>,
22435            ) -> std::result::Result<(), std::fmt::Error> {
22436                wkt::internal::display_enum(f, self.name(), self.value())
22437            }
22438        }
22439
22440        impl std::convert::From<i32> for Mode {
22441            fn from(value: i32) -> Self {
22442                match value {
22443                    0 => Self::Unspecified,
22444                    1 => Self::SuggestionOnly,
22445                    2 => Self::Auto,
22446                    _ => Self::UnknownValue(mode::UnknownValue(
22447                        wkt::internal::UnknownEnumValue::Integer(value),
22448                    )),
22449                }
22450            }
22451        }
22452
22453        impl std::convert::From<&str> for Mode {
22454            fn from(value: &str) -> Self {
22455                use std::string::ToString;
22456                match value {
22457                    "MODE_UNSPECIFIED" => Self::Unspecified,
22458                    "SUGGESTION_ONLY" => Self::SuggestionOnly,
22459                    "AUTO" => Self::Auto,
22460                    _ => Self::UnknownValue(mode::UnknownValue(
22461                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22462                    )),
22463                }
22464            }
22465        }
22466
22467        impl serde::ser::Serialize for Mode {
22468            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22469            where
22470                S: serde::Serializer,
22471            {
22472                match self {
22473                    Self::Unspecified => serializer.serialize_i32(0),
22474                    Self::SuggestionOnly => serializer.serialize_i32(1),
22475                    Self::Auto => serializer.serialize_i32(2),
22476                    Self::UnknownValue(u) => u.0.serialize(serializer),
22477                }
22478            }
22479        }
22480
22481        impl<'de> serde::de::Deserialize<'de> for Mode {
22482            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22483            where
22484                D: serde::Deserializer<'de>,
22485            {
22486                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22487                    ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode",
22488                ))
22489            }
22490        }
22491    }
22492
22493    /// This field specifies all conversational related parameters addition to
22494    /// traditional retail search.
22495    #[derive(Clone, Default, PartialEq)]
22496    #[non_exhaustive]
22497    pub struct ConversationalSearchSpec {
22498        /// This field specifies whether the customer would like to do conversational
22499        /// search. If this field is set to true, conversational related extra
22500        /// information will be returned from server side, including follow-up
22501        /// question, answer options, etc.
22502        pub followup_conversation_requested: bool,
22503
22504        /// This field specifies the conversation id, which maintains the state of
22505        /// the conversation between client side and server side. Use the value from
22506        /// the previous [ConversationalSearchResult.conversation_id][]. For the
22507        /// initial request, this should be empty.
22508        pub conversation_id: std::string::String,
22509
22510        /// This field specifies the current user answer during the conversational
22511        /// search. This can be either user selected from suggested answers or user
22512        /// input plain text.
22513        pub user_answer: std::option::Option<
22514            crate::model::search_request::conversational_search_spec::UserAnswer,
22515        >,
22516
22517        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22518    }
22519
22520    impl ConversationalSearchSpec {
22521        pub fn new() -> Self {
22522            std::default::Default::default()
22523        }
22524
22525        /// Sets the value of [followup_conversation_requested][crate::model::search_request::ConversationalSearchSpec::followup_conversation_requested].
22526        ///
22527        /// # Example
22528        /// ```ignore,no_run
22529        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22530        /// let x = ConversationalSearchSpec::new().set_followup_conversation_requested(true);
22531        /// ```
22532        pub fn set_followup_conversation_requested<T: std::convert::Into<bool>>(
22533            mut self,
22534            v: T,
22535        ) -> Self {
22536            self.followup_conversation_requested = v.into();
22537            self
22538        }
22539
22540        /// Sets the value of [conversation_id][crate::model::search_request::ConversationalSearchSpec::conversation_id].
22541        ///
22542        /// # Example
22543        /// ```ignore,no_run
22544        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22545        /// let x = ConversationalSearchSpec::new().set_conversation_id("example");
22546        /// ```
22547        pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
22548            mut self,
22549            v: T,
22550        ) -> Self {
22551            self.conversation_id = v.into();
22552            self
22553        }
22554
22555        /// Sets the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22556        ///
22557        /// # Example
22558        /// ```ignore,no_run
22559        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22560        /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22561        /// let x = ConversationalSearchSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
22562        /// ```
22563        pub fn set_user_answer<T>(mut self, v: T) -> Self
22564        where
22565            T: std::convert::Into<
22566                    crate::model::search_request::conversational_search_spec::UserAnswer,
22567                >,
22568        {
22569            self.user_answer = std::option::Option::Some(v.into());
22570            self
22571        }
22572
22573        /// Sets or clears the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22574        ///
22575        /// # Example
22576        /// ```ignore,no_run
22577        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22578        /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22579        /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
22580        /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
22581        /// ```
22582        pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
22583        where
22584            T: std::convert::Into<
22585                    crate::model::search_request::conversational_search_spec::UserAnswer,
22586                >,
22587        {
22588            self.user_answer = v.map(|x| x.into());
22589            self
22590        }
22591    }
22592
22593    impl wkt::message::Message for ConversationalSearchSpec {
22594        fn typename() -> &'static str {
22595            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec"
22596        }
22597    }
22598
22599    /// Defines additional types related to [ConversationalSearchSpec].
22600    pub mod conversational_search_spec {
22601        #[allow(unused_imports)]
22602        use super::*;
22603
22604        /// This field specifies the current user answer during the conversational
22605        /// search. This can be either user selected from suggested answers or user
22606        /// input plain text.
22607        #[derive(Clone, Default, PartialEq)]
22608        #[non_exhaustive]
22609        pub struct UserAnswer {
22610            /// This field specifies the type of user answer.
22611            pub r#type: std::option::Option<
22612                crate::model::search_request::conversational_search_spec::user_answer::Type,
22613            >,
22614
22615            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22616        }
22617
22618        impl UserAnswer {
22619            pub fn new() -> Self {
22620                std::default::Default::default()
22621            }
22622
22623            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::type].
22624            ///
22625            /// Note that all the setters affecting `r#type` are mutually
22626            /// exclusive.
22627            ///
22628            /// # Example
22629            /// ```ignore,no_run
22630            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22631            /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::Type;
22632            /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
22633            /// ```
22634            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
22635            {
22636                self.r#type = v.into();
22637                self
22638            }
22639
22640            /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22641            /// if it holds a `TextAnswer`, `None` if the field is not set or
22642            /// holds a different branch.
22643            pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
22644                #[allow(unreachable_patterns)]
22645                self.r#type.as_ref().and_then(|v| match v {
22646                    crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(v) => std::option::Option::Some(v),
22647                    _ => std::option::Option::None,
22648                })
22649            }
22650
22651            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22652            /// to hold a `TextAnswer`.
22653            ///
22654            /// Note that all the setters affecting `r#type` are
22655            /// mutually exclusive.
22656            ///
22657            /// # Example
22658            /// ```ignore,no_run
22659            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22660            /// let x = UserAnswer::new().set_text_answer("example");
22661            /// assert!(x.text_answer().is_some());
22662            /// assert!(x.selected_answer().is_none());
22663            /// ```
22664            pub fn set_text_answer<T: std::convert::Into<std::string::String>>(
22665                mut self,
22666                v: T,
22667            ) -> Self {
22668                self.r#type = std::option::Option::Some(
22669                    crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(
22670                        v.into()
22671                    )
22672                );
22673                self
22674            }
22675
22676            /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22677            /// if it holds a `SelectedAnswer`, `None` if the field is not set or
22678            /// holds a different branch.
22679            pub fn selected_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>{
22680                #[allow(unreachable_patterns)]
22681                self.r#type.as_ref().and_then(|v| match v {
22682                    crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(v) => std::option::Option::Some(v),
22683                    _ => std::option::Option::None,
22684                })
22685            }
22686
22687            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22688            /// to hold a `SelectedAnswer`.
22689            ///
22690            /// Note that all the setters affecting `r#type` are
22691            /// mutually exclusive.
22692            ///
22693            /// # Example
22694            /// ```ignore,no_run
22695            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22696            /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22697            /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
22698            /// assert!(x.selected_answer().is_some());
22699            /// assert!(x.text_answer().is_none());
22700            /// ```
22701            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{
22702                self.r#type = std::option::Option::Some(
22703                    crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(
22704                        v.into()
22705                    )
22706                );
22707                self
22708            }
22709        }
22710
22711        impl wkt::message::Message for UserAnswer {
22712            fn typename() -> &'static str {
22713                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer"
22714            }
22715        }
22716
22717        /// Defines additional types related to [UserAnswer].
22718        pub mod user_answer {
22719            #[allow(unused_imports)]
22720            use super::*;
22721
22722            /// This field specifies the selected answers during the conversational
22723            /// search.
22724            #[derive(Clone, Default, PartialEq)]
22725            #[non_exhaustive]
22726            pub struct SelectedAnswer {
22727                /// This field is deprecated and should not be set.
22728                #[deprecated]
22729                pub product_attribute_values: std::vec::Vec<crate::model::ProductAttributeValue>,
22730
22731                /// This field specifies the selected answer which is a attribute
22732                /// key-value.
22733                pub product_attribute_value:
22734                    std::option::Option<crate::model::ProductAttributeValue>,
22735
22736                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22737            }
22738
22739            impl SelectedAnswer {
22740                pub fn new() -> Self {
22741                    std::default::Default::default()
22742                }
22743
22744                /// Sets the value of [product_attribute_values][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_values].
22745                ///
22746                /// # Example
22747                /// ```ignore,no_run
22748                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22749                /// use google_cloud_retail_v2::model::ProductAttributeValue;
22750                /// let x = SelectedAnswer::new()
22751                ///     .set_product_attribute_values([
22752                ///         ProductAttributeValue::default()/* use setters */,
22753                ///         ProductAttributeValue::default()/* use (different) setters */,
22754                ///     ]);
22755                /// ```
22756                #[deprecated]
22757                pub fn set_product_attribute_values<T, V>(mut self, v: T) -> Self
22758                where
22759                    T: std::iter::IntoIterator<Item = V>,
22760                    V: std::convert::Into<crate::model::ProductAttributeValue>,
22761                {
22762                    use std::iter::Iterator;
22763                    self.product_attribute_values = v.into_iter().map(|i| i.into()).collect();
22764                    self
22765                }
22766
22767                /// Sets the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22768                ///
22769                /// # Example
22770                /// ```ignore,no_run
22771                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22772                /// use google_cloud_retail_v2::model::ProductAttributeValue;
22773                /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
22774                /// ```
22775                pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
22776                where
22777                    T: std::convert::Into<crate::model::ProductAttributeValue>,
22778                {
22779                    self.product_attribute_value = std::option::Option::Some(v.into());
22780                    self
22781                }
22782
22783                /// Sets or clears the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
22784                ///
22785                /// # Example
22786                /// ```ignore,no_run
22787                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
22788                /// use google_cloud_retail_v2::model::ProductAttributeValue;
22789                /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
22790                /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
22791                /// ```
22792                pub fn set_or_clear_product_attribute_value<T>(
22793                    mut self,
22794                    v: std::option::Option<T>,
22795                ) -> Self
22796                where
22797                    T: std::convert::Into<crate::model::ProductAttributeValue>,
22798                {
22799                    self.product_attribute_value = v.map(|x| x.into());
22800                    self
22801                }
22802            }
22803
22804            impl wkt::message::Message for SelectedAnswer {
22805                fn typename() -> &'static str {
22806                    "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer"
22807                }
22808            }
22809
22810            /// This field specifies the type of user answer.
22811            #[derive(Clone, Debug, PartialEq)]
22812            #[non_exhaustive]
22813            pub enum Type {
22814                /// This field specifies the incremental input text from the user during
22815                /// the conversational search.
22816                TextAnswer(std::string::String),
22817                /// This field specifies the selected attributes during the
22818                /// conversational search. This should be a subset of
22819                /// [ConversationalSearchResult.suggested_answers][].
22820                SelectedAnswer(std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>),
22821            }
22822        }
22823    }
22824
22825    /// This field specifies tile navigation related parameters.
22826    #[derive(Clone, Default, PartialEq)]
22827    #[non_exhaustive]
22828    pub struct TileNavigationSpec {
22829        /// This field specifies whether the customer would like to request tile
22830        /// navigation.
22831        pub tile_navigation_requested: bool,
22832
22833        /// This optional field specifies the tiles which are already clicked in
22834        /// client side. While the feature works without this field set, particularly
22835        /// for an initial query, it is highly recommended to set this field because
22836        /// it can improve the quality of the search response and removes possible
22837        /// duplicate tiles.
22838        ///
22839        /// NOTE: This field is not being used for filtering search
22840        /// products. Client side should also put all the applied tiles in
22841        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
22842        ///
22843        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
22844        pub applied_tiles: std::vec::Vec<crate::model::Tile>,
22845
22846        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22847    }
22848
22849    impl TileNavigationSpec {
22850        pub fn new() -> Self {
22851            std::default::Default::default()
22852        }
22853
22854        /// Sets the value of [tile_navigation_requested][crate::model::search_request::TileNavigationSpec::tile_navigation_requested].
22855        ///
22856        /// # Example
22857        /// ```ignore,no_run
22858        /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
22859        /// let x = TileNavigationSpec::new().set_tile_navigation_requested(true);
22860        /// ```
22861        pub fn set_tile_navigation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22862            self.tile_navigation_requested = v.into();
22863            self
22864        }
22865
22866        /// Sets the value of [applied_tiles][crate::model::search_request::TileNavigationSpec::applied_tiles].
22867        ///
22868        /// # Example
22869        /// ```ignore,no_run
22870        /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
22871        /// use google_cloud_retail_v2::model::Tile;
22872        /// let x = TileNavigationSpec::new()
22873        ///     .set_applied_tiles([
22874        ///         Tile::default()/* use setters */,
22875        ///         Tile::default()/* use (different) setters */,
22876        ///     ]);
22877        /// ```
22878        pub fn set_applied_tiles<T, V>(mut self, v: T) -> Self
22879        where
22880            T: std::iter::IntoIterator<Item = V>,
22881            V: std::convert::Into<crate::model::Tile>,
22882        {
22883            use std::iter::Iterator;
22884            self.applied_tiles = v.into_iter().map(|i| i.into()).collect();
22885            self
22886        }
22887    }
22888
22889    impl wkt::message::Message for TileNavigationSpec {
22890        fn typename() -> &'static str {
22891            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.TileNavigationSpec"
22892        }
22893    }
22894
22895    /// The search mode of each search request.
22896    ///
22897    /// # Working with unknown values
22898    ///
22899    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22900    /// additional enum variants at any time. Adding new variants is not considered
22901    /// a breaking change. Applications should write their code in anticipation of:
22902    ///
22903    /// - New values appearing in future releases of the client library, **and**
22904    /// - New values received dynamically, without application changes.
22905    ///
22906    /// Please consult the [Working with enums] section in the user guide for some
22907    /// guidelines.
22908    ///
22909    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
22910    #[derive(Clone, Debug, PartialEq)]
22911    #[non_exhaustive]
22912    pub enum SearchMode {
22913        /// Default value. In this case both product search and faceted search will
22914        /// be performed. Both
22915        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22916        /// and [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet]
22917        /// will be returned.
22918        ///
22919        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22920        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22921        Unspecified,
22922        /// Only product search will be performed. The faceted search will be
22923        /// disabled.
22924        ///
22925        /// Only
22926        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22927        /// will be returned.
22928        /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
22929        /// not be returned, even if
22930        /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
22931        /// or
22932        /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
22933        /// is set.
22934        ///
22935        /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
22936        /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
22937        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22938        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22939        ProductSearchOnly,
22940        /// Only faceted search will be performed. The product search will be
22941        /// disabled.
22942        ///
22943        /// When in this mode, one or both of
22944        /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
22945        /// and
22946        /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
22947        /// should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
22948        /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
22949        /// be returned.
22950        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
22951        /// will not be returned.
22952        ///
22953        /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
22954        /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
22955        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
22956        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
22957        FacetedSearchOnly,
22958        /// If set, the enum was initialized with an unknown value.
22959        ///
22960        /// Applications can examine the value using [SearchMode::value] or
22961        /// [SearchMode::name].
22962        UnknownValue(search_mode::UnknownValue),
22963    }
22964
22965    #[doc(hidden)]
22966    pub mod search_mode {
22967        #[allow(unused_imports)]
22968        use super::*;
22969        #[derive(Clone, Debug, PartialEq)]
22970        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22971    }
22972
22973    impl SearchMode {
22974        /// Gets the enum value.
22975        ///
22976        /// Returns `None` if the enum contains an unknown value deserialized from
22977        /// the string representation of enums.
22978        pub fn value(&self) -> std::option::Option<i32> {
22979            match self {
22980                Self::Unspecified => std::option::Option::Some(0),
22981                Self::ProductSearchOnly => std::option::Option::Some(1),
22982                Self::FacetedSearchOnly => std::option::Option::Some(2),
22983                Self::UnknownValue(u) => u.0.value(),
22984            }
22985        }
22986
22987        /// Gets the enum value as a string.
22988        ///
22989        /// Returns `None` if the enum contains an unknown value deserialized from
22990        /// the integer representation of enums.
22991        pub fn name(&self) -> std::option::Option<&str> {
22992            match self {
22993                Self::Unspecified => std::option::Option::Some("SEARCH_MODE_UNSPECIFIED"),
22994                Self::ProductSearchOnly => std::option::Option::Some("PRODUCT_SEARCH_ONLY"),
22995                Self::FacetedSearchOnly => std::option::Option::Some("FACETED_SEARCH_ONLY"),
22996                Self::UnknownValue(u) => u.0.name(),
22997            }
22998        }
22999    }
23000
23001    impl std::default::Default for SearchMode {
23002        fn default() -> Self {
23003            use std::convert::From;
23004            Self::from(0)
23005        }
23006    }
23007
23008    impl std::fmt::Display for SearchMode {
23009        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23010            wkt::internal::display_enum(f, self.name(), self.value())
23011        }
23012    }
23013
23014    impl std::convert::From<i32> for SearchMode {
23015        fn from(value: i32) -> Self {
23016            match value {
23017                0 => Self::Unspecified,
23018                1 => Self::ProductSearchOnly,
23019                2 => Self::FacetedSearchOnly,
23020                _ => Self::UnknownValue(search_mode::UnknownValue(
23021                    wkt::internal::UnknownEnumValue::Integer(value),
23022                )),
23023            }
23024        }
23025    }
23026
23027    impl std::convert::From<&str> for SearchMode {
23028        fn from(value: &str) -> Self {
23029            use std::string::ToString;
23030            match value {
23031                "SEARCH_MODE_UNSPECIFIED" => Self::Unspecified,
23032                "PRODUCT_SEARCH_ONLY" => Self::ProductSearchOnly,
23033                "FACETED_SEARCH_ONLY" => Self::FacetedSearchOnly,
23034                _ => Self::UnknownValue(search_mode::UnknownValue(
23035                    wkt::internal::UnknownEnumValue::String(value.to_string()),
23036                )),
23037            }
23038        }
23039    }
23040
23041    impl serde::ser::Serialize for SearchMode {
23042        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23043        where
23044            S: serde::Serializer,
23045        {
23046            match self {
23047                Self::Unspecified => serializer.serialize_i32(0),
23048                Self::ProductSearchOnly => serializer.serialize_i32(1),
23049                Self::FacetedSearchOnly => serializer.serialize_i32(2),
23050                Self::UnknownValue(u) => u.0.serialize(serializer),
23051            }
23052        }
23053    }
23054
23055    impl<'de> serde::de::Deserialize<'de> for SearchMode {
23056        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23057        where
23058            D: serde::Deserializer<'de>,
23059        {
23060            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMode>::new(
23061                ".google.cloud.retail.v2.SearchRequest.SearchMode",
23062            ))
23063        }
23064    }
23065}
23066
23067/// Response message for
23068/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
23069///
23070/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
23071#[derive(Clone, Default, PartialEq)]
23072#[non_exhaustive]
23073pub struct SearchResponse {
23074    /// A list of matched items. The order represents the ranking.
23075    pub results: std::vec::Vec<crate::model::search_response::SearchResult>,
23076
23077    /// Results of facets requested by user.
23078    pub facets: std::vec::Vec<crate::model::search_response::Facet>,
23079
23080    /// The estimated total count of matched items irrespective of pagination. The
23081    /// count of [results][google.cloud.retail.v2.SearchResponse.results] returned
23082    /// by pagination may be less than the
23083    /// [total_size][google.cloud.retail.v2.SearchResponse.total_size] that
23084    /// matches.
23085    ///
23086    /// [google.cloud.retail.v2.SearchResponse.results]: crate::model::SearchResponse::results
23087    /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
23088    pub total_size: i32,
23089
23090    /// Contains the spell corrected query, if found. If the spell correction type
23091    /// is AUTOMATIC, then the search results are based on corrected_query.
23092    /// Otherwise the original query is used for search.
23093    pub corrected_query: std::string::String,
23094
23095    /// A unique search token. This should be included in the
23096    /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
23097    /// search, which enables accurate attribution of search model performance.
23098    ///
23099    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23100    pub attribution_token: std::string::String,
23101
23102    /// A token that can be sent as
23103    /// [SearchRequest.page_token][google.cloud.retail.v2.SearchRequest.page_token]
23104    /// to retrieve the next page. If this field is omitted, there are no
23105    /// subsequent pages.
23106    ///
23107    /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
23108    pub next_page_token: std::string::String,
23109
23110    /// Query expansion information for the returned results.
23111    pub query_expansion_info:
23112        std::option::Option<crate::model::search_response::QueryExpansionInfo>,
23113
23114    /// The URI of a customer-defined redirect page. If redirect action is
23115    /// triggered, no search is performed, and only
23116    /// [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and
23117    /// [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
23118    /// are set in the response.
23119    ///
23120    /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
23121    /// [google.cloud.retail.v2.SearchResponse.redirect_uri]: crate::model::SearchResponse::redirect_uri
23122    pub redirect_uri: std::string::String,
23123
23124    /// The fully qualified resource name of applied
23125    /// [controls](https://cloud.google.com/retail/docs/serving-control-rules).
23126    pub applied_controls: std::vec::Vec<std::string::String>,
23127
23128    /// Metadata for pin controls which were applicable to the request.
23129    /// This contains two map fields, one for all matched pins and one for pins
23130    /// which were matched but not applied.
23131    ///
23132    /// The two maps are keyed by pin position, and the values are the product ids
23133    /// which were matched to that pin.
23134    pub pin_control_metadata: std::option::Option<crate::model::PinControlMetadata>,
23135
23136    /// The invalid
23137    /// [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
23138    /// that are not applied during serving.
23139    ///
23140    /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
23141    pub invalid_condition_boost_specs:
23142        std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23143
23144    /// Metadata related to A/B testing experiment associated with this
23145    /// response. Only exists when an experiment is triggered.
23146    pub experiment_info: std::vec::Vec<crate::model::ExperimentInfo>,
23147
23148    /// This field specifies all related information that is needed on client
23149    /// side for UI rendering of conversational retail search.
23150    pub conversational_search_result:
23151        std::option::Option<crate::model::search_response::ConversationalSearchResult>,
23152
23153    /// This field specifies all related information for tile navigation that will
23154    /// be used in client side.
23155    pub tile_navigation_result:
23156        std::option::Option<crate::model::search_response::TileNavigationResult>,
23157
23158    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23159}
23160
23161impl SearchResponse {
23162    pub fn new() -> Self {
23163        std::default::Default::default()
23164    }
23165
23166    /// Sets the value of [results][crate::model::SearchResponse::results].
23167    ///
23168    /// # Example
23169    /// ```ignore,no_run
23170    /// # use google_cloud_retail_v2::model::SearchResponse;
23171    /// use google_cloud_retail_v2::model::search_response::SearchResult;
23172    /// let x = SearchResponse::new()
23173    ///     .set_results([
23174    ///         SearchResult::default()/* use setters */,
23175    ///         SearchResult::default()/* use (different) setters */,
23176    ///     ]);
23177    /// ```
23178    pub fn set_results<T, V>(mut self, v: T) -> Self
23179    where
23180        T: std::iter::IntoIterator<Item = V>,
23181        V: std::convert::Into<crate::model::search_response::SearchResult>,
23182    {
23183        use std::iter::Iterator;
23184        self.results = v.into_iter().map(|i| i.into()).collect();
23185        self
23186    }
23187
23188    /// Sets the value of [facets][crate::model::SearchResponse::facets].
23189    ///
23190    /// # Example
23191    /// ```ignore,no_run
23192    /// # use google_cloud_retail_v2::model::SearchResponse;
23193    /// use google_cloud_retail_v2::model::search_response::Facet;
23194    /// let x = SearchResponse::new()
23195    ///     .set_facets([
23196    ///         Facet::default()/* use setters */,
23197    ///         Facet::default()/* use (different) setters */,
23198    ///     ]);
23199    /// ```
23200    pub fn set_facets<T, V>(mut self, v: T) -> Self
23201    where
23202        T: std::iter::IntoIterator<Item = V>,
23203        V: std::convert::Into<crate::model::search_response::Facet>,
23204    {
23205        use std::iter::Iterator;
23206        self.facets = v.into_iter().map(|i| i.into()).collect();
23207        self
23208    }
23209
23210    /// Sets the value of [total_size][crate::model::SearchResponse::total_size].
23211    ///
23212    /// # Example
23213    /// ```ignore,no_run
23214    /// # use google_cloud_retail_v2::model::SearchResponse;
23215    /// let x = SearchResponse::new().set_total_size(42);
23216    /// ```
23217    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23218        self.total_size = v.into();
23219        self
23220    }
23221
23222    /// Sets the value of [corrected_query][crate::model::SearchResponse::corrected_query].
23223    ///
23224    /// # Example
23225    /// ```ignore,no_run
23226    /// # use google_cloud_retail_v2::model::SearchResponse;
23227    /// let x = SearchResponse::new().set_corrected_query("example");
23228    /// ```
23229    pub fn set_corrected_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23230        self.corrected_query = v.into();
23231        self
23232    }
23233
23234    /// Sets the value of [attribution_token][crate::model::SearchResponse::attribution_token].
23235    ///
23236    /// # Example
23237    /// ```ignore,no_run
23238    /// # use google_cloud_retail_v2::model::SearchResponse;
23239    /// let x = SearchResponse::new().set_attribution_token("example");
23240    /// ```
23241    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
23242        mut self,
23243        v: T,
23244    ) -> Self {
23245        self.attribution_token = v.into();
23246        self
23247    }
23248
23249    /// Sets the value of [next_page_token][crate::model::SearchResponse::next_page_token].
23250    ///
23251    /// # Example
23252    /// ```ignore,no_run
23253    /// # use google_cloud_retail_v2::model::SearchResponse;
23254    /// let x = SearchResponse::new().set_next_page_token("example");
23255    /// ```
23256    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23257        self.next_page_token = v.into();
23258        self
23259    }
23260
23261    /// Sets the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23262    ///
23263    /// # Example
23264    /// ```ignore,no_run
23265    /// # use google_cloud_retail_v2::model::SearchResponse;
23266    /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23267    /// let x = SearchResponse::new().set_query_expansion_info(QueryExpansionInfo::default()/* use setters */);
23268    /// ```
23269    pub fn set_query_expansion_info<T>(mut self, v: T) -> Self
23270    where
23271        T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23272    {
23273        self.query_expansion_info = std::option::Option::Some(v.into());
23274        self
23275    }
23276
23277    /// Sets or clears the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23278    ///
23279    /// # Example
23280    /// ```ignore,no_run
23281    /// # use google_cloud_retail_v2::model::SearchResponse;
23282    /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23283    /// let x = SearchResponse::new().set_or_clear_query_expansion_info(Some(QueryExpansionInfo::default()/* use setters */));
23284    /// let x = SearchResponse::new().set_or_clear_query_expansion_info(None::<QueryExpansionInfo>);
23285    /// ```
23286    pub fn set_or_clear_query_expansion_info<T>(mut self, v: std::option::Option<T>) -> Self
23287    where
23288        T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23289    {
23290        self.query_expansion_info = v.map(|x| x.into());
23291        self
23292    }
23293
23294    /// Sets the value of [redirect_uri][crate::model::SearchResponse::redirect_uri].
23295    ///
23296    /// # Example
23297    /// ```ignore,no_run
23298    /// # use google_cloud_retail_v2::model::SearchResponse;
23299    /// let x = SearchResponse::new().set_redirect_uri("example");
23300    /// ```
23301    pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23302        self.redirect_uri = v.into();
23303        self
23304    }
23305
23306    /// Sets the value of [applied_controls][crate::model::SearchResponse::applied_controls].
23307    ///
23308    /// # Example
23309    /// ```ignore,no_run
23310    /// # use google_cloud_retail_v2::model::SearchResponse;
23311    /// let x = SearchResponse::new().set_applied_controls(["a", "b", "c"]);
23312    /// ```
23313    pub fn set_applied_controls<T, V>(mut self, v: T) -> Self
23314    where
23315        T: std::iter::IntoIterator<Item = V>,
23316        V: std::convert::Into<std::string::String>,
23317    {
23318        use std::iter::Iterator;
23319        self.applied_controls = v.into_iter().map(|i| i.into()).collect();
23320        self
23321    }
23322
23323    /// Sets the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23324    ///
23325    /// # Example
23326    /// ```ignore,no_run
23327    /// # use google_cloud_retail_v2::model::SearchResponse;
23328    /// use google_cloud_retail_v2::model::PinControlMetadata;
23329    /// let x = SearchResponse::new().set_pin_control_metadata(PinControlMetadata::default()/* use setters */);
23330    /// ```
23331    pub fn set_pin_control_metadata<T>(mut self, v: T) -> Self
23332    where
23333        T: std::convert::Into<crate::model::PinControlMetadata>,
23334    {
23335        self.pin_control_metadata = std::option::Option::Some(v.into());
23336        self
23337    }
23338
23339    /// Sets or clears the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23340    ///
23341    /// # Example
23342    /// ```ignore,no_run
23343    /// # use google_cloud_retail_v2::model::SearchResponse;
23344    /// use google_cloud_retail_v2::model::PinControlMetadata;
23345    /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(Some(PinControlMetadata::default()/* use setters */));
23346    /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(None::<PinControlMetadata>);
23347    /// ```
23348    pub fn set_or_clear_pin_control_metadata<T>(mut self, v: std::option::Option<T>) -> Self
23349    where
23350        T: std::convert::Into<crate::model::PinControlMetadata>,
23351    {
23352        self.pin_control_metadata = v.map(|x| x.into());
23353        self
23354    }
23355
23356    /// Sets the value of [invalid_condition_boost_specs][crate::model::SearchResponse::invalid_condition_boost_specs].
23357    ///
23358    /// # Example
23359    /// ```ignore,no_run
23360    /// # use google_cloud_retail_v2::model::SearchResponse;
23361    /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
23362    /// let x = SearchResponse::new()
23363    ///     .set_invalid_condition_boost_specs([
23364    ///         ConditionBoostSpec::default()/* use setters */,
23365    ///         ConditionBoostSpec::default()/* use (different) setters */,
23366    ///     ]);
23367    /// ```
23368    pub fn set_invalid_condition_boost_specs<T, V>(mut self, v: T) -> Self
23369    where
23370        T: std::iter::IntoIterator<Item = V>,
23371        V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23372    {
23373        use std::iter::Iterator;
23374        self.invalid_condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
23375        self
23376    }
23377
23378    /// Sets the value of [experiment_info][crate::model::SearchResponse::experiment_info].
23379    ///
23380    /// # Example
23381    /// ```ignore,no_run
23382    /// # use google_cloud_retail_v2::model::SearchResponse;
23383    /// use google_cloud_retail_v2::model::ExperimentInfo;
23384    /// let x = SearchResponse::new()
23385    ///     .set_experiment_info([
23386    ///         ExperimentInfo::default()/* use setters */,
23387    ///         ExperimentInfo::default()/* use (different) setters */,
23388    ///     ]);
23389    /// ```
23390    pub fn set_experiment_info<T, V>(mut self, v: T) -> Self
23391    where
23392        T: std::iter::IntoIterator<Item = V>,
23393        V: std::convert::Into<crate::model::ExperimentInfo>,
23394    {
23395        use std::iter::Iterator;
23396        self.experiment_info = v.into_iter().map(|i| i.into()).collect();
23397        self
23398    }
23399
23400    /// Sets the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23401    ///
23402    /// # Example
23403    /// ```ignore,no_run
23404    /// # use google_cloud_retail_v2::model::SearchResponse;
23405    /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23406    /// let x = SearchResponse::new().set_conversational_search_result(ConversationalSearchResult::default()/* use setters */);
23407    /// ```
23408    pub fn set_conversational_search_result<T>(mut self, v: T) -> Self
23409    where
23410        T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23411    {
23412        self.conversational_search_result = std::option::Option::Some(v.into());
23413        self
23414    }
23415
23416    /// Sets or clears the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23417    ///
23418    /// # Example
23419    /// ```ignore,no_run
23420    /// # use google_cloud_retail_v2::model::SearchResponse;
23421    /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23422    /// let x = SearchResponse::new().set_or_clear_conversational_search_result(Some(ConversationalSearchResult::default()/* use setters */));
23423    /// let x = SearchResponse::new().set_or_clear_conversational_search_result(None::<ConversationalSearchResult>);
23424    /// ```
23425    pub fn set_or_clear_conversational_search_result<T>(mut self, v: std::option::Option<T>) -> Self
23426    where
23427        T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23428    {
23429        self.conversational_search_result = v.map(|x| x.into());
23430        self
23431    }
23432
23433    /// Sets the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23434    ///
23435    /// # Example
23436    /// ```ignore,no_run
23437    /// # use google_cloud_retail_v2::model::SearchResponse;
23438    /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23439    /// let x = SearchResponse::new().set_tile_navigation_result(TileNavigationResult::default()/* use setters */);
23440    /// ```
23441    pub fn set_tile_navigation_result<T>(mut self, v: T) -> Self
23442    where
23443        T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23444    {
23445        self.tile_navigation_result = std::option::Option::Some(v.into());
23446        self
23447    }
23448
23449    /// Sets or clears the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23450    ///
23451    /// # Example
23452    /// ```ignore,no_run
23453    /// # use google_cloud_retail_v2::model::SearchResponse;
23454    /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23455    /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(Some(TileNavigationResult::default()/* use setters */));
23456    /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(None::<TileNavigationResult>);
23457    /// ```
23458    pub fn set_or_clear_tile_navigation_result<T>(mut self, v: std::option::Option<T>) -> Self
23459    where
23460        T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23461    {
23462        self.tile_navigation_result = v.map(|x| x.into());
23463        self
23464    }
23465}
23466
23467impl wkt::message::Message for SearchResponse {
23468    fn typename() -> &'static str {
23469        "type.googleapis.com/google.cloud.retail.v2.SearchResponse"
23470    }
23471}
23472
23473#[doc(hidden)]
23474impl google_cloud_gax::paginator::internal::PageableResponse for SearchResponse {
23475    type PageItem = crate::model::search_response::SearchResult;
23476
23477    fn items(self) -> std::vec::Vec<Self::PageItem> {
23478        self.results
23479    }
23480
23481    fn next_page_token(&self) -> std::string::String {
23482        use std::clone::Clone;
23483        self.next_page_token.clone()
23484    }
23485}
23486
23487/// Defines additional types related to [SearchResponse].
23488pub mod search_response {
23489    #[allow(unused_imports)]
23490    use super::*;
23491
23492    /// Represents the search results.
23493    #[derive(Clone, Default, PartialEq)]
23494    #[non_exhaustive]
23495    pub struct SearchResult {
23496        /// [Product.id][google.cloud.retail.v2.Product.id] of the searched
23497        /// [Product][google.cloud.retail.v2.Product].
23498        ///
23499        /// [google.cloud.retail.v2.Product]: crate::model::Product
23500        /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
23501        pub id: std::string::String,
23502
23503        /// The product data snippet in the search response. Only
23504        /// [Product.name][google.cloud.retail.v2.Product.name] is guaranteed to be
23505        /// populated.
23506        ///
23507        /// [Product.variants][google.cloud.retail.v2.Product.variants] contains the
23508        /// product variants that match the search query. If there are multiple
23509        /// product variants matching the query, top 5 most relevant product variants
23510        /// are returned and ordered by relevancy.
23511        ///
23512        /// If relevancy can be deternmined, use
23513        /// [matching_variant_fields][google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]
23514        /// to look up matched product variants fields. If relevancy cannot be
23515        /// determined, e.g. when searching "shoe" all products in a shoe product can
23516        /// be a match, 5 product variants are returned but order is meaningless.
23517        ///
23518        /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23519        /// [google.cloud.retail.v2.Product.variants]: crate::model::Product::variants
23520        /// [google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]: crate::model::search_response::SearchResult::matching_variant_fields
23521        pub product: std::option::Option<crate::model::Product>,
23522
23523        /// The count of matched
23524        /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23525        /// [Product][google.cloud.retail.v2.Product]s.
23526        ///
23527        /// [google.cloud.retail.v2.Product]: crate::model::Product
23528        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23529        pub matching_variant_count: i32,
23530
23531        /// If a [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23532        /// [Product][google.cloud.retail.v2.Product] matches the search query, this
23533        /// map indicates which [Product][google.cloud.retail.v2.Product] fields are
23534        /// matched. The key is the
23535        /// [Product.name][google.cloud.retail.v2.Product.name], the value is a field
23536        /// mask of the matched [Product][google.cloud.retail.v2.Product] fields. If
23537        /// matched attributes cannot be determined, this map will be empty.
23538        ///
23539        /// For example, a key "sku1" with field mask
23540        /// "products.color_info" indicates there is a match between
23541        /// "sku1" [ColorInfo][google.cloud.retail.v2.ColorInfo] and the query.
23542        ///
23543        /// [google.cloud.retail.v2.ColorInfo]: crate::model::ColorInfo
23544        /// [google.cloud.retail.v2.Product]: crate::model::Product
23545        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23546        /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23547        pub matching_variant_fields: std::collections::HashMap<std::string::String, wkt::FieldMask>,
23548
23549        /// The rollup matching
23550        /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23551        /// [Product][google.cloud.retail.v2.Product] attributes. The key is one of
23552        /// the
23553        /// [SearchRequest.variant_rollup_keys][google.cloud.retail.v2.SearchRequest.variant_rollup_keys].
23554        /// The values are the merged and de-duplicated
23555        /// [Product][google.cloud.retail.v2.Product] attributes. Notice that the
23556        /// rollup values are respect filter. For example, when filtering by
23557        /// "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is
23558        /// returned.
23559        ///
23560        /// For textual and numerical attributes, the rollup values is a list of
23561        /// string or double values with type
23562        /// [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if
23563        /// there are two variants with colors "red" and "blue", the rollup values
23564        /// are
23565        ///
23566        /// ```norust
23567        /// { key: "colorFamilies"
23568        ///   value {
23569        ///     list_value {
23570        ///       values { string_value: "red" }
23571        ///       values { string_value: "blue" }
23572        ///      }
23573        ///   }
23574        /// }
23575        /// ```
23576        ///
23577        /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], the rollup
23578        /// values is a double value with type
23579        /// [google.protobuf.Value][google.protobuf.Value]. For example,
23580        /// `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there
23581        /// are 10 variants in this product are available in the store "store1".
23582        ///
23583        /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
23584        /// [google.cloud.retail.v2.Product]: crate::model::Product
23585        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23586        /// [google.cloud.retail.v2.SearchRequest.variant_rollup_keys]: crate::model::SearchRequest::variant_rollup_keys
23587        /// [google.protobuf.ListValue]: wkt::ListValue
23588        /// [google.protobuf.Value]: wkt::Value
23589        pub variant_rollup_values: std::collections::HashMap<std::string::String, wkt::Value>,
23590
23591        /// Specifies previous events related to this product for this user based on
23592        /// [UserEvent][google.cloud.retail.v2.UserEvent] with same
23593        /// [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
23594        /// or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
23595        ///
23596        /// This is set only when
23597        /// [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
23598        /// is
23599        /// [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
23600        ///
23601        /// Possible values:
23602        ///
23603        /// * `purchased`: Indicates that this product has been purchased before.
23604        ///
23605        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
23606        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]: crate::model::search_request::PersonalizationSpec::mode
23607        /// [google.cloud.retail.v2.SearchRequest.visitor_id]: crate::model::SearchRequest::visitor_id
23608        /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23609        /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
23610        pub personal_labels: std::vec::Vec<std::string::String>,
23611
23612        /// Google provided available scores.
23613        pub model_scores: std::collections::HashMap<std::string::String, crate::model::DoubleList>,
23614
23615        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23616    }
23617
23618    impl SearchResult {
23619        pub fn new() -> Self {
23620            std::default::Default::default()
23621        }
23622
23623        /// Sets the value of [id][crate::model::search_response::SearchResult::id].
23624        ///
23625        /// # Example
23626        /// ```ignore,no_run
23627        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23628        /// let x = SearchResult::new().set_id("example");
23629        /// ```
23630        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23631            self.id = v.into();
23632            self
23633        }
23634
23635        /// Sets the value of [product][crate::model::search_response::SearchResult::product].
23636        ///
23637        /// # Example
23638        /// ```ignore,no_run
23639        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23640        /// use google_cloud_retail_v2::model::Product;
23641        /// let x = SearchResult::new().set_product(Product::default()/* use setters */);
23642        /// ```
23643        pub fn set_product<T>(mut self, v: T) -> Self
23644        where
23645            T: std::convert::Into<crate::model::Product>,
23646        {
23647            self.product = std::option::Option::Some(v.into());
23648            self
23649        }
23650
23651        /// Sets or clears the value of [product][crate::model::search_response::SearchResult::product].
23652        ///
23653        /// # Example
23654        /// ```ignore,no_run
23655        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23656        /// use google_cloud_retail_v2::model::Product;
23657        /// let x = SearchResult::new().set_or_clear_product(Some(Product::default()/* use setters */));
23658        /// let x = SearchResult::new().set_or_clear_product(None::<Product>);
23659        /// ```
23660        pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
23661        where
23662            T: std::convert::Into<crate::model::Product>,
23663        {
23664            self.product = v.map(|x| x.into());
23665            self
23666        }
23667
23668        /// Sets the value of [matching_variant_count][crate::model::search_response::SearchResult::matching_variant_count].
23669        ///
23670        /// # Example
23671        /// ```ignore,no_run
23672        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23673        /// let x = SearchResult::new().set_matching_variant_count(42);
23674        /// ```
23675        pub fn set_matching_variant_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23676            self.matching_variant_count = v.into();
23677            self
23678        }
23679
23680        /// Sets the value of [matching_variant_fields][crate::model::search_response::SearchResult::matching_variant_fields].
23681        ///
23682        /// # Example
23683        /// ```ignore,no_run
23684        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23685        /// use wkt::FieldMask;
23686        /// let x = SearchResult::new().set_matching_variant_fields([
23687        ///     ("key0", FieldMask::default()/* use setters */),
23688        ///     ("key1", FieldMask::default()/* use (different) setters */),
23689        /// ]);
23690        /// ```
23691        pub fn set_matching_variant_fields<T, K, V>(mut self, v: T) -> Self
23692        where
23693            T: std::iter::IntoIterator<Item = (K, V)>,
23694            K: std::convert::Into<std::string::String>,
23695            V: std::convert::Into<wkt::FieldMask>,
23696        {
23697            use std::iter::Iterator;
23698            self.matching_variant_fields =
23699                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23700            self
23701        }
23702
23703        /// Sets the value of [variant_rollup_values][crate::model::search_response::SearchResult::variant_rollup_values].
23704        ///
23705        /// # Example
23706        /// ```ignore,no_run
23707        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23708        /// use wkt::Value;
23709        /// let x = SearchResult::new().set_variant_rollup_values([
23710        ///     ("key0", Value::default()/* use setters */),
23711        ///     ("key1", Value::default()/* use (different) setters */),
23712        /// ]);
23713        /// ```
23714        pub fn set_variant_rollup_values<T, K, V>(mut self, v: T) -> Self
23715        where
23716            T: std::iter::IntoIterator<Item = (K, V)>,
23717            K: std::convert::Into<std::string::String>,
23718            V: std::convert::Into<wkt::Value>,
23719        {
23720            use std::iter::Iterator;
23721            self.variant_rollup_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23722            self
23723        }
23724
23725        /// Sets the value of [personal_labels][crate::model::search_response::SearchResult::personal_labels].
23726        ///
23727        /// # Example
23728        /// ```ignore,no_run
23729        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23730        /// let x = SearchResult::new().set_personal_labels(["a", "b", "c"]);
23731        /// ```
23732        pub fn set_personal_labels<T, V>(mut self, v: T) -> Self
23733        where
23734            T: std::iter::IntoIterator<Item = V>,
23735            V: std::convert::Into<std::string::String>,
23736        {
23737            use std::iter::Iterator;
23738            self.personal_labels = v.into_iter().map(|i| i.into()).collect();
23739            self
23740        }
23741
23742        /// Sets the value of [model_scores][crate::model::search_response::SearchResult::model_scores].
23743        ///
23744        /// # Example
23745        /// ```ignore,no_run
23746        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23747        /// use google_cloud_retail_v2::model::DoubleList;
23748        /// let x = SearchResult::new().set_model_scores([
23749        ///     ("key0", DoubleList::default()/* use setters */),
23750        ///     ("key1", DoubleList::default()/* use (different) setters */),
23751        /// ]);
23752        /// ```
23753        pub fn set_model_scores<T, K, V>(mut self, v: T) -> Self
23754        where
23755            T: std::iter::IntoIterator<Item = (K, V)>,
23756            K: std::convert::Into<std::string::String>,
23757            V: std::convert::Into<crate::model::DoubleList>,
23758        {
23759            use std::iter::Iterator;
23760            self.model_scores = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
23761            self
23762        }
23763    }
23764
23765    impl wkt::message::Message for SearchResult {
23766        fn typename() -> &'static str {
23767            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.SearchResult"
23768        }
23769    }
23770
23771    /// A facet result.
23772    #[derive(Clone, Default, PartialEq)]
23773    #[non_exhaustive]
23774    pub struct Facet {
23775        /// The key for this facet. E.g., "colorFamilies" or "price" or
23776        /// "attributes.attr1".
23777        pub key: std::string::String,
23778
23779        /// The facet values for this field.
23780        pub values: std::vec::Vec<crate::model::search_response::facet::FacetValue>,
23781
23782        /// Whether the facet is dynamically generated.
23783        pub dynamic_facet: bool,
23784
23785        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23786    }
23787
23788    impl Facet {
23789        pub fn new() -> Self {
23790            std::default::Default::default()
23791        }
23792
23793        /// Sets the value of [key][crate::model::search_response::Facet::key].
23794        ///
23795        /// # Example
23796        /// ```ignore,no_run
23797        /// # use google_cloud_retail_v2::model::search_response::Facet;
23798        /// let x = Facet::new().set_key("example");
23799        /// ```
23800        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23801            self.key = v.into();
23802            self
23803        }
23804
23805        /// Sets the value of [values][crate::model::search_response::Facet::values].
23806        ///
23807        /// # Example
23808        /// ```ignore,no_run
23809        /// # use google_cloud_retail_v2::model::search_response::Facet;
23810        /// use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23811        /// let x = Facet::new()
23812        ///     .set_values([
23813        ///         FacetValue::default()/* use setters */,
23814        ///         FacetValue::default()/* use (different) setters */,
23815        ///     ]);
23816        /// ```
23817        pub fn set_values<T, V>(mut self, v: T) -> Self
23818        where
23819            T: std::iter::IntoIterator<Item = V>,
23820            V: std::convert::Into<crate::model::search_response::facet::FacetValue>,
23821        {
23822            use std::iter::Iterator;
23823            self.values = v.into_iter().map(|i| i.into()).collect();
23824            self
23825        }
23826
23827        /// Sets the value of [dynamic_facet][crate::model::search_response::Facet::dynamic_facet].
23828        ///
23829        /// # Example
23830        /// ```ignore,no_run
23831        /// # use google_cloud_retail_v2::model::search_response::Facet;
23832        /// let x = Facet::new().set_dynamic_facet(true);
23833        /// ```
23834        pub fn set_dynamic_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23835            self.dynamic_facet = v.into();
23836            self
23837        }
23838    }
23839
23840    impl wkt::message::Message for Facet {
23841        fn typename() -> &'static str {
23842            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet"
23843        }
23844    }
23845
23846    /// Defines additional types related to [Facet].
23847    pub mod facet {
23848        #[allow(unused_imports)]
23849        use super::*;
23850
23851        /// A facet value which contains value names and their count.
23852        #[derive(Clone, Default, PartialEq)]
23853        #[non_exhaustive]
23854        pub struct FacetValue {
23855            /// Number of items that have this facet value.
23856            pub count: i64,
23857
23858            /// The minimum value in the
23859            /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
23860            /// Only supported on numerical facets and returned if
23861            /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
23862            /// is true.
23863            ///
23864            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
23865            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
23866            pub min_value: f64,
23867
23868            /// The maximum value in the
23869            /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
23870            /// Only supported on numerical facets and returned if
23871            /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
23872            /// is true.
23873            ///
23874            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
23875            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
23876            pub max_value: f64,
23877
23878            /// A facet value which contains values.
23879            pub facet_value:
23880                std::option::Option<crate::model::search_response::facet::facet_value::FacetValue>,
23881
23882            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23883        }
23884
23885        impl FacetValue {
23886            pub fn new() -> Self {
23887                std::default::Default::default()
23888            }
23889
23890            /// Sets the value of [count][crate::model::search_response::facet::FacetValue::count].
23891            ///
23892            /// # Example
23893            /// ```ignore,no_run
23894            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23895            /// let x = FacetValue::new().set_count(42);
23896            /// ```
23897            pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
23898                self.count = v.into();
23899                self
23900            }
23901
23902            /// Sets the value of [min_value][crate::model::search_response::facet::FacetValue::min_value].
23903            ///
23904            /// # Example
23905            /// ```ignore,no_run
23906            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23907            /// let x = FacetValue::new().set_min_value(42.0);
23908            /// ```
23909            pub fn set_min_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
23910                self.min_value = v.into();
23911                self
23912            }
23913
23914            /// Sets the value of [max_value][crate::model::search_response::facet::FacetValue::max_value].
23915            ///
23916            /// # Example
23917            /// ```ignore,no_run
23918            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23919            /// let x = FacetValue::new().set_max_value(42.0);
23920            /// ```
23921            pub fn set_max_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
23922                self.max_value = v.into();
23923                self
23924            }
23925
23926            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value].
23927            ///
23928            /// Note that all the setters affecting `facet_value` are mutually
23929            /// exclusive.
23930            ///
23931            /// # Example
23932            /// ```ignore,no_run
23933            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23934            /// use google_cloud_retail_v2::model::search_response::facet::facet_value::FacetValue as FacetValueOneOf;
23935            /// let x = FacetValue::new().set_facet_value(Some(FacetValueOneOf::Value("example".to_string())));
23936            /// ```
23937            pub fn set_facet_value<
23938                T: std::convert::Into<
23939                        std::option::Option<
23940                            crate::model::search_response::facet::facet_value::FacetValue,
23941                        >,
23942                    >,
23943            >(
23944                mut self,
23945                v: T,
23946            ) -> Self {
23947                self.facet_value = v.into();
23948                self
23949            }
23950
23951            /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23952            /// if it holds a `Value`, `None` if the field is not set or
23953            /// holds a different branch.
23954            pub fn value(&self) -> std::option::Option<&std::string::String> {
23955                #[allow(unreachable_patterns)]
23956                self.facet_value.as_ref().and_then(|v| match v {
23957                    crate::model::search_response::facet::facet_value::FacetValue::Value(v) => {
23958                        std::option::Option::Some(v)
23959                    }
23960                    _ => std::option::Option::None,
23961                })
23962            }
23963
23964            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23965            /// to hold a `Value`.
23966            ///
23967            /// Note that all the setters affecting `facet_value` are
23968            /// mutually exclusive.
23969            ///
23970            /// # Example
23971            /// ```ignore,no_run
23972            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
23973            /// let x = FacetValue::new().set_value("example");
23974            /// assert!(x.value().is_some());
23975            /// assert!(x.interval().is_none());
23976            /// ```
23977            pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23978                self.facet_value = std::option::Option::Some(
23979                    crate::model::search_response::facet::facet_value::FacetValue::Value(v.into()),
23980                );
23981                self
23982            }
23983
23984            /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
23985            /// if it holds a `Interval`, `None` if the field is not set or
23986            /// holds a different branch.
23987            pub fn interval(
23988                &self,
23989            ) -> std::option::Option<&std::boxed::Box<crate::model::Interval>> {
23990                #[allow(unreachable_patterns)]
23991                self.facet_value.as_ref().and_then(|v| match v {
23992                    crate::model::search_response::facet::facet_value::FacetValue::Interval(v) => {
23993                        std::option::Option::Some(v)
23994                    }
23995                    _ => std::option::Option::None,
23996                })
23997            }
23998
23999            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24000            /// to hold a `Interval`.
24001            ///
24002            /// Note that all the setters affecting `facet_value` are
24003            /// mutually exclusive.
24004            ///
24005            /// # Example
24006            /// ```ignore,no_run
24007            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24008            /// use google_cloud_retail_v2::model::Interval;
24009            /// let x = FacetValue::new().set_interval(Interval::default()/* use setters */);
24010            /// assert!(x.interval().is_some());
24011            /// assert!(x.value().is_none());
24012            /// ```
24013            pub fn set_interval<T: std::convert::Into<std::boxed::Box<crate::model::Interval>>>(
24014                mut self,
24015                v: T,
24016            ) -> Self {
24017                self.facet_value = std::option::Option::Some(
24018                    crate::model::search_response::facet::facet_value::FacetValue::Interval(
24019                        v.into(),
24020                    ),
24021                );
24022                self
24023            }
24024        }
24025
24026        impl wkt::message::Message for FacetValue {
24027            fn typename() -> &'static str {
24028                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"
24029            }
24030        }
24031
24032        /// Defines additional types related to [FacetValue].
24033        pub mod facet_value {
24034            #[allow(unused_imports)]
24035            use super::*;
24036
24037            /// A facet value which contains values.
24038            #[derive(Clone, Debug, PartialEq)]
24039            #[non_exhaustive]
24040            pub enum FacetValue {
24041                /// Text value of a facet, such as "Black" for facet "colorFamilies".
24042                Value(std::string::String),
24043                /// Interval value for a facet, such as [10, 20) for facet "price".
24044                Interval(std::boxed::Box<crate::model::Interval>),
24045            }
24046        }
24047    }
24048
24049    /// Information describing query expansion including whether expansion has
24050    /// occurred.
24051    #[derive(Clone, Default, PartialEq)]
24052    #[non_exhaustive]
24053    pub struct QueryExpansionInfo {
24054        /// Bool describing whether query expansion has occurred.
24055        pub expanded_query: bool,
24056
24057        /// Number of pinned results. This field will only be set when expansion
24058        /// happens and
24059        /// [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
24060        /// is set to true.
24061        ///
24062        /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]: crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results
24063        pub pinned_result_count: i64,
24064
24065        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24066    }
24067
24068    impl QueryExpansionInfo {
24069        pub fn new() -> Self {
24070            std::default::Default::default()
24071        }
24072
24073        /// Sets the value of [expanded_query][crate::model::search_response::QueryExpansionInfo::expanded_query].
24074        ///
24075        /// # Example
24076        /// ```ignore,no_run
24077        /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24078        /// let x = QueryExpansionInfo::new().set_expanded_query(true);
24079        /// ```
24080        pub fn set_expanded_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24081            self.expanded_query = v.into();
24082            self
24083        }
24084
24085        /// Sets the value of [pinned_result_count][crate::model::search_response::QueryExpansionInfo::pinned_result_count].
24086        ///
24087        /// # Example
24088        /// ```ignore,no_run
24089        /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24090        /// let x = QueryExpansionInfo::new().set_pinned_result_count(42);
24091        /// ```
24092        pub fn set_pinned_result_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24093            self.pinned_result_count = v.into();
24094            self
24095        }
24096    }
24097
24098    impl wkt::message::Message for QueryExpansionInfo {
24099        fn typename() -> &'static str {
24100            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"
24101        }
24102    }
24103
24104    /// This field specifies all related information that is needed on client
24105    /// side for UI rendering of conversational retail search.
24106    #[derive(Clone, Default, PartialEq)]
24107    #[non_exhaustive]
24108    pub struct ConversationalSearchResult {
24109        /// Conversation UUID. This field will be stored in client side storage to
24110        /// maintain the conversation session with server and will be used for next
24111        /// search request's
24112        /// [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]
24113        /// to restore conversation state in server.
24114        ///
24115        /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]: crate::model::search_request::ConversationalSearchSpec::conversation_id
24116        pub conversation_id: std::string::String,
24117
24118        /// The current refined query for the conversational search. This field
24119        /// will be used in customer UI that the query in the search bar should be
24120        /// replaced with the refined query. For example, if
24121        /// [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] is
24122        /// `dress` and next
24123        /// [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]
24124        /// is `red color`, which does not match any product attribute value filters,
24125        /// the refined query will be `dress, red color`.
24126        ///
24127        /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]: crate::model::search_request::conversational_search_spec::UserAnswer::type
24128        /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
24129        pub refined_query: std::string::String,
24130
24131        /// This field is deprecated but will be kept for backward compatibility.
24132        /// There is expected to have only one additional filter and the value will
24133        /// be the same to the same as field `additional_filter`.
24134        #[deprecated]
24135        pub additional_filters: std::vec::Vec<
24136            crate::model::search_response::conversational_search_result::AdditionalFilter,
24137        >,
24138
24139        /// The follow-up question. e.g., `What is the color?`
24140        pub followup_question: std::string::String,
24141
24142        /// The answer options provided to client for the follow-up question.
24143        pub suggested_answers: std::vec::Vec<
24144            crate::model::search_response::conversational_search_result::SuggestedAnswer,
24145        >,
24146
24147        /// This is the incremental additional filters implied from the current
24148        /// user answer. User should add the suggested addition filters to the
24149        /// previous
24150        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],  and
24151        /// use the merged filter in the follow up search request.
24152        ///
24153        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
24154        pub additional_filter: std::option::Option<
24155            crate::model::search_response::conversational_search_result::AdditionalFilter,
24156        >,
24157
24158        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24159    }
24160
24161    impl ConversationalSearchResult {
24162        pub fn new() -> Self {
24163            std::default::Default::default()
24164        }
24165
24166        /// Sets the value of [conversation_id][crate::model::search_response::ConversationalSearchResult::conversation_id].
24167        ///
24168        /// # Example
24169        /// ```ignore,no_run
24170        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24171        /// let x = ConversationalSearchResult::new().set_conversation_id("example");
24172        /// ```
24173        pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
24174            mut self,
24175            v: T,
24176        ) -> Self {
24177            self.conversation_id = v.into();
24178            self
24179        }
24180
24181        /// Sets the value of [refined_query][crate::model::search_response::ConversationalSearchResult::refined_query].
24182        ///
24183        /// # Example
24184        /// ```ignore,no_run
24185        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24186        /// let x = ConversationalSearchResult::new().set_refined_query("example");
24187        /// ```
24188        pub fn set_refined_query<T: std::convert::Into<std::string::String>>(
24189            mut self,
24190            v: T,
24191        ) -> Self {
24192            self.refined_query = v.into();
24193            self
24194        }
24195
24196        /// Sets the value of [additional_filters][crate::model::search_response::ConversationalSearchResult::additional_filters].
24197        ///
24198        /// # Example
24199        /// ```ignore,no_run
24200        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24201        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24202        /// let x = ConversationalSearchResult::new()
24203        ///     .set_additional_filters([
24204        ///         AdditionalFilter::default()/* use setters */,
24205        ///         AdditionalFilter::default()/* use (different) setters */,
24206        ///     ]);
24207        /// ```
24208        #[deprecated]
24209        pub fn set_additional_filters<T, V>(mut self, v: T) -> Self
24210        where
24211            T: std::iter::IntoIterator<Item = V>,
24212            V: std::convert::Into<
24213                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24214                >,
24215        {
24216            use std::iter::Iterator;
24217            self.additional_filters = v.into_iter().map(|i| i.into()).collect();
24218            self
24219        }
24220
24221        /// Sets the value of [followup_question][crate::model::search_response::ConversationalSearchResult::followup_question].
24222        ///
24223        /// # Example
24224        /// ```ignore,no_run
24225        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24226        /// let x = ConversationalSearchResult::new().set_followup_question("example");
24227        /// ```
24228        pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
24229            mut self,
24230            v: T,
24231        ) -> Self {
24232            self.followup_question = v.into();
24233            self
24234        }
24235
24236        /// Sets the value of [suggested_answers][crate::model::search_response::ConversationalSearchResult::suggested_answers].
24237        ///
24238        /// # Example
24239        /// ```ignore,no_run
24240        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24241        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24242        /// let x = ConversationalSearchResult::new()
24243        ///     .set_suggested_answers([
24244        ///         SuggestedAnswer::default()/* use setters */,
24245        ///         SuggestedAnswer::default()/* use (different) setters */,
24246        ///     ]);
24247        /// ```
24248        pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
24249        where
24250            T: std::iter::IntoIterator<Item = V>,
24251            V: std::convert::Into<
24252                    crate::model::search_response::conversational_search_result::SuggestedAnswer,
24253                >,
24254        {
24255            use std::iter::Iterator;
24256            self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
24257            self
24258        }
24259
24260        /// Sets the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24261        ///
24262        /// # Example
24263        /// ```ignore,no_run
24264        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24265        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24266        /// let x = ConversationalSearchResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
24267        /// ```
24268        pub fn set_additional_filter<T>(mut self, v: T) -> Self
24269        where
24270            T: std::convert::Into<
24271                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24272                >,
24273        {
24274            self.additional_filter = std::option::Option::Some(v.into());
24275            self
24276        }
24277
24278        /// Sets or clears the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24279        ///
24280        /// # Example
24281        /// ```ignore,no_run
24282        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24283        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24284        /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
24285        /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
24286        /// ```
24287        pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
24288        where
24289            T: std::convert::Into<
24290                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24291                >,
24292        {
24293            self.additional_filter = v.map(|x| x.into());
24294            self
24295        }
24296    }
24297
24298    impl wkt::message::Message for ConversationalSearchResult {
24299        fn typename() -> &'static str {
24300            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult"
24301        }
24302    }
24303
24304    /// Defines additional types related to [ConversationalSearchResult].
24305    pub mod conversational_search_result {
24306        #[allow(unused_imports)]
24307        use super::*;
24308
24309        /// Suggested answers to the follow-up question.
24310        #[derive(Clone, Default, PartialEq)]
24311        #[non_exhaustive]
24312        pub struct SuggestedAnswer {
24313            /// Product attribute value, including an attribute key and an
24314            /// attribute value. Other types can be added here in the future.
24315            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24316
24317            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24318        }
24319
24320        impl SuggestedAnswer {
24321            pub fn new() -> Self {
24322                std::default::Default::default()
24323            }
24324
24325            /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24326            ///
24327            /// # Example
24328            /// ```ignore,no_run
24329            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24330            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24331            /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24332            /// ```
24333            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24334            where
24335                T: std::convert::Into<crate::model::ProductAttributeValue>,
24336            {
24337                self.product_attribute_value = std::option::Option::Some(v.into());
24338                self
24339            }
24340
24341            /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24342            ///
24343            /// # Example
24344            /// ```ignore,no_run
24345            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24346            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24347            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24348            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24349            /// ```
24350            pub fn set_or_clear_product_attribute_value<T>(
24351                mut self,
24352                v: std::option::Option<T>,
24353            ) -> Self
24354            where
24355                T: std::convert::Into<crate::model::ProductAttributeValue>,
24356            {
24357                self.product_attribute_value = v.map(|x| x.into());
24358                self
24359            }
24360        }
24361
24362        impl wkt::message::Message for SuggestedAnswer {
24363            fn typename() -> &'static str {
24364                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer"
24365            }
24366        }
24367
24368        /// Additional filter that client side need to apply.
24369        #[derive(Clone, Default, PartialEq)]
24370        #[non_exhaustive]
24371        pub struct AdditionalFilter {
24372            /// Product attribute value, including an attribute key and an
24373            /// attribute value. Other types can be added here in the future.
24374            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24375
24376            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24377        }
24378
24379        impl AdditionalFilter {
24380            pub fn new() -> Self {
24381                std::default::Default::default()
24382            }
24383
24384            /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24385            ///
24386            /// # Example
24387            /// ```ignore,no_run
24388            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24389            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24390            /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24391            /// ```
24392            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24393            where
24394                T: std::convert::Into<crate::model::ProductAttributeValue>,
24395            {
24396                self.product_attribute_value = std::option::Option::Some(v.into());
24397                self
24398            }
24399
24400            /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24401            ///
24402            /// # Example
24403            /// ```ignore,no_run
24404            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24405            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24406            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24407            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24408            /// ```
24409            pub fn set_or_clear_product_attribute_value<T>(
24410                mut self,
24411                v: std::option::Option<T>,
24412            ) -> Self
24413            where
24414                T: std::convert::Into<crate::model::ProductAttributeValue>,
24415            {
24416                self.product_attribute_value = v.map(|x| x.into());
24417                self
24418            }
24419        }
24420
24421        impl wkt::message::Message for AdditionalFilter {
24422            fn typename() -> &'static str {
24423                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter"
24424            }
24425        }
24426    }
24427
24428    /// This field specifies all related information for tile navigation that will
24429    /// be used in client side.
24430    #[derive(Clone, Default, PartialEq)]
24431    #[non_exhaustive]
24432    pub struct TileNavigationResult {
24433        /// The current tiles that are used for tile navigation, sorted by
24434        /// engagement.
24435        pub tiles: std::vec::Vec<crate::model::Tile>,
24436
24437        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24438    }
24439
24440    impl TileNavigationResult {
24441        pub fn new() -> Self {
24442            std::default::Default::default()
24443        }
24444
24445        /// Sets the value of [tiles][crate::model::search_response::TileNavigationResult::tiles].
24446        ///
24447        /// # Example
24448        /// ```ignore,no_run
24449        /// # use google_cloud_retail_v2::model::search_response::TileNavigationResult;
24450        /// use google_cloud_retail_v2::model::Tile;
24451        /// let x = TileNavigationResult::new()
24452        ///     .set_tiles([
24453        ///         Tile::default()/* use setters */,
24454        ///         Tile::default()/* use (different) setters */,
24455        ///     ]);
24456        /// ```
24457        pub fn set_tiles<T, V>(mut self, v: T) -> Self
24458        where
24459            T: std::iter::IntoIterator<Item = V>,
24460            V: std::convert::Into<crate::model::Tile>,
24461        {
24462            use std::iter::Iterator;
24463            self.tiles = v.into_iter().map(|i| i.into()).collect();
24464            self
24465        }
24466    }
24467
24468    impl wkt::message::Message for TileNavigationResult {
24469        fn typename() -> &'static str {
24470            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.TileNavigationResult"
24471        }
24472    }
24473}
24474
24475/// Metadata for active A/B testing experiment.
24476#[derive(Clone, Default, PartialEq)]
24477#[non_exhaustive]
24478pub struct ExperimentInfo {
24479    /// The fully qualified resource name of the experiment that provides the
24480    /// serving config under test, should an active experiment exist. For example:
24481    /// `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id`
24482    pub experiment: std::string::String,
24483
24484    /// Information associated with the specific experiment entity being recorded.
24485    pub experiment_metadata: std::option::Option<crate::model::experiment_info::ExperimentMetadata>,
24486
24487    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24488}
24489
24490impl ExperimentInfo {
24491    pub fn new() -> Self {
24492        std::default::Default::default()
24493    }
24494
24495    /// Sets the value of [experiment][crate::model::ExperimentInfo::experiment].
24496    ///
24497    /// # Example
24498    /// ```ignore,no_run
24499    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24500    /// let x = ExperimentInfo::new().set_experiment("example");
24501    /// ```
24502    pub fn set_experiment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24503        self.experiment = v.into();
24504        self
24505    }
24506
24507    /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata].
24508    ///
24509    /// Note that all the setters affecting `experiment_metadata` are mutually
24510    /// exclusive.
24511    ///
24512    /// # Example
24513    /// ```ignore,no_run
24514    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24515    /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24516    /// let x = ExperimentInfo::new().set_experiment_metadata(Some(
24517    ///     google_cloud_retail_v2::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(ServingConfigExperiment::default().into())));
24518    /// ```
24519    pub fn set_experiment_metadata<
24520        T: std::convert::Into<std::option::Option<crate::model::experiment_info::ExperimentMetadata>>,
24521    >(
24522        mut self,
24523        v: T,
24524    ) -> Self {
24525        self.experiment_metadata = v.into();
24526        self
24527    }
24528
24529    /// The value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24530    /// if it holds a `ServingConfigExperiment`, `None` if the field is not set or
24531    /// holds a different branch.
24532    pub fn serving_config_experiment(
24533        &self,
24534    ) -> std::option::Option<&std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>
24535    {
24536        #[allow(unreachable_patterns)]
24537        self.experiment_metadata.as_ref().and_then(|v| match v {
24538            crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v) => {
24539                std::option::Option::Some(v)
24540            }
24541            _ => std::option::Option::None,
24542        })
24543    }
24544
24545    /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24546    /// to hold a `ServingConfigExperiment`.
24547    ///
24548    /// Note that all the setters affecting `experiment_metadata` are
24549    /// mutually exclusive.
24550    ///
24551    /// # Example
24552    /// ```ignore,no_run
24553    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24554    /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24555    /// let x = ExperimentInfo::new().set_serving_config_experiment(ServingConfigExperiment::default()/* use setters */);
24556    /// assert!(x.serving_config_experiment().is_some());
24557    /// ```
24558    pub fn set_serving_config_experiment<
24559        T: std::convert::Into<std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>,
24560    >(
24561        mut self,
24562        v: T,
24563    ) -> Self {
24564        self.experiment_metadata = std::option::Option::Some(
24565            crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v.into()),
24566        );
24567        self
24568    }
24569}
24570
24571impl wkt::message::Message for ExperimentInfo {
24572    fn typename() -> &'static str {
24573        "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo"
24574    }
24575}
24576
24577/// Defines additional types related to [ExperimentInfo].
24578pub mod experiment_info {
24579    #[allow(unused_imports)]
24580    use super::*;
24581
24582    /// Metadata for active serving config A/B tests.
24583    #[derive(Clone, Default, PartialEq)]
24584    #[non_exhaustive]
24585    pub struct ServingConfigExperiment {
24586        /// The fully qualified resource name of the original
24587        /// [SearchRequest.placement][google.cloud.retail.v2.SearchRequest.placement]
24588        /// in the search request prior to reassignment by experiment API. For
24589        /// example: `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24590        ///
24591        /// [google.cloud.retail.v2.SearchRequest.placement]: crate::model::SearchRequest::placement
24592        pub original_serving_config: std::string::String,
24593
24594        /// The fully qualified resource name of the serving config
24595        /// `Experiment.VariantArm.serving_config_id` responsible for generating
24596        /// the search response. For example:
24597        /// `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24598        pub experiment_serving_config: std::string::String,
24599
24600        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24601    }
24602
24603    impl ServingConfigExperiment {
24604        pub fn new() -> Self {
24605            std::default::Default::default()
24606        }
24607
24608        /// Sets the value of [original_serving_config][crate::model::experiment_info::ServingConfigExperiment::original_serving_config].
24609        ///
24610        /// # Example
24611        /// ```ignore,no_run
24612        /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24613        /// let x = ServingConfigExperiment::new().set_original_serving_config("example");
24614        /// ```
24615        pub fn set_original_serving_config<T: std::convert::Into<std::string::String>>(
24616            mut self,
24617            v: T,
24618        ) -> Self {
24619            self.original_serving_config = v.into();
24620            self
24621        }
24622
24623        /// Sets the value of [experiment_serving_config][crate::model::experiment_info::ServingConfigExperiment::experiment_serving_config].
24624        ///
24625        /// # Example
24626        /// ```ignore,no_run
24627        /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24628        /// let x = ServingConfigExperiment::new().set_experiment_serving_config("example");
24629        /// ```
24630        pub fn set_experiment_serving_config<T: std::convert::Into<std::string::String>>(
24631            mut self,
24632            v: T,
24633        ) -> Self {
24634            self.experiment_serving_config = v.into();
24635            self
24636        }
24637    }
24638
24639    impl wkt::message::Message for ServingConfigExperiment {
24640        fn typename() -> &'static str {
24641            "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment"
24642        }
24643    }
24644
24645    /// Information associated with the specific experiment entity being recorded.
24646    #[derive(Clone, Debug, PartialEq)]
24647    #[non_exhaustive]
24648    pub enum ExperimentMetadata {
24649        /// A/B test between existing Cloud Retail Search
24650        /// [ServingConfig][google.cloud.retail.v2.ServingConfig]s.
24651        ///
24652        /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24653        ServingConfigExperiment(
24654            std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>,
24655        ),
24656    }
24657}
24658
24659/// Configures metadata that is used to generate serving time results (e.g.
24660/// search results or recommendation predictions).
24661#[derive(Clone, Default, PartialEq)]
24662#[non_exhaustive]
24663pub struct ServingConfig {
24664    /// Immutable. Fully qualified name
24665    /// `projects/*/locations/global/catalogs/*/servingConfig/*`
24666    pub name: std::string::String,
24667
24668    /// Required. The human readable serving config display name. Used in Retail
24669    /// UI.
24670    ///
24671    /// This field must be a UTF-8 encoded string with a length limit of 128
24672    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
24673    pub display_name: std::string::String,
24674
24675    /// The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
24676    /// to use at serving time. Currently only RecommendationModels are supported:
24677    /// <https://cloud.google.com/retail/recommendations-ai/docs/create-models>
24678    /// Can be changed but only to a compatible model (e.g.
24679    /// others-you-may-like CTR to others-you-may-like CVR).
24680    ///
24681    /// Required when
24682    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24683    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24684    ///
24685    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
24686    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24687    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24688    pub model_id: std::string::String,
24689
24690    /// How much price ranking we want in serving results.
24691    /// Price reranking causes product items with a similar
24692    /// recommendation probability to be ordered by price, with the
24693    /// highest-priced items first. This setting could result in a decrease in
24694    /// click-through and conversion rates.
24695    /// Allowed values are:
24696    ///
24697    /// * `no-price-reranking`
24698    /// * `low-price-reranking`
24699    /// * `medium-price-reranking`
24700    /// * `high-price-reranking`
24701    ///
24702    /// If not specified, we choose default based on model type. Default value:
24703    /// `no-price-reranking`.
24704    ///
24705    /// Can only be set if
24706    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24707    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24708    ///
24709    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24710    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24711    pub price_reranking_level: std::string::String,
24712
24713    /// Facet specifications for faceted search. If empty, no facets are returned.
24714    /// The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
24715    /// resources with only the Facet control set. These controls are assumed to be
24716    /// in the same [Catalog][google.cloud.retail.v2.Catalog] as the
24717    /// [ServingConfig][google.cloud.retail.v2.ServingConfig].
24718    /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
24719    /// is returned.
24720    ///
24721    /// Can only be set if
24722    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24723    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24724    ///
24725    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
24726    /// [google.cloud.retail.v2.Control]: crate::model::Control
24727    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24728    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24729    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24730    pub facet_control_ids: std::vec::Vec<std::string::String>,
24731
24732    /// The specification for dynamically generated facets. Notice that only
24733    /// textual facets can be dynamically generated.
24734    ///
24735    /// Can only be set if
24736    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24737    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24738    ///
24739    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24740    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24741    pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
24742
24743    /// Condition boost specifications. If a product matches multiple conditions
24744    /// in the specifications, boost scores from these specifications are all
24745    /// applied and combined in a non-linear way. Maximum number of
24746    /// specifications is 100.
24747    ///
24748    /// Notice that if both
24749    /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
24750    /// and
24751    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
24752    /// are set, the boost conditions from both places are evaluated. If a search
24753    /// request matches multiple boost conditions, the final boost score is equal
24754    /// to the sum of the boost scores from all matched boost conditions.
24755    ///
24756    /// Can only be set if
24757    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24758    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24759    ///
24760    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
24761    /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
24762    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24763    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24764    pub boost_control_ids: std::vec::Vec<std::string::String>,
24765
24766    /// Condition filter specifications. If a product matches multiple conditions
24767    /// in the specifications, filters from these specifications are all
24768    /// applied and combined via the AND operator. Maximum number of
24769    /// specifications is 100.
24770    ///
24771    /// Can only be set if
24772    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24773    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24774    ///
24775    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24776    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24777    pub filter_control_ids: std::vec::Vec<std::string::String>,
24778
24779    /// Condition redirect specifications. Only the first triggered redirect action
24780    /// is applied, even if multiple apply. Maximum number of specifications is
24781    /// 1000.
24782    ///
24783    /// Can only be set if
24784    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24785    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24786    ///
24787    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24788    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24789    pub redirect_control_ids: std::vec::Vec<std::string::String>,
24790
24791    /// Condition synonyms specifications. If multiple syonyms conditions match,
24792    /// all matching synonyms control in the list will execute. Order of controls
24793    /// in the list will not matter. Maximum number of specifications is
24794    /// 100.
24795    ///
24796    /// Can only be set if
24797    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24798    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24799    ///
24800    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24801    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24802    pub twoway_synonyms_control_ids: std::vec::Vec<std::string::String>,
24803
24804    /// Condition oneway synonyms specifications. If multiple oneway synonyms
24805    /// conditions match, all matching oneway synonyms controls in the list will
24806    /// execute. Order of controls in the list will not matter. Maximum number of
24807    /// specifications is 100.
24808    ///
24809    /// Can only be set if
24810    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24811    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24812    ///
24813    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24814    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24815    pub oneway_synonyms_control_ids: std::vec::Vec<std::string::String>,
24816
24817    /// Condition do not associate specifications. If multiple do not associate
24818    /// conditions match, all matching do not associate controls in the list will
24819    /// execute.
24820    ///
24821    /// - Order does not matter.
24822    /// - Maximum number of specifications is 100.
24823    ///
24824    /// Can only be set if
24825    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24826    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24827    ///
24828    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24829    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24830    pub do_not_associate_control_ids: std::vec::Vec<std::string::String>,
24831
24832    /// Condition replacement specifications.
24833    ///
24834    /// - Applied according to the order in the list.
24835    /// - A previously replaced term can not be re-replaced.
24836    /// - Maximum number of specifications is 100.
24837    ///
24838    /// Can only be set if
24839    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24840    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24841    ///
24842    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24843    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24844    pub replacement_control_ids: std::vec::Vec<std::string::String>,
24845
24846    /// Condition ignore specifications. If multiple ignore
24847    /// conditions match, all matching ignore controls in the list will
24848    /// execute.
24849    ///
24850    /// - Order does not matter.
24851    /// - Maximum number of specifications is 100.
24852    ///
24853    /// Can only be set if
24854    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24855    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24856    ///
24857    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24858    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24859    pub ignore_control_ids: std::vec::Vec<std::string::String>,
24860
24861    /// How much diversity to use in recommendation model results e.g.
24862    /// `medium-diversity` or `high-diversity`. Currently supported values:
24863    ///
24864    /// * `no-diversity`
24865    /// * `low-diversity`
24866    /// * `medium-diversity`
24867    /// * `high-diversity`
24868    /// * `auto-diversity`
24869    ///
24870    /// If not specified, we choose default based on recommendation model
24871    /// type. Default value: `no-diversity`.
24872    ///
24873    /// Can only be set if
24874    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24875    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24876    ///
24877    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24878    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24879    pub diversity_level: std::string::String,
24880
24881    /// What kind of diversity to use - data driven or rule based. If unset, the
24882    /// server behavior defaults to
24883    /// [RULE_BASED_DIVERSITY][google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY].
24884    ///
24885    /// [google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]: crate::model::serving_config::DiversityType::RuleBasedDiversity
24886    pub diversity_type: crate::model::serving_config::DiversityType,
24887
24888    /// Whether to add additional category filters on the `similar-items` model.
24889    /// If not specified, we enable it by default.
24890    /// Allowed values are:
24891    ///
24892    /// * `no-category-match`: No additional filtering of original results from
24893    ///   the model and the customer's filters.
24894    /// * `relaxed-category-match`: Only keep results with categories that match
24895    ///   at least one item categories in the PredictRequests's context item.
24896    ///   * If customer also sends filters in the PredictRequest, then the results
24897    ///     will satisfy both conditions (user given and category match).
24898    ///
24899    /// Can only be set if
24900    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24901    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
24902    ///
24903    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24904    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
24905    pub enable_category_filter_level: std::string::String,
24906
24907    /// When the flag is enabled, the products in the denylist will not be filtered
24908    /// out in the recommendation filtering results.
24909    pub ignore_recs_denylist: bool,
24910
24911    /// The specification for personalization spec.
24912    ///
24913    /// Can only be set if
24914    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
24915    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
24916    ///
24917    /// Notice that if both
24918    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
24919    /// and
24920    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
24921    /// are set.
24922    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
24923    /// will override
24924    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
24925    ///
24926    /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
24927    /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
24928    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
24929    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
24930    pub personalization_spec:
24931        std::option::Option<crate::model::search_request::PersonalizationSpec>,
24932
24933    /// Required. Immutable. Specifies the solution types that a serving config can
24934    /// be associated with. Currently we support setting only one type of solution.
24935    pub solution_types: std::vec::Vec<crate::model::SolutionType>,
24936
24937    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24938}
24939
24940impl ServingConfig {
24941    pub fn new() -> Self {
24942        std::default::Default::default()
24943    }
24944
24945    /// Sets the value of [name][crate::model::ServingConfig::name].
24946    ///
24947    /// # Example
24948    /// ```ignore,no_run
24949    /// # use google_cloud_retail_v2::model::ServingConfig;
24950    /// let x = ServingConfig::new().set_name("example");
24951    /// ```
24952    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24953        self.name = v.into();
24954        self
24955    }
24956
24957    /// Sets the value of [display_name][crate::model::ServingConfig::display_name].
24958    ///
24959    /// # Example
24960    /// ```ignore,no_run
24961    /// # use google_cloud_retail_v2::model::ServingConfig;
24962    /// let x = ServingConfig::new().set_display_name("example");
24963    /// ```
24964    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24965        self.display_name = v.into();
24966        self
24967    }
24968
24969    /// Sets the value of [model_id][crate::model::ServingConfig::model_id].
24970    ///
24971    /// # Example
24972    /// ```ignore,no_run
24973    /// # use google_cloud_retail_v2::model::ServingConfig;
24974    /// let x = ServingConfig::new().set_model_id("example");
24975    /// ```
24976    pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24977        self.model_id = v.into();
24978        self
24979    }
24980
24981    /// Sets the value of [price_reranking_level][crate::model::ServingConfig::price_reranking_level].
24982    ///
24983    /// # Example
24984    /// ```ignore,no_run
24985    /// # use google_cloud_retail_v2::model::ServingConfig;
24986    /// let x = ServingConfig::new().set_price_reranking_level("example");
24987    /// ```
24988    pub fn set_price_reranking_level<T: std::convert::Into<std::string::String>>(
24989        mut self,
24990        v: T,
24991    ) -> Self {
24992        self.price_reranking_level = v.into();
24993        self
24994    }
24995
24996    /// Sets the value of [facet_control_ids][crate::model::ServingConfig::facet_control_ids].
24997    ///
24998    /// # Example
24999    /// ```ignore,no_run
25000    /// # use google_cloud_retail_v2::model::ServingConfig;
25001    /// let x = ServingConfig::new().set_facet_control_ids(["a", "b", "c"]);
25002    /// ```
25003    pub fn set_facet_control_ids<T, V>(mut self, v: T) -> Self
25004    where
25005        T: std::iter::IntoIterator<Item = V>,
25006        V: std::convert::Into<std::string::String>,
25007    {
25008        use std::iter::Iterator;
25009        self.facet_control_ids = v.into_iter().map(|i| i.into()).collect();
25010        self
25011    }
25012
25013    /// Sets the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25014    ///
25015    /// # Example
25016    /// ```ignore,no_run
25017    /// # use google_cloud_retail_v2::model::ServingConfig;
25018    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25019    /// let x = ServingConfig::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
25020    /// ```
25021    pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
25022    where
25023        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25024    {
25025        self.dynamic_facet_spec = std::option::Option::Some(v.into());
25026        self
25027    }
25028
25029    /// Sets or clears the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25030    ///
25031    /// # Example
25032    /// ```ignore,no_run
25033    /// # use google_cloud_retail_v2::model::ServingConfig;
25034    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25035    /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
25036    /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
25037    /// ```
25038    pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
25039    where
25040        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25041    {
25042        self.dynamic_facet_spec = v.map(|x| x.into());
25043        self
25044    }
25045
25046    /// Sets the value of [boost_control_ids][crate::model::ServingConfig::boost_control_ids].
25047    ///
25048    /// # Example
25049    /// ```ignore,no_run
25050    /// # use google_cloud_retail_v2::model::ServingConfig;
25051    /// let x = ServingConfig::new().set_boost_control_ids(["a", "b", "c"]);
25052    /// ```
25053    pub fn set_boost_control_ids<T, V>(mut self, v: T) -> Self
25054    where
25055        T: std::iter::IntoIterator<Item = V>,
25056        V: std::convert::Into<std::string::String>,
25057    {
25058        use std::iter::Iterator;
25059        self.boost_control_ids = v.into_iter().map(|i| i.into()).collect();
25060        self
25061    }
25062
25063    /// Sets the value of [filter_control_ids][crate::model::ServingConfig::filter_control_ids].
25064    ///
25065    /// # Example
25066    /// ```ignore,no_run
25067    /// # use google_cloud_retail_v2::model::ServingConfig;
25068    /// let x = ServingConfig::new().set_filter_control_ids(["a", "b", "c"]);
25069    /// ```
25070    pub fn set_filter_control_ids<T, V>(mut self, v: T) -> Self
25071    where
25072        T: std::iter::IntoIterator<Item = V>,
25073        V: std::convert::Into<std::string::String>,
25074    {
25075        use std::iter::Iterator;
25076        self.filter_control_ids = v.into_iter().map(|i| i.into()).collect();
25077        self
25078    }
25079
25080    /// Sets the value of [redirect_control_ids][crate::model::ServingConfig::redirect_control_ids].
25081    ///
25082    /// # Example
25083    /// ```ignore,no_run
25084    /// # use google_cloud_retail_v2::model::ServingConfig;
25085    /// let x = ServingConfig::new().set_redirect_control_ids(["a", "b", "c"]);
25086    /// ```
25087    pub fn set_redirect_control_ids<T, V>(mut self, v: T) -> Self
25088    where
25089        T: std::iter::IntoIterator<Item = V>,
25090        V: std::convert::Into<std::string::String>,
25091    {
25092        use std::iter::Iterator;
25093        self.redirect_control_ids = v.into_iter().map(|i| i.into()).collect();
25094        self
25095    }
25096
25097    /// Sets the value of [twoway_synonyms_control_ids][crate::model::ServingConfig::twoway_synonyms_control_ids].
25098    ///
25099    /// # Example
25100    /// ```ignore,no_run
25101    /// # use google_cloud_retail_v2::model::ServingConfig;
25102    /// let x = ServingConfig::new().set_twoway_synonyms_control_ids(["a", "b", "c"]);
25103    /// ```
25104    pub fn set_twoway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25105    where
25106        T: std::iter::IntoIterator<Item = V>,
25107        V: std::convert::Into<std::string::String>,
25108    {
25109        use std::iter::Iterator;
25110        self.twoway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25111        self
25112    }
25113
25114    /// Sets the value of [oneway_synonyms_control_ids][crate::model::ServingConfig::oneway_synonyms_control_ids].
25115    ///
25116    /// # Example
25117    /// ```ignore,no_run
25118    /// # use google_cloud_retail_v2::model::ServingConfig;
25119    /// let x = ServingConfig::new().set_oneway_synonyms_control_ids(["a", "b", "c"]);
25120    /// ```
25121    pub fn set_oneway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25122    where
25123        T: std::iter::IntoIterator<Item = V>,
25124        V: std::convert::Into<std::string::String>,
25125    {
25126        use std::iter::Iterator;
25127        self.oneway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25128        self
25129    }
25130
25131    /// Sets the value of [do_not_associate_control_ids][crate::model::ServingConfig::do_not_associate_control_ids].
25132    ///
25133    /// # Example
25134    /// ```ignore,no_run
25135    /// # use google_cloud_retail_v2::model::ServingConfig;
25136    /// let x = ServingConfig::new().set_do_not_associate_control_ids(["a", "b", "c"]);
25137    /// ```
25138    pub fn set_do_not_associate_control_ids<T, V>(mut self, v: T) -> Self
25139    where
25140        T: std::iter::IntoIterator<Item = V>,
25141        V: std::convert::Into<std::string::String>,
25142    {
25143        use std::iter::Iterator;
25144        self.do_not_associate_control_ids = v.into_iter().map(|i| i.into()).collect();
25145        self
25146    }
25147
25148    /// Sets the value of [replacement_control_ids][crate::model::ServingConfig::replacement_control_ids].
25149    ///
25150    /// # Example
25151    /// ```ignore,no_run
25152    /// # use google_cloud_retail_v2::model::ServingConfig;
25153    /// let x = ServingConfig::new().set_replacement_control_ids(["a", "b", "c"]);
25154    /// ```
25155    pub fn set_replacement_control_ids<T, V>(mut self, v: T) -> Self
25156    where
25157        T: std::iter::IntoIterator<Item = V>,
25158        V: std::convert::Into<std::string::String>,
25159    {
25160        use std::iter::Iterator;
25161        self.replacement_control_ids = v.into_iter().map(|i| i.into()).collect();
25162        self
25163    }
25164
25165    /// Sets the value of [ignore_control_ids][crate::model::ServingConfig::ignore_control_ids].
25166    ///
25167    /// # Example
25168    /// ```ignore,no_run
25169    /// # use google_cloud_retail_v2::model::ServingConfig;
25170    /// let x = ServingConfig::new().set_ignore_control_ids(["a", "b", "c"]);
25171    /// ```
25172    pub fn set_ignore_control_ids<T, V>(mut self, v: T) -> Self
25173    where
25174        T: std::iter::IntoIterator<Item = V>,
25175        V: std::convert::Into<std::string::String>,
25176    {
25177        use std::iter::Iterator;
25178        self.ignore_control_ids = v.into_iter().map(|i| i.into()).collect();
25179        self
25180    }
25181
25182    /// Sets the value of [diversity_level][crate::model::ServingConfig::diversity_level].
25183    ///
25184    /// # Example
25185    /// ```ignore,no_run
25186    /// # use google_cloud_retail_v2::model::ServingConfig;
25187    /// let x = ServingConfig::new().set_diversity_level("example");
25188    /// ```
25189    pub fn set_diversity_level<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25190        self.diversity_level = v.into();
25191        self
25192    }
25193
25194    /// Sets the value of [diversity_type][crate::model::ServingConfig::diversity_type].
25195    ///
25196    /// # Example
25197    /// ```ignore,no_run
25198    /// # use google_cloud_retail_v2::model::ServingConfig;
25199    /// use google_cloud_retail_v2::model::serving_config::DiversityType;
25200    /// let x0 = ServingConfig::new().set_diversity_type(DiversityType::RuleBasedDiversity);
25201    /// let x1 = ServingConfig::new().set_diversity_type(DiversityType::DataDrivenDiversity);
25202    /// ```
25203    pub fn set_diversity_type<
25204        T: std::convert::Into<crate::model::serving_config::DiversityType>,
25205    >(
25206        mut self,
25207        v: T,
25208    ) -> Self {
25209        self.diversity_type = v.into();
25210        self
25211    }
25212
25213    /// Sets the value of [enable_category_filter_level][crate::model::ServingConfig::enable_category_filter_level].
25214    ///
25215    /// # Example
25216    /// ```ignore,no_run
25217    /// # use google_cloud_retail_v2::model::ServingConfig;
25218    /// let x = ServingConfig::new().set_enable_category_filter_level("example");
25219    /// ```
25220    pub fn set_enable_category_filter_level<T: std::convert::Into<std::string::String>>(
25221        mut self,
25222        v: T,
25223    ) -> Self {
25224        self.enable_category_filter_level = v.into();
25225        self
25226    }
25227
25228    /// Sets the value of [ignore_recs_denylist][crate::model::ServingConfig::ignore_recs_denylist].
25229    ///
25230    /// # Example
25231    /// ```ignore,no_run
25232    /// # use google_cloud_retail_v2::model::ServingConfig;
25233    /// let x = ServingConfig::new().set_ignore_recs_denylist(true);
25234    /// ```
25235    pub fn set_ignore_recs_denylist<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25236        self.ignore_recs_denylist = v.into();
25237        self
25238    }
25239
25240    /// Sets the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25241    ///
25242    /// # Example
25243    /// ```ignore,no_run
25244    /// # use google_cloud_retail_v2::model::ServingConfig;
25245    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25246    /// let x = ServingConfig::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
25247    /// ```
25248    pub fn set_personalization_spec<T>(mut self, v: T) -> Self
25249    where
25250        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25251    {
25252        self.personalization_spec = std::option::Option::Some(v.into());
25253        self
25254    }
25255
25256    /// Sets or clears the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25257    ///
25258    /// # Example
25259    /// ```ignore,no_run
25260    /// # use google_cloud_retail_v2::model::ServingConfig;
25261    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25262    /// let x = ServingConfig::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
25263    /// let x = ServingConfig::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
25264    /// ```
25265    pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
25266    where
25267        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25268    {
25269        self.personalization_spec = v.map(|x| x.into());
25270        self
25271    }
25272
25273    /// Sets the value of [solution_types][crate::model::ServingConfig::solution_types].
25274    ///
25275    /// # Example
25276    /// ```ignore,no_run
25277    /// # use google_cloud_retail_v2::model::ServingConfig;
25278    /// use google_cloud_retail_v2::model::SolutionType;
25279    /// let x = ServingConfig::new().set_solution_types([
25280    ///     SolutionType::Recommendation,
25281    ///     SolutionType::Search,
25282    /// ]);
25283    /// ```
25284    pub fn set_solution_types<T, V>(mut self, v: T) -> Self
25285    where
25286        T: std::iter::IntoIterator<Item = V>,
25287        V: std::convert::Into<crate::model::SolutionType>,
25288    {
25289        use std::iter::Iterator;
25290        self.solution_types = v.into_iter().map(|i| i.into()).collect();
25291        self
25292    }
25293}
25294
25295impl wkt::message::Message for ServingConfig {
25296    fn typename() -> &'static str {
25297        "type.googleapis.com/google.cloud.retail.v2.ServingConfig"
25298    }
25299}
25300
25301/// Defines additional types related to [ServingConfig].
25302pub mod serving_config {
25303    #[allow(unused_imports)]
25304    use super::*;
25305
25306    /// What type of diversity - data or rule based.
25307    ///
25308    /// # Working with unknown values
25309    ///
25310    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25311    /// additional enum variants at any time. Adding new variants is not considered
25312    /// a breaking change. Applications should write their code in anticipation of:
25313    ///
25314    /// - New values appearing in future releases of the client library, **and**
25315    /// - New values received dynamically, without application changes.
25316    ///
25317    /// Please consult the [Working with enums] section in the user guide for some
25318    /// guidelines.
25319    ///
25320    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
25321    #[derive(Clone, Debug, PartialEq)]
25322    #[non_exhaustive]
25323    pub enum DiversityType {
25324        /// Default value.
25325        Unspecified,
25326        /// Rule based diversity.
25327        RuleBasedDiversity,
25328        /// Data driven diversity.
25329        DataDrivenDiversity,
25330        /// If set, the enum was initialized with an unknown value.
25331        ///
25332        /// Applications can examine the value using [DiversityType::value] or
25333        /// [DiversityType::name].
25334        UnknownValue(diversity_type::UnknownValue),
25335    }
25336
25337    #[doc(hidden)]
25338    pub mod diversity_type {
25339        #[allow(unused_imports)]
25340        use super::*;
25341        #[derive(Clone, Debug, PartialEq)]
25342        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25343    }
25344
25345    impl DiversityType {
25346        /// Gets the enum value.
25347        ///
25348        /// Returns `None` if the enum contains an unknown value deserialized from
25349        /// the string representation of enums.
25350        pub fn value(&self) -> std::option::Option<i32> {
25351            match self {
25352                Self::Unspecified => std::option::Option::Some(0),
25353                Self::RuleBasedDiversity => std::option::Option::Some(2),
25354                Self::DataDrivenDiversity => std::option::Option::Some(3),
25355                Self::UnknownValue(u) => u.0.value(),
25356            }
25357        }
25358
25359        /// Gets the enum value as a string.
25360        ///
25361        /// Returns `None` if the enum contains an unknown value deserialized from
25362        /// the integer representation of enums.
25363        pub fn name(&self) -> std::option::Option<&str> {
25364            match self {
25365                Self::Unspecified => std::option::Option::Some("DIVERSITY_TYPE_UNSPECIFIED"),
25366                Self::RuleBasedDiversity => std::option::Option::Some("RULE_BASED_DIVERSITY"),
25367                Self::DataDrivenDiversity => std::option::Option::Some("DATA_DRIVEN_DIVERSITY"),
25368                Self::UnknownValue(u) => u.0.name(),
25369            }
25370        }
25371    }
25372
25373    impl std::default::Default for DiversityType {
25374        fn default() -> Self {
25375            use std::convert::From;
25376            Self::from(0)
25377        }
25378    }
25379
25380    impl std::fmt::Display for DiversityType {
25381        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25382            wkt::internal::display_enum(f, self.name(), self.value())
25383        }
25384    }
25385
25386    impl std::convert::From<i32> for DiversityType {
25387        fn from(value: i32) -> Self {
25388            match value {
25389                0 => Self::Unspecified,
25390                2 => Self::RuleBasedDiversity,
25391                3 => Self::DataDrivenDiversity,
25392                _ => Self::UnknownValue(diversity_type::UnknownValue(
25393                    wkt::internal::UnknownEnumValue::Integer(value),
25394                )),
25395            }
25396        }
25397    }
25398
25399    impl std::convert::From<&str> for DiversityType {
25400        fn from(value: &str) -> Self {
25401            use std::string::ToString;
25402            match value {
25403                "DIVERSITY_TYPE_UNSPECIFIED" => Self::Unspecified,
25404                "RULE_BASED_DIVERSITY" => Self::RuleBasedDiversity,
25405                "DATA_DRIVEN_DIVERSITY" => Self::DataDrivenDiversity,
25406                _ => Self::UnknownValue(diversity_type::UnknownValue(
25407                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25408                )),
25409            }
25410        }
25411    }
25412
25413    impl serde::ser::Serialize for DiversityType {
25414        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25415        where
25416            S: serde::Serializer,
25417        {
25418            match self {
25419                Self::Unspecified => serializer.serialize_i32(0),
25420                Self::RuleBasedDiversity => serializer.serialize_i32(2),
25421                Self::DataDrivenDiversity => serializer.serialize_i32(3),
25422                Self::UnknownValue(u) => u.0.serialize(serializer),
25423            }
25424        }
25425    }
25426
25427    impl<'de> serde::de::Deserialize<'de> for DiversityType {
25428        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25429        where
25430            D: serde::Deserializer<'de>,
25431        {
25432            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiversityType>::new(
25433                ".google.cloud.retail.v2.ServingConfig.DiversityType",
25434            ))
25435        }
25436    }
25437}
25438
25439/// Request for CreateServingConfig method.
25440#[derive(Clone, Default, PartialEq)]
25441#[non_exhaustive]
25442pub struct CreateServingConfigRequest {
25443    /// Required. Full resource name of parent. Format:
25444    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25445    pub parent: std::string::String,
25446
25447    /// Required. The ServingConfig to create.
25448    pub serving_config: std::option::Option<crate::model::ServingConfig>,
25449
25450    /// Required. The ID to use for the ServingConfig, which will become the final
25451    /// component of the ServingConfig's resource name.
25452    ///
25453    /// This value should be 4-63 characters, and valid characters
25454    /// are /[a-z][0-9]-_/.
25455    pub serving_config_id: std::string::String,
25456
25457    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25458}
25459
25460impl CreateServingConfigRequest {
25461    pub fn new() -> Self {
25462        std::default::Default::default()
25463    }
25464
25465    /// Sets the value of [parent][crate::model::CreateServingConfigRequest::parent].
25466    ///
25467    /// # Example
25468    /// ```ignore,no_run
25469    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25470    /// let x = CreateServingConfigRequest::new().set_parent("example");
25471    /// ```
25472    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25473        self.parent = v.into();
25474        self
25475    }
25476
25477    /// Sets the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25478    ///
25479    /// # Example
25480    /// ```ignore,no_run
25481    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25482    /// use google_cloud_retail_v2::model::ServingConfig;
25483    /// let x = CreateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25484    /// ```
25485    pub fn set_serving_config<T>(mut self, v: T) -> Self
25486    where
25487        T: std::convert::Into<crate::model::ServingConfig>,
25488    {
25489        self.serving_config = std::option::Option::Some(v.into());
25490        self
25491    }
25492
25493    /// Sets or clears the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25494    ///
25495    /// # Example
25496    /// ```ignore,no_run
25497    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25498    /// use google_cloud_retail_v2::model::ServingConfig;
25499    /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25500    /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25501    /// ```
25502    pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25503    where
25504        T: std::convert::Into<crate::model::ServingConfig>,
25505    {
25506        self.serving_config = v.map(|x| x.into());
25507        self
25508    }
25509
25510    /// Sets the value of [serving_config_id][crate::model::CreateServingConfigRequest::serving_config_id].
25511    ///
25512    /// # Example
25513    /// ```ignore,no_run
25514    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25515    /// let x = CreateServingConfigRequest::new().set_serving_config_id("example");
25516    /// ```
25517    pub fn set_serving_config_id<T: std::convert::Into<std::string::String>>(
25518        mut self,
25519        v: T,
25520    ) -> Self {
25521        self.serving_config_id = v.into();
25522        self
25523    }
25524}
25525
25526impl wkt::message::Message for CreateServingConfigRequest {
25527    fn typename() -> &'static str {
25528        "type.googleapis.com/google.cloud.retail.v2.CreateServingConfigRequest"
25529    }
25530}
25531
25532/// Request for UpdateServingConfig method.
25533#[derive(Clone, Default, PartialEq)]
25534#[non_exhaustive]
25535pub struct UpdateServingConfigRequest {
25536    /// Required. The ServingConfig to update.
25537    pub serving_config: std::option::Option<crate::model::ServingConfig>,
25538
25539    /// Indicates which fields in the provided
25540    /// [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
25541    /// following are NOT supported:
25542    ///
25543    /// * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
25544    ///
25545    /// If not set, all supported fields are updated.
25546    ///
25547    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25548    /// [google.cloud.retail.v2.ServingConfig.name]: crate::model::ServingConfig::name
25549    pub update_mask: std::option::Option<wkt::FieldMask>,
25550
25551    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25552}
25553
25554impl UpdateServingConfigRequest {
25555    pub fn new() -> Self {
25556        std::default::Default::default()
25557    }
25558
25559    /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25560    ///
25561    /// # Example
25562    /// ```ignore,no_run
25563    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25564    /// use google_cloud_retail_v2::model::ServingConfig;
25565    /// let x = UpdateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25566    /// ```
25567    pub fn set_serving_config<T>(mut self, v: T) -> Self
25568    where
25569        T: std::convert::Into<crate::model::ServingConfig>,
25570    {
25571        self.serving_config = std::option::Option::Some(v.into());
25572        self
25573    }
25574
25575    /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25576    ///
25577    /// # Example
25578    /// ```ignore,no_run
25579    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25580    /// use google_cloud_retail_v2::model::ServingConfig;
25581    /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25582    /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25583    /// ```
25584    pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25585    where
25586        T: std::convert::Into<crate::model::ServingConfig>,
25587    {
25588        self.serving_config = v.map(|x| x.into());
25589        self
25590    }
25591
25592    /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25593    ///
25594    /// # Example
25595    /// ```ignore,no_run
25596    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25597    /// use wkt::FieldMask;
25598    /// let x = UpdateServingConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
25599    /// ```
25600    pub fn set_update_mask<T>(mut self, v: T) -> Self
25601    where
25602        T: std::convert::Into<wkt::FieldMask>,
25603    {
25604        self.update_mask = std::option::Option::Some(v.into());
25605        self
25606    }
25607
25608    /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25609    ///
25610    /// # Example
25611    /// ```ignore,no_run
25612    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25613    /// use wkt::FieldMask;
25614    /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
25615    /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
25616    /// ```
25617    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
25618    where
25619        T: std::convert::Into<wkt::FieldMask>,
25620    {
25621        self.update_mask = v.map(|x| x.into());
25622        self
25623    }
25624}
25625
25626impl wkt::message::Message for UpdateServingConfigRequest {
25627    fn typename() -> &'static str {
25628        "type.googleapis.com/google.cloud.retail.v2.UpdateServingConfigRequest"
25629    }
25630}
25631
25632/// Request for DeleteServingConfig method.
25633#[derive(Clone, Default, PartialEq)]
25634#[non_exhaustive]
25635pub struct DeleteServingConfigRequest {
25636    /// Required. The resource name of the ServingConfig to delete. Format:
25637    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25638    pub name: std::string::String,
25639
25640    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25641}
25642
25643impl DeleteServingConfigRequest {
25644    pub fn new() -> Self {
25645        std::default::Default::default()
25646    }
25647
25648    /// Sets the value of [name][crate::model::DeleteServingConfigRequest::name].
25649    ///
25650    /// # Example
25651    /// ```ignore,no_run
25652    /// # use google_cloud_retail_v2::model::DeleteServingConfigRequest;
25653    /// let x = DeleteServingConfigRequest::new().set_name("example");
25654    /// ```
25655    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25656        self.name = v.into();
25657        self
25658    }
25659}
25660
25661impl wkt::message::Message for DeleteServingConfigRequest {
25662    fn typename() -> &'static str {
25663        "type.googleapis.com/google.cloud.retail.v2.DeleteServingConfigRequest"
25664    }
25665}
25666
25667/// Request for GetServingConfig method.
25668#[derive(Clone, Default, PartialEq)]
25669#[non_exhaustive]
25670pub struct GetServingConfigRequest {
25671    /// Required. The resource name of the ServingConfig to get. Format:
25672    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25673    pub name: std::string::String,
25674
25675    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25676}
25677
25678impl GetServingConfigRequest {
25679    pub fn new() -> Self {
25680        std::default::Default::default()
25681    }
25682
25683    /// Sets the value of [name][crate::model::GetServingConfigRequest::name].
25684    ///
25685    /// # Example
25686    /// ```ignore,no_run
25687    /// # use google_cloud_retail_v2::model::GetServingConfigRequest;
25688    /// let x = GetServingConfigRequest::new().set_name("example");
25689    /// ```
25690    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25691        self.name = v.into();
25692        self
25693    }
25694}
25695
25696impl wkt::message::Message for GetServingConfigRequest {
25697    fn typename() -> &'static str {
25698        "type.googleapis.com/google.cloud.retail.v2.GetServingConfigRequest"
25699    }
25700}
25701
25702/// Request for ListServingConfigs method.
25703#[derive(Clone, Default, PartialEq)]
25704#[non_exhaustive]
25705pub struct ListServingConfigsRequest {
25706    /// Required. The catalog resource name. Format:
25707    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25708    pub parent: std::string::String,
25709
25710    /// Optional. Maximum number of results to return. If unspecified, defaults
25711    /// to 100. If a value greater than 100 is provided, at most 100 results are
25712    /// returned.
25713    pub page_size: i32,
25714
25715    /// Optional. A page token, received from a previous `ListServingConfigs` call.
25716    /// Provide this to retrieve the subsequent page.
25717    pub page_token: std::string::String,
25718
25719    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25720}
25721
25722impl ListServingConfigsRequest {
25723    pub fn new() -> Self {
25724        std::default::Default::default()
25725    }
25726
25727    /// Sets the value of [parent][crate::model::ListServingConfigsRequest::parent].
25728    ///
25729    /// # Example
25730    /// ```ignore,no_run
25731    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25732    /// let x = ListServingConfigsRequest::new().set_parent("example");
25733    /// ```
25734    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25735        self.parent = v.into();
25736        self
25737    }
25738
25739    /// Sets the value of [page_size][crate::model::ListServingConfigsRequest::page_size].
25740    ///
25741    /// # Example
25742    /// ```ignore,no_run
25743    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25744    /// let x = ListServingConfigsRequest::new().set_page_size(42);
25745    /// ```
25746    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
25747        self.page_size = v.into();
25748        self
25749    }
25750
25751    /// Sets the value of [page_token][crate::model::ListServingConfigsRequest::page_token].
25752    ///
25753    /// # Example
25754    /// ```ignore,no_run
25755    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
25756    /// let x = ListServingConfigsRequest::new().set_page_token("example");
25757    /// ```
25758    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25759        self.page_token = v.into();
25760        self
25761    }
25762}
25763
25764impl wkt::message::Message for ListServingConfigsRequest {
25765    fn typename() -> &'static str {
25766        "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsRequest"
25767    }
25768}
25769
25770/// Response for ListServingConfigs method.
25771#[derive(Clone, Default, PartialEq)]
25772#[non_exhaustive]
25773pub struct ListServingConfigsResponse {
25774    /// All the ServingConfigs for a given catalog.
25775    pub serving_configs: std::vec::Vec<crate::model::ServingConfig>,
25776
25777    /// Pagination token, if not returned indicates the last page.
25778    pub next_page_token: std::string::String,
25779
25780    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25781}
25782
25783impl ListServingConfigsResponse {
25784    pub fn new() -> Self {
25785        std::default::Default::default()
25786    }
25787
25788    /// Sets the value of [serving_configs][crate::model::ListServingConfigsResponse::serving_configs].
25789    ///
25790    /// # Example
25791    /// ```ignore,no_run
25792    /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
25793    /// use google_cloud_retail_v2::model::ServingConfig;
25794    /// let x = ListServingConfigsResponse::new()
25795    ///     .set_serving_configs([
25796    ///         ServingConfig::default()/* use setters */,
25797    ///         ServingConfig::default()/* use (different) setters */,
25798    ///     ]);
25799    /// ```
25800    pub fn set_serving_configs<T, V>(mut self, v: T) -> Self
25801    where
25802        T: std::iter::IntoIterator<Item = V>,
25803        V: std::convert::Into<crate::model::ServingConfig>,
25804    {
25805        use std::iter::Iterator;
25806        self.serving_configs = v.into_iter().map(|i| i.into()).collect();
25807        self
25808    }
25809
25810    /// Sets the value of [next_page_token][crate::model::ListServingConfigsResponse::next_page_token].
25811    ///
25812    /// # Example
25813    /// ```ignore,no_run
25814    /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
25815    /// let x = ListServingConfigsResponse::new().set_next_page_token("example");
25816    /// ```
25817    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25818        self.next_page_token = v.into();
25819        self
25820    }
25821}
25822
25823impl wkt::message::Message for ListServingConfigsResponse {
25824    fn typename() -> &'static str {
25825        "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsResponse"
25826    }
25827}
25828
25829#[doc(hidden)]
25830impl google_cloud_gax::paginator::internal::PageableResponse for ListServingConfigsResponse {
25831    type PageItem = crate::model::ServingConfig;
25832
25833    fn items(self) -> std::vec::Vec<Self::PageItem> {
25834        self.serving_configs
25835    }
25836
25837    fn next_page_token(&self) -> std::string::String {
25838        use std::clone::Clone;
25839        self.next_page_token.clone()
25840    }
25841}
25842
25843/// Request for AddControl method.
25844#[derive(Clone, Default, PartialEq)]
25845#[non_exhaustive]
25846pub struct AddControlRequest {
25847    /// Required. The source ServingConfig resource name . Format:
25848    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25849    pub serving_config: std::string::String,
25850
25851    /// Required. The id of the control to apply. Assumed to be in the same catalog
25852    /// as the serving config - if id is not found a NOT_FOUND error is returned.
25853    pub control_id: std::string::String,
25854
25855    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25856}
25857
25858impl AddControlRequest {
25859    pub fn new() -> Self {
25860        std::default::Default::default()
25861    }
25862
25863    /// Sets the value of [serving_config][crate::model::AddControlRequest::serving_config].
25864    ///
25865    /// # Example
25866    /// ```ignore,no_run
25867    /// # use google_cloud_retail_v2::model::AddControlRequest;
25868    /// let x = AddControlRequest::new().set_serving_config("example");
25869    /// ```
25870    pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25871        self.serving_config = v.into();
25872        self
25873    }
25874
25875    /// Sets the value of [control_id][crate::model::AddControlRequest::control_id].
25876    ///
25877    /// # Example
25878    /// ```ignore,no_run
25879    /// # use google_cloud_retail_v2::model::AddControlRequest;
25880    /// let x = AddControlRequest::new().set_control_id("example");
25881    /// ```
25882    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25883        self.control_id = v.into();
25884        self
25885    }
25886}
25887
25888impl wkt::message::Message for AddControlRequest {
25889    fn typename() -> &'static str {
25890        "type.googleapis.com/google.cloud.retail.v2.AddControlRequest"
25891    }
25892}
25893
25894/// Request for RemoveControl method.
25895#[derive(Clone, Default, PartialEq)]
25896#[non_exhaustive]
25897pub struct RemoveControlRequest {
25898    /// Required. The source ServingConfig resource name . Format:
25899    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25900    pub serving_config: std::string::String,
25901
25902    /// Required. The id of the control to apply. Assumed to be in the same catalog
25903    /// as the serving config.
25904    pub control_id: std::string::String,
25905
25906    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25907}
25908
25909impl RemoveControlRequest {
25910    pub fn new() -> Self {
25911        std::default::Default::default()
25912    }
25913
25914    /// Sets the value of [serving_config][crate::model::RemoveControlRequest::serving_config].
25915    ///
25916    /// # Example
25917    /// ```ignore,no_run
25918    /// # use google_cloud_retail_v2::model::RemoveControlRequest;
25919    /// let x = RemoveControlRequest::new().set_serving_config("example");
25920    /// ```
25921    pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25922        self.serving_config = v.into();
25923        self
25924    }
25925
25926    /// Sets the value of [control_id][crate::model::RemoveControlRequest::control_id].
25927    ///
25928    /// # Example
25929    /// ```ignore,no_run
25930    /// # use google_cloud_retail_v2::model::RemoveControlRequest;
25931    /// let x = RemoveControlRequest::new().set_control_id("example");
25932    /// ```
25933    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25934        self.control_id = v.into();
25935        self
25936    }
25937}
25938
25939impl wkt::message::Message for RemoveControlRequest {
25940    fn typename() -> &'static str {
25941        "type.googleapis.com/google.cloud.retail.v2.RemoveControlRequest"
25942    }
25943}
25944
25945/// UserEvent captures all metadata information Retail API needs to know about
25946/// how end users interact with customers' website.
25947#[derive(Clone, Default, PartialEq)]
25948#[non_exhaustive]
25949pub struct UserEvent {
25950    /// Required. User event type. Allowed values are:
25951    ///
25952    /// * `add-to-cart`: Products being added to cart.
25953    /// * `remove-from-cart`: Products being removed from cart.
25954    /// * `category-page-view`: Special pages such as sale or promotion pages
25955    ///   viewed.
25956    /// * `detail-page-view`: Products detail page viewed.
25957    /// * `home-page-view`: Homepage viewed.
25958    /// * `purchase-complete`: User finishing a purchase.
25959    /// * `search`: Product search.
25960    /// * `shopping-cart-page-view`: User viewing a shopping cart.
25961    pub event_type: std::string::String,
25962
25963    /// Required. A unique identifier for tracking visitors.
25964    ///
25965    /// For example, this could be implemented with an HTTP cookie, which should be
25966    /// able to uniquely identify a visitor on a single device. This unique
25967    /// identifier should not change if the visitor log in/out of the website.
25968    ///
25969    /// Don't set the field to the same fixed ID for different users. This mixes
25970    /// the event history of those users together, which results in degraded model
25971    /// quality.
25972    ///
25973    /// The field must be a UTF-8 encoded string with a length limit of 128
25974    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
25975    ///
25976    /// The field should not contain PII or user-data. We recommend to use Google
25977    /// Analytics [Client
25978    /// ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
25979    /// for this field.
25980    pub visitor_id: std::string::String,
25981
25982    /// A unique identifier for tracking a visitor session with a length limit of
25983    /// 128 bytes. A session is an aggregation of an end user behavior in a time
25984    /// span.
25985    ///
25986    /// A general guideline to populate the session_id:
25987    ///
25988    /// 1. If user has no activity for 30 min, a new session_id should be assigned.
25989    /// 1. The session_id should be unique across users, suggest use uuid or add
25990    ///    visitor_id as prefix.
25991    pub session_id: std::string::String,
25992
25993    /// Only required for
25994    /// [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
25995    /// method. Timestamp of when the user event happened.
25996    ///
25997    /// [google.cloud.retail.v2.UserEventService.ImportUserEvents]: crate::client::UserEventService::import_user_events
25998    pub event_time: std::option::Option<wkt::Timestamp>,
25999
26000    /// A list of identifiers for the independent experiment groups this user event
26001    /// belongs to. This is used to distinguish between user events associated with
26002    /// different experiment setups (e.g. using Retail API, using different
26003    /// recommendation models).
26004    pub experiment_ids: std::vec::Vec<std::string::String>,
26005
26006    /// Highly recommended for user events that are the result of
26007    /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26008    /// This field enables accurate attribution of recommendation model
26009    /// performance.
26010    ///
26011    /// The value must be a valid
26012    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26013    /// for user events that are the result of
26014    /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26015    /// The value must be a valid
26016    /// [SearchResponse.attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
26017    /// for user events that are the result of
26018    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
26019    ///
26020    /// This token enables us to accurately attribute page view or purchase back to
26021    /// the event and the particular predict response containing this
26022    /// clicked/purchased product. If user clicks on product K in the
26023    /// recommendation results, pass
26024    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26025    /// as a URL parameter to product K's page. When recording events on product
26026    /// K's page, log the
26027    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26028    /// to this field.
26029    ///
26030    /// [google.cloud.retail.v2.PredictResponse.attribution_token]: crate::model::PredictResponse::attribution_token
26031    /// [google.cloud.retail.v2.PredictionService.Predict]: crate::client::PredictionService::predict
26032    /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
26033    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
26034    pub attribution_token: std::string::String,
26035
26036    /// The main product details related to the event.
26037    ///
26038    /// This field is optional except for the following event types:
26039    ///
26040    /// * `add-to-cart`
26041    /// * `detail-page-view`
26042    /// * `purchase-complete`
26043    ///
26044    /// In a `search` event, this field represents the products returned to the end
26045    /// user on the current page (the end user may have not finished browsing the
26046    /// whole page yet). When a new page is returned to the end user, after
26047    /// pagination/filtering/ordering even for the same query, a new `search` event
26048    /// with different
26049    /// [product_details][google.cloud.retail.v2.UserEvent.product_details] is
26050    /// desired. The end user may have not finished browsing the whole page yet.
26051    ///
26052    /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
26053    pub product_details: std::vec::Vec<crate::model::ProductDetail>,
26054
26055    /// The main auto-completion details related to the event.
26056    ///
26057    /// This field should be set for `search` event when autocomplete function is
26058    /// enabled and the user clicks a suggestion for search.
26059    pub completion_detail: std::option::Option<crate::model::CompletionDetail>,
26060
26061    /// Extra user event features to include in the recommendation model.
26062    ///
26063    /// If you provide custom attributes for ingested user events, also include
26064    /// them in the user events that you associate with prediction requests. Custom
26065    /// attribute formatting must be consistent between imported events and events
26066    /// provided with prediction requests. This lets the Retail API use
26067    /// those custom attributes when training models and serving predictions, which
26068    /// helps improve recommendation quality.
26069    ///
26070    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
26071    /// error is returned:
26072    ///
26073    /// * The key must be a UTF-8 encoded string with a length limit of 5,000
26074    ///   characters.
26075    /// * For text attributes, at most 400 values are allowed. Empty values are not
26076    ///   allowed. Each value must be a UTF-8 encoded string with a length limit of
26077    ///   256 characters.
26078    /// * For number attributes, at most 400 values are allowed.
26079    ///
26080    /// For product recommendations, an example of extra user information is
26081    /// traffic_channel, which is how a user arrives at the site. Users can arrive
26082    /// at the site by coming to the site directly, coming through Google
26083    /// search, or in other ways.
26084    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
26085
26086    /// The ID or name of the associated shopping cart. This ID is used
26087    /// to associate multiple items added or present in the cart before purchase.
26088    ///
26089    /// This can only be set for `add-to-cart`, `purchase-complete`, or
26090    /// `shopping-cart-page-view` events.
26091    pub cart_id: std::string::String,
26092
26093    /// A transaction represents the entire purchase transaction.
26094    ///
26095    /// Required for `purchase-complete` events. Other event types should not set
26096    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26097    pub purchase_transaction: std::option::Option<crate::model::PurchaseTransaction>,
26098
26099    /// The user's search query.
26100    ///
26101    /// See [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] for
26102    /// definition.
26103    ///
26104    /// The value must be a UTF-8 encoded string with a length limit of 5,000
26105    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26106    ///
26107    /// At least one of
26108    /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26109    /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26110    /// required for `search` events. Other event types should not set this field.
26111    /// Otherwise, an INVALID_ARGUMENT error is returned.
26112    ///
26113    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
26114    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26115    /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26116    pub search_query: std::string::String,
26117
26118    /// The filter syntax consists of an expression language for constructing a
26119    /// predicate from one or more fields of the products being filtered.
26120    ///
26121    /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
26122    /// definition and syntax.
26123    ///
26124    /// The value must be a UTF-8 encoded string with a length limit of 1,000
26125    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26126    ///
26127    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
26128    pub filter: std::string::String,
26129
26130    /// The order in which products are returned.
26131    ///
26132    /// See [SearchRequest.order_by][google.cloud.retail.v2.SearchRequest.order_by]
26133    /// for definition and syntax.
26134    ///
26135    /// The value must be a UTF-8 encoded string with a length limit of 1,000
26136    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26137    ///
26138    /// This can only be set for `search` events. Other event types should not set
26139    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26140    ///
26141    /// [google.cloud.retail.v2.SearchRequest.order_by]: crate::model::SearchRequest::order_by
26142    pub order_by: std::string::String,
26143
26144    /// An integer that specifies the current offset for pagination (the 0-indexed
26145    /// starting location, amongst the products deemed by the API as relevant).
26146    ///
26147    /// See [SearchRequest.offset][google.cloud.retail.v2.SearchRequest.offset] for
26148    /// definition.
26149    ///
26150    /// If this field is negative, an INVALID_ARGUMENT is returned.
26151    ///
26152    /// This can only be set for `search` events. Other event types should not set
26153    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26154    ///
26155    /// [google.cloud.retail.v2.SearchRequest.offset]: crate::model::SearchRequest::offset
26156    pub offset: i32,
26157
26158    /// The categories associated with a category page.
26159    ///
26160    /// To represent full path of category, use '>' sign to separate different
26161    /// hierarchies. If '>' is part of the category name, replace it with
26162    /// other character(s).
26163    ///
26164    /// Category pages include special pages such as sales or promotions. For
26165    /// instance, a special sale page may have the category hierarchy:
26166    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
26167    ///
26168    /// Required for `category-page-view` events. At least one of
26169    /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26170    /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26171    /// required for `search` events. Other event types should not set this field.
26172    /// Otherwise, an INVALID_ARGUMENT error is returned.
26173    ///
26174    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26175    /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26176    pub page_categories: std::vec::Vec<std::string::String>,
26177
26178    /// User information.
26179    pub user_info: std::option::Option<crate::model::UserInfo>,
26180
26181    /// Complete URL (window.location.href) of the user's current page.
26182    ///
26183    /// When using the client side event reporting with JavaScript pixel and Google
26184    /// Tag Manager, this value is filled in automatically. Maximum length 5,000
26185    /// characters.
26186    pub uri: std::string::String,
26187
26188    /// The referrer URL of the current page.
26189    ///
26190    /// When using the client side event reporting with JavaScript pixel and Google
26191    /// Tag Manager, this value is filled in automatically.
26192    pub referrer_uri: std::string::String,
26193
26194    /// A unique ID of a web page view.
26195    ///
26196    /// This should be kept the same for all user events triggered from the same
26197    /// pageview. For example, an item detail page view could trigger multiple
26198    /// events as the user is browsing the page. The `pageViewId` property should
26199    /// be kept the same for all these events so that they can be grouped together
26200    /// properly.
26201    ///
26202    /// When using the client side event reporting with JavaScript pixel and Google
26203    /// Tag Manager, this value is filled in automatically.
26204    pub page_view_id: std::string::String,
26205
26206    /// The entity for customers that may run multiple different entities, domains,
26207    /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
26208    /// `google.com`, `youtube.com`, etc.
26209    /// We recommend that you set this field to get better per-entity search,
26210    /// completion, and prediction results.
26211    pub entity: std::string::String,
26212
26213    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26214}
26215
26216impl UserEvent {
26217    pub fn new() -> Self {
26218        std::default::Default::default()
26219    }
26220
26221    /// Sets the value of [event_type][crate::model::UserEvent::event_type].
26222    ///
26223    /// # Example
26224    /// ```ignore,no_run
26225    /// # use google_cloud_retail_v2::model::UserEvent;
26226    /// let x = UserEvent::new().set_event_type("example");
26227    /// ```
26228    pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26229        self.event_type = v.into();
26230        self
26231    }
26232
26233    /// Sets the value of [visitor_id][crate::model::UserEvent::visitor_id].
26234    ///
26235    /// # Example
26236    /// ```ignore,no_run
26237    /// # use google_cloud_retail_v2::model::UserEvent;
26238    /// let x = UserEvent::new().set_visitor_id("example");
26239    /// ```
26240    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26241        self.visitor_id = v.into();
26242        self
26243    }
26244
26245    /// Sets the value of [session_id][crate::model::UserEvent::session_id].
26246    ///
26247    /// # Example
26248    /// ```ignore,no_run
26249    /// # use google_cloud_retail_v2::model::UserEvent;
26250    /// let x = UserEvent::new().set_session_id("example");
26251    /// ```
26252    pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26253        self.session_id = v.into();
26254        self
26255    }
26256
26257    /// Sets the value of [event_time][crate::model::UserEvent::event_time].
26258    ///
26259    /// # Example
26260    /// ```ignore,no_run
26261    /// # use google_cloud_retail_v2::model::UserEvent;
26262    /// use wkt::Timestamp;
26263    /// let x = UserEvent::new().set_event_time(Timestamp::default()/* use setters */);
26264    /// ```
26265    pub fn set_event_time<T>(mut self, v: T) -> Self
26266    where
26267        T: std::convert::Into<wkt::Timestamp>,
26268    {
26269        self.event_time = std::option::Option::Some(v.into());
26270        self
26271    }
26272
26273    /// Sets or clears the value of [event_time][crate::model::UserEvent::event_time].
26274    ///
26275    /// # Example
26276    /// ```ignore,no_run
26277    /// # use google_cloud_retail_v2::model::UserEvent;
26278    /// use wkt::Timestamp;
26279    /// let x = UserEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
26280    /// let x = UserEvent::new().set_or_clear_event_time(None::<Timestamp>);
26281    /// ```
26282    pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
26283    where
26284        T: std::convert::Into<wkt::Timestamp>,
26285    {
26286        self.event_time = v.map(|x| x.into());
26287        self
26288    }
26289
26290    /// Sets the value of [experiment_ids][crate::model::UserEvent::experiment_ids].
26291    ///
26292    /// # Example
26293    /// ```ignore,no_run
26294    /// # use google_cloud_retail_v2::model::UserEvent;
26295    /// let x = UserEvent::new().set_experiment_ids(["a", "b", "c"]);
26296    /// ```
26297    pub fn set_experiment_ids<T, V>(mut self, v: T) -> Self
26298    where
26299        T: std::iter::IntoIterator<Item = V>,
26300        V: std::convert::Into<std::string::String>,
26301    {
26302        use std::iter::Iterator;
26303        self.experiment_ids = v.into_iter().map(|i| i.into()).collect();
26304        self
26305    }
26306
26307    /// Sets the value of [attribution_token][crate::model::UserEvent::attribution_token].
26308    ///
26309    /// # Example
26310    /// ```ignore,no_run
26311    /// # use google_cloud_retail_v2::model::UserEvent;
26312    /// let x = UserEvent::new().set_attribution_token("example");
26313    /// ```
26314    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
26315        mut self,
26316        v: T,
26317    ) -> Self {
26318        self.attribution_token = v.into();
26319        self
26320    }
26321
26322    /// Sets the value of [product_details][crate::model::UserEvent::product_details].
26323    ///
26324    /// # Example
26325    /// ```ignore,no_run
26326    /// # use google_cloud_retail_v2::model::UserEvent;
26327    /// use google_cloud_retail_v2::model::ProductDetail;
26328    /// let x = UserEvent::new()
26329    ///     .set_product_details([
26330    ///         ProductDetail::default()/* use setters */,
26331    ///         ProductDetail::default()/* use (different) setters */,
26332    ///     ]);
26333    /// ```
26334    pub fn set_product_details<T, V>(mut self, v: T) -> Self
26335    where
26336        T: std::iter::IntoIterator<Item = V>,
26337        V: std::convert::Into<crate::model::ProductDetail>,
26338    {
26339        use std::iter::Iterator;
26340        self.product_details = v.into_iter().map(|i| i.into()).collect();
26341        self
26342    }
26343
26344    /// Sets the value of [completion_detail][crate::model::UserEvent::completion_detail].
26345    ///
26346    /// # Example
26347    /// ```ignore,no_run
26348    /// # use google_cloud_retail_v2::model::UserEvent;
26349    /// use google_cloud_retail_v2::model::CompletionDetail;
26350    /// let x = UserEvent::new().set_completion_detail(CompletionDetail::default()/* use setters */);
26351    /// ```
26352    pub fn set_completion_detail<T>(mut self, v: T) -> Self
26353    where
26354        T: std::convert::Into<crate::model::CompletionDetail>,
26355    {
26356        self.completion_detail = std::option::Option::Some(v.into());
26357        self
26358    }
26359
26360    /// Sets or clears the value of [completion_detail][crate::model::UserEvent::completion_detail].
26361    ///
26362    /// # Example
26363    /// ```ignore,no_run
26364    /// # use google_cloud_retail_v2::model::UserEvent;
26365    /// use google_cloud_retail_v2::model::CompletionDetail;
26366    /// let x = UserEvent::new().set_or_clear_completion_detail(Some(CompletionDetail::default()/* use setters */));
26367    /// let x = UserEvent::new().set_or_clear_completion_detail(None::<CompletionDetail>);
26368    /// ```
26369    pub fn set_or_clear_completion_detail<T>(mut self, v: std::option::Option<T>) -> Self
26370    where
26371        T: std::convert::Into<crate::model::CompletionDetail>,
26372    {
26373        self.completion_detail = v.map(|x| x.into());
26374        self
26375    }
26376
26377    /// Sets the value of [attributes][crate::model::UserEvent::attributes].
26378    ///
26379    /// # Example
26380    /// ```ignore,no_run
26381    /// # use google_cloud_retail_v2::model::UserEvent;
26382    /// use google_cloud_retail_v2::model::CustomAttribute;
26383    /// let x = UserEvent::new().set_attributes([
26384    ///     ("key0", CustomAttribute::default()/* use setters */),
26385    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
26386    /// ]);
26387    /// ```
26388    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
26389    where
26390        T: std::iter::IntoIterator<Item = (K, V)>,
26391        K: std::convert::Into<std::string::String>,
26392        V: std::convert::Into<crate::model::CustomAttribute>,
26393    {
26394        use std::iter::Iterator;
26395        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26396        self
26397    }
26398
26399    /// Sets the value of [cart_id][crate::model::UserEvent::cart_id].
26400    ///
26401    /// # Example
26402    /// ```ignore,no_run
26403    /// # use google_cloud_retail_v2::model::UserEvent;
26404    /// let x = UserEvent::new().set_cart_id("example");
26405    /// ```
26406    pub fn set_cart_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26407        self.cart_id = v.into();
26408        self
26409    }
26410
26411    /// Sets the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26412    ///
26413    /// # Example
26414    /// ```ignore,no_run
26415    /// # use google_cloud_retail_v2::model::UserEvent;
26416    /// use google_cloud_retail_v2::model::PurchaseTransaction;
26417    /// let x = UserEvent::new().set_purchase_transaction(PurchaseTransaction::default()/* use setters */);
26418    /// ```
26419    pub fn set_purchase_transaction<T>(mut self, v: T) -> Self
26420    where
26421        T: std::convert::Into<crate::model::PurchaseTransaction>,
26422    {
26423        self.purchase_transaction = std::option::Option::Some(v.into());
26424        self
26425    }
26426
26427    /// Sets or clears the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26428    ///
26429    /// # Example
26430    /// ```ignore,no_run
26431    /// # use google_cloud_retail_v2::model::UserEvent;
26432    /// use google_cloud_retail_v2::model::PurchaseTransaction;
26433    /// let x = UserEvent::new().set_or_clear_purchase_transaction(Some(PurchaseTransaction::default()/* use setters */));
26434    /// let x = UserEvent::new().set_or_clear_purchase_transaction(None::<PurchaseTransaction>);
26435    /// ```
26436    pub fn set_or_clear_purchase_transaction<T>(mut self, v: std::option::Option<T>) -> Self
26437    where
26438        T: std::convert::Into<crate::model::PurchaseTransaction>,
26439    {
26440        self.purchase_transaction = v.map(|x| x.into());
26441        self
26442    }
26443
26444    /// Sets the value of [search_query][crate::model::UserEvent::search_query].
26445    ///
26446    /// # Example
26447    /// ```ignore,no_run
26448    /// # use google_cloud_retail_v2::model::UserEvent;
26449    /// let x = UserEvent::new().set_search_query("example");
26450    /// ```
26451    pub fn set_search_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26452        self.search_query = v.into();
26453        self
26454    }
26455
26456    /// Sets the value of [filter][crate::model::UserEvent::filter].
26457    ///
26458    /// # Example
26459    /// ```ignore,no_run
26460    /// # use google_cloud_retail_v2::model::UserEvent;
26461    /// let x = UserEvent::new().set_filter("example");
26462    /// ```
26463    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26464        self.filter = v.into();
26465        self
26466    }
26467
26468    /// Sets the value of [order_by][crate::model::UserEvent::order_by].
26469    ///
26470    /// # Example
26471    /// ```ignore,no_run
26472    /// # use google_cloud_retail_v2::model::UserEvent;
26473    /// let x = UserEvent::new().set_order_by("example");
26474    /// ```
26475    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26476        self.order_by = v.into();
26477        self
26478    }
26479
26480    /// Sets the value of [offset][crate::model::UserEvent::offset].
26481    ///
26482    /// # Example
26483    /// ```ignore,no_run
26484    /// # use google_cloud_retail_v2::model::UserEvent;
26485    /// let x = UserEvent::new().set_offset(42);
26486    /// ```
26487    pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26488        self.offset = v.into();
26489        self
26490    }
26491
26492    /// Sets the value of [page_categories][crate::model::UserEvent::page_categories].
26493    ///
26494    /// # Example
26495    /// ```ignore,no_run
26496    /// # use google_cloud_retail_v2::model::UserEvent;
26497    /// let x = UserEvent::new().set_page_categories(["a", "b", "c"]);
26498    /// ```
26499    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
26500    where
26501        T: std::iter::IntoIterator<Item = V>,
26502        V: std::convert::Into<std::string::String>,
26503    {
26504        use std::iter::Iterator;
26505        self.page_categories = v.into_iter().map(|i| i.into()).collect();
26506        self
26507    }
26508
26509    /// Sets the value of [user_info][crate::model::UserEvent::user_info].
26510    ///
26511    /// # Example
26512    /// ```ignore,no_run
26513    /// # use google_cloud_retail_v2::model::UserEvent;
26514    /// use google_cloud_retail_v2::model::UserInfo;
26515    /// let x = UserEvent::new().set_user_info(UserInfo::default()/* use setters */);
26516    /// ```
26517    pub fn set_user_info<T>(mut self, v: T) -> Self
26518    where
26519        T: std::convert::Into<crate::model::UserInfo>,
26520    {
26521        self.user_info = std::option::Option::Some(v.into());
26522        self
26523    }
26524
26525    /// Sets or clears the value of [user_info][crate::model::UserEvent::user_info].
26526    ///
26527    /// # Example
26528    /// ```ignore,no_run
26529    /// # use google_cloud_retail_v2::model::UserEvent;
26530    /// use google_cloud_retail_v2::model::UserInfo;
26531    /// let x = UserEvent::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
26532    /// let x = UserEvent::new().set_or_clear_user_info(None::<UserInfo>);
26533    /// ```
26534    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
26535    where
26536        T: std::convert::Into<crate::model::UserInfo>,
26537    {
26538        self.user_info = v.map(|x| x.into());
26539        self
26540    }
26541
26542    /// Sets the value of [uri][crate::model::UserEvent::uri].
26543    ///
26544    /// # Example
26545    /// ```ignore,no_run
26546    /// # use google_cloud_retail_v2::model::UserEvent;
26547    /// let x = UserEvent::new().set_uri("example");
26548    /// ```
26549    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26550        self.uri = v.into();
26551        self
26552    }
26553
26554    /// Sets the value of [referrer_uri][crate::model::UserEvent::referrer_uri].
26555    ///
26556    /// # Example
26557    /// ```ignore,no_run
26558    /// # use google_cloud_retail_v2::model::UserEvent;
26559    /// let x = UserEvent::new().set_referrer_uri("example");
26560    /// ```
26561    pub fn set_referrer_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26562        self.referrer_uri = v.into();
26563        self
26564    }
26565
26566    /// Sets the value of [page_view_id][crate::model::UserEvent::page_view_id].
26567    ///
26568    /// # Example
26569    /// ```ignore,no_run
26570    /// # use google_cloud_retail_v2::model::UserEvent;
26571    /// let x = UserEvent::new().set_page_view_id("example");
26572    /// ```
26573    pub fn set_page_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26574        self.page_view_id = v.into();
26575        self
26576    }
26577
26578    /// Sets the value of [entity][crate::model::UserEvent::entity].
26579    ///
26580    /// # Example
26581    /// ```ignore,no_run
26582    /// # use google_cloud_retail_v2::model::UserEvent;
26583    /// let x = UserEvent::new().set_entity("example");
26584    /// ```
26585    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26586        self.entity = v.into();
26587        self
26588    }
26589}
26590
26591impl wkt::message::Message for UserEvent {
26592    fn typename() -> &'static str {
26593        "type.googleapis.com/google.cloud.retail.v2.UserEvent"
26594    }
26595}
26596
26597/// Detailed product information associated with a user event.
26598#[derive(Clone, Default, PartialEq)]
26599#[non_exhaustive]
26600pub struct ProductDetail {
26601    /// Required. [Product][google.cloud.retail.v2.Product] information.
26602    ///
26603    /// Required field(s):
26604    ///
26605    /// * [Product.id][google.cloud.retail.v2.Product.id]
26606    ///
26607    /// Optional override field(s):
26608    ///
26609    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
26610    ///
26611    /// If any supported optional fields are provided, we will treat them as a full
26612    /// override when looking up product information from the catalog. Thus, it is
26613    /// important to ensure that the overriding fields are accurate and
26614    /// complete.
26615    ///
26616    /// All other product fields are ignored and instead populated via catalog
26617    /// lookup after event ingestion.
26618    ///
26619    /// [google.cloud.retail.v2.Product]: crate::model::Product
26620    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
26621    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
26622    pub product: std::option::Option<crate::model::Product>,
26623
26624    /// Quantity of the product associated with the user event.
26625    ///
26626    /// For example, this field will be 2 if two products are added to the shopping
26627    /// cart for `purchase-complete` event. Required for `add-to-cart` and
26628    /// `purchase-complete` event types.
26629    pub quantity: std::option::Option<wkt::Int32Value>,
26630
26631    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26632}
26633
26634impl ProductDetail {
26635    pub fn new() -> Self {
26636        std::default::Default::default()
26637    }
26638
26639    /// Sets the value of [product][crate::model::ProductDetail::product].
26640    ///
26641    /// # Example
26642    /// ```ignore,no_run
26643    /// # use google_cloud_retail_v2::model::ProductDetail;
26644    /// use google_cloud_retail_v2::model::Product;
26645    /// let x = ProductDetail::new().set_product(Product::default()/* use setters */);
26646    /// ```
26647    pub fn set_product<T>(mut self, v: T) -> Self
26648    where
26649        T: std::convert::Into<crate::model::Product>,
26650    {
26651        self.product = std::option::Option::Some(v.into());
26652        self
26653    }
26654
26655    /// Sets or clears the value of [product][crate::model::ProductDetail::product].
26656    ///
26657    /// # Example
26658    /// ```ignore,no_run
26659    /// # use google_cloud_retail_v2::model::ProductDetail;
26660    /// use google_cloud_retail_v2::model::Product;
26661    /// let x = ProductDetail::new().set_or_clear_product(Some(Product::default()/* use setters */));
26662    /// let x = ProductDetail::new().set_or_clear_product(None::<Product>);
26663    /// ```
26664    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
26665    where
26666        T: std::convert::Into<crate::model::Product>,
26667    {
26668        self.product = v.map(|x| x.into());
26669        self
26670    }
26671
26672    /// Sets the value of [quantity][crate::model::ProductDetail::quantity].
26673    ///
26674    /// # Example
26675    /// ```ignore,no_run
26676    /// # use google_cloud_retail_v2::model::ProductDetail;
26677    /// use wkt::Int32Value;
26678    /// let x = ProductDetail::new().set_quantity(Int32Value::default()/* use setters */);
26679    /// ```
26680    pub fn set_quantity<T>(mut self, v: T) -> Self
26681    where
26682        T: std::convert::Into<wkt::Int32Value>,
26683    {
26684        self.quantity = std::option::Option::Some(v.into());
26685        self
26686    }
26687
26688    /// Sets or clears the value of [quantity][crate::model::ProductDetail::quantity].
26689    ///
26690    /// # Example
26691    /// ```ignore,no_run
26692    /// # use google_cloud_retail_v2::model::ProductDetail;
26693    /// use wkt::Int32Value;
26694    /// let x = ProductDetail::new().set_or_clear_quantity(Some(Int32Value::default()/* use setters */));
26695    /// let x = ProductDetail::new().set_or_clear_quantity(None::<Int32Value>);
26696    /// ```
26697    pub fn set_or_clear_quantity<T>(mut self, v: std::option::Option<T>) -> Self
26698    where
26699        T: std::convert::Into<wkt::Int32Value>,
26700    {
26701        self.quantity = v.map(|x| x.into());
26702        self
26703    }
26704}
26705
26706impl wkt::message::Message for ProductDetail {
26707    fn typename() -> &'static str {
26708        "type.googleapis.com/google.cloud.retail.v2.ProductDetail"
26709    }
26710}
26711
26712/// Detailed completion information including completion attribution token and
26713/// clicked completion info.
26714#[derive(Clone, Default, PartialEq)]
26715#[non_exhaustive]
26716pub struct CompletionDetail {
26717    /// Completion attribution token in
26718    /// [CompleteQueryResponse.attribution_token][google.cloud.retail.v2.CompleteQueryResponse.attribution_token].
26719    ///
26720    /// [google.cloud.retail.v2.CompleteQueryResponse.attribution_token]: crate::model::CompleteQueryResponse::attribution_token
26721    pub completion_attribution_token: std::string::String,
26722
26723    /// End user selected
26724    /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion].
26725    ///
26726    /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26727    pub selected_suggestion: std::string::String,
26728
26729    /// End user selected
26730    /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]
26731    /// position, starting from 0.
26732    ///
26733    /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
26734    pub selected_position: i32,
26735
26736    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26737}
26738
26739impl CompletionDetail {
26740    pub fn new() -> Self {
26741        std::default::Default::default()
26742    }
26743
26744    /// Sets the value of [completion_attribution_token][crate::model::CompletionDetail::completion_attribution_token].
26745    ///
26746    /// # Example
26747    /// ```ignore,no_run
26748    /// # use google_cloud_retail_v2::model::CompletionDetail;
26749    /// let x = CompletionDetail::new().set_completion_attribution_token("example");
26750    /// ```
26751    pub fn set_completion_attribution_token<T: std::convert::Into<std::string::String>>(
26752        mut self,
26753        v: T,
26754    ) -> Self {
26755        self.completion_attribution_token = v.into();
26756        self
26757    }
26758
26759    /// Sets the value of [selected_suggestion][crate::model::CompletionDetail::selected_suggestion].
26760    ///
26761    /// # Example
26762    /// ```ignore,no_run
26763    /// # use google_cloud_retail_v2::model::CompletionDetail;
26764    /// let x = CompletionDetail::new().set_selected_suggestion("example");
26765    /// ```
26766    pub fn set_selected_suggestion<T: std::convert::Into<std::string::String>>(
26767        mut self,
26768        v: T,
26769    ) -> Self {
26770        self.selected_suggestion = v.into();
26771        self
26772    }
26773
26774    /// Sets the value of [selected_position][crate::model::CompletionDetail::selected_position].
26775    ///
26776    /// # Example
26777    /// ```ignore,no_run
26778    /// # use google_cloud_retail_v2::model::CompletionDetail;
26779    /// let x = CompletionDetail::new().set_selected_position(42);
26780    /// ```
26781    pub fn set_selected_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26782        self.selected_position = v.into();
26783        self
26784    }
26785}
26786
26787impl wkt::message::Message for CompletionDetail {
26788    fn typename() -> &'static str {
26789        "type.googleapis.com/google.cloud.retail.v2.CompletionDetail"
26790    }
26791}
26792
26793/// A transaction represents the entire purchase transaction.
26794#[derive(Clone, Default, PartialEq)]
26795#[non_exhaustive]
26796pub struct PurchaseTransaction {
26797    /// The transaction ID with a length limit of 128 characters.
26798    pub id: std::string::String,
26799
26800    /// Required. Total non-zero revenue or grand total associated with the
26801    /// transaction. This value include shipping, tax, or other adjustments to
26802    /// total revenue that you want to include as part of your revenue
26803    /// calculations.
26804    pub revenue: f32,
26805
26806    /// All the taxes associated with the transaction.
26807    pub tax: f32,
26808
26809    /// All the costs associated with the products. These can be manufacturing
26810    /// costs, shipping expenses not borne by the end user, or any other costs,
26811    /// such that:
26812    ///
26813    /// * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
26814    ///   [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
26815    ///   [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
26816    ///
26817    /// [google.cloud.retail.v2.PurchaseTransaction.cost]: crate::model::PurchaseTransaction::cost
26818    /// [google.cloud.retail.v2.PurchaseTransaction.revenue]: crate::model::PurchaseTransaction::revenue
26819    /// [google.cloud.retail.v2.PurchaseTransaction.tax]: crate::model::PurchaseTransaction::tax
26820    pub cost: f32,
26821
26822    /// Required. Currency code. Use three-character ISO-4217 code.
26823    pub currency_code: std::string::String,
26824
26825    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26826}
26827
26828impl PurchaseTransaction {
26829    pub fn new() -> Self {
26830        std::default::Default::default()
26831    }
26832
26833    /// Sets the value of [id][crate::model::PurchaseTransaction::id].
26834    ///
26835    /// # Example
26836    /// ```ignore,no_run
26837    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26838    /// let x = PurchaseTransaction::new().set_id("example");
26839    /// ```
26840    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26841        self.id = v.into();
26842        self
26843    }
26844
26845    /// Sets the value of [revenue][crate::model::PurchaseTransaction::revenue].
26846    ///
26847    /// # Example
26848    /// ```ignore,no_run
26849    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26850    /// let x = PurchaseTransaction::new().set_revenue(42.0);
26851    /// ```
26852    pub fn set_revenue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26853        self.revenue = v.into();
26854        self
26855    }
26856
26857    /// Sets the value of [tax][crate::model::PurchaseTransaction::tax].
26858    ///
26859    /// # Example
26860    /// ```ignore,no_run
26861    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26862    /// let x = PurchaseTransaction::new().set_tax(42.0);
26863    /// ```
26864    pub fn set_tax<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26865        self.tax = v.into();
26866        self
26867    }
26868
26869    /// Sets the value of [cost][crate::model::PurchaseTransaction::cost].
26870    ///
26871    /// # Example
26872    /// ```ignore,no_run
26873    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26874    /// let x = PurchaseTransaction::new().set_cost(42.0);
26875    /// ```
26876    pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
26877        self.cost = v.into();
26878        self
26879    }
26880
26881    /// Sets the value of [currency_code][crate::model::PurchaseTransaction::currency_code].
26882    ///
26883    /// # Example
26884    /// ```ignore,no_run
26885    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
26886    /// let x = PurchaseTransaction::new().set_currency_code("example");
26887    /// ```
26888    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26889        self.currency_code = v.into();
26890        self
26891    }
26892}
26893
26894impl wkt::message::Message for PurchaseTransaction {
26895    fn typename() -> &'static str {
26896        "type.googleapis.com/google.cloud.retail.v2.PurchaseTransaction"
26897    }
26898}
26899
26900/// Request message for WriteUserEvent method.
26901#[derive(Clone, Default, PartialEq)]
26902#[non_exhaustive]
26903pub struct WriteUserEventRequest {
26904    /// Required. The parent catalog resource name, such as
26905    /// `projects/1234/locations/global/catalogs/default_catalog`.
26906    pub parent: std::string::String,
26907
26908    /// Required. User event to write.
26909    pub user_event: std::option::Option<crate::model::UserEvent>,
26910
26911    /// If set to true, the user event will be written asynchronously after
26912    /// validation, and the API will respond without waiting for the write.
26913    /// Therefore, silent failures can occur even if the API returns success. In
26914    /// case of silent failures, error messages can be found in Stackdriver logs.
26915    pub write_async: bool,
26916
26917    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26918}
26919
26920impl WriteUserEventRequest {
26921    pub fn new() -> Self {
26922        std::default::Default::default()
26923    }
26924
26925    /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
26926    ///
26927    /// # Example
26928    /// ```ignore,no_run
26929    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26930    /// let x = WriteUserEventRequest::new().set_parent("example");
26931    /// ```
26932    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26933        self.parent = v.into();
26934        self
26935    }
26936
26937    /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
26938    ///
26939    /// # Example
26940    /// ```ignore,no_run
26941    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26942    /// use google_cloud_retail_v2::model::UserEvent;
26943    /// let x = WriteUserEventRequest::new().set_user_event(UserEvent::default()/* use setters */);
26944    /// ```
26945    pub fn set_user_event<T>(mut self, v: T) -> Self
26946    where
26947        T: std::convert::Into<crate::model::UserEvent>,
26948    {
26949        self.user_event = std::option::Option::Some(v.into());
26950        self
26951    }
26952
26953    /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
26954    ///
26955    /// # Example
26956    /// ```ignore,no_run
26957    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26958    /// use google_cloud_retail_v2::model::UserEvent;
26959    /// let x = WriteUserEventRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
26960    /// let x = WriteUserEventRequest::new().set_or_clear_user_event(None::<UserEvent>);
26961    /// ```
26962    pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
26963    where
26964        T: std::convert::Into<crate::model::UserEvent>,
26965    {
26966        self.user_event = v.map(|x| x.into());
26967        self
26968    }
26969
26970    /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
26971    ///
26972    /// # Example
26973    /// ```ignore,no_run
26974    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
26975    /// let x = WriteUserEventRequest::new().set_write_async(true);
26976    /// ```
26977    pub fn set_write_async<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
26978        self.write_async = v.into();
26979        self
26980    }
26981}
26982
26983impl wkt::message::Message for WriteUserEventRequest {
26984    fn typename() -> &'static str {
26985        "type.googleapis.com/google.cloud.retail.v2.WriteUserEventRequest"
26986    }
26987}
26988
26989/// Request message for CollectUserEvent method.
26990#[derive(Clone, Default, PartialEq)]
26991#[non_exhaustive]
26992pub struct CollectUserEventRequest {
26993    /// Required. The parent catalog name, such as
26994    /// `projects/1234/locations/global/catalogs/default_catalog`.
26995    pub parent: std::string::String,
26996
26997    /// Required. URL encoded UserEvent proto with a length limit of 2,000,000
26998    /// characters.
26999    pub user_event: std::string::String,
27000
27001    /// The URL including cgi-parameters but excluding the hash fragment with a
27002    /// length limit of 5,000 characters. This is often more useful than the
27003    /// referer URL, because many browsers only send the domain for 3rd party
27004    /// requests.
27005    pub uri: std::string::String,
27006
27007    /// The event timestamp in milliseconds. This prevents browser caching of
27008    /// otherwise identical get requests. The name is abbreviated to reduce the
27009    /// payload bytes.
27010    pub ets: i64,
27011
27012    /// An arbitrary serialized JSON string that contains necessary information
27013    /// that can comprise a user event. When this field is specified, the
27014    /// user_event field will be ignored. Note: line-delimited JSON is not
27015    /// supported, a single JSON only.
27016    pub raw_json: std::string::String,
27017
27018    /// The rule that can convert the raw_json to a user event. It is needed
27019    /// only when the raw_json is set.
27020    pub conversion_rule:
27021        std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27022
27023    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27024}
27025
27026impl CollectUserEventRequest {
27027    pub fn new() -> Self {
27028        std::default::Default::default()
27029    }
27030
27031    /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
27032    ///
27033    /// # Example
27034    /// ```ignore,no_run
27035    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27036    /// let x = CollectUserEventRequest::new().set_parent("example");
27037    /// ```
27038    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27039        self.parent = v.into();
27040        self
27041    }
27042
27043    /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
27044    ///
27045    /// # Example
27046    /// ```ignore,no_run
27047    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27048    /// let x = CollectUserEventRequest::new().set_user_event("example");
27049    /// ```
27050    pub fn set_user_event<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27051        self.user_event = v.into();
27052        self
27053    }
27054
27055    /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
27056    ///
27057    /// # Example
27058    /// ```ignore,no_run
27059    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27060    /// let x = CollectUserEventRequest::new().set_uri("example");
27061    /// ```
27062    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27063        self.uri = v.into();
27064        self
27065    }
27066
27067    /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
27068    ///
27069    /// # Example
27070    /// ```ignore,no_run
27071    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27072    /// let x = CollectUserEventRequest::new().set_ets(42);
27073    /// ```
27074    pub fn set_ets<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27075        self.ets = v.into();
27076        self
27077    }
27078
27079    /// Sets the value of [raw_json][crate::model::CollectUserEventRequest::raw_json].
27080    ///
27081    /// # Example
27082    /// ```ignore,no_run
27083    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27084    /// let x = CollectUserEventRequest::new().set_raw_json("example");
27085    /// ```
27086    pub fn set_raw_json<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27087        self.raw_json = v.into();
27088        self
27089    }
27090
27091    /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule].
27092    ///
27093    /// Note that all the setters affecting `conversion_rule` are mutually
27094    /// exclusive.
27095    ///
27096    /// # Example
27097    /// ```ignore,no_run
27098    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27099    /// use google_cloud_retail_v2::model::collect_user_event_request::ConversionRule;
27100    /// let x = CollectUserEventRequest::new().set_conversion_rule(Some(ConversionRule::PrebuiltRule("example".to_string())));
27101    /// ```
27102    pub fn set_conversion_rule<
27103        T: std::convert::Into<
27104                std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27105            >,
27106    >(
27107        mut self,
27108        v: T,
27109    ) -> Self {
27110        self.conversion_rule = v.into();
27111        self
27112    }
27113
27114    /// The value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27115    /// if it holds a `PrebuiltRule`, `None` if the field is not set or
27116    /// holds a different branch.
27117    pub fn prebuilt_rule(&self) -> std::option::Option<&std::string::String> {
27118        #[allow(unreachable_patterns)]
27119        self.conversion_rule.as_ref().and_then(|v| match v {
27120            crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v) => {
27121                std::option::Option::Some(v)
27122            }
27123            _ => std::option::Option::None,
27124        })
27125    }
27126
27127    /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27128    /// to hold a `PrebuiltRule`.
27129    ///
27130    /// Note that all the setters affecting `conversion_rule` are
27131    /// mutually exclusive.
27132    ///
27133    /// # Example
27134    /// ```ignore,no_run
27135    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27136    /// let x = CollectUserEventRequest::new().set_prebuilt_rule("example");
27137    /// assert!(x.prebuilt_rule().is_some());
27138    /// ```
27139    pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27140        self.conversion_rule = std::option::Option::Some(
27141            crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v.into()),
27142        );
27143        self
27144    }
27145}
27146
27147impl wkt::message::Message for CollectUserEventRequest {
27148    fn typename() -> &'static str {
27149        "type.googleapis.com/google.cloud.retail.v2.CollectUserEventRequest"
27150    }
27151}
27152
27153/// Defines additional types related to [CollectUserEventRequest].
27154pub mod collect_user_event_request {
27155    #[allow(unused_imports)]
27156    use super::*;
27157
27158    /// The rule that can convert the raw_json to a user event. It is needed
27159    /// only when the raw_json is set.
27160    #[derive(Clone, Debug, PartialEq)]
27161    #[non_exhaustive]
27162    pub enum ConversionRule {
27163        /// The prebuilt rule name that can convert a specific type of raw_json.
27164        /// For example: "ga4_bq" rule for the GA4 user event schema.
27165        PrebuiltRule(std::string::String),
27166    }
27167}
27168
27169/// Request message for RejoinUserEvents method.
27170#[derive(Clone, Default, PartialEq)]
27171#[non_exhaustive]
27172pub struct RejoinUserEventsRequest {
27173    /// Required. The parent catalog resource name, such as
27174    /// `projects/1234/locations/global/catalogs/default_catalog`.
27175    pub parent: std::string::String,
27176
27177    /// The type of the user event rejoin to define the scope and range of the user
27178    /// events to be rejoined with the latest product catalog. Defaults to
27179    /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
27180    /// an invalid integer value.
27181    pub user_event_rejoin_scope: crate::model::rejoin_user_events_request::UserEventRejoinScope,
27182
27183    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27184}
27185
27186impl RejoinUserEventsRequest {
27187    pub fn new() -> Self {
27188        std::default::Default::default()
27189    }
27190
27191    /// Sets the value of [parent][crate::model::RejoinUserEventsRequest::parent].
27192    ///
27193    /// # Example
27194    /// ```ignore,no_run
27195    /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27196    /// let x = RejoinUserEventsRequest::new().set_parent("example");
27197    /// ```
27198    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27199        self.parent = v.into();
27200        self
27201    }
27202
27203    /// Sets the value of [user_event_rejoin_scope][crate::model::RejoinUserEventsRequest::user_event_rejoin_scope].
27204    ///
27205    /// # Example
27206    /// ```ignore,no_run
27207    /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27208    /// use google_cloud_retail_v2::model::rejoin_user_events_request::UserEventRejoinScope;
27209    /// let x0 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::JoinedEvents);
27210    /// let x1 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::UnjoinedEvents);
27211    /// ```
27212    pub fn set_user_event_rejoin_scope<
27213        T: std::convert::Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
27214    >(
27215        mut self,
27216        v: T,
27217    ) -> Self {
27218        self.user_event_rejoin_scope = v.into();
27219        self
27220    }
27221}
27222
27223impl wkt::message::Message for RejoinUserEventsRequest {
27224    fn typename() -> &'static str {
27225        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsRequest"
27226    }
27227}
27228
27229/// Defines additional types related to [RejoinUserEventsRequest].
27230pub mod rejoin_user_events_request {
27231    #[allow(unused_imports)]
27232    use super::*;
27233
27234    /// The scope of user events to be rejoined with the latest product catalog.
27235    /// If the rejoining aims at reducing number of unjoined events, set
27236    /// `UserEventRejoinScope` to `UNJOINED_EVENTS`.
27237    /// If the rejoining aims at correcting product catalog information in joined
27238    /// events, set `UserEventRejoinScope` to `JOINED_EVENTS`.
27239    /// If all events needs to be rejoined, set `UserEventRejoinScope` to
27240    /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`.
27241    ///
27242    /// # Working with unknown values
27243    ///
27244    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27245    /// additional enum variants at any time. Adding new variants is not considered
27246    /// a breaking change. Applications should write their code in anticipation of:
27247    ///
27248    /// - New values appearing in future releases of the client library, **and**
27249    /// - New values received dynamically, without application changes.
27250    ///
27251    /// Please consult the [Working with enums] section in the user guide for some
27252    /// guidelines.
27253    ///
27254    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27255    #[derive(Clone, Debug, PartialEq)]
27256    #[non_exhaustive]
27257    pub enum UserEventRejoinScope {
27258        /// Rejoin all events with the latest product catalog, including both joined
27259        /// events and unjoined events.
27260        Unspecified,
27261        /// Only rejoin joined events with the latest product catalog.
27262        JoinedEvents,
27263        /// Only rejoin unjoined events with the latest product catalog.
27264        UnjoinedEvents,
27265        /// If set, the enum was initialized with an unknown value.
27266        ///
27267        /// Applications can examine the value using [UserEventRejoinScope::value] or
27268        /// [UserEventRejoinScope::name].
27269        UnknownValue(user_event_rejoin_scope::UnknownValue),
27270    }
27271
27272    #[doc(hidden)]
27273    pub mod user_event_rejoin_scope {
27274        #[allow(unused_imports)]
27275        use super::*;
27276        #[derive(Clone, Debug, PartialEq)]
27277        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27278    }
27279
27280    impl UserEventRejoinScope {
27281        /// Gets the enum value.
27282        ///
27283        /// Returns `None` if the enum contains an unknown value deserialized from
27284        /// the string representation of enums.
27285        pub fn value(&self) -> std::option::Option<i32> {
27286            match self {
27287                Self::Unspecified => std::option::Option::Some(0),
27288                Self::JoinedEvents => std::option::Option::Some(1),
27289                Self::UnjoinedEvents => std::option::Option::Some(2),
27290                Self::UnknownValue(u) => u.0.value(),
27291            }
27292        }
27293
27294        /// Gets the enum value as a string.
27295        ///
27296        /// Returns `None` if the enum contains an unknown value deserialized from
27297        /// the integer representation of enums.
27298        pub fn name(&self) -> std::option::Option<&str> {
27299            match self {
27300                Self::Unspecified => {
27301                    std::option::Option::Some("USER_EVENT_REJOIN_SCOPE_UNSPECIFIED")
27302                }
27303                Self::JoinedEvents => std::option::Option::Some("JOINED_EVENTS"),
27304                Self::UnjoinedEvents => std::option::Option::Some("UNJOINED_EVENTS"),
27305                Self::UnknownValue(u) => u.0.name(),
27306            }
27307        }
27308    }
27309
27310    impl std::default::Default for UserEventRejoinScope {
27311        fn default() -> Self {
27312            use std::convert::From;
27313            Self::from(0)
27314        }
27315    }
27316
27317    impl std::fmt::Display for UserEventRejoinScope {
27318        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27319            wkt::internal::display_enum(f, self.name(), self.value())
27320        }
27321    }
27322
27323    impl std::convert::From<i32> for UserEventRejoinScope {
27324        fn from(value: i32) -> Self {
27325            match value {
27326                0 => Self::Unspecified,
27327                1 => Self::JoinedEvents,
27328                2 => Self::UnjoinedEvents,
27329                _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27330                    wkt::internal::UnknownEnumValue::Integer(value),
27331                )),
27332            }
27333        }
27334    }
27335
27336    impl std::convert::From<&str> for UserEventRejoinScope {
27337        fn from(value: &str) -> Self {
27338            use std::string::ToString;
27339            match value {
27340                "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" => Self::Unspecified,
27341                "JOINED_EVENTS" => Self::JoinedEvents,
27342                "UNJOINED_EVENTS" => Self::UnjoinedEvents,
27343                _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27344                    wkt::internal::UnknownEnumValue::String(value.to_string()),
27345                )),
27346            }
27347        }
27348    }
27349
27350    impl serde::ser::Serialize for UserEventRejoinScope {
27351        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27352        where
27353            S: serde::Serializer,
27354        {
27355            match self {
27356                Self::Unspecified => serializer.serialize_i32(0),
27357                Self::JoinedEvents => serializer.serialize_i32(1),
27358                Self::UnjoinedEvents => serializer.serialize_i32(2),
27359                Self::UnknownValue(u) => u.0.serialize(serializer),
27360            }
27361        }
27362    }
27363
27364    impl<'de> serde::de::Deserialize<'de> for UserEventRejoinScope {
27365        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27366        where
27367            D: serde::Deserializer<'de>,
27368        {
27369            deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserEventRejoinScope>::new(
27370                ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope",
27371            ))
27372        }
27373    }
27374}
27375
27376/// Response message for `RejoinUserEvents` method.
27377#[derive(Clone, Default, PartialEq)]
27378#[non_exhaustive]
27379pub struct RejoinUserEventsResponse {
27380    /// Number of user events that were joined with latest product catalog.
27381    pub rejoined_user_events_count: i64,
27382
27383    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27384}
27385
27386impl RejoinUserEventsResponse {
27387    pub fn new() -> Self {
27388        std::default::Default::default()
27389    }
27390
27391    /// Sets the value of [rejoined_user_events_count][crate::model::RejoinUserEventsResponse::rejoined_user_events_count].
27392    ///
27393    /// # Example
27394    /// ```ignore,no_run
27395    /// # use google_cloud_retail_v2::model::RejoinUserEventsResponse;
27396    /// let x = RejoinUserEventsResponse::new().set_rejoined_user_events_count(42);
27397    /// ```
27398    pub fn set_rejoined_user_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27399        self.rejoined_user_events_count = v.into();
27400        self
27401    }
27402}
27403
27404impl wkt::message::Message for RejoinUserEventsResponse {
27405    fn typename() -> &'static str {
27406        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsResponse"
27407    }
27408}
27409
27410/// Metadata for `RejoinUserEvents` method.
27411#[derive(Clone, Default, PartialEq)]
27412#[non_exhaustive]
27413pub struct RejoinUserEventsMetadata {
27414    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27415}
27416
27417impl RejoinUserEventsMetadata {
27418    pub fn new() -> Self {
27419        std::default::Default::default()
27420    }
27421}
27422
27423impl wkt::message::Message for RejoinUserEventsMetadata {
27424    fn typename() -> &'static str {
27425        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsMetadata"
27426    }
27427}
27428
27429/// At which level we offer configuration for attributes.
27430///
27431/// # Working with unknown values
27432///
27433/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27434/// additional enum variants at any time. Adding new variants is not considered
27435/// a breaking change. Applications should write their code in anticipation of:
27436///
27437/// - New values appearing in future releases of the client library, **and**
27438/// - New values received dynamically, without application changes.
27439///
27440/// Please consult the [Working with enums] section in the user guide for some
27441/// guidelines.
27442///
27443/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27444#[derive(Clone, Debug, PartialEq)]
27445#[non_exhaustive]
27446pub enum AttributeConfigLevel {
27447    /// Value used when unset. In this case, server behavior defaults to
27448    /// [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
27449    ///
27450    /// [google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]: crate::model::AttributeConfigLevel::CatalogLevelAttributeConfig
27451    Unspecified,
27452    /// At this level, we honor the attribute configurations set in
27453    /// [Product.attributes][google.cloud.retail.v2.Product.attributes].
27454    ///
27455    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
27456    ProductLevelAttributeConfig,
27457    /// At this level, we honor the attribute configurations set in
27458    /// `CatalogConfig.attribute_configs`.
27459    CatalogLevelAttributeConfig,
27460    /// If set, the enum was initialized with an unknown value.
27461    ///
27462    /// Applications can examine the value using [AttributeConfigLevel::value] or
27463    /// [AttributeConfigLevel::name].
27464    UnknownValue(attribute_config_level::UnknownValue),
27465}
27466
27467#[doc(hidden)]
27468pub mod attribute_config_level {
27469    #[allow(unused_imports)]
27470    use super::*;
27471    #[derive(Clone, Debug, PartialEq)]
27472    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27473}
27474
27475impl AttributeConfigLevel {
27476    /// Gets the enum value.
27477    ///
27478    /// Returns `None` if the enum contains an unknown value deserialized from
27479    /// the string representation of enums.
27480    pub fn value(&self) -> std::option::Option<i32> {
27481        match self {
27482            Self::Unspecified => std::option::Option::Some(0),
27483            Self::ProductLevelAttributeConfig => std::option::Option::Some(1),
27484            Self::CatalogLevelAttributeConfig => std::option::Option::Some(2),
27485            Self::UnknownValue(u) => u.0.value(),
27486        }
27487    }
27488
27489    /// Gets the enum value as a string.
27490    ///
27491    /// Returns `None` if the enum contains an unknown value deserialized from
27492    /// the integer representation of enums.
27493    pub fn name(&self) -> std::option::Option<&str> {
27494        match self {
27495            Self::Unspecified => std::option::Option::Some("ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"),
27496            Self::ProductLevelAttributeConfig => {
27497                std::option::Option::Some("PRODUCT_LEVEL_ATTRIBUTE_CONFIG")
27498            }
27499            Self::CatalogLevelAttributeConfig => {
27500                std::option::Option::Some("CATALOG_LEVEL_ATTRIBUTE_CONFIG")
27501            }
27502            Self::UnknownValue(u) => u.0.name(),
27503        }
27504    }
27505}
27506
27507impl std::default::Default for AttributeConfigLevel {
27508    fn default() -> Self {
27509        use std::convert::From;
27510        Self::from(0)
27511    }
27512}
27513
27514impl std::fmt::Display for AttributeConfigLevel {
27515    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27516        wkt::internal::display_enum(f, self.name(), self.value())
27517    }
27518}
27519
27520impl std::convert::From<i32> for AttributeConfigLevel {
27521    fn from(value: i32) -> Self {
27522        match value {
27523            0 => Self::Unspecified,
27524            1 => Self::ProductLevelAttributeConfig,
27525            2 => Self::CatalogLevelAttributeConfig,
27526            _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27527                wkt::internal::UnknownEnumValue::Integer(value),
27528            )),
27529        }
27530    }
27531}
27532
27533impl std::convert::From<&str> for AttributeConfigLevel {
27534    fn from(value: &str) -> Self {
27535        use std::string::ToString;
27536        match value {
27537            "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" => Self::Unspecified,
27538            "PRODUCT_LEVEL_ATTRIBUTE_CONFIG" => Self::ProductLevelAttributeConfig,
27539            "CATALOG_LEVEL_ATTRIBUTE_CONFIG" => Self::CatalogLevelAttributeConfig,
27540            _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27541                wkt::internal::UnknownEnumValue::String(value.to_string()),
27542            )),
27543        }
27544    }
27545}
27546
27547impl serde::ser::Serialize for AttributeConfigLevel {
27548    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27549    where
27550        S: serde::Serializer,
27551    {
27552        match self {
27553            Self::Unspecified => serializer.serialize_i32(0),
27554            Self::ProductLevelAttributeConfig => serializer.serialize_i32(1),
27555            Self::CatalogLevelAttributeConfig => serializer.serialize_i32(2),
27556            Self::UnknownValue(u) => u.0.serialize(serializer),
27557        }
27558    }
27559}
27560
27561impl<'de> serde::de::Deserialize<'de> for AttributeConfigLevel {
27562    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27563    where
27564        D: serde::Deserializer<'de>,
27565    {
27566        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeConfigLevel>::new(
27567            ".google.cloud.retail.v2.AttributeConfigLevel",
27568        ))
27569    }
27570}
27571
27572/// The type of solution.
27573///
27574/// # Working with unknown values
27575///
27576/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27577/// additional enum variants at any time. Adding new variants is not considered
27578/// a breaking change. Applications should write their code in anticipation of:
27579///
27580/// - New values appearing in future releases of the client library, **and**
27581/// - New values received dynamically, without application changes.
27582///
27583/// Please consult the [Working with enums] section in the user guide for some
27584/// guidelines.
27585///
27586/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27587#[derive(Clone, Debug, PartialEq)]
27588#[non_exhaustive]
27589pub enum SolutionType {
27590    /// Default value.
27591    Unspecified,
27592    /// Used for Recommendations AI.
27593    Recommendation,
27594    /// Used for Retail Search.
27595    Search,
27596    /// If set, the enum was initialized with an unknown value.
27597    ///
27598    /// Applications can examine the value using [SolutionType::value] or
27599    /// [SolutionType::name].
27600    UnknownValue(solution_type::UnknownValue),
27601}
27602
27603#[doc(hidden)]
27604pub mod solution_type {
27605    #[allow(unused_imports)]
27606    use super::*;
27607    #[derive(Clone, Debug, PartialEq)]
27608    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27609}
27610
27611impl SolutionType {
27612    /// Gets the enum value.
27613    ///
27614    /// Returns `None` if the enum contains an unknown value deserialized from
27615    /// the string representation of enums.
27616    pub fn value(&self) -> std::option::Option<i32> {
27617        match self {
27618            Self::Unspecified => std::option::Option::Some(0),
27619            Self::Recommendation => std::option::Option::Some(1),
27620            Self::Search => std::option::Option::Some(2),
27621            Self::UnknownValue(u) => u.0.value(),
27622        }
27623    }
27624
27625    /// Gets the enum value as a string.
27626    ///
27627    /// Returns `None` if the enum contains an unknown value deserialized from
27628    /// the integer representation of enums.
27629    pub fn name(&self) -> std::option::Option<&str> {
27630        match self {
27631            Self::Unspecified => std::option::Option::Some("SOLUTION_TYPE_UNSPECIFIED"),
27632            Self::Recommendation => std::option::Option::Some("SOLUTION_TYPE_RECOMMENDATION"),
27633            Self::Search => std::option::Option::Some("SOLUTION_TYPE_SEARCH"),
27634            Self::UnknownValue(u) => u.0.name(),
27635        }
27636    }
27637}
27638
27639impl std::default::Default for SolutionType {
27640    fn default() -> Self {
27641        use std::convert::From;
27642        Self::from(0)
27643    }
27644}
27645
27646impl std::fmt::Display for SolutionType {
27647    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27648        wkt::internal::display_enum(f, self.name(), self.value())
27649    }
27650}
27651
27652impl std::convert::From<i32> for SolutionType {
27653    fn from(value: i32) -> Self {
27654        match value {
27655            0 => Self::Unspecified,
27656            1 => Self::Recommendation,
27657            2 => Self::Search,
27658            _ => Self::UnknownValue(solution_type::UnknownValue(
27659                wkt::internal::UnknownEnumValue::Integer(value),
27660            )),
27661        }
27662    }
27663}
27664
27665impl std::convert::From<&str> for SolutionType {
27666    fn from(value: &str) -> Self {
27667        use std::string::ToString;
27668        match value {
27669            "SOLUTION_TYPE_UNSPECIFIED" => Self::Unspecified,
27670            "SOLUTION_TYPE_RECOMMENDATION" => Self::Recommendation,
27671            "SOLUTION_TYPE_SEARCH" => Self::Search,
27672            _ => Self::UnknownValue(solution_type::UnknownValue(
27673                wkt::internal::UnknownEnumValue::String(value.to_string()),
27674            )),
27675        }
27676    }
27677}
27678
27679impl serde::ser::Serialize for SolutionType {
27680    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27681    where
27682        S: serde::Serializer,
27683    {
27684        match self {
27685            Self::Unspecified => serializer.serialize_i32(0),
27686            Self::Recommendation => serializer.serialize_i32(1),
27687            Self::Search => serializer.serialize_i32(2),
27688            Self::UnknownValue(u) => u.0.serialize(serializer),
27689        }
27690    }
27691}
27692
27693impl<'de> serde::de::Deserialize<'de> for SolutionType {
27694    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27695    where
27696        D: serde::Deserializer<'de>,
27697    {
27698        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SolutionType>::new(
27699            ".google.cloud.retail.v2.SolutionType",
27700        ))
27701    }
27702}
27703
27704/// If filtering for recommendations is enabled.
27705///
27706/// # Working with unknown values
27707///
27708/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27709/// additional enum variants at any time. Adding new variants is not considered
27710/// a breaking change. Applications should write their code in anticipation of:
27711///
27712/// - New values appearing in future releases of the client library, **and**
27713/// - New values received dynamically, without application changes.
27714///
27715/// Please consult the [Working with enums] section in the user guide for some
27716/// guidelines.
27717///
27718/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27719#[derive(Clone, Debug, PartialEq)]
27720#[non_exhaustive]
27721pub enum RecommendationsFilteringOption {
27722    /// Value used when unset.
27723    /// In this case, server behavior defaults to
27724    /// [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED].
27725    ///
27726    /// [google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]: crate::model::RecommendationsFilteringOption::RecommendationsFilteringDisabled
27727    Unspecified,
27728    /// Recommendation filtering is disabled.
27729    RecommendationsFilteringDisabled,
27730    /// Recommendation filtering is enabled.
27731    RecommendationsFilteringEnabled,
27732    /// If set, the enum was initialized with an unknown value.
27733    ///
27734    /// Applications can examine the value using [RecommendationsFilteringOption::value] or
27735    /// [RecommendationsFilteringOption::name].
27736    UnknownValue(recommendations_filtering_option::UnknownValue),
27737}
27738
27739#[doc(hidden)]
27740pub mod recommendations_filtering_option {
27741    #[allow(unused_imports)]
27742    use super::*;
27743    #[derive(Clone, Debug, PartialEq)]
27744    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27745}
27746
27747impl RecommendationsFilteringOption {
27748    /// Gets the enum value.
27749    ///
27750    /// Returns `None` if the enum contains an unknown value deserialized from
27751    /// the string representation of enums.
27752    pub fn value(&self) -> std::option::Option<i32> {
27753        match self {
27754            Self::Unspecified => std::option::Option::Some(0),
27755            Self::RecommendationsFilteringDisabled => std::option::Option::Some(1),
27756            Self::RecommendationsFilteringEnabled => std::option::Option::Some(3),
27757            Self::UnknownValue(u) => u.0.value(),
27758        }
27759    }
27760
27761    /// Gets the enum value as a string.
27762    ///
27763    /// Returns `None` if the enum contains an unknown value deserialized from
27764    /// the integer representation of enums.
27765    pub fn name(&self) -> std::option::Option<&str> {
27766        match self {
27767            Self::Unspecified => {
27768                std::option::Option::Some("RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED")
27769            }
27770            Self::RecommendationsFilteringDisabled => {
27771                std::option::Option::Some("RECOMMENDATIONS_FILTERING_DISABLED")
27772            }
27773            Self::RecommendationsFilteringEnabled => {
27774                std::option::Option::Some("RECOMMENDATIONS_FILTERING_ENABLED")
27775            }
27776            Self::UnknownValue(u) => u.0.name(),
27777        }
27778    }
27779}
27780
27781impl std::default::Default for RecommendationsFilteringOption {
27782    fn default() -> Self {
27783        use std::convert::From;
27784        Self::from(0)
27785    }
27786}
27787
27788impl std::fmt::Display for RecommendationsFilteringOption {
27789    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27790        wkt::internal::display_enum(f, self.name(), self.value())
27791    }
27792}
27793
27794impl std::convert::From<i32> for RecommendationsFilteringOption {
27795    fn from(value: i32) -> Self {
27796        match value {
27797            0 => Self::Unspecified,
27798            1 => Self::RecommendationsFilteringDisabled,
27799            3 => Self::RecommendationsFilteringEnabled,
27800            _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
27801                wkt::internal::UnknownEnumValue::Integer(value),
27802            )),
27803        }
27804    }
27805}
27806
27807impl std::convert::From<&str> for RecommendationsFilteringOption {
27808    fn from(value: &str) -> Self {
27809        use std::string::ToString;
27810        match value {
27811            "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" => Self::Unspecified,
27812            "RECOMMENDATIONS_FILTERING_DISABLED" => Self::RecommendationsFilteringDisabled,
27813            "RECOMMENDATIONS_FILTERING_ENABLED" => Self::RecommendationsFilteringEnabled,
27814            _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
27815                wkt::internal::UnknownEnumValue::String(value.to_string()),
27816            )),
27817        }
27818    }
27819}
27820
27821impl serde::ser::Serialize for RecommendationsFilteringOption {
27822    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27823    where
27824        S: serde::Serializer,
27825    {
27826        match self {
27827            Self::Unspecified => serializer.serialize_i32(0),
27828            Self::RecommendationsFilteringDisabled => serializer.serialize_i32(1),
27829            Self::RecommendationsFilteringEnabled => serializer.serialize_i32(3),
27830            Self::UnknownValue(u) => u.0.serialize(serializer),
27831        }
27832    }
27833}
27834
27835impl<'de> serde::de::Deserialize<'de> for RecommendationsFilteringOption {
27836    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27837    where
27838        D: serde::Deserializer<'de>,
27839    {
27840        deserializer.deserialize_any(
27841            wkt::internal::EnumVisitor::<RecommendationsFilteringOption>::new(
27842                ".google.cloud.retail.v2.RecommendationsFilteringOption",
27843            ),
27844        )
27845    }
27846}
27847
27848/// The use case of Cloud Retail Search.
27849///
27850/// # Working with unknown values
27851///
27852/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27853/// additional enum variants at any time. Adding new variants is not considered
27854/// a breaking change. Applications should write their code in anticipation of:
27855///
27856/// - New values appearing in future releases of the client library, **and**
27857/// - New values received dynamically, without application changes.
27858///
27859/// Please consult the [Working with enums] section in the user guide for some
27860/// guidelines.
27861///
27862/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
27863#[derive(Clone, Debug, PartialEq)]
27864#[non_exhaustive]
27865pub enum SearchSolutionUseCase {
27866    /// The value when it's unspecified. In this case, server behavior defaults to
27867    /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
27868    ///
27869    /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
27870    Unspecified,
27871    /// Search use case. Expects the traffic has a non-empty
27872    /// [query][google.cloud.retail.v2.SearchRequest.query].
27873    ///
27874    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
27875    Search,
27876    /// Browse use case. Expects the traffic has an empty
27877    /// [query][google.cloud.retail.v2.SearchRequest.query].
27878    ///
27879    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
27880    Browse,
27881    /// If set, the enum was initialized with an unknown value.
27882    ///
27883    /// Applications can examine the value using [SearchSolutionUseCase::value] or
27884    /// [SearchSolutionUseCase::name].
27885    UnknownValue(search_solution_use_case::UnknownValue),
27886}
27887
27888#[doc(hidden)]
27889pub mod search_solution_use_case {
27890    #[allow(unused_imports)]
27891    use super::*;
27892    #[derive(Clone, Debug, PartialEq)]
27893    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27894}
27895
27896impl SearchSolutionUseCase {
27897    /// Gets the enum value.
27898    ///
27899    /// Returns `None` if the enum contains an unknown value deserialized from
27900    /// the string representation of enums.
27901    pub fn value(&self) -> std::option::Option<i32> {
27902        match self {
27903            Self::Unspecified => std::option::Option::Some(0),
27904            Self::Search => std::option::Option::Some(1),
27905            Self::Browse => std::option::Option::Some(2),
27906            Self::UnknownValue(u) => u.0.value(),
27907        }
27908    }
27909
27910    /// Gets the enum value as a string.
27911    ///
27912    /// Returns `None` if the enum contains an unknown value deserialized from
27913    /// the integer representation of enums.
27914    pub fn name(&self) -> std::option::Option<&str> {
27915        match self {
27916            Self::Unspecified => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"),
27917            Self::Search => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_SEARCH"),
27918            Self::Browse => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_BROWSE"),
27919            Self::UnknownValue(u) => u.0.name(),
27920        }
27921    }
27922}
27923
27924impl std::default::Default for SearchSolutionUseCase {
27925    fn default() -> Self {
27926        use std::convert::From;
27927        Self::from(0)
27928    }
27929}
27930
27931impl std::fmt::Display for SearchSolutionUseCase {
27932    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27933        wkt::internal::display_enum(f, self.name(), self.value())
27934    }
27935}
27936
27937impl std::convert::From<i32> for SearchSolutionUseCase {
27938    fn from(value: i32) -> Self {
27939        match value {
27940            0 => Self::Unspecified,
27941            1 => Self::Search,
27942            2 => Self::Browse,
27943            _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
27944                wkt::internal::UnknownEnumValue::Integer(value),
27945            )),
27946        }
27947    }
27948}
27949
27950impl std::convert::From<&str> for SearchSolutionUseCase {
27951    fn from(value: &str) -> Self {
27952        use std::string::ToString;
27953        match value {
27954            "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED" => Self::Unspecified,
27955            "SEARCH_SOLUTION_USE_CASE_SEARCH" => Self::Search,
27956            "SEARCH_SOLUTION_USE_CASE_BROWSE" => Self::Browse,
27957            _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
27958                wkt::internal::UnknownEnumValue::String(value.to_string()),
27959            )),
27960        }
27961    }
27962}
27963
27964impl serde::ser::Serialize for SearchSolutionUseCase {
27965    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27966    where
27967        S: serde::Serializer,
27968    {
27969        match self {
27970            Self::Unspecified => serializer.serialize_i32(0),
27971            Self::Search => serializer.serialize_i32(1),
27972            Self::Browse => serializer.serialize_i32(2),
27973            Self::UnknownValue(u) => u.0.serialize(serializer),
27974        }
27975    }
27976}
27977
27978impl<'de> serde::de::Deserialize<'de> for SearchSolutionUseCase {
27979    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27980    where
27981        D: serde::Deserializer<'de>,
27982    {
27983        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchSolutionUseCase>::new(
27984            ".google.cloud.retail.v2.SearchSolutionUseCase",
27985        ))
27986    }
27987}
27988
27989/// Harm categories that will block the content.
27990///
27991/// # Working with unknown values
27992///
27993/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27994/// additional enum variants at any time. Adding new variants is not considered
27995/// a breaking change. Applications should write their code in anticipation of:
27996///
27997/// - New values appearing in future releases of the client library, **and**
27998/// - New values received dynamically, without application changes.
27999///
28000/// Please consult the [Working with enums] section in the user guide for some
28001/// guidelines.
28002///
28003/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
28004#[derive(Clone, Debug, PartialEq)]
28005#[non_exhaustive]
28006pub enum HarmCategory {
28007    /// The harm category is unspecified.
28008    Unspecified,
28009    /// The harm category is hate speech.
28010    HateSpeech,
28011    /// The harm category is dangerous content.
28012    DangerousContent,
28013    /// The harm category is harassment.
28014    Harassment,
28015    /// The harm category is sexually explicit content.
28016    SexuallyExplicit,
28017    /// The harm category is civic integrity.
28018    CivicIntegrity,
28019    /// If set, the enum was initialized with an unknown value.
28020    ///
28021    /// Applications can examine the value using [HarmCategory::value] or
28022    /// [HarmCategory::name].
28023    UnknownValue(harm_category::UnknownValue),
28024}
28025
28026#[doc(hidden)]
28027pub mod harm_category {
28028    #[allow(unused_imports)]
28029    use super::*;
28030    #[derive(Clone, Debug, PartialEq)]
28031    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28032}
28033
28034impl HarmCategory {
28035    /// Gets the enum value.
28036    ///
28037    /// Returns `None` if the enum contains an unknown value deserialized from
28038    /// the string representation of enums.
28039    pub fn value(&self) -> std::option::Option<i32> {
28040        match self {
28041            Self::Unspecified => std::option::Option::Some(0),
28042            Self::HateSpeech => std::option::Option::Some(1),
28043            Self::DangerousContent => std::option::Option::Some(2),
28044            Self::Harassment => std::option::Option::Some(3),
28045            Self::SexuallyExplicit => std::option::Option::Some(4),
28046            Self::CivicIntegrity => std::option::Option::Some(5),
28047            Self::UnknownValue(u) => u.0.value(),
28048        }
28049    }
28050
28051    /// Gets the enum value as a string.
28052    ///
28053    /// Returns `None` if the enum contains an unknown value deserialized from
28054    /// the integer representation of enums.
28055    pub fn name(&self) -> std::option::Option<&str> {
28056        match self {
28057            Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
28058            Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
28059            Self::DangerousContent => std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT"),
28060            Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
28061            Self::SexuallyExplicit => std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT"),
28062            Self::CivicIntegrity => std::option::Option::Some("HARM_CATEGORY_CIVIC_INTEGRITY"),
28063            Self::UnknownValue(u) => u.0.name(),
28064        }
28065    }
28066}
28067
28068impl std::default::Default for HarmCategory {
28069    fn default() -> Self {
28070        use std::convert::From;
28071        Self::from(0)
28072    }
28073}
28074
28075impl std::fmt::Display for HarmCategory {
28076    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28077        wkt::internal::display_enum(f, self.name(), self.value())
28078    }
28079}
28080
28081impl std::convert::From<i32> for HarmCategory {
28082    fn from(value: i32) -> Self {
28083        match value {
28084            0 => Self::Unspecified,
28085            1 => Self::HateSpeech,
28086            2 => Self::DangerousContent,
28087            3 => Self::Harassment,
28088            4 => Self::SexuallyExplicit,
28089            5 => Self::CivicIntegrity,
28090            _ => Self::UnknownValue(harm_category::UnknownValue(
28091                wkt::internal::UnknownEnumValue::Integer(value),
28092            )),
28093        }
28094    }
28095}
28096
28097impl std::convert::From<&str> for HarmCategory {
28098    fn from(value: &str) -> Self {
28099        use std::string::ToString;
28100        match value {
28101            "HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
28102            "HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
28103            "HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
28104            "HARM_CATEGORY_HARASSMENT" => Self::Harassment,
28105            "HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
28106            "HARM_CATEGORY_CIVIC_INTEGRITY" => Self::CivicIntegrity,
28107            _ => Self::UnknownValue(harm_category::UnknownValue(
28108                wkt::internal::UnknownEnumValue::String(value.to_string()),
28109            )),
28110        }
28111    }
28112}
28113
28114impl serde::ser::Serialize for HarmCategory {
28115    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28116    where
28117        S: serde::Serializer,
28118    {
28119        match self {
28120            Self::Unspecified => serializer.serialize_i32(0),
28121            Self::HateSpeech => serializer.serialize_i32(1),
28122            Self::DangerousContent => serializer.serialize_i32(2),
28123            Self::Harassment => serializer.serialize_i32(3),
28124            Self::SexuallyExplicit => serializer.serialize_i32(4),
28125            Self::CivicIntegrity => serializer.serialize_i32(5),
28126            Self::UnknownValue(u) => u.0.serialize(serializer),
28127        }
28128    }
28129}
28130
28131impl<'de> serde::de::Deserialize<'de> for HarmCategory {
28132    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28133    where
28134        D: serde::Deserializer<'de>,
28135    {
28136        deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
28137            ".google.cloud.retail.v2.HarmCategory",
28138        ))
28139    }
28140}