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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_api;
26extern crate google_cloud_gax;
27extern crate google_cloud_longrunning;
28extern crate google_cloud_lro;
29extern crate google_cloud_rpc;
30extern crate google_cloud_type;
31extern crate serde;
32extern crate serde_json;
33extern crate serde_with;
34extern crate std;
35extern crate tracing;
36extern crate wkt;
37
38mod debug;
39mod deserialize;
40mod serialize;
41
42/// Configures what level the product should be uploaded with regards to
43/// how users will be send events and how predictions will be made.
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct ProductLevelConfig {
47    /// The type of [Product][google.cloud.retail.v2.Product]s allowed to be
48    /// ingested into the catalog. Acceptable values are:
49    ///
50    /// * `primary` (default): You can ingest
51    ///   [Product][google.cloud.retail.v2.Product]s of all types. When
52    ///   ingesting a [Product][google.cloud.retail.v2.Product], its type will
53    ///   default to
54    ///   [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] if
55    ///   unset.
56    /// * `variant` (incompatible with Retail Search): You can only
57    ///   ingest
58    ///   [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
59    ///   [Product][google.cloud.retail.v2.Product]s. This means
60    ///   [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
61    ///   cannot be empty.
62    ///
63    /// If this field is set to an invalid value other than these, an
64    /// INVALID_ARGUMENT error is returned.
65    ///
66    /// If this field is `variant` and
67    /// [merchant_center_product_id_field][google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]
68    /// is `itemGroupId`, an INVALID_ARGUMENT error is returned.
69    ///
70    /// See [Product
71    /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
72    /// for more details.
73    ///
74    /// [google.cloud.retail.v2.Product]: crate::model::Product
75    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
76    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
77    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
78    /// [google.cloud.retail.v2.ProductLevelConfig.merchant_center_product_id_field]: crate::model::ProductLevelConfig::merchant_center_product_id_field
79    pub ingestion_product_type: std::string::String,
80
81    /// Which field of [Merchant Center
82    /// Product](/bigquery-transfer/docs/merchant-center-products-schema) should be
83    /// imported as [Product.id][google.cloud.retail.v2.Product.id]. Acceptable
84    /// values are:
85    ///
86    /// * `offerId` (default): Import `offerId` as the product ID.
87    /// * `itemGroupId`: Import `itemGroupId` as the product ID. Notice that Retail
88    ///   API will choose one item from the ones with the same `itemGroupId`, and
89    ///   use it to represent the item group.
90    ///
91    /// If this field is set to an invalid value other than these, an
92    /// INVALID_ARGUMENT error is returned.
93    ///
94    /// If this field is `itemGroupId` and
95    /// [ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
96    /// is `variant`, an INVALID_ARGUMENT error is returned.
97    ///
98    /// See [Product
99    /// levels](https://cloud.google.com/retail/docs/catalog#product-levels)
100    /// for more details.
101    ///
102    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
103    /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
104    pub merchant_center_product_id_field: std::string::String,
105
106    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
107}
108
109impl ProductLevelConfig {
110    /// Creates a new default instance.
111    pub fn new() -> Self {
112        std::default::Default::default()
113    }
114
115    /// Sets the value of [ingestion_product_type][crate::model::ProductLevelConfig::ingestion_product_type].
116    ///
117    /// # Example
118    /// ```ignore,no_run
119    /// # use google_cloud_retail_v2::model::ProductLevelConfig;
120    /// let x = ProductLevelConfig::new().set_ingestion_product_type("example");
121    /// ```
122    pub fn set_ingestion_product_type<T: std::convert::Into<std::string::String>>(
123        mut self,
124        v: T,
125    ) -> Self {
126        self.ingestion_product_type = v.into();
127        self
128    }
129
130    /// Sets the value of [merchant_center_product_id_field][crate::model::ProductLevelConfig::merchant_center_product_id_field].
131    ///
132    /// # Example
133    /// ```ignore,no_run
134    /// # use google_cloud_retail_v2::model::ProductLevelConfig;
135    /// let x = ProductLevelConfig::new().set_merchant_center_product_id_field("example");
136    /// ```
137    pub fn set_merchant_center_product_id_field<T: std::convert::Into<std::string::String>>(
138        mut self,
139        v: T,
140    ) -> Self {
141        self.merchant_center_product_id_field = v.into();
142        self
143    }
144}
145
146impl wkt::message::Message for ProductLevelConfig {
147    fn typename() -> &'static str {
148        "type.googleapis.com/google.cloud.retail.v2.ProductLevelConfig"
149    }
150}
151
152/// Catalog level attribute config for an attribute. For example, if customers
153/// want to enable/disable facet for a specific attribute.
154#[derive(Clone, Default, PartialEq)]
155#[non_exhaustive]
156pub struct CatalogAttribute {
157    /// Required. Attribute name.
158    /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
159    /// `attributes.xyz`.
160    /// To be indexable, the attribute name can contain only alpha-numeric
161    /// characters and underscores. For example, an attribute named
162    /// `attributes.abc_xyz` can be indexed, but an attribute named
163    /// `attributes.abc-xyz` cannot be indexed.
164    ///
165    /// If the attribute key starts with `attributes.`, then the attribute is a
166    /// custom attribute. Attributes such as `brands`, `patterns`, and `title` are
167    /// built-in and called system attributes.
168    pub key: std::string::String,
169
170    /// Output only. Indicates whether this attribute has been used by any
171    /// products. `True` if at least one [Product][google.cloud.retail.v2.Product]
172    /// is using this attribute in
173    /// [Product.attributes][google.cloud.retail.v2.Product.attributes]. Otherwise,
174    /// this field is `False`.
175    ///
176    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] can be
177    /// pre-loaded by using
178    /// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
179    /// or
180    /// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
181    /// APIs. This field is `False` for pre-loaded
182    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]s.
183    ///
184    /// Only pre-loaded [catalog
185    /// attributes][google.cloud.retail.v2.CatalogAttribute] that are neither in
186    /// use by products nor predefined can be deleted. [Catalog
187    /// attributes][google.cloud.retail.v2.CatalogAttribute] that are
188    /// either in use by products or are predefined attributes cannot be deleted;
189    /// however, their configuration properties will reset to default values upon
190    /// removal request.
191    ///
192    /// After catalog changes, it takes about 10 minutes for this field to update.
193    ///
194    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
195    /// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
196    /// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
197    /// [google.cloud.retail.v2.Product]: crate::model::Product
198    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
199    pub in_use: bool,
200
201    /// Output only. The type of this attribute. This is derived from the attribute
202    /// in [Product.attributes][google.cloud.retail.v2.Product.attributes].
203    ///
204    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
205    pub r#type: crate::model::catalog_attribute::AttributeType,
206
207    /// When
208    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
209    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if INDEXABLE_ENABLED attribute values
210    /// are indexed so that it can be filtered, faceted, or boosted in
211    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
212    ///
213    /// Must be specified when
214    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
215    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
216    ///
217    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
218    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
219    pub indexable_option: crate::model::catalog_attribute::IndexableOption,
220
221    /// If DYNAMIC_FACETABLE_ENABLED, attribute values are available for dynamic
222    /// facet. Could only be DYNAMIC_FACETABLE_DISABLED if
223    /// [CatalogAttribute.indexable_option][google.cloud.retail.v2.CatalogAttribute.indexable_option]
224    /// is INDEXABLE_DISABLED. Otherwise, an INVALID_ARGUMENT error is returned.
225    ///
226    /// Must be specified, otherwise throws INVALID_FORMAT error.
227    ///
228    /// [google.cloud.retail.v2.CatalogAttribute.indexable_option]: crate::model::CatalogAttribute::indexable_option
229    pub dynamic_facetable_option: crate::model::catalog_attribute::DynamicFacetableOption,
230
231    /// When
232    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
233    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, if SEARCHABLE_ENABLED, attribute values
234    /// are searchable by text queries in
235    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
236    ///
237    /// If SEARCHABLE_ENABLED but attribute type is numerical, attribute values
238    /// will not be searchable by text queries in
239    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search], as
240    /// there are no text values associated to numerical attributes.
241    ///
242    /// Must be specified, when
243    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
244    /// is CATALOG_LEVEL_ATTRIBUTE_CONFIG, otherwise throws INVALID_FORMAT error.
245    ///
246    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
247    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
248    pub searchable_option: crate::model::catalog_attribute::SearchableOption,
249
250    /// If EXACT_SEARCHABLE_ENABLED, attribute values will be exact searchable.
251    /// This property only applies to textual custom attributes and requires
252    /// indexable set to enabled to enable exact-searchable. If unset, the server
253    /// behavior defaults to
254    /// [EXACT_SEARCHABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED].
255    ///
256    /// [google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption.EXACT_SEARCHABLE_DISABLED]: crate::model::catalog_attribute::ExactSearchableOption::ExactSearchableDisabled
257    pub exact_searchable_option: crate::model::catalog_attribute::ExactSearchableOption,
258
259    /// If RETRIEVABLE_ENABLED, attribute values are retrievable in the search
260    /// results. If unset, the server behavior defaults to
261    /// [RETRIEVABLE_DISABLED][google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED].
262    ///
263    /// [google.cloud.retail.v2.CatalogAttribute.RetrievableOption.RETRIEVABLE_DISABLED]: crate::model::catalog_attribute::RetrievableOption::RetrievableDisabled
264    pub retrievable_option: crate::model::catalog_attribute::RetrievableOption,
265
266    /// Contains facet options.
267    pub facet_config: std::option::Option<crate::model::catalog_attribute::FacetConfig>,
268
269    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
270}
271
272impl CatalogAttribute {
273    /// Creates a new default instance.
274    pub fn new() -> Self {
275        std::default::Default::default()
276    }
277
278    /// Sets the value of [key][crate::model::CatalogAttribute::key].
279    ///
280    /// # Example
281    /// ```ignore,no_run
282    /// # use google_cloud_retail_v2::model::CatalogAttribute;
283    /// let x = CatalogAttribute::new().set_key("example");
284    /// ```
285    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
286        self.key = v.into();
287        self
288    }
289
290    /// Sets the value of [in_use][crate::model::CatalogAttribute::in_use].
291    ///
292    /// # Example
293    /// ```ignore,no_run
294    /// # use google_cloud_retail_v2::model::CatalogAttribute;
295    /// let x = CatalogAttribute::new().set_in_use(true);
296    /// ```
297    pub fn set_in_use<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
298        self.in_use = v.into();
299        self
300    }
301
302    /// Sets the value of [r#type][crate::model::CatalogAttribute::type].
303    ///
304    /// # Example
305    /// ```ignore,no_run
306    /// # use google_cloud_retail_v2::model::CatalogAttribute;
307    /// use google_cloud_retail_v2::model::catalog_attribute::AttributeType;
308    /// let x0 = CatalogAttribute::new().set_type(AttributeType::Textual);
309    /// let x1 = CatalogAttribute::new().set_type(AttributeType::Numerical);
310    /// ```
311    pub fn set_type<T: std::convert::Into<crate::model::catalog_attribute::AttributeType>>(
312        mut self,
313        v: T,
314    ) -> Self {
315        self.r#type = v.into();
316        self
317    }
318
319    /// Sets the value of [indexable_option][crate::model::CatalogAttribute::indexable_option].
320    ///
321    /// # Example
322    /// ```ignore,no_run
323    /// # use google_cloud_retail_v2::model::CatalogAttribute;
324    /// use google_cloud_retail_v2::model::catalog_attribute::IndexableOption;
325    /// let x0 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableEnabled);
326    /// let x1 = CatalogAttribute::new().set_indexable_option(IndexableOption::IndexableDisabled);
327    /// ```
328    pub fn set_indexable_option<
329        T: std::convert::Into<crate::model::catalog_attribute::IndexableOption>,
330    >(
331        mut self,
332        v: T,
333    ) -> Self {
334        self.indexable_option = v.into();
335        self
336    }
337
338    /// Sets the value of [dynamic_facetable_option][crate::model::CatalogAttribute::dynamic_facetable_option].
339    ///
340    /// # Example
341    /// ```ignore,no_run
342    /// # use google_cloud_retail_v2::model::CatalogAttribute;
343    /// use google_cloud_retail_v2::model::catalog_attribute::DynamicFacetableOption;
344    /// let x0 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableEnabled);
345    /// let x1 = CatalogAttribute::new().set_dynamic_facetable_option(DynamicFacetableOption::DynamicFacetableDisabled);
346    /// ```
347    pub fn set_dynamic_facetable_option<
348        T: std::convert::Into<crate::model::catalog_attribute::DynamicFacetableOption>,
349    >(
350        mut self,
351        v: T,
352    ) -> Self {
353        self.dynamic_facetable_option = v.into();
354        self
355    }
356
357    /// Sets the value of [searchable_option][crate::model::CatalogAttribute::searchable_option].
358    ///
359    /// # Example
360    /// ```ignore,no_run
361    /// # use google_cloud_retail_v2::model::CatalogAttribute;
362    /// use google_cloud_retail_v2::model::catalog_attribute::SearchableOption;
363    /// let x0 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableEnabled);
364    /// let x1 = CatalogAttribute::new().set_searchable_option(SearchableOption::SearchableDisabled);
365    /// ```
366    pub fn set_searchable_option<
367        T: std::convert::Into<crate::model::catalog_attribute::SearchableOption>,
368    >(
369        mut self,
370        v: T,
371    ) -> Self {
372        self.searchable_option = v.into();
373        self
374    }
375
376    /// Sets the value of [exact_searchable_option][crate::model::CatalogAttribute::exact_searchable_option].
377    ///
378    /// # Example
379    /// ```ignore,no_run
380    /// # use google_cloud_retail_v2::model::CatalogAttribute;
381    /// use google_cloud_retail_v2::model::catalog_attribute::ExactSearchableOption;
382    /// let x0 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableEnabled);
383    /// let x1 = CatalogAttribute::new().set_exact_searchable_option(ExactSearchableOption::ExactSearchableDisabled);
384    /// ```
385    pub fn set_exact_searchable_option<
386        T: std::convert::Into<crate::model::catalog_attribute::ExactSearchableOption>,
387    >(
388        mut self,
389        v: T,
390    ) -> Self {
391        self.exact_searchable_option = v.into();
392        self
393    }
394
395    /// Sets the value of [retrievable_option][crate::model::CatalogAttribute::retrievable_option].
396    ///
397    /// # Example
398    /// ```ignore,no_run
399    /// # use google_cloud_retail_v2::model::CatalogAttribute;
400    /// use google_cloud_retail_v2::model::catalog_attribute::RetrievableOption;
401    /// let x0 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableEnabled);
402    /// let x1 = CatalogAttribute::new().set_retrievable_option(RetrievableOption::RetrievableDisabled);
403    /// ```
404    pub fn set_retrievable_option<
405        T: std::convert::Into<crate::model::catalog_attribute::RetrievableOption>,
406    >(
407        mut self,
408        v: T,
409    ) -> Self {
410        self.retrievable_option = v.into();
411        self
412    }
413
414    /// Sets the value of [facet_config][crate::model::CatalogAttribute::facet_config].
415    ///
416    /// # Example
417    /// ```ignore,no_run
418    /// # use google_cloud_retail_v2::model::CatalogAttribute;
419    /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
420    /// let x = CatalogAttribute::new().set_facet_config(FacetConfig::default()/* use setters */);
421    /// ```
422    pub fn set_facet_config<T>(mut self, v: T) -> Self
423    where
424        T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
425    {
426        self.facet_config = std::option::Option::Some(v.into());
427        self
428    }
429
430    /// Sets or clears the value of [facet_config][crate::model::CatalogAttribute::facet_config].
431    ///
432    /// # Example
433    /// ```ignore,no_run
434    /// # use google_cloud_retail_v2::model::CatalogAttribute;
435    /// use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
436    /// let x = CatalogAttribute::new().set_or_clear_facet_config(Some(FacetConfig::default()/* use setters */));
437    /// let x = CatalogAttribute::new().set_or_clear_facet_config(None::<FacetConfig>);
438    /// ```
439    pub fn set_or_clear_facet_config<T>(mut self, v: std::option::Option<T>) -> Self
440    where
441        T: std::convert::Into<crate::model::catalog_attribute::FacetConfig>,
442    {
443        self.facet_config = v.map(|x| x.into());
444        self
445    }
446}
447
448impl wkt::message::Message for CatalogAttribute {
449    fn typename() -> &'static str {
450        "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute"
451    }
452}
453
454/// Defines additional types related to [CatalogAttribute].
455pub mod catalog_attribute {
456    #[allow(unused_imports)]
457    use super::*;
458
459    /// Possible options for the facet that corresponds to the current attribute
460    /// config.
461    #[derive(Clone, Default, PartialEq)]
462    #[non_exhaustive]
463    pub struct FacetConfig {
464        /// If you don't set the facet
465        /// [SearchRequest.FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]
466        /// in the request to a numerical attribute, then we use the computed
467        /// intervals with rounded bounds obtained from all its product numerical
468        /// attribute values. The computed intervals might not be ideal for some
469        /// attributes. Therefore, we give you the option to overwrite them with the
470        /// facet_intervals field. The maximum of facet intervals per
471        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 40. Each
472        /// interval must have a lower bound or an upper bound. If both bounds are
473        /// provided, then the lower bound must be smaller or equal than the upper
474        /// bound.
475        ///
476        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
477        /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
478        pub facet_intervals: std::vec::Vec<crate::model::Interval>,
479
480        /// Each instance represents a list of attribute values to ignore as facet
481        /// values for a specific time range. The maximum number of instances per
482        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 25.
483        ///
484        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
485        pub ignored_facet_values:
486            std::vec::Vec<crate::model::catalog_attribute::facet_config::IgnoredFacetValues>,
487
488        /// Each instance replaces a list of facet values by a merged facet
489        /// value. If a facet value is not in any list, then it will stay the same.
490        /// To avoid conflicts, only paths of length 1 are accepted. In other words,
491        /// if "dark_blue" merged into "BLUE", then the latter can't merge into
492        /// "blues" because this would create a path of length 2. The maximum number
493        /// of instances of MergedFacetValue per
494        /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] is 100. This
495        /// feature is available only for textual custom attributes.
496        ///
497        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
498        pub merged_facet_values:
499            std::vec::Vec<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
500
501        /// Use this field only if you want to merge a facet key into another facet
502        /// key.
503        pub merged_facet:
504            std::option::Option<crate::model::catalog_attribute::facet_config::MergedFacet>,
505
506        /// Set this field only if you want to rerank based on facet values engaged
507        /// by the user for the current key. This option is only possible for custom
508        /// facetable textual keys.
509        pub rerank_config:
510            std::option::Option<crate::model::catalog_attribute::facet_config::RerankConfig>,
511
512        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
513    }
514
515    impl FacetConfig {
516        /// Creates a new default instance.
517        pub fn new() -> Self {
518            std::default::Default::default()
519        }
520
521        /// Sets the value of [facet_intervals][crate::model::catalog_attribute::FacetConfig::facet_intervals].
522        ///
523        /// # Example
524        /// ```ignore,no_run
525        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
526        /// use google_cloud_retail_v2::model::Interval;
527        /// let x = FacetConfig::new()
528        ///     .set_facet_intervals([
529        ///         Interval::default()/* use setters */,
530        ///         Interval::default()/* use (different) setters */,
531        ///     ]);
532        /// ```
533        pub fn set_facet_intervals<T, V>(mut self, v: T) -> Self
534        where
535            T: std::iter::IntoIterator<Item = V>,
536            V: std::convert::Into<crate::model::Interval>,
537        {
538            use std::iter::Iterator;
539            self.facet_intervals = v.into_iter().map(|i| i.into()).collect();
540            self
541        }
542
543        /// Sets the value of [ignored_facet_values][crate::model::catalog_attribute::FacetConfig::ignored_facet_values].
544        ///
545        /// # Example
546        /// ```ignore,no_run
547        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
548        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
549        /// let x = FacetConfig::new()
550        ///     .set_ignored_facet_values([
551        ///         IgnoredFacetValues::default()/* use setters */,
552        ///         IgnoredFacetValues::default()/* use (different) setters */,
553        ///     ]);
554        /// ```
555        pub fn set_ignored_facet_values<T, V>(mut self, v: T) -> Self
556        where
557            T: std::iter::IntoIterator<Item = V>,
558            V: std::convert::Into<
559                    crate::model::catalog_attribute::facet_config::IgnoredFacetValues,
560                >,
561        {
562            use std::iter::Iterator;
563            self.ignored_facet_values = v.into_iter().map(|i| i.into()).collect();
564            self
565        }
566
567        /// Sets the value of [merged_facet_values][crate::model::catalog_attribute::FacetConfig::merged_facet_values].
568        ///
569        /// # Example
570        /// ```ignore,no_run
571        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
572        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
573        /// let x = FacetConfig::new()
574        ///     .set_merged_facet_values([
575        ///         MergedFacetValue::default()/* use setters */,
576        ///         MergedFacetValue::default()/* use (different) setters */,
577        ///     ]);
578        /// ```
579        pub fn set_merged_facet_values<T, V>(mut self, v: T) -> Self
580        where
581            T: std::iter::IntoIterator<Item = V>,
582            V: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacetValue>,
583        {
584            use std::iter::Iterator;
585            self.merged_facet_values = v.into_iter().map(|i| i.into()).collect();
586            self
587        }
588
589        /// Sets the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
590        ///
591        /// # Example
592        /// ```ignore,no_run
593        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
594        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
595        /// let x = FacetConfig::new().set_merged_facet(MergedFacet::default()/* use setters */);
596        /// ```
597        pub fn set_merged_facet<T>(mut self, v: T) -> Self
598        where
599            T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
600        {
601            self.merged_facet = std::option::Option::Some(v.into());
602            self
603        }
604
605        /// Sets or clears the value of [merged_facet][crate::model::catalog_attribute::FacetConfig::merged_facet].
606        ///
607        /// # Example
608        /// ```ignore,no_run
609        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
610        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
611        /// let x = FacetConfig::new().set_or_clear_merged_facet(Some(MergedFacet::default()/* use setters */));
612        /// let x = FacetConfig::new().set_or_clear_merged_facet(None::<MergedFacet>);
613        /// ```
614        pub fn set_or_clear_merged_facet<T>(mut self, v: std::option::Option<T>) -> Self
615        where
616            T: std::convert::Into<crate::model::catalog_attribute::facet_config::MergedFacet>,
617        {
618            self.merged_facet = v.map(|x| x.into());
619            self
620        }
621
622        /// Sets the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
623        ///
624        /// # Example
625        /// ```ignore,no_run
626        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
627        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
628        /// let x = FacetConfig::new().set_rerank_config(RerankConfig::default()/* use setters */);
629        /// ```
630        pub fn set_rerank_config<T>(mut self, v: T) -> Self
631        where
632            T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
633        {
634            self.rerank_config = std::option::Option::Some(v.into());
635            self
636        }
637
638        /// Sets or clears the value of [rerank_config][crate::model::catalog_attribute::FacetConfig::rerank_config].
639        ///
640        /// # Example
641        /// ```ignore,no_run
642        /// # use google_cloud_retail_v2::model::catalog_attribute::FacetConfig;
643        /// use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
644        /// let x = FacetConfig::new().set_or_clear_rerank_config(Some(RerankConfig::default()/* use setters */));
645        /// let x = FacetConfig::new().set_or_clear_rerank_config(None::<RerankConfig>);
646        /// ```
647        pub fn set_or_clear_rerank_config<T>(mut self, v: std::option::Option<T>) -> Self
648        where
649            T: std::convert::Into<crate::model::catalog_attribute::facet_config::RerankConfig>,
650        {
651            self.rerank_config = v.map(|x| x.into());
652            self
653        }
654    }
655
656    impl wkt::message::Message for FacetConfig {
657        fn typename() -> &'static str {
658            "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig"
659        }
660    }
661
662    /// Defines additional types related to [FacetConfig].
663    pub mod facet_config {
664        #[allow(unused_imports)]
665        use super::*;
666
667        /// [Facet values][google.cloud.retail.v2.SearchResponse.Facet.values] to
668        /// ignore on [facets][google.cloud.retail.v2.SearchResponse.Facet] during
669        /// the specified time range for the given
670        /// [SearchResponse.Facet.key][google.cloud.retail.v2.SearchResponse.Facet.key]
671        /// attribute.
672        ///
673        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
674        /// [google.cloud.retail.v2.SearchResponse.Facet.key]: crate::model::search_response::Facet::key
675        /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
676        #[derive(Clone, Default, PartialEq)]
677        #[non_exhaustive]
678        pub struct IgnoredFacetValues {
679            /// List of facet values to ignore for the following time range. The facet
680            /// values are the same as the attribute values. There is a limit of 10
681            /// values per instance of IgnoredFacetValues. Each value can have at most
682            /// 128 characters.
683            pub values: std::vec::Vec<std::string::String>,
684
685            /// Time range for the current list of facet values to ignore.
686            /// If multiple time ranges are specified for an facet value for the
687            /// current attribute, consider all of them. If both are empty, ignore
688            /// always. If start time and end time are set, then start time
689            /// must be before end time.
690            /// If start time is not empty and end time is empty, then will ignore
691            /// these facet values after the start time.
692            pub start_time: std::option::Option<wkt::Timestamp>,
693
694            /// If start time is empty and end time is not empty, then ignore these
695            /// facet values before end time.
696            pub end_time: std::option::Option<wkt::Timestamp>,
697
698            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
699        }
700
701        impl IgnoredFacetValues {
702            /// Creates a new default instance.
703            pub fn new() -> Self {
704                std::default::Default::default()
705            }
706
707            /// Sets the value of [values][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::values].
708            ///
709            /// # Example
710            /// ```ignore,no_run
711            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
712            /// let x = IgnoredFacetValues::new().set_values(["a", "b", "c"]);
713            /// ```
714            pub fn set_values<T, V>(mut self, v: T) -> Self
715            where
716                T: std::iter::IntoIterator<Item = V>,
717                V: std::convert::Into<std::string::String>,
718            {
719                use std::iter::Iterator;
720                self.values = v.into_iter().map(|i| i.into()).collect();
721                self
722            }
723
724            /// Sets the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
725            ///
726            /// # Example
727            /// ```ignore,no_run
728            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
729            /// use wkt::Timestamp;
730            /// let x = IgnoredFacetValues::new().set_start_time(Timestamp::default()/* use setters */);
731            /// ```
732            pub fn set_start_time<T>(mut self, v: T) -> Self
733            where
734                T: std::convert::Into<wkt::Timestamp>,
735            {
736                self.start_time = std::option::Option::Some(v.into());
737                self
738            }
739
740            /// Sets or clears the value of [start_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::start_time].
741            ///
742            /// # Example
743            /// ```ignore,no_run
744            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
745            /// use wkt::Timestamp;
746            /// let x = IgnoredFacetValues::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
747            /// let x = IgnoredFacetValues::new().set_or_clear_start_time(None::<Timestamp>);
748            /// ```
749            pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
750            where
751                T: std::convert::Into<wkt::Timestamp>,
752            {
753                self.start_time = v.map(|x| x.into());
754                self
755            }
756
757            /// Sets the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
758            ///
759            /// # Example
760            /// ```ignore,no_run
761            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
762            /// use wkt::Timestamp;
763            /// let x = IgnoredFacetValues::new().set_end_time(Timestamp::default()/* use setters */);
764            /// ```
765            pub fn set_end_time<T>(mut self, v: T) -> Self
766            where
767                T: std::convert::Into<wkt::Timestamp>,
768            {
769                self.end_time = std::option::Option::Some(v.into());
770                self
771            }
772
773            /// Sets or clears the value of [end_time][crate::model::catalog_attribute::facet_config::IgnoredFacetValues::end_time].
774            ///
775            /// # Example
776            /// ```ignore,no_run
777            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::IgnoredFacetValues;
778            /// use wkt::Timestamp;
779            /// let x = IgnoredFacetValues::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
780            /// let x = IgnoredFacetValues::new().set_or_clear_end_time(None::<Timestamp>);
781            /// ```
782            pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
783            where
784                T: std::convert::Into<wkt::Timestamp>,
785            {
786                self.end_time = v.map(|x| x.into());
787                self
788            }
789        }
790
791        impl wkt::message::Message for IgnoredFacetValues {
792            fn typename() -> &'static str {
793                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.IgnoredFacetValues"
794            }
795        }
796
797        /// Replaces a set of textual facet values by the same (possibly different)
798        /// merged facet value. Each facet value should appear at most once as a
799        /// value per [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
800        /// This feature is available only for textual custom attributes.
801        ///
802        /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
803        #[derive(Clone, Default, PartialEq)]
804        #[non_exhaustive]
805        pub struct MergedFacetValue {
806            /// All the facet values that are replaces by the same
807            /// [merged_value][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]
808            /// that follows. The maximum number of values per MergedFacetValue is 25.
809            /// Each value can have up to 128 characters.
810            ///
811            /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue.merged_value]: crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value
812            pub values: std::vec::Vec<std::string::String>,
813
814            /// All the previous values are replaced by this merged facet value.
815            /// This merged_value must be non-empty and can have up to 128 characters.
816            pub merged_value: std::string::String,
817
818            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
819        }
820
821        impl MergedFacetValue {
822            /// Creates a new default instance.
823            pub fn new() -> Self {
824                std::default::Default::default()
825            }
826
827            /// Sets the value of [values][crate::model::catalog_attribute::facet_config::MergedFacetValue::values].
828            ///
829            /// # Example
830            /// ```ignore,no_run
831            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
832            /// let x = MergedFacetValue::new().set_values(["a", "b", "c"]);
833            /// ```
834            pub fn set_values<T, V>(mut self, v: T) -> Self
835            where
836                T: std::iter::IntoIterator<Item = V>,
837                V: std::convert::Into<std::string::String>,
838            {
839                use std::iter::Iterator;
840                self.values = v.into_iter().map(|i| i.into()).collect();
841                self
842            }
843
844            /// Sets the value of [merged_value][crate::model::catalog_attribute::facet_config::MergedFacetValue::merged_value].
845            ///
846            /// # Example
847            /// ```ignore,no_run
848            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacetValue;
849            /// let x = MergedFacetValue::new().set_merged_value("example");
850            /// ```
851            pub fn set_merged_value<T: std::convert::Into<std::string::String>>(
852                mut self,
853                v: T,
854            ) -> Self {
855                self.merged_value = v.into();
856                self
857            }
858        }
859
860        impl wkt::message::Message for MergedFacetValue {
861            fn typename() -> &'static str {
862                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacetValue"
863            }
864        }
865
866        /// The current facet key (i.e. attribute config) maps into the
867        /// [merged_facet_key][google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key].
868        /// A facet key can have at most one child. The current facet key and the
869        /// merged facet key need both to be textual custom attributes or both
870        /// numerical custom attributes (same type).
871        ///
872        /// [google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet.merged_facet_key]: crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key
873        #[derive(Clone, Default, PartialEq)]
874        #[non_exhaustive]
875        pub struct MergedFacet {
876            /// The merged facet key should be a valid facet key that is different than
877            /// the facet key of the current catalog attribute. We refer this is
878            /// merged facet key as the child of the current catalog attribute. This
879            /// merged facet key can't be a parent of another facet key (i.e. no
880            /// directed path of length 2). This merged facet key needs to be either a
881            /// textual custom attribute or a numerical custom attribute.
882            pub merged_facet_key: std::string::String,
883
884            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
885        }
886
887        impl MergedFacet {
888            /// Creates a new default instance.
889            pub fn new() -> Self {
890                std::default::Default::default()
891            }
892
893            /// Sets the value of [merged_facet_key][crate::model::catalog_attribute::facet_config::MergedFacet::merged_facet_key].
894            ///
895            /// # Example
896            /// ```ignore,no_run
897            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::MergedFacet;
898            /// let x = MergedFacet::new().set_merged_facet_key("example");
899            /// ```
900            pub fn set_merged_facet_key<T: std::convert::Into<std::string::String>>(
901                mut self,
902                v: T,
903            ) -> Self {
904                self.merged_facet_key = v.into();
905                self
906            }
907        }
908
909        impl wkt::message::Message for MergedFacet {
910            fn typename() -> &'static str {
911                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.MergedFacet"
912            }
913        }
914
915        /// Options to rerank based on facet values engaged by the user for the
916        /// current key. That key needs to be a custom textual key and facetable.
917        /// To use this control, you also need to pass all the facet keys engaged by
918        /// the user in the request using the field [SearchRequest.FacetSpec]. In
919        /// particular, if you don't pass the facet keys engaged that you want to
920        /// rerank on, this control won't be effective. Moreover, to obtain better
921        /// results, the facet values that you want to rerank on should be close to
922        /// English (ideally made of words, underscores, and spaces).
923        #[derive(Clone, Default, PartialEq)]
924        #[non_exhaustive]
925        pub struct RerankConfig {
926            /// If set to true, then we also rerank the dynamic facets based on the
927            /// facet values engaged by the user for the current attribute key during
928            /// serving.
929            pub rerank_facet: bool,
930
931            /// If empty, rerank on all facet values for the current key. Otherwise,
932            /// will rerank on the facet values from this list only.
933            pub facet_values: std::vec::Vec<std::string::String>,
934
935            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
936        }
937
938        impl RerankConfig {
939            /// Creates a new default instance.
940            pub fn new() -> Self {
941                std::default::Default::default()
942            }
943
944            /// Sets the value of [rerank_facet][crate::model::catalog_attribute::facet_config::RerankConfig::rerank_facet].
945            ///
946            /// # Example
947            /// ```ignore,no_run
948            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
949            /// let x = RerankConfig::new().set_rerank_facet(true);
950            /// ```
951            pub fn set_rerank_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
952                self.rerank_facet = v.into();
953                self
954            }
955
956            /// Sets the value of [facet_values][crate::model::catalog_attribute::facet_config::RerankConfig::facet_values].
957            ///
958            /// # Example
959            /// ```ignore,no_run
960            /// # use google_cloud_retail_v2::model::catalog_attribute::facet_config::RerankConfig;
961            /// let x = RerankConfig::new().set_facet_values(["a", "b", "c"]);
962            /// ```
963            pub fn set_facet_values<T, V>(mut self, v: T) -> Self
964            where
965                T: std::iter::IntoIterator<Item = V>,
966                V: std::convert::Into<std::string::String>,
967            {
968                use std::iter::Iterator;
969                self.facet_values = v.into_iter().map(|i| i.into()).collect();
970                self
971            }
972        }
973
974        impl wkt::message::Message for RerankConfig {
975            fn typename() -> &'static str {
976                "type.googleapis.com/google.cloud.retail.v2.CatalogAttribute.FacetConfig.RerankConfig"
977            }
978        }
979    }
980
981    /// The type of an attribute.
982    ///
983    /// # Working with unknown values
984    ///
985    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
986    /// additional enum variants at any time. Adding new variants is not considered
987    /// a breaking change. Applications should write their code in anticipation of:
988    ///
989    /// - New values appearing in future releases of the client library, **and**
990    /// - New values received dynamically, without application changes.
991    ///
992    /// Please consult the [Working with enums] section in the user guide for some
993    /// guidelines.
994    ///
995    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
996    #[derive(Clone, Debug, PartialEq)]
997    #[non_exhaustive]
998    pub enum AttributeType {
999        /// The type of the attribute is unknown.
1000        ///
1001        /// Used when type cannot be derived from attribute that is not
1002        /// [in_use][google.cloud.retail.v2.CatalogAttribute.in_use].
1003        ///
1004        /// [google.cloud.retail.v2.CatalogAttribute.in_use]: crate::model::CatalogAttribute::in_use
1005        Unknown,
1006        /// Textual attribute.
1007        Textual,
1008        /// Numerical attribute.
1009        Numerical,
1010        /// If set, the enum was initialized with an unknown value.
1011        ///
1012        /// Applications can examine the value using [AttributeType::value] or
1013        /// [AttributeType::name].
1014        UnknownValue(attribute_type::UnknownValue),
1015    }
1016
1017    #[doc(hidden)]
1018    pub mod attribute_type {
1019        #[allow(unused_imports)]
1020        use super::*;
1021        #[derive(Clone, Debug, PartialEq)]
1022        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1023    }
1024
1025    impl AttributeType {
1026        /// Gets the enum value.
1027        ///
1028        /// Returns `None` if the enum contains an unknown value deserialized from
1029        /// the string representation of enums.
1030        pub fn value(&self) -> std::option::Option<i32> {
1031            match self {
1032                Self::Unknown => std::option::Option::Some(0),
1033                Self::Textual => std::option::Option::Some(1),
1034                Self::Numerical => std::option::Option::Some(2),
1035                Self::UnknownValue(u) => u.0.value(),
1036            }
1037        }
1038
1039        /// Gets the enum value as a string.
1040        ///
1041        /// Returns `None` if the enum contains an unknown value deserialized from
1042        /// the integer representation of enums.
1043        pub fn name(&self) -> std::option::Option<&str> {
1044            match self {
1045                Self::Unknown => std::option::Option::Some("UNKNOWN"),
1046                Self::Textual => std::option::Option::Some("TEXTUAL"),
1047                Self::Numerical => std::option::Option::Some("NUMERICAL"),
1048                Self::UnknownValue(u) => u.0.name(),
1049            }
1050        }
1051    }
1052
1053    impl std::default::Default for AttributeType {
1054        fn default() -> Self {
1055            use std::convert::From;
1056            Self::from(0)
1057        }
1058    }
1059
1060    impl std::fmt::Display for AttributeType {
1061        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1062            wkt::internal::display_enum(f, self.name(), self.value())
1063        }
1064    }
1065
1066    impl std::convert::From<i32> for AttributeType {
1067        fn from(value: i32) -> Self {
1068            match value {
1069                0 => Self::Unknown,
1070                1 => Self::Textual,
1071                2 => Self::Numerical,
1072                _ => Self::UnknownValue(attribute_type::UnknownValue(
1073                    wkt::internal::UnknownEnumValue::Integer(value),
1074                )),
1075            }
1076        }
1077    }
1078
1079    impl std::convert::From<&str> for AttributeType {
1080        fn from(value: &str) -> Self {
1081            use std::string::ToString;
1082            match value {
1083                "UNKNOWN" => Self::Unknown,
1084                "TEXTUAL" => Self::Textual,
1085                "NUMERICAL" => Self::Numerical,
1086                _ => Self::UnknownValue(attribute_type::UnknownValue(
1087                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1088                )),
1089            }
1090        }
1091    }
1092
1093    impl serde::ser::Serialize for AttributeType {
1094        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1095        where
1096            S: serde::Serializer,
1097        {
1098            match self {
1099                Self::Unknown => serializer.serialize_i32(0),
1100                Self::Textual => serializer.serialize_i32(1),
1101                Self::Numerical => serializer.serialize_i32(2),
1102                Self::UnknownValue(u) => u.0.serialize(serializer),
1103            }
1104        }
1105    }
1106
1107    impl<'de> serde::de::Deserialize<'de> for AttributeType {
1108        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1109        where
1110            D: serde::Deserializer<'de>,
1111        {
1112            deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeType>::new(
1113                ".google.cloud.retail.v2.CatalogAttribute.AttributeType",
1114            ))
1115        }
1116    }
1117
1118    /// The status of the indexable option of a catalog attribute.
1119    ///
1120    /// # Working with unknown values
1121    ///
1122    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1123    /// additional enum variants at any time. Adding new variants is not considered
1124    /// a breaking change. Applications should write their code in anticipation of:
1125    ///
1126    /// - New values appearing in future releases of the client library, **and**
1127    /// - New values received dynamically, without application changes.
1128    ///
1129    /// Please consult the [Working with enums] section in the user guide for some
1130    /// guidelines.
1131    ///
1132    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1133    #[derive(Clone, Debug, PartialEq)]
1134    #[non_exhaustive]
1135    pub enum IndexableOption {
1136        /// Value used when unset.
1137        Unspecified,
1138        /// Indexable option enabled for an attribute.
1139        IndexableEnabled,
1140        /// Indexable option disabled for an attribute.
1141        IndexableDisabled,
1142        /// If set, the enum was initialized with an unknown value.
1143        ///
1144        /// Applications can examine the value using [IndexableOption::value] or
1145        /// [IndexableOption::name].
1146        UnknownValue(indexable_option::UnknownValue),
1147    }
1148
1149    #[doc(hidden)]
1150    pub mod indexable_option {
1151        #[allow(unused_imports)]
1152        use super::*;
1153        #[derive(Clone, Debug, PartialEq)]
1154        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1155    }
1156
1157    impl IndexableOption {
1158        /// Gets the enum value.
1159        ///
1160        /// Returns `None` if the enum contains an unknown value deserialized from
1161        /// the string representation of enums.
1162        pub fn value(&self) -> std::option::Option<i32> {
1163            match self {
1164                Self::Unspecified => std::option::Option::Some(0),
1165                Self::IndexableEnabled => std::option::Option::Some(1),
1166                Self::IndexableDisabled => std::option::Option::Some(2),
1167                Self::UnknownValue(u) => u.0.value(),
1168            }
1169        }
1170
1171        /// Gets the enum value as a string.
1172        ///
1173        /// Returns `None` if the enum contains an unknown value deserialized from
1174        /// the integer representation of enums.
1175        pub fn name(&self) -> std::option::Option<&str> {
1176            match self {
1177                Self::Unspecified => std::option::Option::Some("INDEXABLE_OPTION_UNSPECIFIED"),
1178                Self::IndexableEnabled => std::option::Option::Some("INDEXABLE_ENABLED"),
1179                Self::IndexableDisabled => std::option::Option::Some("INDEXABLE_DISABLED"),
1180                Self::UnknownValue(u) => u.0.name(),
1181            }
1182        }
1183    }
1184
1185    impl std::default::Default for IndexableOption {
1186        fn default() -> Self {
1187            use std::convert::From;
1188            Self::from(0)
1189        }
1190    }
1191
1192    impl std::fmt::Display for IndexableOption {
1193        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1194            wkt::internal::display_enum(f, self.name(), self.value())
1195        }
1196    }
1197
1198    impl std::convert::From<i32> for IndexableOption {
1199        fn from(value: i32) -> Self {
1200            match value {
1201                0 => Self::Unspecified,
1202                1 => Self::IndexableEnabled,
1203                2 => Self::IndexableDisabled,
1204                _ => Self::UnknownValue(indexable_option::UnknownValue(
1205                    wkt::internal::UnknownEnumValue::Integer(value),
1206                )),
1207            }
1208        }
1209    }
1210
1211    impl std::convert::From<&str> for IndexableOption {
1212        fn from(value: &str) -> Self {
1213            use std::string::ToString;
1214            match value {
1215                "INDEXABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1216                "INDEXABLE_ENABLED" => Self::IndexableEnabled,
1217                "INDEXABLE_DISABLED" => Self::IndexableDisabled,
1218                _ => Self::UnknownValue(indexable_option::UnknownValue(
1219                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1220                )),
1221            }
1222        }
1223    }
1224
1225    impl serde::ser::Serialize for IndexableOption {
1226        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1227        where
1228            S: serde::Serializer,
1229        {
1230            match self {
1231                Self::Unspecified => serializer.serialize_i32(0),
1232                Self::IndexableEnabled => serializer.serialize_i32(1),
1233                Self::IndexableDisabled => serializer.serialize_i32(2),
1234                Self::UnknownValue(u) => u.0.serialize(serializer),
1235            }
1236        }
1237    }
1238
1239    impl<'de> serde::de::Deserialize<'de> for IndexableOption {
1240        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1241        where
1242            D: serde::Deserializer<'de>,
1243        {
1244            deserializer.deserialize_any(wkt::internal::EnumVisitor::<IndexableOption>::new(
1245                ".google.cloud.retail.v2.CatalogAttribute.IndexableOption",
1246            ))
1247        }
1248    }
1249
1250    /// The status of the dynamic facetable option of a catalog attribute.
1251    ///
1252    /// # Working with unknown values
1253    ///
1254    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1255    /// additional enum variants at any time. Adding new variants is not considered
1256    /// a breaking change. Applications should write their code in anticipation of:
1257    ///
1258    /// - New values appearing in future releases of the client library, **and**
1259    /// - New values received dynamically, without application changes.
1260    ///
1261    /// Please consult the [Working with enums] section in the user guide for some
1262    /// guidelines.
1263    ///
1264    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1265    #[derive(Clone, Debug, PartialEq)]
1266    #[non_exhaustive]
1267    pub enum DynamicFacetableOption {
1268        /// Value used when unset.
1269        Unspecified,
1270        /// Dynamic facetable option enabled for an attribute.
1271        DynamicFacetableEnabled,
1272        /// Dynamic facetable option disabled for an attribute.
1273        DynamicFacetableDisabled,
1274        /// If set, the enum was initialized with an unknown value.
1275        ///
1276        /// Applications can examine the value using [DynamicFacetableOption::value] or
1277        /// [DynamicFacetableOption::name].
1278        UnknownValue(dynamic_facetable_option::UnknownValue),
1279    }
1280
1281    #[doc(hidden)]
1282    pub mod dynamic_facetable_option {
1283        #[allow(unused_imports)]
1284        use super::*;
1285        #[derive(Clone, Debug, PartialEq)]
1286        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1287    }
1288
1289    impl DynamicFacetableOption {
1290        /// Gets the enum value.
1291        ///
1292        /// Returns `None` if the enum contains an unknown value deserialized from
1293        /// the string representation of enums.
1294        pub fn value(&self) -> std::option::Option<i32> {
1295            match self {
1296                Self::Unspecified => std::option::Option::Some(0),
1297                Self::DynamicFacetableEnabled => std::option::Option::Some(1),
1298                Self::DynamicFacetableDisabled => std::option::Option::Some(2),
1299                Self::UnknownValue(u) => u.0.value(),
1300            }
1301        }
1302
1303        /// Gets the enum value as a string.
1304        ///
1305        /// Returns `None` if the enum contains an unknown value deserialized from
1306        /// the integer representation of enums.
1307        pub fn name(&self) -> std::option::Option<&str> {
1308            match self {
1309                Self::Unspecified => {
1310                    std::option::Option::Some("DYNAMIC_FACETABLE_OPTION_UNSPECIFIED")
1311                }
1312                Self::DynamicFacetableEnabled => {
1313                    std::option::Option::Some("DYNAMIC_FACETABLE_ENABLED")
1314                }
1315                Self::DynamicFacetableDisabled => {
1316                    std::option::Option::Some("DYNAMIC_FACETABLE_DISABLED")
1317                }
1318                Self::UnknownValue(u) => u.0.name(),
1319            }
1320        }
1321    }
1322
1323    impl std::default::Default for DynamicFacetableOption {
1324        fn default() -> Self {
1325            use std::convert::From;
1326            Self::from(0)
1327        }
1328    }
1329
1330    impl std::fmt::Display for DynamicFacetableOption {
1331        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1332            wkt::internal::display_enum(f, self.name(), self.value())
1333        }
1334    }
1335
1336    impl std::convert::From<i32> for DynamicFacetableOption {
1337        fn from(value: i32) -> Self {
1338            match value {
1339                0 => Self::Unspecified,
1340                1 => Self::DynamicFacetableEnabled,
1341                2 => Self::DynamicFacetableDisabled,
1342                _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1343                    wkt::internal::UnknownEnumValue::Integer(value),
1344                )),
1345            }
1346        }
1347    }
1348
1349    impl std::convert::From<&str> for DynamicFacetableOption {
1350        fn from(value: &str) -> Self {
1351            use std::string::ToString;
1352            match value {
1353                "DYNAMIC_FACETABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1354                "DYNAMIC_FACETABLE_ENABLED" => Self::DynamicFacetableEnabled,
1355                "DYNAMIC_FACETABLE_DISABLED" => Self::DynamicFacetableDisabled,
1356                _ => Self::UnknownValue(dynamic_facetable_option::UnknownValue(
1357                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1358                )),
1359            }
1360        }
1361    }
1362
1363    impl serde::ser::Serialize for DynamicFacetableOption {
1364        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1365        where
1366            S: serde::Serializer,
1367        {
1368            match self {
1369                Self::Unspecified => serializer.serialize_i32(0),
1370                Self::DynamicFacetableEnabled => serializer.serialize_i32(1),
1371                Self::DynamicFacetableDisabled => serializer.serialize_i32(2),
1372                Self::UnknownValue(u) => u.0.serialize(serializer),
1373            }
1374        }
1375    }
1376
1377    impl<'de> serde::de::Deserialize<'de> for DynamicFacetableOption {
1378        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1379        where
1380            D: serde::Deserializer<'de>,
1381        {
1382            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DynamicFacetableOption>::new(
1383                ".google.cloud.retail.v2.CatalogAttribute.DynamicFacetableOption",
1384            ))
1385        }
1386    }
1387
1388    /// The status of the searchable option of a catalog attribute.
1389    ///
1390    /// # Working with unknown values
1391    ///
1392    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1393    /// additional enum variants at any time. Adding new variants is not considered
1394    /// a breaking change. Applications should write their code in anticipation of:
1395    ///
1396    /// - New values appearing in future releases of the client library, **and**
1397    /// - New values received dynamically, without application changes.
1398    ///
1399    /// Please consult the [Working with enums] section in the user guide for some
1400    /// guidelines.
1401    ///
1402    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1403    #[derive(Clone, Debug, PartialEq)]
1404    #[non_exhaustive]
1405    pub enum SearchableOption {
1406        /// Value used when unset.
1407        Unspecified,
1408        /// Searchable option enabled for an attribute.
1409        SearchableEnabled,
1410        /// Searchable option disabled for an attribute.
1411        SearchableDisabled,
1412        /// If set, the enum was initialized with an unknown value.
1413        ///
1414        /// Applications can examine the value using [SearchableOption::value] or
1415        /// [SearchableOption::name].
1416        UnknownValue(searchable_option::UnknownValue),
1417    }
1418
1419    #[doc(hidden)]
1420    pub mod searchable_option {
1421        #[allow(unused_imports)]
1422        use super::*;
1423        #[derive(Clone, Debug, PartialEq)]
1424        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1425    }
1426
1427    impl SearchableOption {
1428        /// Gets the enum value.
1429        ///
1430        /// Returns `None` if the enum contains an unknown value deserialized from
1431        /// the string representation of enums.
1432        pub fn value(&self) -> std::option::Option<i32> {
1433            match self {
1434                Self::Unspecified => std::option::Option::Some(0),
1435                Self::SearchableEnabled => std::option::Option::Some(1),
1436                Self::SearchableDisabled => std::option::Option::Some(2),
1437                Self::UnknownValue(u) => u.0.value(),
1438            }
1439        }
1440
1441        /// Gets the enum value as a string.
1442        ///
1443        /// Returns `None` if the enum contains an unknown value deserialized from
1444        /// the integer representation of enums.
1445        pub fn name(&self) -> std::option::Option<&str> {
1446            match self {
1447                Self::Unspecified => std::option::Option::Some("SEARCHABLE_OPTION_UNSPECIFIED"),
1448                Self::SearchableEnabled => std::option::Option::Some("SEARCHABLE_ENABLED"),
1449                Self::SearchableDisabled => std::option::Option::Some("SEARCHABLE_DISABLED"),
1450                Self::UnknownValue(u) => u.0.name(),
1451            }
1452        }
1453    }
1454
1455    impl std::default::Default for SearchableOption {
1456        fn default() -> Self {
1457            use std::convert::From;
1458            Self::from(0)
1459        }
1460    }
1461
1462    impl std::fmt::Display for SearchableOption {
1463        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1464            wkt::internal::display_enum(f, self.name(), self.value())
1465        }
1466    }
1467
1468    impl std::convert::From<i32> for SearchableOption {
1469        fn from(value: i32) -> Self {
1470            match value {
1471                0 => Self::Unspecified,
1472                1 => Self::SearchableEnabled,
1473                2 => Self::SearchableDisabled,
1474                _ => Self::UnknownValue(searchable_option::UnknownValue(
1475                    wkt::internal::UnknownEnumValue::Integer(value),
1476                )),
1477            }
1478        }
1479    }
1480
1481    impl std::convert::From<&str> for SearchableOption {
1482        fn from(value: &str) -> Self {
1483            use std::string::ToString;
1484            match value {
1485                "SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1486                "SEARCHABLE_ENABLED" => Self::SearchableEnabled,
1487                "SEARCHABLE_DISABLED" => Self::SearchableDisabled,
1488                _ => Self::UnknownValue(searchable_option::UnknownValue(
1489                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1490                )),
1491            }
1492        }
1493    }
1494
1495    impl serde::ser::Serialize for SearchableOption {
1496        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1497        where
1498            S: serde::Serializer,
1499        {
1500            match self {
1501                Self::Unspecified => serializer.serialize_i32(0),
1502                Self::SearchableEnabled => serializer.serialize_i32(1),
1503                Self::SearchableDisabled => serializer.serialize_i32(2),
1504                Self::UnknownValue(u) => u.0.serialize(serializer),
1505            }
1506        }
1507    }
1508
1509    impl<'de> serde::de::Deserialize<'de> for SearchableOption {
1510        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1511        where
1512            D: serde::Deserializer<'de>,
1513        {
1514            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchableOption>::new(
1515                ".google.cloud.retail.v2.CatalogAttribute.SearchableOption",
1516            ))
1517        }
1518    }
1519
1520    /// The status of the exact-searchable option of a catalog attribute.
1521    ///
1522    /// # Working with unknown values
1523    ///
1524    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1525    /// additional enum variants at any time. Adding new variants is not considered
1526    /// a breaking change. Applications should write their code in anticipation of:
1527    ///
1528    /// - New values appearing in future releases of the client library, **and**
1529    /// - New values received dynamically, without application changes.
1530    ///
1531    /// Please consult the [Working with enums] section in the user guide for some
1532    /// guidelines.
1533    ///
1534    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1535    #[derive(Clone, Debug, PartialEq)]
1536    #[non_exhaustive]
1537    pub enum ExactSearchableOption {
1538        /// Value used when unset.
1539        Unspecified,
1540        /// Exact searchable option enabled for an attribute.
1541        ExactSearchableEnabled,
1542        /// Exact searchable option disabled for an attribute.
1543        ExactSearchableDisabled,
1544        /// If set, the enum was initialized with an unknown value.
1545        ///
1546        /// Applications can examine the value using [ExactSearchableOption::value] or
1547        /// [ExactSearchableOption::name].
1548        UnknownValue(exact_searchable_option::UnknownValue),
1549    }
1550
1551    #[doc(hidden)]
1552    pub mod exact_searchable_option {
1553        #[allow(unused_imports)]
1554        use super::*;
1555        #[derive(Clone, Debug, PartialEq)]
1556        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1557    }
1558
1559    impl ExactSearchableOption {
1560        /// Gets the enum value.
1561        ///
1562        /// Returns `None` if the enum contains an unknown value deserialized from
1563        /// the string representation of enums.
1564        pub fn value(&self) -> std::option::Option<i32> {
1565            match self {
1566                Self::Unspecified => std::option::Option::Some(0),
1567                Self::ExactSearchableEnabled => std::option::Option::Some(1),
1568                Self::ExactSearchableDisabled => std::option::Option::Some(2),
1569                Self::UnknownValue(u) => u.0.value(),
1570            }
1571        }
1572
1573        /// Gets the enum value as a string.
1574        ///
1575        /// Returns `None` if the enum contains an unknown value deserialized from
1576        /// the integer representation of enums.
1577        pub fn name(&self) -> std::option::Option<&str> {
1578            match self {
1579                Self::Unspecified => {
1580                    std::option::Option::Some("EXACT_SEARCHABLE_OPTION_UNSPECIFIED")
1581                }
1582                Self::ExactSearchableEnabled => {
1583                    std::option::Option::Some("EXACT_SEARCHABLE_ENABLED")
1584                }
1585                Self::ExactSearchableDisabled => {
1586                    std::option::Option::Some("EXACT_SEARCHABLE_DISABLED")
1587                }
1588                Self::UnknownValue(u) => u.0.name(),
1589            }
1590        }
1591    }
1592
1593    impl std::default::Default for ExactSearchableOption {
1594        fn default() -> Self {
1595            use std::convert::From;
1596            Self::from(0)
1597        }
1598    }
1599
1600    impl std::fmt::Display for ExactSearchableOption {
1601        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1602            wkt::internal::display_enum(f, self.name(), self.value())
1603        }
1604    }
1605
1606    impl std::convert::From<i32> for ExactSearchableOption {
1607        fn from(value: i32) -> Self {
1608            match value {
1609                0 => Self::Unspecified,
1610                1 => Self::ExactSearchableEnabled,
1611                2 => Self::ExactSearchableDisabled,
1612                _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1613                    wkt::internal::UnknownEnumValue::Integer(value),
1614                )),
1615            }
1616        }
1617    }
1618
1619    impl std::convert::From<&str> for ExactSearchableOption {
1620        fn from(value: &str) -> Self {
1621            use std::string::ToString;
1622            match value {
1623                "EXACT_SEARCHABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1624                "EXACT_SEARCHABLE_ENABLED" => Self::ExactSearchableEnabled,
1625                "EXACT_SEARCHABLE_DISABLED" => Self::ExactSearchableDisabled,
1626                _ => Self::UnknownValue(exact_searchable_option::UnknownValue(
1627                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1628                )),
1629            }
1630        }
1631    }
1632
1633    impl serde::ser::Serialize for ExactSearchableOption {
1634        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1635        where
1636            S: serde::Serializer,
1637        {
1638            match self {
1639                Self::Unspecified => serializer.serialize_i32(0),
1640                Self::ExactSearchableEnabled => serializer.serialize_i32(1),
1641                Self::ExactSearchableDisabled => serializer.serialize_i32(2),
1642                Self::UnknownValue(u) => u.0.serialize(serializer),
1643            }
1644        }
1645    }
1646
1647    impl<'de> serde::de::Deserialize<'de> for ExactSearchableOption {
1648        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1649        where
1650            D: serde::Deserializer<'de>,
1651        {
1652            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ExactSearchableOption>::new(
1653                ".google.cloud.retail.v2.CatalogAttribute.ExactSearchableOption",
1654            ))
1655        }
1656    }
1657
1658    /// The status of the retrievable option of a catalog attribute.
1659    ///
1660    /// # Working with unknown values
1661    ///
1662    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1663    /// additional enum variants at any time. Adding new variants is not considered
1664    /// a breaking change. Applications should write their code in anticipation of:
1665    ///
1666    /// - New values appearing in future releases of the client library, **and**
1667    /// - New values received dynamically, without application changes.
1668    ///
1669    /// Please consult the [Working with enums] section in the user guide for some
1670    /// guidelines.
1671    ///
1672    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1673    #[derive(Clone, Debug, PartialEq)]
1674    #[non_exhaustive]
1675    pub enum RetrievableOption {
1676        /// Value used when unset.
1677        Unspecified,
1678        /// Retrievable option enabled for an attribute.
1679        RetrievableEnabled,
1680        /// Retrievable option disabled for an attribute.
1681        RetrievableDisabled,
1682        /// If set, the enum was initialized with an unknown value.
1683        ///
1684        /// Applications can examine the value using [RetrievableOption::value] or
1685        /// [RetrievableOption::name].
1686        UnknownValue(retrievable_option::UnknownValue),
1687    }
1688
1689    #[doc(hidden)]
1690    pub mod retrievable_option {
1691        #[allow(unused_imports)]
1692        use super::*;
1693        #[derive(Clone, Debug, PartialEq)]
1694        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1695    }
1696
1697    impl RetrievableOption {
1698        /// Gets the enum value.
1699        ///
1700        /// Returns `None` if the enum contains an unknown value deserialized from
1701        /// the string representation of enums.
1702        pub fn value(&self) -> std::option::Option<i32> {
1703            match self {
1704                Self::Unspecified => std::option::Option::Some(0),
1705                Self::RetrievableEnabled => std::option::Option::Some(1),
1706                Self::RetrievableDisabled => std::option::Option::Some(2),
1707                Self::UnknownValue(u) => u.0.value(),
1708            }
1709        }
1710
1711        /// Gets the enum value as a string.
1712        ///
1713        /// Returns `None` if the enum contains an unknown value deserialized from
1714        /// the integer representation of enums.
1715        pub fn name(&self) -> std::option::Option<&str> {
1716            match self {
1717                Self::Unspecified => std::option::Option::Some("RETRIEVABLE_OPTION_UNSPECIFIED"),
1718                Self::RetrievableEnabled => std::option::Option::Some("RETRIEVABLE_ENABLED"),
1719                Self::RetrievableDisabled => std::option::Option::Some("RETRIEVABLE_DISABLED"),
1720                Self::UnknownValue(u) => u.0.name(),
1721            }
1722        }
1723    }
1724
1725    impl std::default::Default for RetrievableOption {
1726        fn default() -> Self {
1727            use std::convert::From;
1728            Self::from(0)
1729        }
1730    }
1731
1732    impl std::fmt::Display for RetrievableOption {
1733        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1734            wkt::internal::display_enum(f, self.name(), self.value())
1735        }
1736    }
1737
1738    impl std::convert::From<i32> for RetrievableOption {
1739        fn from(value: i32) -> Self {
1740            match value {
1741                0 => Self::Unspecified,
1742                1 => Self::RetrievableEnabled,
1743                2 => Self::RetrievableDisabled,
1744                _ => Self::UnknownValue(retrievable_option::UnknownValue(
1745                    wkt::internal::UnknownEnumValue::Integer(value),
1746                )),
1747            }
1748        }
1749    }
1750
1751    impl std::convert::From<&str> for RetrievableOption {
1752        fn from(value: &str) -> Self {
1753            use std::string::ToString;
1754            match value {
1755                "RETRIEVABLE_OPTION_UNSPECIFIED" => Self::Unspecified,
1756                "RETRIEVABLE_ENABLED" => Self::RetrievableEnabled,
1757                "RETRIEVABLE_DISABLED" => Self::RetrievableDisabled,
1758                _ => Self::UnknownValue(retrievable_option::UnknownValue(
1759                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1760                )),
1761            }
1762        }
1763    }
1764
1765    impl serde::ser::Serialize for RetrievableOption {
1766        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1767        where
1768            S: serde::Serializer,
1769        {
1770            match self {
1771                Self::Unspecified => serializer.serialize_i32(0),
1772                Self::RetrievableEnabled => serializer.serialize_i32(1),
1773                Self::RetrievableDisabled => serializer.serialize_i32(2),
1774                Self::UnknownValue(u) => u.0.serialize(serializer),
1775            }
1776        }
1777    }
1778
1779    impl<'de> serde::de::Deserialize<'de> for RetrievableOption {
1780        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1781        where
1782            D: serde::Deserializer<'de>,
1783        {
1784            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RetrievableOption>::new(
1785                ".google.cloud.retail.v2.CatalogAttribute.RetrievableOption",
1786            ))
1787        }
1788    }
1789}
1790
1791/// Catalog level attribute config.
1792#[derive(Clone, Default, PartialEq)]
1793#[non_exhaustive]
1794pub struct AttributesConfig {
1795    /// Required. Immutable. The fully qualified resource name of the attribute
1796    /// config. Format: `projects/*/locations/*/catalogs/*/attributesConfig`
1797    pub name: std::string::String,
1798
1799    /// Enable attribute(s) config at catalog level.
1800    /// For example, indexable, dynamic_facetable, or searchable for each
1801    /// attribute.
1802    ///
1803    /// The key is catalog attribute's name.
1804    /// For example: `color`, `brands`, `attributes.custom_attribute`, such as
1805    /// `attributes.xyz`.
1806    ///
1807    /// The maximum number of catalog attributes allowed in a request is 1000.
1808    pub catalog_attributes:
1809        std::collections::HashMap<std::string::String, crate::model::CatalogAttribute>,
1810
1811    /// Output only. The
1812    /// [AttributeConfigLevel][google.cloud.retail.v2.AttributeConfigLevel] used
1813    /// for this catalog.
1814    ///
1815    /// [google.cloud.retail.v2.AttributeConfigLevel]: crate::model::AttributeConfigLevel
1816    pub attribute_config_level: crate::model::AttributeConfigLevel,
1817
1818    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1819}
1820
1821impl AttributesConfig {
1822    /// Creates a new default instance.
1823    pub fn new() -> Self {
1824        std::default::Default::default()
1825    }
1826
1827    /// Sets the value of [name][crate::model::AttributesConfig::name].
1828    ///
1829    /// # Example
1830    /// ```ignore,no_run
1831    /// # use google_cloud_retail_v2::model::AttributesConfig;
1832    /// # let project_id = "project_id";
1833    /// # let location_id = "location_id";
1834    /// # let catalog_id = "catalog_id";
1835    /// let x = AttributesConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
1836    /// ```
1837    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1838        self.name = v.into();
1839        self
1840    }
1841
1842    /// Sets the value of [catalog_attributes][crate::model::AttributesConfig::catalog_attributes].
1843    ///
1844    /// # Example
1845    /// ```ignore,no_run
1846    /// # use google_cloud_retail_v2::model::AttributesConfig;
1847    /// use google_cloud_retail_v2::model::CatalogAttribute;
1848    /// let x = AttributesConfig::new().set_catalog_attributes([
1849    ///     ("key0", CatalogAttribute::default()/* use setters */),
1850    ///     ("key1", CatalogAttribute::default()/* use (different) setters */),
1851    /// ]);
1852    /// ```
1853    pub fn set_catalog_attributes<T, K, V>(mut self, v: T) -> Self
1854    where
1855        T: std::iter::IntoIterator<Item = (K, V)>,
1856        K: std::convert::Into<std::string::String>,
1857        V: std::convert::Into<crate::model::CatalogAttribute>,
1858    {
1859        use std::iter::Iterator;
1860        self.catalog_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1861        self
1862    }
1863
1864    /// Sets the value of [attribute_config_level][crate::model::AttributesConfig::attribute_config_level].
1865    ///
1866    /// # Example
1867    /// ```ignore,no_run
1868    /// # use google_cloud_retail_v2::model::AttributesConfig;
1869    /// use google_cloud_retail_v2::model::AttributeConfigLevel;
1870    /// let x0 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::ProductLevelAttributeConfig);
1871    /// let x1 = AttributesConfig::new().set_attribute_config_level(AttributeConfigLevel::CatalogLevelAttributeConfig);
1872    /// ```
1873    pub fn set_attribute_config_level<T: std::convert::Into<crate::model::AttributeConfigLevel>>(
1874        mut self,
1875        v: T,
1876    ) -> Self {
1877        self.attribute_config_level = v.into();
1878        self
1879    }
1880}
1881
1882impl wkt::message::Message for AttributesConfig {
1883    fn typename() -> &'static str {
1884        "type.googleapis.com/google.cloud.retail.v2.AttributesConfig"
1885    }
1886}
1887
1888/// Catalog level autocomplete config for customers to customize autocomplete
1889/// feature's settings.
1890#[derive(Clone, Default, PartialEq)]
1891#[non_exhaustive]
1892pub struct CompletionConfig {
1893    /// Required. Immutable. Fully qualified name
1894    /// `projects/*/locations/*/catalogs/*/completionConfig`
1895    pub name: std::string::String,
1896
1897    /// Specifies the matching order for autocomplete suggestions, e.g., a query
1898    /// consisting of 'sh' with 'out-of-order' specified would suggest "women's
1899    /// shoes", whereas a query of 'red s' with 'exact-prefix' specified would
1900    /// suggest "red shoes". Currently supported values:
1901    ///
1902    /// * 'out-of-order'
1903    /// * 'exact-prefix'
1904    ///
1905    /// Default value: 'exact-prefix'.
1906    pub matching_order: std::string::String,
1907
1908    /// The maximum number of autocomplete suggestions returned per term. Default
1909    /// value is 20. If left unset or set to 0, then will fallback to default
1910    /// value.
1911    ///
1912    /// Value range is 1 to 20.
1913    pub max_suggestions: i32,
1914
1915    /// The minimum number of characters needed to be typed in order to get
1916    /// suggestions. Default value is 2. If left unset or set to 0, then will
1917    /// fallback to default value.
1918    ///
1919    /// Value range is 1 to 20.
1920    pub min_prefix_length: i32,
1921
1922    /// If set to true, the auto learning function is enabled. Auto learning uses
1923    /// user data to generate suggestions using ML techniques. Default value is
1924    /// false. Only after enabling auto learning can users use `cloud-retail`
1925    /// data in
1926    /// [CompleteQueryRequest][google.cloud.retail.v2.CompleteQueryRequest].
1927    ///
1928    /// [google.cloud.retail.v2.CompleteQueryRequest]: crate::model::CompleteQueryRequest
1929    pub auto_learning: bool,
1930
1931    /// Output only. The source data for the latest import of the autocomplete
1932    /// suggestion phrases.
1933    pub suggestions_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1934
1935    /// Output only. Name of the LRO corresponding to the latest suggestion terms
1936    /// list import.
1937    ///
1938    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API
1939    /// method to retrieve the latest state of the Long Running Operation.
1940    pub last_suggestions_import_operation: std::string::String,
1941
1942    /// Output only. The source data for the latest import of the autocomplete
1943    /// denylist phrases.
1944    pub denylist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1945
1946    /// Output only. Name of the LRO corresponding to the latest denylist import.
1947    ///
1948    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1949    /// retrieve the latest state of the Long Running Operation.
1950    pub last_denylist_import_operation: std::string::String,
1951
1952    /// Output only. The source data for the latest import of the autocomplete
1953    /// allowlist phrases.
1954    pub allowlist_input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
1955
1956    /// Output only. Name of the LRO corresponding to the latest allowlist import.
1957    ///
1958    /// Can use [GetOperation][google.longrunning.Operations.GetOperation] API to
1959    /// retrieve the latest state of the Long Running Operation.
1960    pub last_allowlist_import_operation: std::string::String,
1961
1962    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1963}
1964
1965impl CompletionConfig {
1966    /// Creates a new default instance.
1967    pub fn new() -> Self {
1968        std::default::Default::default()
1969    }
1970
1971    /// Sets the value of [name][crate::model::CompletionConfig::name].
1972    ///
1973    /// # Example
1974    /// ```ignore,no_run
1975    /// # use google_cloud_retail_v2::model::CompletionConfig;
1976    /// # let project_id = "project_id";
1977    /// # let location_id = "location_id";
1978    /// # let catalog_id = "catalog_id";
1979    /// let x = CompletionConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/completionConfig"));
1980    /// ```
1981    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1982        self.name = v.into();
1983        self
1984    }
1985
1986    /// Sets the value of [matching_order][crate::model::CompletionConfig::matching_order].
1987    ///
1988    /// # Example
1989    /// ```ignore,no_run
1990    /// # use google_cloud_retail_v2::model::CompletionConfig;
1991    /// let x = CompletionConfig::new().set_matching_order("example");
1992    /// ```
1993    pub fn set_matching_order<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1994        self.matching_order = v.into();
1995        self
1996    }
1997
1998    /// Sets the value of [max_suggestions][crate::model::CompletionConfig::max_suggestions].
1999    ///
2000    /// # Example
2001    /// ```ignore,no_run
2002    /// # use google_cloud_retail_v2::model::CompletionConfig;
2003    /// let x = CompletionConfig::new().set_max_suggestions(42);
2004    /// ```
2005    pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2006        self.max_suggestions = v.into();
2007        self
2008    }
2009
2010    /// Sets the value of [min_prefix_length][crate::model::CompletionConfig::min_prefix_length].
2011    ///
2012    /// # Example
2013    /// ```ignore,no_run
2014    /// # use google_cloud_retail_v2::model::CompletionConfig;
2015    /// let x = CompletionConfig::new().set_min_prefix_length(42);
2016    /// ```
2017    pub fn set_min_prefix_length<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2018        self.min_prefix_length = v.into();
2019        self
2020    }
2021
2022    /// Sets the value of [auto_learning][crate::model::CompletionConfig::auto_learning].
2023    ///
2024    /// # Example
2025    /// ```ignore,no_run
2026    /// # use google_cloud_retail_v2::model::CompletionConfig;
2027    /// let x = CompletionConfig::new().set_auto_learning(true);
2028    /// ```
2029    pub fn set_auto_learning<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2030        self.auto_learning = v.into();
2031        self
2032    }
2033
2034    /// Sets 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_suggestions_input_config(CompletionDataInputConfig::default()/* use setters */);
2041    /// ```
2042    pub fn set_suggestions_input_config<T>(mut self, v: T) -> Self
2043    where
2044        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2045    {
2046        self.suggestions_input_config = std::option::Option::Some(v.into());
2047        self
2048    }
2049
2050    /// Sets or clears the value of [suggestions_input_config][crate::model::CompletionConfig::suggestions_input_config].
2051    ///
2052    /// # Example
2053    /// ```ignore,no_run
2054    /// # use google_cloud_retail_v2::model::CompletionConfig;
2055    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2056    /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2057    /// let x = CompletionConfig::new().set_or_clear_suggestions_input_config(None::<CompletionDataInputConfig>);
2058    /// ```
2059    pub fn set_or_clear_suggestions_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2060    where
2061        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2062    {
2063        self.suggestions_input_config = v.map(|x| x.into());
2064        self
2065    }
2066
2067    /// Sets the value of [last_suggestions_import_operation][crate::model::CompletionConfig::last_suggestions_import_operation].
2068    ///
2069    /// # Example
2070    /// ```ignore,no_run
2071    /// # use google_cloud_retail_v2::model::CompletionConfig;
2072    /// let x = CompletionConfig::new().set_last_suggestions_import_operation("example");
2073    /// ```
2074    pub fn set_last_suggestions_import_operation<T: std::convert::Into<std::string::String>>(
2075        mut self,
2076        v: T,
2077    ) -> Self {
2078        self.last_suggestions_import_operation = v.into();
2079        self
2080    }
2081
2082    /// Sets 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_denylist_input_config(CompletionDataInputConfig::default()/* use setters */);
2089    /// ```
2090    pub fn set_denylist_input_config<T>(mut self, v: T) -> Self
2091    where
2092        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2093    {
2094        self.denylist_input_config = std::option::Option::Some(v.into());
2095        self
2096    }
2097
2098    /// Sets or clears the value of [denylist_input_config][crate::model::CompletionConfig::denylist_input_config].
2099    ///
2100    /// # Example
2101    /// ```ignore,no_run
2102    /// # use google_cloud_retail_v2::model::CompletionConfig;
2103    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2104    /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2105    /// let x = CompletionConfig::new().set_or_clear_denylist_input_config(None::<CompletionDataInputConfig>);
2106    /// ```
2107    pub fn set_or_clear_denylist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2108    where
2109        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2110    {
2111        self.denylist_input_config = v.map(|x| x.into());
2112        self
2113    }
2114
2115    /// Sets the value of [last_denylist_import_operation][crate::model::CompletionConfig::last_denylist_import_operation].
2116    ///
2117    /// # Example
2118    /// ```ignore,no_run
2119    /// # use google_cloud_retail_v2::model::CompletionConfig;
2120    /// let x = CompletionConfig::new().set_last_denylist_import_operation("example");
2121    /// ```
2122    pub fn set_last_denylist_import_operation<T: std::convert::Into<std::string::String>>(
2123        mut self,
2124        v: T,
2125    ) -> Self {
2126        self.last_denylist_import_operation = v.into();
2127        self
2128    }
2129
2130    /// Sets 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_allowlist_input_config(CompletionDataInputConfig::default()/* use setters */);
2137    /// ```
2138    pub fn set_allowlist_input_config<T>(mut self, v: T) -> Self
2139    where
2140        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2141    {
2142        self.allowlist_input_config = std::option::Option::Some(v.into());
2143        self
2144    }
2145
2146    /// Sets or clears the value of [allowlist_input_config][crate::model::CompletionConfig::allowlist_input_config].
2147    ///
2148    /// # Example
2149    /// ```ignore,no_run
2150    /// # use google_cloud_retail_v2::model::CompletionConfig;
2151    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
2152    /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
2153    /// let x = CompletionConfig::new().set_or_clear_allowlist_input_config(None::<CompletionDataInputConfig>);
2154    /// ```
2155    pub fn set_or_clear_allowlist_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2156    where
2157        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
2158    {
2159        self.allowlist_input_config = v.map(|x| x.into());
2160        self
2161    }
2162
2163    /// Sets the value of [last_allowlist_import_operation][crate::model::CompletionConfig::last_allowlist_import_operation].
2164    ///
2165    /// # Example
2166    /// ```ignore,no_run
2167    /// # use google_cloud_retail_v2::model::CompletionConfig;
2168    /// let x = CompletionConfig::new().set_last_allowlist_import_operation("example");
2169    /// ```
2170    pub fn set_last_allowlist_import_operation<T: std::convert::Into<std::string::String>>(
2171        mut self,
2172        v: T,
2173    ) -> Self {
2174        self.last_allowlist_import_operation = v.into();
2175        self
2176    }
2177}
2178
2179impl wkt::message::Message for CompletionConfig {
2180    fn typename() -> &'static str {
2181        "type.googleapis.com/google.cloud.retail.v2.CompletionConfig"
2182    }
2183}
2184
2185/// The catalog configuration.
2186#[derive(Clone, Default, PartialEq)]
2187#[non_exhaustive]
2188pub struct Catalog {
2189    /// Required. Immutable. The fully qualified resource name of the catalog.
2190    pub name: std::string::String,
2191
2192    /// Required. Immutable. The catalog display name.
2193    ///
2194    /// This field must be a UTF-8 encoded string with a length limit of 128
2195    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2196    pub display_name: std::string::String,
2197
2198    /// Required. The product level configuration.
2199    pub product_level_config: std::option::Option<crate::model::ProductLevelConfig>,
2200
2201    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2202}
2203
2204impl Catalog {
2205    /// Creates a new default instance.
2206    pub fn new() -> Self {
2207        std::default::Default::default()
2208    }
2209
2210    /// Sets the value of [name][crate::model::Catalog::name].
2211    ///
2212    /// # Example
2213    /// ```ignore,no_run
2214    /// # use google_cloud_retail_v2::model::Catalog;
2215    /// # let project_id = "project_id";
2216    /// # let location_id = "location_id";
2217    /// # let catalog_id = "catalog_id";
2218    /// let x = Catalog::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
2219    /// ```
2220    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2221        self.name = v.into();
2222        self
2223    }
2224
2225    /// Sets the value of [display_name][crate::model::Catalog::display_name].
2226    ///
2227    /// # Example
2228    /// ```ignore,no_run
2229    /// # use google_cloud_retail_v2::model::Catalog;
2230    /// let x = Catalog::new().set_display_name("example");
2231    /// ```
2232    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2233        self.display_name = v.into();
2234        self
2235    }
2236
2237    /// Sets the value of [product_level_config][crate::model::Catalog::product_level_config].
2238    ///
2239    /// # Example
2240    /// ```ignore,no_run
2241    /// # use google_cloud_retail_v2::model::Catalog;
2242    /// use google_cloud_retail_v2::model::ProductLevelConfig;
2243    /// let x = Catalog::new().set_product_level_config(ProductLevelConfig::default()/* use setters */);
2244    /// ```
2245    pub fn set_product_level_config<T>(mut self, v: T) -> Self
2246    where
2247        T: std::convert::Into<crate::model::ProductLevelConfig>,
2248    {
2249        self.product_level_config = std::option::Option::Some(v.into());
2250        self
2251    }
2252
2253    /// Sets or clears the value of [product_level_config][crate::model::Catalog::product_level_config].
2254    ///
2255    /// # Example
2256    /// ```ignore,no_run
2257    /// # use google_cloud_retail_v2::model::Catalog;
2258    /// use google_cloud_retail_v2::model::ProductLevelConfig;
2259    /// let x = Catalog::new().set_or_clear_product_level_config(Some(ProductLevelConfig::default()/* use setters */));
2260    /// let x = Catalog::new().set_or_clear_product_level_config(None::<ProductLevelConfig>);
2261    /// ```
2262    pub fn set_or_clear_product_level_config<T>(mut self, v: std::option::Option<T>) -> Self
2263    where
2264        T: std::convert::Into<crate::model::ProductLevelConfig>,
2265    {
2266        self.product_level_config = v.map(|x| x.into());
2267        self
2268    }
2269}
2270
2271impl wkt::message::Message for Catalog {
2272    fn typename() -> &'static str {
2273        "type.googleapis.com/google.cloud.retail.v2.Catalog"
2274    }
2275}
2276
2277/// Request for
2278/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2279/// method.
2280///
2281/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2282#[derive(Clone, Default, PartialEq)]
2283#[non_exhaustive]
2284pub struct ListCatalogsRequest {
2285    /// Required. The account resource name with an associated location.
2286    ///
2287    /// If the caller does not have permission to list
2288    /// [Catalog][google.cloud.retail.v2.Catalog]s under this location, regardless
2289    /// of whether or not this location exists, a PERMISSION_DENIED error is
2290    /// returned.
2291    ///
2292    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2293    pub parent: std::string::String,
2294
2295    /// Maximum number of [Catalog][google.cloud.retail.v2.Catalog]s to return. If
2296    /// unspecified, defaults to 50. The maximum allowed value is 1000. Values
2297    /// above 1000 will be coerced to 1000.
2298    ///
2299    /// If this field is negative, an INVALID_ARGUMENT is returned.
2300    ///
2301    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2302    pub page_size: i32,
2303
2304    /// A page token
2305    /// [ListCatalogsResponse.next_page_token][google.cloud.retail.v2.ListCatalogsResponse.next_page_token],
2306    /// received from a previous
2307    /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2308    /// call. Provide this to retrieve the subsequent page.
2309    ///
2310    /// When paginating, all other parameters provided to
2311    /// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2312    /// must match the call that provided the page token. Otherwise, an
2313    /// INVALID_ARGUMENT error is returned.
2314    ///
2315    /// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2316    /// [google.cloud.retail.v2.ListCatalogsResponse.next_page_token]: crate::model::ListCatalogsResponse::next_page_token
2317    pub page_token: std::string::String,
2318
2319    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2320}
2321
2322impl ListCatalogsRequest {
2323    /// Creates a new default instance.
2324    pub fn new() -> Self {
2325        std::default::Default::default()
2326    }
2327
2328    /// Sets the value of [parent][crate::model::ListCatalogsRequest::parent].
2329    ///
2330    /// # Example
2331    /// ```ignore,no_run
2332    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2333    /// let x = ListCatalogsRequest::new().set_parent("example");
2334    /// ```
2335    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2336        self.parent = v.into();
2337        self
2338    }
2339
2340    /// Sets the value of [page_size][crate::model::ListCatalogsRequest::page_size].
2341    ///
2342    /// # Example
2343    /// ```ignore,no_run
2344    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2345    /// let x = ListCatalogsRequest::new().set_page_size(42);
2346    /// ```
2347    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2348        self.page_size = v.into();
2349        self
2350    }
2351
2352    /// Sets the value of [page_token][crate::model::ListCatalogsRequest::page_token].
2353    ///
2354    /// # Example
2355    /// ```ignore,no_run
2356    /// # use google_cloud_retail_v2::model::ListCatalogsRequest;
2357    /// let x = ListCatalogsRequest::new().set_page_token("example");
2358    /// ```
2359    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2360        self.page_token = v.into();
2361        self
2362    }
2363}
2364
2365impl wkt::message::Message for ListCatalogsRequest {
2366    fn typename() -> &'static str {
2367        "type.googleapis.com/google.cloud.retail.v2.ListCatalogsRequest"
2368    }
2369}
2370
2371/// Response for
2372/// [CatalogService.ListCatalogs][google.cloud.retail.v2.CatalogService.ListCatalogs]
2373/// method.
2374///
2375/// [google.cloud.retail.v2.CatalogService.ListCatalogs]: crate::client::CatalogService::list_catalogs
2376#[derive(Clone, Default, PartialEq)]
2377#[non_exhaustive]
2378pub struct ListCatalogsResponse {
2379    /// All the customer's [Catalog][google.cloud.retail.v2.Catalog]s.
2380    ///
2381    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2382    pub catalogs: std::vec::Vec<crate::model::Catalog>,
2383
2384    /// A token that can be sent as
2385    /// [ListCatalogsRequest.page_token][google.cloud.retail.v2.ListCatalogsRequest.page_token]
2386    /// to retrieve the next page. If this field is omitted, there are no
2387    /// subsequent pages.
2388    ///
2389    /// [google.cloud.retail.v2.ListCatalogsRequest.page_token]: crate::model::ListCatalogsRequest::page_token
2390    pub next_page_token: std::string::String,
2391
2392    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2393}
2394
2395impl ListCatalogsResponse {
2396    /// Creates a new default instance.
2397    pub fn new() -> Self {
2398        std::default::Default::default()
2399    }
2400
2401    /// Sets the value of [catalogs][crate::model::ListCatalogsResponse::catalogs].
2402    ///
2403    /// # Example
2404    /// ```ignore,no_run
2405    /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2406    /// use google_cloud_retail_v2::model::Catalog;
2407    /// let x = ListCatalogsResponse::new()
2408    ///     .set_catalogs([
2409    ///         Catalog::default()/* use setters */,
2410    ///         Catalog::default()/* use (different) setters */,
2411    ///     ]);
2412    /// ```
2413    pub fn set_catalogs<T, V>(mut self, v: T) -> Self
2414    where
2415        T: std::iter::IntoIterator<Item = V>,
2416        V: std::convert::Into<crate::model::Catalog>,
2417    {
2418        use std::iter::Iterator;
2419        self.catalogs = v.into_iter().map(|i| i.into()).collect();
2420        self
2421    }
2422
2423    /// Sets the value of [next_page_token][crate::model::ListCatalogsResponse::next_page_token].
2424    ///
2425    /// # Example
2426    /// ```ignore,no_run
2427    /// # use google_cloud_retail_v2::model::ListCatalogsResponse;
2428    /// let x = ListCatalogsResponse::new().set_next_page_token("example");
2429    /// ```
2430    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2431        self.next_page_token = v.into();
2432        self
2433    }
2434}
2435
2436impl wkt::message::Message for ListCatalogsResponse {
2437    fn typename() -> &'static str {
2438        "type.googleapis.com/google.cloud.retail.v2.ListCatalogsResponse"
2439    }
2440}
2441
2442#[doc(hidden)]
2443impl google_cloud_gax::paginator::internal::PageableResponse for ListCatalogsResponse {
2444    type PageItem = crate::model::Catalog;
2445
2446    fn items(self) -> std::vec::Vec<Self::PageItem> {
2447        self.catalogs
2448    }
2449
2450    fn next_page_token(&self) -> std::string::String {
2451        use std::clone::Clone;
2452        self.next_page_token.clone()
2453    }
2454}
2455
2456/// Request for
2457/// [CatalogService.UpdateCatalog][google.cloud.retail.v2.CatalogService.UpdateCatalog]
2458/// method.
2459///
2460/// [google.cloud.retail.v2.CatalogService.UpdateCatalog]: crate::client::CatalogService::update_catalog
2461#[derive(Clone, Default, PartialEq)]
2462#[non_exhaustive]
2463pub struct UpdateCatalogRequest {
2464    /// Required. The [Catalog][google.cloud.retail.v2.Catalog] to update.
2465    ///
2466    /// If the caller does not have permission to update the
2467    /// [Catalog][google.cloud.retail.v2.Catalog], regardless of whether or not it
2468    /// exists, a PERMISSION_DENIED error is returned.
2469    ///
2470    /// If the [Catalog][google.cloud.retail.v2.Catalog] to update does not exist,
2471    /// a NOT_FOUND error is returned.
2472    ///
2473    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2474    pub catalog: std::option::Option<crate::model::Catalog>,
2475
2476    /// Indicates which fields in the provided
2477    /// [Catalog][google.cloud.retail.v2.Catalog] to update.
2478    ///
2479    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
2480    /// is returned.
2481    ///
2482    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
2483    pub update_mask: std::option::Option<wkt::FieldMask>,
2484
2485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2486}
2487
2488impl UpdateCatalogRequest {
2489    /// Creates a new default instance.
2490    pub fn new() -> Self {
2491        std::default::Default::default()
2492    }
2493
2494    /// Sets the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2495    ///
2496    /// # Example
2497    /// ```ignore,no_run
2498    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2499    /// use google_cloud_retail_v2::model::Catalog;
2500    /// let x = UpdateCatalogRequest::new().set_catalog(Catalog::default()/* use setters */);
2501    /// ```
2502    pub fn set_catalog<T>(mut self, v: T) -> Self
2503    where
2504        T: std::convert::Into<crate::model::Catalog>,
2505    {
2506        self.catalog = std::option::Option::Some(v.into());
2507        self
2508    }
2509
2510    /// Sets or clears the value of [catalog][crate::model::UpdateCatalogRequest::catalog].
2511    ///
2512    /// # Example
2513    /// ```ignore,no_run
2514    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2515    /// use google_cloud_retail_v2::model::Catalog;
2516    /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(Some(Catalog::default()/* use setters */));
2517    /// let x = UpdateCatalogRequest::new().set_or_clear_catalog(None::<Catalog>);
2518    /// ```
2519    pub fn set_or_clear_catalog<T>(mut self, v: std::option::Option<T>) -> Self
2520    where
2521        T: std::convert::Into<crate::model::Catalog>,
2522    {
2523        self.catalog = v.map(|x| x.into());
2524        self
2525    }
2526
2527    /// Sets the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2528    ///
2529    /// # Example
2530    /// ```ignore,no_run
2531    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2532    /// use wkt::FieldMask;
2533    /// let x = UpdateCatalogRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2534    /// ```
2535    pub fn set_update_mask<T>(mut self, v: T) -> Self
2536    where
2537        T: std::convert::Into<wkt::FieldMask>,
2538    {
2539        self.update_mask = std::option::Option::Some(v.into());
2540        self
2541    }
2542
2543    /// Sets or clears the value of [update_mask][crate::model::UpdateCatalogRequest::update_mask].
2544    ///
2545    /// # Example
2546    /// ```ignore,no_run
2547    /// # use google_cloud_retail_v2::model::UpdateCatalogRequest;
2548    /// use wkt::FieldMask;
2549    /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2550    /// let x = UpdateCatalogRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2551    /// ```
2552    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2553    where
2554        T: std::convert::Into<wkt::FieldMask>,
2555    {
2556        self.update_mask = v.map(|x| x.into());
2557        self
2558    }
2559}
2560
2561impl wkt::message::Message for UpdateCatalogRequest {
2562    fn typename() -> &'static str {
2563        "type.googleapis.com/google.cloud.retail.v2.UpdateCatalogRequest"
2564    }
2565}
2566
2567/// Request message to set a specified branch as new default_branch.
2568#[derive(Clone, Default, PartialEq)]
2569#[non_exhaustive]
2570pub struct SetDefaultBranchRequest {
2571    /// Full resource name of the catalog, such as
2572    /// `projects/*/locations/global/catalogs/default_catalog`.
2573    pub catalog: std::string::String,
2574
2575    /// The final component of the resource name of a branch.
2576    ///
2577    /// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
2578    /// error is returned.
2579    ///
2580    /// If there are no sufficient active products in the targeted branch and
2581    /// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
2582    /// FAILED_PRECONDITION error is returned.
2583    ///
2584    /// [google.cloud.retail.v2.SetDefaultBranchRequest.force]: crate::model::SetDefaultBranchRequest::force
2585    pub branch_id: std::string::String,
2586
2587    /// Some note on this request, this can be retrieved by
2588    /// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
2589    /// before next valid default branch set occurs.
2590    ///
2591    /// This field must be a UTF-8 encoded string with a length limit of 1,000
2592    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
2593    ///
2594    /// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2595    pub note: std::string::String,
2596
2597    /// If set to true, it permits switching to a branch with
2598    /// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
2599    /// if it has no sufficient active products.
2600    ///
2601    /// [google.cloud.retail.v2.SetDefaultBranchRequest.branch_id]: crate::model::SetDefaultBranchRequest::branch_id
2602    pub force: bool,
2603
2604    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2605}
2606
2607impl SetDefaultBranchRequest {
2608    /// Creates a new default instance.
2609    pub fn new() -> Self {
2610        std::default::Default::default()
2611    }
2612
2613    /// Sets the value of [catalog][crate::model::SetDefaultBranchRequest::catalog].
2614    ///
2615    /// # Example
2616    /// ```ignore,no_run
2617    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2618    /// # let project_id = "project_id";
2619    /// # let location_id = "location_id";
2620    /// # let catalog_id = "catalog_id";
2621    /// let x = SetDefaultBranchRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
2622    /// ```
2623    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2624        self.catalog = v.into();
2625        self
2626    }
2627
2628    /// Sets the value of [branch_id][crate::model::SetDefaultBranchRequest::branch_id].
2629    ///
2630    /// # Example
2631    /// ```ignore,no_run
2632    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2633    /// let x = SetDefaultBranchRequest::new().set_branch_id("example");
2634    /// ```
2635    pub fn set_branch_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2636        self.branch_id = v.into();
2637        self
2638    }
2639
2640    /// Sets the value of [note][crate::model::SetDefaultBranchRequest::note].
2641    ///
2642    /// # Example
2643    /// ```ignore,no_run
2644    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2645    /// let x = SetDefaultBranchRequest::new().set_note("example");
2646    /// ```
2647    pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2648        self.note = v.into();
2649        self
2650    }
2651
2652    /// Sets the value of [force][crate::model::SetDefaultBranchRequest::force].
2653    ///
2654    /// # Example
2655    /// ```ignore,no_run
2656    /// # use google_cloud_retail_v2::model::SetDefaultBranchRequest;
2657    /// let x = SetDefaultBranchRequest::new().set_force(true);
2658    /// ```
2659    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
2660        self.force = v.into();
2661        self
2662    }
2663}
2664
2665impl wkt::message::Message for SetDefaultBranchRequest {
2666    fn typename() -> &'static str {
2667        "type.googleapis.com/google.cloud.retail.v2.SetDefaultBranchRequest"
2668    }
2669}
2670
2671/// Request message to show which branch is currently the default branch.
2672#[derive(Clone, Default, PartialEq)]
2673#[non_exhaustive]
2674pub struct GetDefaultBranchRequest {
2675    /// The parent catalog resource name, such as
2676    /// `projects/*/locations/global/catalogs/default_catalog`.
2677    pub catalog: std::string::String,
2678
2679    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2680}
2681
2682impl GetDefaultBranchRequest {
2683    /// Creates a new default instance.
2684    pub fn new() -> Self {
2685        std::default::Default::default()
2686    }
2687
2688    /// Sets the value of [catalog][crate::model::GetDefaultBranchRequest::catalog].
2689    ///
2690    /// # Example
2691    /// ```ignore,no_run
2692    /// # use google_cloud_retail_v2::model::GetDefaultBranchRequest;
2693    /// # let project_id = "project_id";
2694    /// # let location_id = "location_id";
2695    /// # let catalog_id = "catalog_id";
2696    /// let x = GetDefaultBranchRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
2697    /// ```
2698    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2699        self.catalog = v.into();
2700        self
2701    }
2702}
2703
2704impl wkt::message::Message for GetDefaultBranchRequest {
2705    fn typename() -> &'static str {
2706        "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchRequest"
2707    }
2708}
2709
2710/// Response message of
2711/// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch].
2712///
2713/// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: crate::client::CatalogService::get_default_branch
2714#[derive(Clone, Default, PartialEq)]
2715#[non_exhaustive]
2716pub struct GetDefaultBranchResponse {
2717    /// Full resource name of the branch id currently set as default branch.
2718    pub branch: std::string::String,
2719
2720    /// The time when this branch is set to default.
2721    pub set_time: std::option::Option<wkt::Timestamp>,
2722
2723    /// This corresponds to
2724    /// [SetDefaultBranchRequest.note][google.cloud.retail.v2.SetDefaultBranchRequest.note]
2725    /// field, when this branch was set as default.
2726    ///
2727    /// [google.cloud.retail.v2.SetDefaultBranchRequest.note]: crate::model::SetDefaultBranchRequest::note
2728    pub note: std::string::String,
2729
2730    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2731}
2732
2733impl GetDefaultBranchResponse {
2734    /// Creates a new default instance.
2735    pub fn new() -> Self {
2736        std::default::Default::default()
2737    }
2738
2739    /// Sets the value of [branch][crate::model::GetDefaultBranchResponse::branch].
2740    ///
2741    /// # Example
2742    /// ```ignore,no_run
2743    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2744    /// let x = GetDefaultBranchResponse::new().set_branch("example");
2745    /// ```
2746    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2747        self.branch = v.into();
2748        self
2749    }
2750
2751    /// Sets the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2752    ///
2753    /// # Example
2754    /// ```ignore,no_run
2755    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2756    /// use wkt::Timestamp;
2757    /// let x = GetDefaultBranchResponse::new().set_set_time(Timestamp::default()/* use setters */);
2758    /// ```
2759    pub fn set_set_time<T>(mut self, v: T) -> Self
2760    where
2761        T: std::convert::Into<wkt::Timestamp>,
2762    {
2763        self.set_time = std::option::Option::Some(v.into());
2764        self
2765    }
2766
2767    /// Sets or clears the value of [set_time][crate::model::GetDefaultBranchResponse::set_time].
2768    ///
2769    /// # Example
2770    /// ```ignore,no_run
2771    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2772    /// use wkt::Timestamp;
2773    /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
2774    /// let x = GetDefaultBranchResponse::new().set_or_clear_set_time(None::<Timestamp>);
2775    /// ```
2776    pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
2777    where
2778        T: std::convert::Into<wkt::Timestamp>,
2779    {
2780        self.set_time = v.map(|x| x.into());
2781        self
2782    }
2783
2784    /// Sets the value of [note][crate::model::GetDefaultBranchResponse::note].
2785    ///
2786    /// # Example
2787    /// ```ignore,no_run
2788    /// # use google_cloud_retail_v2::model::GetDefaultBranchResponse;
2789    /// let x = GetDefaultBranchResponse::new().set_note("example");
2790    /// ```
2791    pub fn set_note<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2792        self.note = v.into();
2793        self
2794    }
2795}
2796
2797impl wkt::message::Message for GetDefaultBranchResponse {
2798    fn typename() -> &'static str {
2799        "type.googleapis.com/google.cloud.retail.v2.GetDefaultBranchResponse"
2800    }
2801}
2802
2803/// Request for
2804/// [CatalogService.GetCompletionConfig][google.cloud.retail.v2.CatalogService.GetCompletionConfig]
2805/// method.
2806///
2807/// [google.cloud.retail.v2.CatalogService.GetCompletionConfig]: crate::client::CatalogService::get_completion_config
2808#[derive(Clone, Default, PartialEq)]
2809#[non_exhaustive]
2810pub struct GetCompletionConfigRequest {
2811    /// Required. Full CompletionConfig resource name. Format:
2812    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/completionConfig`
2813    pub name: std::string::String,
2814
2815    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2816}
2817
2818impl GetCompletionConfigRequest {
2819    /// Creates a new default instance.
2820    pub fn new() -> Self {
2821        std::default::Default::default()
2822    }
2823
2824    /// Sets the value of [name][crate::model::GetCompletionConfigRequest::name].
2825    ///
2826    /// # Example
2827    /// ```ignore,no_run
2828    /// # use google_cloud_retail_v2::model::GetCompletionConfigRequest;
2829    /// # let project_id = "project_id";
2830    /// # let location_id = "location_id";
2831    /// # let catalog_id = "catalog_id";
2832    /// let x = GetCompletionConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/completionConfig"));
2833    /// ```
2834    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2835        self.name = v.into();
2836        self
2837    }
2838}
2839
2840impl wkt::message::Message for GetCompletionConfigRequest {
2841    fn typename() -> &'static str {
2842        "type.googleapis.com/google.cloud.retail.v2.GetCompletionConfigRequest"
2843    }
2844}
2845
2846/// Request for
2847/// [CatalogService.UpdateCompletionConfig][google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]
2848/// method.
2849///
2850/// [google.cloud.retail.v2.CatalogService.UpdateCompletionConfig]: crate::client::CatalogService::update_completion_config
2851#[derive(Clone, Default, PartialEq)]
2852#[non_exhaustive]
2853pub struct UpdateCompletionConfigRequest {
2854    /// Required. The [CompletionConfig][google.cloud.retail.v2.CompletionConfig]
2855    /// to update.
2856    ///
2857    /// If the caller does not have permission to update the
2858    /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig], then a
2859    /// PERMISSION_DENIED error is returned.
2860    ///
2861    /// If the [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to
2862    /// update does not exist, a NOT_FOUND error is returned.
2863    ///
2864    /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2865    pub completion_config: std::option::Option<crate::model::CompletionConfig>,
2866
2867    /// Indicates which fields in the provided
2868    /// [CompletionConfig][google.cloud.retail.v2.CompletionConfig] to update. The
2869    /// following are the only supported fields:
2870    ///
2871    /// * [CompletionConfig.matching_order][google.cloud.retail.v2.CompletionConfig.matching_order]
2872    /// * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]
2873    /// * [CompletionConfig.min_prefix_length][google.cloud.retail.v2.CompletionConfig.min_prefix_length]
2874    /// * [CompletionConfig.auto_learning][google.cloud.retail.v2.CompletionConfig.auto_learning]
2875    ///
2876    /// If not set, all supported fields are updated.
2877    ///
2878    /// [google.cloud.retail.v2.CompletionConfig]: crate::model::CompletionConfig
2879    /// [google.cloud.retail.v2.CompletionConfig.auto_learning]: crate::model::CompletionConfig::auto_learning
2880    /// [google.cloud.retail.v2.CompletionConfig.matching_order]: crate::model::CompletionConfig::matching_order
2881    /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
2882    /// [google.cloud.retail.v2.CompletionConfig.min_prefix_length]: crate::model::CompletionConfig::min_prefix_length
2883    pub update_mask: std::option::Option<wkt::FieldMask>,
2884
2885    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2886}
2887
2888impl UpdateCompletionConfigRequest {
2889    /// Creates a new default instance.
2890    pub fn new() -> Self {
2891        std::default::Default::default()
2892    }
2893
2894    /// Sets the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2895    ///
2896    /// # Example
2897    /// ```ignore,no_run
2898    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2899    /// use google_cloud_retail_v2::model::CompletionConfig;
2900    /// let x = UpdateCompletionConfigRequest::new().set_completion_config(CompletionConfig::default()/* use setters */);
2901    /// ```
2902    pub fn set_completion_config<T>(mut self, v: T) -> Self
2903    where
2904        T: std::convert::Into<crate::model::CompletionConfig>,
2905    {
2906        self.completion_config = std::option::Option::Some(v.into());
2907        self
2908    }
2909
2910    /// Sets or clears the value of [completion_config][crate::model::UpdateCompletionConfigRequest::completion_config].
2911    ///
2912    /// # Example
2913    /// ```ignore,no_run
2914    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2915    /// use google_cloud_retail_v2::model::CompletionConfig;
2916    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(Some(CompletionConfig::default()/* use setters */));
2917    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_completion_config(None::<CompletionConfig>);
2918    /// ```
2919    pub fn set_or_clear_completion_config<T>(mut self, v: std::option::Option<T>) -> Self
2920    where
2921        T: std::convert::Into<crate::model::CompletionConfig>,
2922    {
2923        self.completion_config = v.map(|x| x.into());
2924        self
2925    }
2926
2927    /// Sets the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2928    ///
2929    /// # Example
2930    /// ```ignore,no_run
2931    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2932    /// use wkt::FieldMask;
2933    /// let x = UpdateCompletionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
2934    /// ```
2935    pub fn set_update_mask<T>(mut self, v: T) -> Self
2936    where
2937        T: std::convert::Into<wkt::FieldMask>,
2938    {
2939        self.update_mask = std::option::Option::Some(v.into());
2940        self
2941    }
2942
2943    /// Sets or clears the value of [update_mask][crate::model::UpdateCompletionConfigRequest::update_mask].
2944    ///
2945    /// # Example
2946    /// ```ignore,no_run
2947    /// # use google_cloud_retail_v2::model::UpdateCompletionConfigRequest;
2948    /// use wkt::FieldMask;
2949    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
2950    /// let x = UpdateCompletionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
2951    /// ```
2952    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2953    where
2954        T: std::convert::Into<wkt::FieldMask>,
2955    {
2956        self.update_mask = v.map(|x| x.into());
2957        self
2958    }
2959}
2960
2961impl wkt::message::Message for UpdateCompletionConfigRequest {
2962    fn typename() -> &'static str {
2963        "type.googleapis.com/google.cloud.retail.v2.UpdateCompletionConfigRequest"
2964    }
2965}
2966
2967/// Request for
2968/// [CatalogService.GetAttributesConfig][google.cloud.retail.v2.CatalogService.GetAttributesConfig]
2969/// method.
2970///
2971/// [google.cloud.retail.v2.CatalogService.GetAttributesConfig]: crate::client::CatalogService::get_attributes_config
2972#[derive(Clone, Default, PartialEq)]
2973#[non_exhaustive]
2974pub struct GetAttributesConfigRequest {
2975    /// Required. Full AttributesConfig resource name. Format:
2976    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
2977    pub name: std::string::String,
2978
2979    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2980}
2981
2982impl GetAttributesConfigRequest {
2983    /// Creates a new default instance.
2984    pub fn new() -> Self {
2985        std::default::Default::default()
2986    }
2987
2988    /// Sets the value of [name][crate::model::GetAttributesConfigRequest::name].
2989    ///
2990    /// # Example
2991    /// ```ignore,no_run
2992    /// # use google_cloud_retail_v2::model::GetAttributesConfigRequest;
2993    /// # let project_id = "project_id";
2994    /// # let location_id = "location_id";
2995    /// # let catalog_id = "catalog_id";
2996    /// let x = GetAttributesConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
2997    /// ```
2998    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2999        self.name = v.into();
3000        self
3001    }
3002}
3003
3004impl wkt::message::Message for GetAttributesConfigRequest {
3005    fn typename() -> &'static str {
3006        "type.googleapis.com/google.cloud.retail.v2.GetAttributesConfigRequest"
3007    }
3008}
3009
3010/// Request for
3011/// [CatalogService.UpdateAttributesConfig][google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]
3012/// method.
3013///
3014/// [google.cloud.retail.v2.CatalogService.UpdateAttributesConfig]: crate::client::CatalogService::update_attributes_config
3015#[derive(Clone, Default, PartialEq)]
3016#[non_exhaustive]
3017pub struct UpdateAttributesConfigRequest {
3018    /// Required. The [AttributesConfig][google.cloud.retail.v2.AttributesConfig]
3019    /// to update.
3020    ///
3021    /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
3022    pub attributes_config: std::option::Option<crate::model::AttributesConfig>,
3023
3024    /// Indicates which fields in the provided
3025    /// [AttributesConfig][google.cloud.retail.v2.AttributesConfig] to update. The
3026    /// following is the only supported field:
3027    ///
3028    /// * [AttributesConfig.catalog_attributes][google.cloud.retail.v2.AttributesConfig.catalog_attributes]
3029    ///
3030    /// If not set, all supported fields are updated.
3031    ///
3032    /// [google.cloud.retail.v2.AttributesConfig]: crate::model::AttributesConfig
3033    /// [google.cloud.retail.v2.AttributesConfig.catalog_attributes]: crate::model::AttributesConfig::catalog_attributes
3034    pub update_mask: std::option::Option<wkt::FieldMask>,
3035
3036    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3037}
3038
3039impl UpdateAttributesConfigRequest {
3040    /// Creates a new default instance.
3041    pub fn new() -> Self {
3042        std::default::Default::default()
3043    }
3044
3045    /// Sets the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3046    ///
3047    /// # Example
3048    /// ```ignore,no_run
3049    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3050    /// use google_cloud_retail_v2::model::AttributesConfig;
3051    /// let x = UpdateAttributesConfigRequest::new().set_attributes_config(AttributesConfig::default()/* use setters */);
3052    /// ```
3053    pub fn set_attributes_config<T>(mut self, v: T) -> Self
3054    where
3055        T: std::convert::Into<crate::model::AttributesConfig>,
3056    {
3057        self.attributes_config = std::option::Option::Some(v.into());
3058        self
3059    }
3060
3061    /// Sets or clears the value of [attributes_config][crate::model::UpdateAttributesConfigRequest::attributes_config].
3062    ///
3063    /// # Example
3064    /// ```ignore,no_run
3065    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3066    /// use google_cloud_retail_v2::model::AttributesConfig;
3067    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(Some(AttributesConfig::default()/* use setters */));
3068    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_attributes_config(None::<AttributesConfig>);
3069    /// ```
3070    pub fn set_or_clear_attributes_config<T>(mut self, v: std::option::Option<T>) -> Self
3071    where
3072        T: std::convert::Into<crate::model::AttributesConfig>,
3073    {
3074        self.attributes_config = v.map(|x| x.into());
3075        self
3076    }
3077
3078    /// Sets the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3079    ///
3080    /// # Example
3081    /// ```ignore,no_run
3082    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3083    /// use wkt::FieldMask;
3084    /// let x = UpdateAttributesConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3085    /// ```
3086    pub fn set_update_mask<T>(mut self, v: T) -> Self
3087    where
3088        T: std::convert::Into<wkt::FieldMask>,
3089    {
3090        self.update_mask = std::option::Option::Some(v.into());
3091        self
3092    }
3093
3094    /// Sets or clears the value of [update_mask][crate::model::UpdateAttributesConfigRequest::update_mask].
3095    ///
3096    /// # Example
3097    /// ```ignore,no_run
3098    /// # use google_cloud_retail_v2::model::UpdateAttributesConfigRequest;
3099    /// use wkt::FieldMask;
3100    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3101    /// let x = UpdateAttributesConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3102    /// ```
3103    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3104    where
3105        T: std::convert::Into<wkt::FieldMask>,
3106    {
3107        self.update_mask = v.map(|x| x.into());
3108        self
3109    }
3110}
3111
3112impl wkt::message::Message for UpdateAttributesConfigRequest {
3113    fn typename() -> &'static str {
3114        "type.googleapis.com/google.cloud.retail.v2.UpdateAttributesConfigRequest"
3115    }
3116}
3117
3118/// Request for
3119/// [CatalogService.AddCatalogAttribute][google.cloud.retail.v2.CatalogService.AddCatalogAttribute]
3120/// method.
3121///
3122/// [google.cloud.retail.v2.CatalogService.AddCatalogAttribute]: crate::client::CatalogService::add_catalog_attribute
3123#[derive(Clone, Default, PartialEq)]
3124#[non_exhaustive]
3125pub struct AddCatalogAttributeRequest {
3126    /// Required. Full AttributesConfig resource name. Format:
3127    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3128    pub attributes_config: std::string::String,
3129
3130    /// Required. The [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute]
3131    /// to add.
3132    ///
3133    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3134    pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3135
3136    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3137}
3138
3139impl AddCatalogAttributeRequest {
3140    /// Creates a new default instance.
3141    pub fn new() -> Self {
3142        std::default::Default::default()
3143    }
3144
3145    /// Sets the value of [attributes_config][crate::model::AddCatalogAttributeRequest::attributes_config].
3146    ///
3147    /// # Example
3148    /// ```ignore,no_run
3149    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3150    /// # let project_id = "project_id";
3151    /// # let location_id = "location_id";
3152    /// # let catalog_id = "catalog_id";
3153    /// let x = AddCatalogAttributeRequest::new().set_attributes_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
3154    /// ```
3155    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3156        mut self,
3157        v: T,
3158    ) -> Self {
3159        self.attributes_config = v.into();
3160        self
3161    }
3162
3163    /// Sets the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3164    ///
3165    /// # Example
3166    /// ```ignore,no_run
3167    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3168    /// use google_cloud_retail_v2::model::CatalogAttribute;
3169    /// let x = AddCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3170    /// ```
3171    pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3172    where
3173        T: std::convert::Into<crate::model::CatalogAttribute>,
3174    {
3175        self.catalog_attribute = std::option::Option::Some(v.into());
3176        self
3177    }
3178
3179    /// Sets or clears the value of [catalog_attribute][crate::model::AddCatalogAttributeRequest::catalog_attribute].
3180    ///
3181    /// # Example
3182    /// ```ignore,no_run
3183    /// # use google_cloud_retail_v2::model::AddCatalogAttributeRequest;
3184    /// use google_cloud_retail_v2::model::CatalogAttribute;
3185    /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3186    /// let x = AddCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3187    /// ```
3188    pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3189    where
3190        T: std::convert::Into<crate::model::CatalogAttribute>,
3191    {
3192        self.catalog_attribute = v.map(|x| x.into());
3193        self
3194    }
3195}
3196
3197impl wkt::message::Message for AddCatalogAttributeRequest {
3198    fn typename() -> &'static str {
3199        "type.googleapis.com/google.cloud.retail.v2.AddCatalogAttributeRequest"
3200    }
3201}
3202
3203/// Request for
3204/// [CatalogService.RemoveCatalogAttribute][google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]
3205/// method.
3206///
3207/// [google.cloud.retail.v2.CatalogService.RemoveCatalogAttribute]: crate::client::CatalogService::remove_catalog_attribute
3208#[derive(Clone, Default, PartialEq)]
3209#[non_exhaustive]
3210pub struct RemoveCatalogAttributeRequest {
3211    /// Required. Full AttributesConfig resource name. Format:
3212    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3213    pub attributes_config: std::string::String,
3214
3215    /// Required. The attribute name key of the
3216    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to remove.
3217    ///
3218    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3219    pub key: std::string::String,
3220
3221    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3222}
3223
3224impl RemoveCatalogAttributeRequest {
3225    /// Creates a new default instance.
3226    pub fn new() -> Self {
3227        std::default::Default::default()
3228    }
3229
3230    /// Sets the value of [attributes_config][crate::model::RemoveCatalogAttributeRequest::attributes_config].
3231    ///
3232    /// # Example
3233    /// ```ignore,no_run
3234    /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3235    /// # let project_id = "project_id";
3236    /// # let location_id = "location_id";
3237    /// # let catalog_id = "catalog_id";
3238    /// let x = RemoveCatalogAttributeRequest::new().set_attributes_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
3239    /// ```
3240    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3241        mut self,
3242        v: T,
3243    ) -> Self {
3244        self.attributes_config = v.into();
3245        self
3246    }
3247
3248    /// Sets the value of [key][crate::model::RemoveCatalogAttributeRequest::key].
3249    ///
3250    /// # Example
3251    /// ```ignore,no_run
3252    /// # use google_cloud_retail_v2::model::RemoveCatalogAttributeRequest;
3253    /// let x = RemoveCatalogAttributeRequest::new().set_key("example");
3254    /// ```
3255    pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3256        self.key = v.into();
3257        self
3258    }
3259}
3260
3261impl wkt::message::Message for RemoveCatalogAttributeRequest {
3262    fn typename() -> &'static str {
3263        "type.googleapis.com/google.cloud.retail.v2.RemoveCatalogAttributeRequest"
3264    }
3265}
3266
3267/// Request for
3268/// [CatalogService.ReplaceCatalogAttribute][google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]
3269/// method.
3270///
3271/// [google.cloud.retail.v2.CatalogService.ReplaceCatalogAttribute]: crate::client::CatalogService::replace_catalog_attribute
3272#[derive(Clone, Default, PartialEq)]
3273#[non_exhaustive]
3274pub struct ReplaceCatalogAttributeRequest {
3275    /// Required. Full AttributesConfig resource name. Format:
3276    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig`
3277    pub attributes_config: std::string::String,
3278
3279    /// Required. The updated
3280    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute].
3281    ///
3282    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3283    pub catalog_attribute: std::option::Option<crate::model::CatalogAttribute>,
3284
3285    /// Indicates which fields in the provided
3286    /// [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] to update. The
3287    /// following are NOT supported:
3288    ///
3289    /// * [CatalogAttribute.key][google.cloud.retail.v2.CatalogAttribute.key]
3290    ///
3291    /// If not set, all supported fields are updated.
3292    ///
3293    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
3294    /// [google.cloud.retail.v2.CatalogAttribute.key]: crate::model::CatalogAttribute::key
3295    pub update_mask: std::option::Option<wkt::FieldMask>,
3296
3297    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3298}
3299
3300impl ReplaceCatalogAttributeRequest {
3301    /// Creates a new default instance.
3302    pub fn new() -> Self {
3303        std::default::Default::default()
3304    }
3305
3306    /// Sets the value of [attributes_config][crate::model::ReplaceCatalogAttributeRequest::attributes_config].
3307    ///
3308    /// # Example
3309    /// ```ignore,no_run
3310    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3311    /// # let project_id = "project_id";
3312    /// # let location_id = "location_id";
3313    /// # let catalog_id = "catalog_id";
3314    /// let x = ReplaceCatalogAttributeRequest::new().set_attributes_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/attributesConfig"));
3315    /// ```
3316    pub fn set_attributes_config<T: std::convert::Into<std::string::String>>(
3317        mut self,
3318        v: T,
3319    ) -> Self {
3320        self.attributes_config = v.into();
3321        self
3322    }
3323
3324    /// Sets the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3325    ///
3326    /// # Example
3327    /// ```ignore,no_run
3328    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3329    /// use google_cloud_retail_v2::model::CatalogAttribute;
3330    /// let x = ReplaceCatalogAttributeRequest::new().set_catalog_attribute(CatalogAttribute::default()/* use setters */);
3331    /// ```
3332    pub fn set_catalog_attribute<T>(mut self, v: T) -> Self
3333    where
3334        T: std::convert::Into<crate::model::CatalogAttribute>,
3335    {
3336        self.catalog_attribute = std::option::Option::Some(v.into());
3337        self
3338    }
3339
3340    /// Sets or clears the value of [catalog_attribute][crate::model::ReplaceCatalogAttributeRequest::catalog_attribute].
3341    ///
3342    /// # Example
3343    /// ```ignore,no_run
3344    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3345    /// use google_cloud_retail_v2::model::CatalogAttribute;
3346    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(Some(CatalogAttribute::default()/* use setters */));
3347    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_catalog_attribute(None::<CatalogAttribute>);
3348    /// ```
3349    pub fn set_or_clear_catalog_attribute<T>(mut self, v: std::option::Option<T>) -> Self
3350    where
3351        T: std::convert::Into<crate::model::CatalogAttribute>,
3352    {
3353        self.catalog_attribute = v.map(|x| x.into());
3354        self
3355    }
3356
3357    /// Sets the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3358    ///
3359    /// # Example
3360    /// ```ignore,no_run
3361    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3362    /// use wkt::FieldMask;
3363    /// let x = ReplaceCatalogAttributeRequest::new().set_update_mask(FieldMask::default()/* use setters */);
3364    /// ```
3365    pub fn set_update_mask<T>(mut self, v: T) -> Self
3366    where
3367        T: std::convert::Into<wkt::FieldMask>,
3368    {
3369        self.update_mask = std::option::Option::Some(v.into());
3370        self
3371    }
3372
3373    /// Sets or clears the value of [update_mask][crate::model::ReplaceCatalogAttributeRequest::update_mask].
3374    ///
3375    /// # Example
3376    /// ```ignore,no_run
3377    /// # use google_cloud_retail_v2::model::ReplaceCatalogAttributeRequest;
3378    /// use wkt::FieldMask;
3379    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
3380    /// let x = ReplaceCatalogAttributeRequest::new().set_or_clear_update_mask(None::<FieldMask>);
3381    /// ```
3382    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3383    where
3384        T: std::convert::Into<wkt::FieldMask>,
3385    {
3386        self.update_mask = v.map(|x| x.into());
3387        self
3388    }
3389}
3390
3391impl wkt::message::Message for ReplaceCatalogAttributeRequest {
3392    fn typename() -> &'static str {
3393        "type.googleapis.com/google.cloud.retail.v2.ReplaceCatalogAttributeRequest"
3394    }
3395}
3396
3397/// Metadata that is used to define a condition that triggers an action.
3398/// A valid condition must specify at least one of 'query_terms' or
3399/// 'products_filter'. If multiple fields are specified, the condition is met if
3400/// all the fields are satisfied e.g. if a set of query terms and product_filter
3401/// are set, then only items matching the product_filter for requests with a
3402/// query matching the query terms wil get boosted.
3403#[derive(Clone, Default, PartialEq)]
3404#[non_exhaustive]
3405pub struct Condition {
3406    /// A list (up to 10 entries) of terms to match the query on. If not
3407    /// specified, match all queries.
3408    /// If many query terms are specified, the condition
3409    /// is matched if any of the terms is a match (i.e. using the OR operator).
3410    pub query_terms: std::vec::Vec<crate::model::condition::QueryTerm>,
3411
3412    /// Range of time(s) specifying when Condition is active.
3413    /// Condition true if any time range matches.
3414    pub active_time_range: std::vec::Vec<crate::model::condition::TimeRange>,
3415
3416    /// Used to support browse uses cases.
3417    /// A list (up to 10 entries) of categories or departments.
3418    /// The format should be the same as
3419    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
3420    ///
3421    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
3422    pub page_categories: std::vec::Vec<std::string::String>,
3423
3424    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3425}
3426
3427impl Condition {
3428    /// Creates a new default instance.
3429    pub fn new() -> Self {
3430        std::default::Default::default()
3431    }
3432
3433    /// Sets the value of [query_terms][crate::model::Condition::query_terms].
3434    ///
3435    /// # Example
3436    /// ```ignore,no_run
3437    /// # use google_cloud_retail_v2::model::Condition;
3438    /// use google_cloud_retail_v2::model::condition::QueryTerm;
3439    /// let x = Condition::new()
3440    ///     .set_query_terms([
3441    ///         QueryTerm::default()/* use setters */,
3442    ///         QueryTerm::default()/* use (different) setters */,
3443    ///     ]);
3444    /// ```
3445    pub fn set_query_terms<T, V>(mut self, v: T) -> Self
3446    where
3447        T: std::iter::IntoIterator<Item = V>,
3448        V: std::convert::Into<crate::model::condition::QueryTerm>,
3449    {
3450        use std::iter::Iterator;
3451        self.query_terms = v.into_iter().map(|i| i.into()).collect();
3452        self
3453    }
3454
3455    /// Sets the value of [active_time_range][crate::model::Condition::active_time_range].
3456    ///
3457    /// # Example
3458    /// ```ignore,no_run
3459    /// # use google_cloud_retail_v2::model::Condition;
3460    /// use google_cloud_retail_v2::model::condition::TimeRange;
3461    /// let x = Condition::new()
3462    ///     .set_active_time_range([
3463    ///         TimeRange::default()/* use setters */,
3464    ///         TimeRange::default()/* use (different) setters */,
3465    ///     ]);
3466    /// ```
3467    pub fn set_active_time_range<T, V>(mut self, v: T) -> Self
3468    where
3469        T: std::iter::IntoIterator<Item = V>,
3470        V: std::convert::Into<crate::model::condition::TimeRange>,
3471    {
3472        use std::iter::Iterator;
3473        self.active_time_range = v.into_iter().map(|i| i.into()).collect();
3474        self
3475    }
3476
3477    /// Sets the value of [page_categories][crate::model::Condition::page_categories].
3478    ///
3479    /// # Example
3480    /// ```ignore,no_run
3481    /// # use google_cloud_retail_v2::model::Condition;
3482    /// let x = Condition::new().set_page_categories(["a", "b", "c"]);
3483    /// ```
3484    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
3485    where
3486        T: std::iter::IntoIterator<Item = V>,
3487        V: std::convert::Into<std::string::String>,
3488    {
3489        use std::iter::Iterator;
3490        self.page_categories = v.into_iter().map(|i| i.into()).collect();
3491        self
3492    }
3493}
3494
3495impl wkt::message::Message for Condition {
3496    fn typename() -> &'static str {
3497        "type.googleapis.com/google.cloud.retail.v2.Condition"
3498    }
3499}
3500
3501/// Defines additional types related to [Condition].
3502pub mod condition {
3503    #[allow(unused_imports)]
3504    use super::*;
3505
3506    /// Query terms that we want to match on.
3507    #[derive(Clone, Default, PartialEq)]
3508    #[non_exhaustive]
3509    pub struct QueryTerm {
3510        /// The value of the term to match on.
3511        /// Value cannot be empty.
3512        /// Value can have at most 3 terms if specified as a partial match. Each
3513        /// space separated string is considered as one term.
3514        /// For example, "a b c" is 3 terms and allowed, but " a b c d" is 4 terms
3515        /// and not allowed for a partial match.
3516        pub value: std::string::String,
3517
3518        /// Whether this is supposed to be a full or partial match.
3519        pub full_match: bool,
3520
3521        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3522    }
3523
3524    impl QueryTerm {
3525        /// Creates a new default instance.
3526        pub fn new() -> Self {
3527            std::default::Default::default()
3528        }
3529
3530        /// Sets the value of [value][crate::model::condition::QueryTerm::value].
3531        ///
3532        /// # Example
3533        /// ```ignore,no_run
3534        /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3535        /// let x = QueryTerm::new().set_value("example");
3536        /// ```
3537        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3538            self.value = v.into();
3539            self
3540        }
3541
3542        /// Sets the value of [full_match][crate::model::condition::QueryTerm::full_match].
3543        ///
3544        /// # Example
3545        /// ```ignore,no_run
3546        /// # use google_cloud_retail_v2::model::condition::QueryTerm;
3547        /// let x = QueryTerm::new().set_full_match(true);
3548        /// ```
3549        pub fn set_full_match<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3550            self.full_match = v.into();
3551            self
3552        }
3553    }
3554
3555    impl wkt::message::Message for QueryTerm {
3556        fn typename() -> &'static str {
3557            "type.googleapis.com/google.cloud.retail.v2.Condition.QueryTerm"
3558        }
3559    }
3560
3561    /// Used for time-dependent conditions.
3562    /// Example: Want to have rule applied for week long sale.
3563    #[derive(Clone, Default, PartialEq)]
3564    #[non_exhaustive]
3565    pub struct TimeRange {
3566        /// Start of time range. Range is inclusive.
3567        pub start_time: std::option::Option<wkt::Timestamp>,
3568
3569        /// End of time range. Range is inclusive.
3570        pub end_time: std::option::Option<wkt::Timestamp>,
3571
3572        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3573    }
3574
3575    impl TimeRange {
3576        /// Creates a new default instance.
3577        pub fn new() -> Self {
3578            std::default::Default::default()
3579        }
3580
3581        /// Sets the value of [start_time][crate::model::condition::TimeRange::start_time].
3582        ///
3583        /// # Example
3584        /// ```ignore,no_run
3585        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3586        /// use wkt::Timestamp;
3587        /// let x = TimeRange::new().set_start_time(Timestamp::default()/* use setters */);
3588        /// ```
3589        pub fn set_start_time<T>(mut self, v: T) -> Self
3590        where
3591            T: std::convert::Into<wkt::Timestamp>,
3592        {
3593            self.start_time = std::option::Option::Some(v.into());
3594            self
3595        }
3596
3597        /// Sets or clears the value of [start_time][crate::model::condition::TimeRange::start_time].
3598        ///
3599        /// # Example
3600        /// ```ignore,no_run
3601        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3602        /// use wkt::Timestamp;
3603        /// let x = TimeRange::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3604        /// let x = TimeRange::new().set_or_clear_start_time(None::<Timestamp>);
3605        /// ```
3606        pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3607        where
3608            T: std::convert::Into<wkt::Timestamp>,
3609        {
3610            self.start_time = v.map(|x| x.into());
3611            self
3612        }
3613
3614        /// Sets the value of [end_time][crate::model::condition::TimeRange::end_time].
3615        ///
3616        /// # Example
3617        /// ```ignore,no_run
3618        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3619        /// use wkt::Timestamp;
3620        /// let x = TimeRange::new().set_end_time(Timestamp::default()/* use setters */);
3621        /// ```
3622        pub fn set_end_time<T>(mut self, v: T) -> Self
3623        where
3624            T: std::convert::Into<wkt::Timestamp>,
3625        {
3626            self.end_time = std::option::Option::Some(v.into());
3627            self
3628        }
3629
3630        /// Sets or clears the value of [end_time][crate::model::condition::TimeRange::end_time].
3631        ///
3632        /// # Example
3633        /// ```ignore,no_run
3634        /// # use google_cloud_retail_v2::model::condition::TimeRange;
3635        /// use wkt::Timestamp;
3636        /// let x = TimeRange::new().set_or_clear_end_time(Some(Timestamp::default()/* use setters */));
3637        /// let x = TimeRange::new().set_or_clear_end_time(None::<Timestamp>);
3638        /// ```
3639        pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3640        where
3641            T: std::convert::Into<wkt::Timestamp>,
3642        {
3643            self.end_time = v.map(|x| x.into());
3644            self
3645        }
3646    }
3647
3648    impl wkt::message::Message for TimeRange {
3649        fn typename() -> &'static str {
3650            "type.googleapis.com/google.cloud.retail.v2.Condition.TimeRange"
3651        }
3652    }
3653}
3654
3655/// A rule is a condition-action pair
3656///
3657/// * A condition defines when a rule is to be triggered.
3658/// * An action specifies what occurs on that trigger.
3659///   Currently rules only work for [controls][google.cloud.retail.v2.Control] with
3660///   [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
3661///
3662/// [google.cloud.retail.v2.Control]: crate::model::Control
3663/// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
3664#[derive(Clone, Default, PartialEq)]
3665#[non_exhaustive]
3666pub struct Rule {
3667    /// Required. The condition that triggers the rule.
3668    /// If the condition is empty, the rule will always apply.
3669    pub condition: std::option::Option<crate::model::Condition>,
3670
3671    /// An action must be provided.
3672    pub action: std::option::Option<crate::model::rule::Action>,
3673
3674    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3675}
3676
3677impl Rule {
3678    /// Creates a new default instance.
3679    pub fn new() -> Self {
3680        std::default::Default::default()
3681    }
3682
3683    /// Sets the value of [condition][crate::model::Rule::condition].
3684    ///
3685    /// # Example
3686    /// ```ignore,no_run
3687    /// # use google_cloud_retail_v2::model::Rule;
3688    /// use google_cloud_retail_v2::model::Condition;
3689    /// let x = Rule::new().set_condition(Condition::default()/* use setters */);
3690    /// ```
3691    pub fn set_condition<T>(mut self, v: T) -> Self
3692    where
3693        T: std::convert::Into<crate::model::Condition>,
3694    {
3695        self.condition = std::option::Option::Some(v.into());
3696        self
3697    }
3698
3699    /// Sets or clears the value of [condition][crate::model::Rule::condition].
3700    ///
3701    /// # Example
3702    /// ```ignore,no_run
3703    /// # use google_cloud_retail_v2::model::Rule;
3704    /// use google_cloud_retail_v2::model::Condition;
3705    /// let x = Rule::new().set_or_clear_condition(Some(Condition::default()/* use setters */));
3706    /// let x = Rule::new().set_or_clear_condition(None::<Condition>);
3707    /// ```
3708    pub fn set_or_clear_condition<T>(mut self, v: std::option::Option<T>) -> Self
3709    where
3710        T: std::convert::Into<crate::model::Condition>,
3711    {
3712        self.condition = v.map(|x| x.into());
3713        self
3714    }
3715
3716    /// Sets the value of [action][crate::model::Rule::action].
3717    ///
3718    /// Note that all the setters affecting `action` are mutually
3719    /// exclusive.
3720    ///
3721    /// # Example
3722    /// ```ignore,no_run
3723    /// # use google_cloud_retail_v2::model::Rule;
3724    /// use google_cloud_retail_v2::model::rule::BoostAction;
3725    /// let x = Rule::new().set_action(Some(
3726    ///     google_cloud_retail_v2::model::rule::Action::BoostAction(BoostAction::default().into())));
3727    /// ```
3728    pub fn set_action<T: std::convert::Into<std::option::Option<crate::model::rule::Action>>>(
3729        mut self,
3730        v: T,
3731    ) -> Self {
3732        self.action = v.into();
3733        self
3734    }
3735
3736    /// The value of [action][crate::model::Rule::action]
3737    /// if it holds a `BoostAction`, `None` if the field is not set or
3738    /// holds a different branch.
3739    pub fn boost_action(
3740        &self,
3741    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::BoostAction>> {
3742        #[allow(unreachable_patterns)]
3743        self.action.as_ref().and_then(|v| match v {
3744            crate::model::rule::Action::BoostAction(v) => std::option::Option::Some(v),
3745            _ => std::option::Option::None,
3746        })
3747    }
3748
3749    /// Sets the value of [action][crate::model::Rule::action]
3750    /// to hold a `BoostAction`.
3751    ///
3752    /// Note that all the setters affecting `action` are
3753    /// mutually exclusive.
3754    ///
3755    /// # Example
3756    /// ```ignore,no_run
3757    /// # use google_cloud_retail_v2::model::Rule;
3758    /// use google_cloud_retail_v2::model::rule::BoostAction;
3759    /// let x = Rule::new().set_boost_action(BoostAction::default()/* use setters */);
3760    /// assert!(x.boost_action().is_some());
3761    /// assert!(x.redirect_action().is_none());
3762    /// assert!(x.oneway_synonyms_action().is_none());
3763    /// assert!(x.do_not_associate_action().is_none());
3764    /// assert!(x.replacement_action().is_none());
3765    /// assert!(x.ignore_action().is_none());
3766    /// assert!(x.filter_action().is_none());
3767    /// assert!(x.twoway_synonyms_action().is_none());
3768    /// assert!(x.force_return_facet_action().is_none());
3769    /// assert!(x.remove_facet_action().is_none());
3770    /// assert!(x.pin_action().is_none());
3771    /// ```
3772    pub fn set_boost_action<
3773        T: std::convert::Into<std::boxed::Box<crate::model::rule::BoostAction>>,
3774    >(
3775        mut self,
3776        v: T,
3777    ) -> Self {
3778        self.action = std::option::Option::Some(crate::model::rule::Action::BoostAction(v.into()));
3779        self
3780    }
3781
3782    /// The value of [action][crate::model::Rule::action]
3783    /// if it holds a `RedirectAction`, `None` if the field is not set or
3784    /// holds a different branch.
3785    pub fn redirect_action(
3786        &self,
3787    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RedirectAction>> {
3788        #[allow(unreachable_patterns)]
3789        self.action.as_ref().and_then(|v| match v {
3790            crate::model::rule::Action::RedirectAction(v) => std::option::Option::Some(v),
3791            _ => std::option::Option::None,
3792        })
3793    }
3794
3795    /// Sets the value of [action][crate::model::Rule::action]
3796    /// to hold a `RedirectAction`.
3797    ///
3798    /// Note that all the setters affecting `action` are
3799    /// mutually exclusive.
3800    ///
3801    /// # Example
3802    /// ```ignore,no_run
3803    /// # use google_cloud_retail_v2::model::Rule;
3804    /// use google_cloud_retail_v2::model::rule::RedirectAction;
3805    /// let x = Rule::new().set_redirect_action(RedirectAction::default()/* use setters */);
3806    /// assert!(x.redirect_action().is_some());
3807    /// assert!(x.boost_action().is_none());
3808    /// assert!(x.oneway_synonyms_action().is_none());
3809    /// assert!(x.do_not_associate_action().is_none());
3810    /// assert!(x.replacement_action().is_none());
3811    /// assert!(x.ignore_action().is_none());
3812    /// assert!(x.filter_action().is_none());
3813    /// assert!(x.twoway_synonyms_action().is_none());
3814    /// assert!(x.force_return_facet_action().is_none());
3815    /// assert!(x.remove_facet_action().is_none());
3816    /// assert!(x.pin_action().is_none());
3817    /// ```
3818    pub fn set_redirect_action<
3819        T: std::convert::Into<std::boxed::Box<crate::model::rule::RedirectAction>>,
3820    >(
3821        mut self,
3822        v: T,
3823    ) -> Self {
3824        self.action =
3825            std::option::Option::Some(crate::model::rule::Action::RedirectAction(v.into()));
3826        self
3827    }
3828
3829    /// The value of [action][crate::model::Rule::action]
3830    /// if it holds a `OnewaySynonymsAction`, `None` if the field is not set or
3831    /// holds a different branch.
3832    pub fn oneway_synonyms_action(
3833        &self,
3834    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::OnewaySynonymsAction>> {
3835        #[allow(unreachable_patterns)]
3836        self.action.as_ref().and_then(|v| match v {
3837            crate::model::rule::Action::OnewaySynonymsAction(v) => std::option::Option::Some(v),
3838            _ => std::option::Option::None,
3839        })
3840    }
3841
3842    /// Sets the value of [action][crate::model::Rule::action]
3843    /// to hold a `OnewaySynonymsAction`.
3844    ///
3845    /// Note that all the setters affecting `action` are
3846    /// mutually exclusive.
3847    ///
3848    /// # Example
3849    /// ```ignore,no_run
3850    /// # use google_cloud_retail_v2::model::Rule;
3851    /// use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
3852    /// let x = Rule::new().set_oneway_synonyms_action(OnewaySynonymsAction::default()/* use setters */);
3853    /// assert!(x.oneway_synonyms_action().is_some());
3854    /// assert!(x.boost_action().is_none());
3855    /// assert!(x.redirect_action().is_none());
3856    /// assert!(x.do_not_associate_action().is_none());
3857    /// assert!(x.replacement_action().is_none());
3858    /// assert!(x.ignore_action().is_none());
3859    /// assert!(x.filter_action().is_none());
3860    /// assert!(x.twoway_synonyms_action().is_none());
3861    /// assert!(x.force_return_facet_action().is_none());
3862    /// assert!(x.remove_facet_action().is_none());
3863    /// assert!(x.pin_action().is_none());
3864    /// ```
3865    pub fn set_oneway_synonyms_action<
3866        T: std::convert::Into<std::boxed::Box<crate::model::rule::OnewaySynonymsAction>>,
3867    >(
3868        mut self,
3869        v: T,
3870    ) -> Self {
3871        self.action =
3872            std::option::Option::Some(crate::model::rule::Action::OnewaySynonymsAction(v.into()));
3873        self
3874    }
3875
3876    /// The value of [action][crate::model::Rule::action]
3877    /// if it holds a `DoNotAssociateAction`, `None` if the field is not set or
3878    /// holds a different branch.
3879    pub fn do_not_associate_action(
3880        &self,
3881    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::DoNotAssociateAction>> {
3882        #[allow(unreachable_patterns)]
3883        self.action.as_ref().and_then(|v| match v {
3884            crate::model::rule::Action::DoNotAssociateAction(v) => std::option::Option::Some(v),
3885            _ => std::option::Option::None,
3886        })
3887    }
3888
3889    /// Sets the value of [action][crate::model::Rule::action]
3890    /// to hold a `DoNotAssociateAction`.
3891    ///
3892    /// Note that all the setters affecting `action` are
3893    /// mutually exclusive.
3894    ///
3895    /// # Example
3896    /// ```ignore,no_run
3897    /// # use google_cloud_retail_v2::model::Rule;
3898    /// use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
3899    /// let x = Rule::new().set_do_not_associate_action(DoNotAssociateAction::default()/* use setters */);
3900    /// assert!(x.do_not_associate_action().is_some());
3901    /// assert!(x.boost_action().is_none());
3902    /// assert!(x.redirect_action().is_none());
3903    /// assert!(x.oneway_synonyms_action().is_none());
3904    /// assert!(x.replacement_action().is_none());
3905    /// assert!(x.ignore_action().is_none());
3906    /// assert!(x.filter_action().is_none());
3907    /// assert!(x.twoway_synonyms_action().is_none());
3908    /// assert!(x.force_return_facet_action().is_none());
3909    /// assert!(x.remove_facet_action().is_none());
3910    /// assert!(x.pin_action().is_none());
3911    /// ```
3912    pub fn set_do_not_associate_action<
3913        T: std::convert::Into<std::boxed::Box<crate::model::rule::DoNotAssociateAction>>,
3914    >(
3915        mut self,
3916        v: T,
3917    ) -> Self {
3918        self.action =
3919            std::option::Option::Some(crate::model::rule::Action::DoNotAssociateAction(v.into()));
3920        self
3921    }
3922
3923    /// The value of [action][crate::model::Rule::action]
3924    /// if it holds a `ReplacementAction`, `None` if the field is not set or
3925    /// holds a different branch.
3926    pub fn replacement_action(
3927        &self,
3928    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ReplacementAction>> {
3929        #[allow(unreachable_patterns)]
3930        self.action.as_ref().and_then(|v| match v {
3931            crate::model::rule::Action::ReplacementAction(v) => std::option::Option::Some(v),
3932            _ => std::option::Option::None,
3933        })
3934    }
3935
3936    /// Sets the value of [action][crate::model::Rule::action]
3937    /// to hold a `ReplacementAction`.
3938    ///
3939    /// Note that all the setters affecting `action` are
3940    /// mutually exclusive.
3941    ///
3942    /// # Example
3943    /// ```ignore,no_run
3944    /// # use google_cloud_retail_v2::model::Rule;
3945    /// use google_cloud_retail_v2::model::rule::ReplacementAction;
3946    /// let x = Rule::new().set_replacement_action(ReplacementAction::default()/* use setters */);
3947    /// assert!(x.replacement_action().is_some());
3948    /// assert!(x.boost_action().is_none());
3949    /// assert!(x.redirect_action().is_none());
3950    /// assert!(x.oneway_synonyms_action().is_none());
3951    /// assert!(x.do_not_associate_action().is_none());
3952    /// assert!(x.ignore_action().is_none());
3953    /// assert!(x.filter_action().is_none());
3954    /// assert!(x.twoway_synonyms_action().is_none());
3955    /// assert!(x.force_return_facet_action().is_none());
3956    /// assert!(x.remove_facet_action().is_none());
3957    /// assert!(x.pin_action().is_none());
3958    /// ```
3959    pub fn set_replacement_action<
3960        T: std::convert::Into<std::boxed::Box<crate::model::rule::ReplacementAction>>,
3961    >(
3962        mut self,
3963        v: T,
3964    ) -> Self {
3965        self.action =
3966            std::option::Option::Some(crate::model::rule::Action::ReplacementAction(v.into()));
3967        self
3968    }
3969
3970    /// The value of [action][crate::model::Rule::action]
3971    /// if it holds a `IgnoreAction`, `None` if the field is not set or
3972    /// holds a different branch.
3973    pub fn ignore_action(
3974        &self,
3975    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::IgnoreAction>> {
3976        #[allow(unreachable_patterns)]
3977        self.action.as_ref().and_then(|v| match v {
3978            crate::model::rule::Action::IgnoreAction(v) => std::option::Option::Some(v),
3979            _ => std::option::Option::None,
3980        })
3981    }
3982
3983    /// Sets the value of [action][crate::model::Rule::action]
3984    /// to hold a `IgnoreAction`.
3985    ///
3986    /// Note that all the setters affecting `action` are
3987    /// mutually exclusive.
3988    ///
3989    /// # Example
3990    /// ```ignore,no_run
3991    /// # use google_cloud_retail_v2::model::Rule;
3992    /// use google_cloud_retail_v2::model::rule::IgnoreAction;
3993    /// let x = Rule::new().set_ignore_action(IgnoreAction::default()/* use setters */);
3994    /// assert!(x.ignore_action().is_some());
3995    /// assert!(x.boost_action().is_none());
3996    /// assert!(x.redirect_action().is_none());
3997    /// assert!(x.oneway_synonyms_action().is_none());
3998    /// assert!(x.do_not_associate_action().is_none());
3999    /// assert!(x.replacement_action().is_none());
4000    /// assert!(x.filter_action().is_none());
4001    /// assert!(x.twoway_synonyms_action().is_none());
4002    /// assert!(x.force_return_facet_action().is_none());
4003    /// assert!(x.remove_facet_action().is_none());
4004    /// assert!(x.pin_action().is_none());
4005    /// ```
4006    pub fn set_ignore_action<
4007        T: std::convert::Into<std::boxed::Box<crate::model::rule::IgnoreAction>>,
4008    >(
4009        mut self,
4010        v: T,
4011    ) -> Self {
4012        self.action = std::option::Option::Some(crate::model::rule::Action::IgnoreAction(v.into()));
4013        self
4014    }
4015
4016    /// The value of [action][crate::model::Rule::action]
4017    /// if it holds a `FilterAction`, `None` if the field is not set or
4018    /// holds a different branch.
4019    pub fn filter_action(
4020        &self,
4021    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::FilterAction>> {
4022        #[allow(unreachable_patterns)]
4023        self.action.as_ref().and_then(|v| match v {
4024            crate::model::rule::Action::FilterAction(v) => std::option::Option::Some(v),
4025            _ => std::option::Option::None,
4026        })
4027    }
4028
4029    /// Sets the value of [action][crate::model::Rule::action]
4030    /// to hold a `FilterAction`.
4031    ///
4032    /// Note that all the setters affecting `action` are
4033    /// mutually exclusive.
4034    ///
4035    /// # Example
4036    /// ```ignore,no_run
4037    /// # use google_cloud_retail_v2::model::Rule;
4038    /// use google_cloud_retail_v2::model::rule::FilterAction;
4039    /// let x = Rule::new().set_filter_action(FilterAction::default()/* use setters */);
4040    /// assert!(x.filter_action().is_some());
4041    /// assert!(x.boost_action().is_none());
4042    /// assert!(x.redirect_action().is_none());
4043    /// assert!(x.oneway_synonyms_action().is_none());
4044    /// assert!(x.do_not_associate_action().is_none());
4045    /// assert!(x.replacement_action().is_none());
4046    /// assert!(x.ignore_action().is_none());
4047    /// assert!(x.twoway_synonyms_action().is_none());
4048    /// assert!(x.force_return_facet_action().is_none());
4049    /// assert!(x.remove_facet_action().is_none());
4050    /// assert!(x.pin_action().is_none());
4051    /// ```
4052    pub fn set_filter_action<
4053        T: std::convert::Into<std::boxed::Box<crate::model::rule::FilterAction>>,
4054    >(
4055        mut self,
4056        v: T,
4057    ) -> Self {
4058        self.action = std::option::Option::Some(crate::model::rule::Action::FilterAction(v.into()));
4059        self
4060    }
4061
4062    /// The value of [action][crate::model::Rule::action]
4063    /// if it holds a `TwowaySynonymsAction`, `None` if the field is not set or
4064    /// holds a different branch.
4065    pub fn twoway_synonyms_action(
4066        &self,
4067    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::TwowaySynonymsAction>> {
4068        #[allow(unreachable_patterns)]
4069        self.action.as_ref().and_then(|v| match v {
4070            crate::model::rule::Action::TwowaySynonymsAction(v) => std::option::Option::Some(v),
4071            _ => std::option::Option::None,
4072        })
4073    }
4074
4075    /// Sets the value of [action][crate::model::Rule::action]
4076    /// to hold a `TwowaySynonymsAction`.
4077    ///
4078    /// Note that all the setters affecting `action` are
4079    /// mutually exclusive.
4080    ///
4081    /// # Example
4082    /// ```ignore,no_run
4083    /// # use google_cloud_retail_v2::model::Rule;
4084    /// use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4085    /// let x = Rule::new().set_twoway_synonyms_action(TwowaySynonymsAction::default()/* use setters */);
4086    /// assert!(x.twoway_synonyms_action().is_some());
4087    /// assert!(x.boost_action().is_none());
4088    /// assert!(x.redirect_action().is_none());
4089    /// assert!(x.oneway_synonyms_action().is_none());
4090    /// assert!(x.do_not_associate_action().is_none());
4091    /// assert!(x.replacement_action().is_none());
4092    /// assert!(x.ignore_action().is_none());
4093    /// assert!(x.filter_action().is_none());
4094    /// assert!(x.force_return_facet_action().is_none());
4095    /// assert!(x.remove_facet_action().is_none());
4096    /// assert!(x.pin_action().is_none());
4097    /// ```
4098    pub fn set_twoway_synonyms_action<
4099        T: std::convert::Into<std::boxed::Box<crate::model::rule::TwowaySynonymsAction>>,
4100    >(
4101        mut self,
4102        v: T,
4103    ) -> Self {
4104        self.action =
4105            std::option::Option::Some(crate::model::rule::Action::TwowaySynonymsAction(v.into()));
4106        self
4107    }
4108
4109    /// The value of [action][crate::model::Rule::action]
4110    /// if it holds a `ForceReturnFacetAction`, `None` if the field is not set or
4111    /// holds a different branch.
4112    pub fn force_return_facet_action(
4113        &self,
4114    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::ForceReturnFacetAction>> {
4115        #[allow(unreachable_patterns)]
4116        self.action.as_ref().and_then(|v| match v {
4117            crate::model::rule::Action::ForceReturnFacetAction(v) => std::option::Option::Some(v),
4118            _ => std::option::Option::None,
4119        })
4120    }
4121
4122    /// Sets the value of [action][crate::model::Rule::action]
4123    /// to hold a `ForceReturnFacetAction`.
4124    ///
4125    /// Note that all the setters affecting `action` are
4126    /// mutually exclusive.
4127    ///
4128    /// # Example
4129    /// ```ignore,no_run
4130    /// # use google_cloud_retail_v2::model::Rule;
4131    /// use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4132    /// let x = Rule::new().set_force_return_facet_action(ForceReturnFacetAction::default()/* use setters */);
4133    /// assert!(x.force_return_facet_action().is_some());
4134    /// assert!(x.boost_action().is_none());
4135    /// assert!(x.redirect_action().is_none());
4136    /// assert!(x.oneway_synonyms_action().is_none());
4137    /// assert!(x.do_not_associate_action().is_none());
4138    /// assert!(x.replacement_action().is_none());
4139    /// assert!(x.ignore_action().is_none());
4140    /// assert!(x.filter_action().is_none());
4141    /// assert!(x.twoway_synonyms_action().is_none());
4142    /// assert!(x.remove_facet_action().is_none());
4143    /// assert!(x.pin_action().is_none());
4144    /// ```
4145    pub fn set_force_return_facet_action<
4146        T: std::convert::Into<std::boxed::Box<crate::model::rule::ForceReturnFacetAction>>,
4147    >(
4148        mut self,
4149        v: T,
4150    ) -> Self {
4151        self.action =
4152            std::option::Option::Some(crate::model::rule::Action::ForceReturnFacetAction(v.into()));
4153        self
4154    }
4155
4156    /// The value of [action][crate::model::Rule::action]
4157    /// if it holds a `RemoveFacetAction`, `None` if the field is not set or
4158    /// holds a different branch.
4159    pub fn remove_facet_action(
4160        &self,
4161    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::RemoveFacetAction>> {
4162        #[allow(unreachable_patterns)]
4163        self.action.as_ref().and_then(|v| match v {
4164            crate::model::rule::Action::RemoveFacetAction(v) => std::option::Option::Some(v),
4165            _ => std::option::Option::None,
4166        })
4167    }
4168
4169    /// Sets the value of [action][crate::model::Rule::action]
4170    /// to hold a `RemoveFacetAction`.
4171    ///
4172    /// Note that all the setters affecting `action` are
4173    /// mutually exclusive.
4174    ///
4175    /// # Example
4176    /// ```ignore,no_run
4177    /// # use google_cloud_retail_v2::model::Rule;
4178    /// use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4179    /// let x = Rule::new().set_remove_facet_action(RemoveFacetAction::default()/* use setters */);
4180    /// assert!(x.remove_facet_action().is_some());
4181    /// assert!(x.boost_action().is_none());
4182    /// assert!(x.redirect_action().is_none());
4183    /// assert!(x.oneway_synonyms_action().is_none());
4184    /// assert!(x.do_not_associate_action().is_none());
4185    /// assert!(x.replacement_action().is_none());
4186    /// assert!(x.ignore_action().is_none());
4187    /// assert!(x.filter_action().is_none());
4188    /// assert!(x.twoway_synonyms_action().is_none());
4189    /// assert!(x.force_return_facet_action().is_none());
4190    /// assert!(x.pin_action().is_none());
4191    /// ```
4192    pub fn set_remove_facet_action<
4193        T: std::convert::Into<std::boxed::Box<crate::model::rule::RemoveFacetAction>>,
4194    >(
4195        mut self,
4196        v: T,
4197    ) -> Self {
4198        self.action =
4199            std::option::Option::Some(crate::model::rule::Action::RemoveFacetAction(v.into()));
4200        self
4201    }
4202
4203    /// The value of [action][crate::model::Rule::action]
4204    /// if it holds a `PinAction`, `None` if the field is not set or
4205    /// holds a different branch.
4206    pub fn pin_action(
4207        &self,
4208    ) -> std::option::Option<&std::boxed::Box<crate::model::rule::PinAction>> {
4209        #[allow(unreachable_patterns)]
4210        self.action.as_ref().and_then(|v| match v {
4211            crate::model::rule::Action::PinAction(v) => std::option::Option::Some(v),
4212            _ => std::option::Option::None,
4213        })
4214    }
4215
4216    /// Sets the value of [action][crate::model::Rule::action]
4217    /// to hold a `PinAction`.
4218    ///
4219    /// Note that all the setters affecting `action` are
4220    /// mutually exclusive.
4221    ///
4222    /// # Example
4223    /// ```ignore,no_run
4224    /// # use google_cloud_retail_v2::model::Rule;
4225    /// use google_cloud_retail_v2::model::rule::PinAction;
4226    /// let x = Rule::new().set_pin_action(PinAction::default()/* use setters */);
4227    /// assert!(x.pin_action().is_some());
4228    /// assert!(x.boost_action().is_none());
4229    /// assert!(x.redirect_action().is_none());
4230    /// assert!(x.oneway_synonyms_action().is_none());
4231    /// assert!(x.do_not_associate_action().is_none());
4232    /// assert!(x.replacement_action().is_none());
4233    /// assert!(x.ignore_action().is_none());
4234    /// assert!(x.filter_action().is_none());
4235    /// assert!(x.twoway_synonyms_action().is_none());
4236    /// assert!(x.force_return_facet_action().is_none());
4237    /// assert!(x.remove_facet_action().is_none());
4238    /// ```
4239    pub fn set_pin_action<T: std::convert::Into<std::boxed::Box<crate::model::rule::PinAction>>>(
4240        mut self,
4241        v: T,
4242    ) -> Self {
4243        self.action = std::option::Option::Some(crate::model::rule::Action::PinAction(v.into()));
4244        self
4245    }
4246}
4247
4248impl wkt::message::Message for Rule {
4249    fn typename() -> &'static str {
4250        "type.googleapis.com/google.cloud.retail.v2.Rule"
4251    }
4252}
4253
4254/// Defines additional types related to [Rule].
4255pub mod rule {
4256    #[allow(unused_imports)]
4257    use super::*;
4258
4259    /// A boost action to apply to results matching condition specified above.
4260    #[derive(Clone, Default, PartialEq)]
4261    #[non_exhaustive]
4262    pub struct BoostAction {
4263        /// Strength of the condition boost, which must be in [-1, 1]. Negative
4264        /// boost means demotion. Default is 0.0.
4265        ///
4266        /// Setting to 1.0 gives the item a big promotion. However, it does not
4267        /// necessarily mean that the boosted item will be the top result at all
4268        /// times, nor that other items will be excluded. Results could still be
4269        /// shown even when none of them matches the condition. And results that
4270        /// are significantly more relevant to the search query can still trump
4271        /// your heavily favored but irrelevant items.
4272        ///
4273        /// Setting to -1.0 gives the item a big demotion. However, results that
4274        /// are deeply relevant might still be shown. The item will have an
4275        /// upstream battle to get a fairly high ranking, but it is not blocked out
4276        /// completely.
4277        ///
4278        /// Setting to 0.0 means no boost applied. The boosting condition is
4279        /// ignored.
4280        pub boost: f32,
4281
4282        /// The filter can have a max size of 5000 characters.
4283        /// An expression which specifies which products to apply an action to.
4284        /// The syntax and supported fields are the same as a filter expression. See
4285        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
4286        /// detail syntax and limitations.
4287        ///
4288        /// Examples:
4289        ///
4290        /// * To boost products with product ID "product_1" or "product_2", and
4291        ///   color
4292        ///   "Red" or "Blue":\<br\>
4293        ///   *(id: ANY("product_1", "product_2"))<br>*
4294        ///   *AND<br>*
4295        ///   *(colorFamilies: ANY("Red", "Blue"))<br>*
4296        ///
4297        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4298        pub products_filter: std::string::String,
4299
4300        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4301    }
4302
4303    impl BoostAction {
4304        /// Creates a new default instance.
4305        pub fn new() -> Self {
4306            std::default::Default::default()
4307        }
4308
4309        /// Sets the value of [boost][crate::model::rule::BoostAction::boost].
4310        ///
4311        /// # Example
4312        /// ```ignore,no_run
4313        /// # use google_cloud_retail_v2::model::rule::BoostAction;
4314        /// let x = BoostAction::new().set_boost(42.0);
4315        /// ```
4316        pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4317            self.boost = v.into();
4318            self
4319        }
4320
4321        /// Sets the value of [products_filter][crate::model::rule::BoostAction::products_filter].
4322        ///
4323        /// # Example
4324        /// ```ignore,no_run
4325        /// # use google_cloud_retail_v2::model::rule::BoostAction;
4326        /// let x = BoostAction::new().set_products_filter("example");
4327        /// ```
4328        pub fn set_products_filter<T: std::convert::Into<std::string::String>>(
4329            mut self,
4330            v: T,
4331        ) -> Self {
4332            self.products_filter = v.into();
4333            self
4334        }
4335    }
4336
4337    impl wkt::message::Message for BoostAction {
4338        fn typename() -> &'static str {
4339            "type.googleapis.com/google.cloud.retail.v2.Rule.BoostAction"
4340        }
4341    }
4342
4343    /// * Rule Condition:
4344    ///
4345    ///   - No
4346    ///     [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4347    ///     provided is a global match.
4348    ///   - 1 or more
4349    ///     [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4350    ///     provided are combined with OR operator.
4351    /// * Action Input: The request query and filter that are applied to the
4352    ///   retrieved products, in addition to any filters already provided with the
4353    ///   SearchRequest. The AND operator is used to combine the query's existing
4354    ///   filters with the filter rule(s). NOTE: May result in 0 results when
4355    ///   filters conflict.
4356    ///
4357    /// * Action Result: Filters the returned objects to be ONLY those that passed
4358    ///   the filter.
4359    ///
4360    ///
4361    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4362    #[derive(Clone, Default, PartialEq)]
4363    #[non_exhaustive]
4364    pub struct FilterAction {
4365        /// A filter to apply on the matching condition results. Supported features:
4366        ///
4367        /// * [filter][google.cloud.retail.v2.Rule.FilterAction.filter] must be set.
4368        /// * Filter syntax is identical to
4369        ///   [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter]. For
4370        ///   more
4371        ///   information, see [Filter](/retail/docs/filter-and-order#filter).
4372        /// * To filter products with product ID "product_1" or "product_2", and
4373        ///   color
4374        ///   "Red" or "Blue":\<br\>
4375        ///   *(id: ANY("product_1", "product_2"))<br>*
4376        ///   *AND<br>*
4377        ///   *(colorFamilies: ANY("Red", "Blue"))<br>*
4378        ///
4379        /// [google.cloud.retail.v2.Rule.FilterAction.filter]: crate::model::rule::FilterAction::filter
4380        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
4381        pub filter: std::string::String,
4382
4383        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4384    }
4385
4386    impl FilterAction {
4387        /// Creates a new default instance.
4388        pub fn new() -> Self {
4389            std::default::Default::default()
4390        }
4391
4392        /// Sets the value of [filter][crate::model::rule::FilterAction::filter].
4393        ///
4394        /// # Example
4395        /// ```ignore,no_run
4396        /// # use google_cloud_retail_v2::model::rule::FilterAction;
4397        /// let x = FilterAction::new().set_filter("example");
4398        /// ```
4399        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4400            self.filter = v.into();
4401            self
4402        }
4403    }
4404
4405    impl wkt::message::Message for FilterAction {
4406        fn typename() -> &'static str {
4407            "type.googleapis.com/google.cloud.retail.v2.Rule.FilterAction"
4408        }
4409    }
4410
4411    /// Redirects a shopper to a specific page.
4412    ///
4413    /// * Rule Condition:
4414    ///   Must specify
4415    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms].
4416    /// * Action Input: Request Query
4417    /// * Action Result: Redirects shopper to provided uri.
4418    ///
4419    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4420    #[derive(Clone, Default, PartialEq)]
4421    #[non_exhaustive]
4422    pub struct RedirectAction {
4423        /// URL must have length equal or less than 2000 characters.
4424        pub redirect_uri: std::string::String,
4425
4426        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4427    }
4428
4429    impl RedirectAction {
4430        /// Creates a new default instance.
4431        pub fn new() -> Self {
4432            std::default::Default::default()
4433        }
4434
4435        /// Sets the value of [redirect_uri][crate::model::rule::RedirectAction::redirect_uri].
4436        ///
4437        /// # Example
4438        /// ```ignore,no_run
4439        /// # use google_cloud_retail_v2::model::rule::RedirectAction;
4440        /// let x = RedirectAction::new().set_redirect_uri("example");
4441        /// ```
4442        pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(
4443            mut self,
4444            v: T,
4445        ) -> Self {
4446            self.redirect_uri = v.into();
4447            self
4448        }
4449    }
4450
4451    impl wkt::message::Message for RedirectAction {
4452        fn typename() -> &'static str {
4453            "type.googleapis.com/google.cloud.retail.v2.Rule.RedirectAction"
4454        }
4455    }
4456
4457    /// Creates a set of terms that will be treated as synonyms of each other.
4458    /// Example: synonyms of "sneakers" and "shoes":
4459    ///
4460    /// * "sneakers" will use a synonym of "shoes".
4461    /// * "shoes" will use a synonym of "sneakers".
4462    #[derive(Clone, Default, PartialEq)]
4463    #[non_exhaustive]
4464    pub struct TwowaySynonymsAction {
4465        /// Defines a set of synonyms.
4466        /// Can specify up to 100 synonyms.
4467        /// Must specify at least 2 synonyms.
4468        pub synonyms: std::vec::Vec<std::string::String>,
4469
4470        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4471    }
4472
4473    impl TwowaySynonymsAction {
4474        /// Creates a new default instance.
4475        pub fn new() -> Self {
4476            std::default::Default::default()
4477        }
4478
4479        /// Sets the value of [synonyms][crate::model::rule::TwowaySynonymsAction::synonyms].
4480        ///
4481        /// # Example
4482        /// ```ignore,no_run
4483        /// # use google_cloud_retail_v2::model::rule::TwowaySynonymsAction;
4484        /// let x = TwowaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4485        /// ```
4486        pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4487        where
4488            T: std::iter::IntoIterator<Item = V>,
4489            V: std::convert::Into<std::string::String>,
4490        {
4491            use std::iter::Iterator;
4492            self.synonyms = v.into_iter().map(|i| i.into()).collect();
4493            self
4494        }
4495    }
4496
4497    impl wkt::message::Message for TwowaySynonymsAction {
4498        fn typename() -> &'static str {
4499            "type.googleapis.com/google.cloud.retail.v2.Rule.TwowaySynonymsAction"
4500        }
4501    }
4502
4503    /// Maps a set of terms to a set of synonyms.
4504    /// Set of synonyms will be treated as synonyms of each query term only.
4505    /// `query_terms` will not be treated as synonyms of each other.
4506    /// Example: "sneakers" will use a synonym of "shoes".
4507    /// "shoes" will not use a synonym of "sneakers".
4508    #[derive(Clone, Default, PartialEq)]
4509    #[non_exhaustive]
4510    pub struct OnewaySynonymsAction {
4511        /// Terms from the search query.
4512        /// Will treat synonyms as their synonyms.
4513        /// Not themselves synonyms of the synonyms.
4514        /// Can specify up to 100 terms.
4515        pub query_terms: std::vec::Vec<std::string::String>,
4516
4517        /// Defines a set of synonyms.
4518        /// Cannot contain duplicates.
4519        /// Can specify up to 100 synonyms.
4520        pub synonyms: std::vec::Vec<std::string::String>,
4521
4522        /// Will be [deprecated = true] post migration;
4523        pub oneway_terms: std::vec::Vec<std::string::String>,
4524
4525        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4526    }
4527
4528    impl OnewaySynonymsAction {
4529        /// Creates a new default instance.
4530        pub fn new() -> Self {
4531            std::default::Default::default()
4532        }
4533
4534        /// Sets the value of [query_terms][crate::model::rule::OnewaySynonymsAction::query_terms].
4535        ///
4536        /// # Example
4537        /// ```ignore,no_run
4538        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4539        /// let x = OnewaySynonymsAction::new().set_query_terms(["a", "b", "c"]);
4540        /// ```
4541        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4542        where
4543            T: std::iter::IntoIterator<Item = V>,
4544            V: std::convert::Into<std::string::String>,
4545        {
4546            use std::iter::Iterator;
4547            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4548            self
4549        }
4550
4551        /// Sets the value of [synonyms][crate::model::rule::OnewaySynonymsAction::synonyms].
4552        ///
4553        /// # Example
4554        /// ```ignore,no_run
4555        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4556        /// let x = OnewaySynonymsAction::new().set_synonyms(["a", "b", "c"]);
4557        /// ```
4558        pub fn set_synonyms<T, V>(mut self, v: T) -> Self
4559        where
4560            T: std::iter::IntoIterator<Item = V>,
4561            V: std::convert::Into<std::string::String>,
4562        {
4563            use std::iter::Iterator;
4564            self.synonyms = v.into_iter().map(|i| i.into()).collect();
4565            self
4566        }
4567
4568        /// Sets the value of [oneway_terms][crate::model::rule::OnewaySynonymsAction::oneway_terms].
4569        ///
4570        /// # Example
4571        /// ```ignore,no_run
4572        /// # use google_cloud_retail_v2::model::rule::OnewaySynonymsAction;
4573        /// let x = OnewaySynonymsAction::new().set_oneway_terms(["a", "b", "c"]);
4574        /// ```
4575        pub fn set_oneway_terms<T, V>(mut self, v: T) -> Self
4576        where
4577            T: std::iter::IntoIterator<Item = V>,
4578            V: std::convert::Into<std::string::String>,
4579        {
4580            use std::iter::Iterator;
4581            self.oneway_terms = v.into_iter().map(|i| i.into()).collect();
4582            self
4583        }
4584    }
4585
4586    impl wkt::message::Message for OnewaySynonymsAction {
4587        fn typename() -> &'static str {
4588            "type.googleapis.com/google.cloud.retail.v2.Rule.OnewaySynonymsAction"
4589        }
4590    }
4591
4592    /// Prevents `query_term` from being associated with specified terms during
4593    /// search.
4594    /// Example: Don't associate "gShoe" and "cheap".
4595    #[derive(Clone, Default, PartialEq)]
4596    #[non_exhaustive]
4597    pub struct DoNotAssociateAction {
4598        /// Terms from the search query.
4599        /// Will not consider do_not_associate_terms for search if in search query.
4600        /// Can specify up to 100 terms.
4601        pub query_terms: std::vec::Vec<std::string::String>,
4602
4603        /// Cannot contain duplicates or the query term.
4604        /// Can specify up to 100 terms.
4605        pub do_not_associate_terms: std::vec::Vec<std::string::String>,
4606
4607        /// Will be [deprecated = true] post migration;
4608        pub terms: std::vec::Vec<std::string::String>,
4609
4610        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4611    }
4612
4613    impl DoNotAssociateAction {
4614        /// Creates a new default instance.
4615        pub fn new() -> Self {
4616            std::default::Default::default()
4617        }
4618
4619        /// Sets the value of [query_terms][crate::model::rule::DoNotAssociateAction::query_terms].
4620        ///
4621        /// # Example
4622        /// ```ignore,no_run
4623        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4624        /// let x = DoNotAssociateAction::new().set_query_terms(["a", "b", "c"]);
4625        /// ```
4626        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4627        where
4628            T: std::iter::IntoIterator<Item = V>,
4629            V: std::convert::Into<std::string::String>,
4630        {
4631            use std::iter::Iterator;
4632            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4633            self
4634        }
4635
4636        /// Sets the value of [do_not_associate_terms][crate::model::rule::DoNotAssociateAction::do_not_associate_terms].
4637        ///
4638        /// # Example
4639        /// ```ignore,no_run
4640        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4641        /// let x = DoNotAssociateAction::new().set_do_not_associate_terms(["a", "b", "c"]);
4642        /// ```
4643        pub fn set_do_not_associate_terms<T, V>(mut self, v: T) -> Self
4644        where
4645            T: std::iter::IntoIterator<Item = V>,
4646            V: std::convert::Into<std::string::String>,
4647        {
4648            use std::iter::Iterator;
4649            self.do_not_associate_terms = v.into_iter().map(|i| i.into()).collect();
4650            self
4651        }
4652
4653        /// Sets the value of [terms][crate::model::rule::DoNotAssociateAction::terms].
4654        ///
4655        /// # Example
4656        /// ```ignore,no_run
4657        /// # use google_cloud_retail_v2::model::rule::DoNotAssociateAction;
4658        /// let x = DoNotAssociateAction::new().set_terms(["a", "b", "c"]);
4659        /// ```
4660        pub fn set_terms<T, V>(mut self, v: T) -> Self
4661        where
4662            T: std::iter::IntoIterator<Item = V>,
4663            V: std::convert::Into<std::string::String>,
4664        {
4665            use std::iter::Iterator;
4666            self.terms = v.into_iter().map(|i| i.into()).collect();
4667            self
4668        }
4669    }
4670
4671    impl wkt::message::Message for DoNotAssociateAction {
4672        fn typename() -> &'static str {
4673            "type.googleapis.com/google.cloud.retail.v2.Rule.DoNotAssociateAction"
4674        }
4675    }
4676
4677    /// Replaces a term in the query. Multiple replacement candidates can be
4678    /// specified. All `query_terms` will be replaced with the replacement term.
4679    /// Example: Replace "gShoe" with "google shoe".
4680    #[derive(Clone, Default, PartialEq)]
4681    #[non_exhaustive]
4682    pub struct ReplacementAction {
4683        /// Terms from the search query.
4684        /// Will be replaced by replacement term.
4685        /// Can specify up to 100 terms.
4686        pub query_terms: std::vec::Vec<std::string::String>,
4687
4688        /// Term that will be used for replacement.
4689        pub replacement_term: std::string::String,
4690
4691        /// Will be [deprecated = true] post migration;
4692        pub term: std::string::String,
4693
4694        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4695    }
4696
4697    impl ReplacementAction {
4698        /// Creates a new default instance.
4699        pub fn new() -> Self {
4700            std::default::Default::default()
4701        }
4702
4703        /// Sets the value of [query_terms][crate::model::rule::ReplacementAction::query_terms].
4704        ///
4705        /// # Example
4706        /// ```ignore,no_run
4707        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4708        /// let x = ReplacementAction::new().set_query_terms(["a", "b", "c"]);
4709        /// ```
4710        pub fn set_query_terms<T, V>(mut self, v: T) -> Self
4711        where
4712            T: std::iter::IntoIterator<Item = V>,
4713            V: std::convert::Into<std::string::String>,
4714        {
4715            use std::iter::Iterator;
4716            self.query_terms = v.into_iter().map(|i| i.into()).collect();
4717            self
4718        }
4719
4720        /// Sets the value of [replacement_term][crate::model::rule::ReplacementAction::replacement_term].
4721        ///
4722        /// # Example
4723        /// ```ignore,no_run
4724        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4725        /// let x = ReplacementAction::new().set_replacement_term("example");
4726        /// ```
4727        pub fn set_replacement_term<T: std::convert::Into<std::string::String>>(
4728            mut self,
4729            v: T,
4730        ) -> Self {
4731            self.replacement_term = v.into();
4732            self
4733        }
4734
4735        /// Sets the value of [term][crate::model::rule::ReplacementAction::term].
4736        ///
4737        /// # Example
4738        /// ```ignore,no_run
4739        /// # use google_cloud_retail_v2::model::rule::ReplacementAction;
4740        /// let x = ReplacementAction::new().set_term("example");
4741        /// ```
4742        pub fn set_term<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4743            self.term = v.into();
4744            self
4745        }
4746    }
4747
4748    impl wkt::message::Message for ReplacementAction {
4749        fn typename() -> &'static str {
4750            "type.googleapis.com/google.cloud.retail.v2.Rule.ReplacementAction"
4751        }
4752    }
4753
4754    /// Prevents a term in the query from being used in search.
4755    /// Example: Don't search for "shoddy".
4756    #[derive(Clone, Default, PartialEq)]
4757    #[non_exhaustive]
4758    pub struct IgnoreAction {
4759        /// Terms to ignore in the search query.
4760        pub ignore_terms: std::vec::Vec<std::string::String>,
4761
4762        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4763    }
4764
4765    impl IgnoreAction {
4766        /// Creates a new default instance.
4767        pub fn new() -> Self {
4768            std::default::Default::default()
4769        }
4770
4771        /// Sets the value of [ignore_terms][crate::model::rule::IgnoreAction::ignore_terms].
4772        ///
4773        /// # Example
4774        /// ```ignore,no_run
4775        /// # use google_cloud_retail_v2::model::rule::IgnoreAction;
4776        /// let x = IgnoreAction::new().set_ignore_terms(["a", "b", "c"]);
4777        /// ```
4778        pub fn set_ignore_terms<T, V>(mut self, v: T) -> Self
4779        where
4780            T: std::iter::IntoIterator<Item = V>,
4781            V: std::convert::Into<std::string::String>,
4782        {
4783            use std::iter::Iterator;
4784            self.ignore_terms = v.into_iter().map(|i| i.into()).collect();
4785            self
4786        }
4787    }
4788
4789    impl wkt::message::Message for IgnoreAction {
4790        fn typename() -> &'static str {
4791            "type.googleapis.com/google.cloud.retail.v2.Rule.IgnoreAction"
4792        }
4793    }
4794
4795    /// Force returns an attribute/facet in the request around a certain position
4796    /// or above.
4797    ///
4798    /// * Rule Condition:
4799    ///   Must specify non-empty
4800    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4801    ///   (for search only) or
4802    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4803    ///   (for browse only), but can't specify both.
4804    ///
4805    /// * Action Inputs: attribute name, position
4806    ///
4807    /// * Action Result: Will force return a facet key around a certain position
4808    ///   or above if the condition is satisfied.
4809    ///
4810    ///
4811    /// Example: Suppose the query is "shoes", the
4812    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4813    /// "shoes", the
4814    /// [ForceReturnFacetAction.FacetPositionAdjustment.attribute_name][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]
4815    /// is "size" and the
4816    /// [ForceReturnFacetAction.FacetPositionAdjustment.position][google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]
4817    /// is 8.
4818    ///
4819    /// Two cases: a) The facet key "size" is not already in the top 8 slots, then
4820    /// the facet "size" will appear at a position close to 8. b) The facet key
4821    /// "size" in among the top 8 positions in the request, then it will stay at
4822    /// its current rank.
4823    ///
4824    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4825    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4826    /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.attribute_name]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name
4827    /// [google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment.position]: crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position
4828    #[derive(Clone, Default, PartialEq)]
4829    #[non_exhaustive]
4830    pub struct ForceReturnFacetAction {
4831        /// Each instance corresponds to a force return attribute for the given
4832        /// condition. There can't be more 15 instances here.
4833        pub facet_position_adjustments:
4834            std::vec::Vec<crate::model::rule::force_return_facet_action::FacetPositionAdjustment>,
4835
4836        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4837    }
4838
4839    impl ForceReturnFacetAction {
4840        /// Creates a new default instance.
4841        pub fn new() -> Self {
4842            std::default::Default::default()
4843        }
4844
4845        /// Sets the value of [facet_position_adjustments][crate::model::rule::ForceReturnFacetAction::facet_position_adjustments].
4846        ///
4847        /// # Example
4848        /// ```ignore,no_run
4849        /// # use google_cloud_retail_v2::model::rule::ForceReturnFacetAction;
4850        /// use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4851        /// let x = ForceReturnFacetAction::new()
4852        ///     .set_facet_position_adjustments([
4853        ///         FacetPositionAdjustment::default()/* use setters */,
4854        ///         FacetPositionAdjustment::default()/* use (different) setters */,
4855        ///     ]);
4856        /// ```
4857        pub fn set_facet_position_adjustments<T, V>(mut self, v: T) -> Self
4858        where
4859            T: std::iter::IntoIterator<Item = V>,
4860            V: std::convert::Into<
4861                    crate::model::rule::force_return_facet_action::FacetPositionAdjustment,
4862                >,
4863        {
4864            use std::iter::Iterator;
4865            self.facet_position_adjustments = v.into_iter().map(|i| i.into()).collect();
4866            self
4867        }
4868    }
4869
4870    impl wkt::message::Message for ForceReturnFacetAction {
4871        fn typename() -> &'static str {
4872            "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction"
4873        }
4874    }
4875
4876    /// Defines additional types related to [ForceReturnFacetAction].
4877    pub mod force_return_facet_action {
4878        #[allow(unused_imports)]
4879        use super::*;
4880
4881        /// Each facet position adjustment consists of a single attribute name (i.e.
4882        /// facet key) along with a specified position.
4883        #[derive(Clone, Default, PartialEq)]
4884        #[non_exhaustive]
4885        pub struct FacetPositionAdjustment {
4886            /// The attribute name to force return as a facet. Each attribute name
4887            /// should be a valid attribute name, be non-empty and contain at most 80
4888            /// characters long.
4889            pub attribute_name: std::string::String,
4890
4891            /// This is the position in the request as explained above. It should be
4892            /// strictly positive be at most 100.
4893            pub position: i32,
4894
4895            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4896        }
4897
4898        impl FacetPositionAdjustment {
4899            /// Creates a new default instance.
4900            pub fn new() -> Self {
4901                std::default::Default::default()
4902            }
4903
4904            /// Sets the value of [attribute_name][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::attribute_name].
4905            ///
4906            /// # Example
4907            /// ```ignore,no_run
4908            /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4909            /// let x = FacetPositionAdjustment::new().set_attribute_name("example");
4910            /// ```
4911            pub fn set_attribute_name<T: std::convert::Into<std::string::String>>(
4912                mut self,
4913                v: T,
4914            ) -> Self {
4915                self.attribute_name = v.into();
4916                self
4917            }
4918
4919            /// Sets the value of [position][crate::model::rule::force_return_facet_action::FacetPositionAdjustment::position].
4920            ///
4921            /// # Example
4922            /// ```ignore,no_run
4923            /// # use google_cloud_retail_v2::model::rule::force_return_facet_action::FacetPositionAdjustment;
4924            /// let x = FacetPositionAdjustment::new().set_position(42);
4925            /// ```
4926            pub fn set_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4927                self.position = v.into();
4928                self
4929            }
4930        }
4931
4932        impl wkt::message::Message for FacetPositionAdjustment {
4933            fn typename() -> &'static str {
4934                "type.googleapis.com/google.cloud.retail.v2.Rule.ForceReturnFacetAction.FacetPositionAdjustment"
4935            }
4936        }
4937    }
4938
4939    /// Removes an attribute/facet in the request if is present.
4940    ///
4941    /// * Rule Condition:
4942    ///   Must specify non-empty
4943    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
4944    ///   (for search only) or
4945    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
4946    ///   (for browse only), but can't specify both.
4947    ///
4948    /// * Action Input: attribute name
4949    ///
4950    /// * Action Result: Will remove the attribute (as a facet) from the request
4951    ///   if it is present.
4952    ///
4953    ///
4954    /// Example: Suppose the query is "shoes", the
4955    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
4956    /// "shoes" and the attribute name "size", then facet key "size" will be
4957    /// removed from the request (if it is present).
4958    ///
4959    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
4960    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
4961    #[derive(Clone, Default, PartialEq)]
4962    #[non_exhaustive]
4963    pub struct RemoveFacetAction {
4964        /// The attribute names (i.e. facet keys) to remove from the dynamic facets
4965        /// (if present in the request). There can't be more 3 attribute names.
4966        /// Each attribute name should be a valid attribute name, be non-empty and
4967        /// contain at most 80 characters.
4968        pub attribute_names: std::vec::Vec<std::string::String>,
4969
4970        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4971    }
4972
4973    impl RemoveFacetAction {
4974        /// Creates a new default instance.
4975        pub fn new() -> Self {
4976            std::default::Default::default()
4977        }
4978
4979        /// Sets the value of [attribute_names][crate::model::rule::RemoveFacetAction::attribute_names].
4980        ///
4981        /// # Example
4982        /// ```ignore,no_run
4983        /// # use google_cloud_retail_v2::model::rule::RemoveFacetAction;
4984        /// let x = RemoveFacetAction::new().set_attribute_names(["a", "b", "c"]);
4985        /// ```
4986        pub fn set_attribute_names<T, V>(mut self, v: T) -> Self
4987        where
4988            T: std::iter::IntoIterator<Item = V>,
4989            V: std::convert::Into<std::string::String>,
4990        {
4991            use std::iter::Iterator;
4992            self.attribute_names = v.into_iter().map(|i| i.into()).collect();
4993            self
4994        }
4995    }
4996
4997    impl wkt::message::Message for RemoveFacetAction {
4998        fn typename() -> &'static str {
4999            "type.googleapis.com/google.cloud.retail.v2.Rule.RemoveFacetAction"
5000        }
5001    }
5002
5003    /// Pins one or more specified products to a specific position in the
5004    /// results.
5005    ///
5006    /// * Rule Condition:
5007    ///   Must specify non-empty
5008    ///   [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms]
5009    ///   (for search only) or
5010    ///   [Condition.page_categories][google.cloud.retail.v2.Condition.page_categories]
5011    ///   (for browse only), but can't specify both.
5012    ///
5013    /// * Action Input: mapping of `[pin_position, product_id]` pairs (pin position
5014    ///   uses 1-based indexing).
5015    ///
5016    /// * Action Result: Will pin products with matching ids to the position
5017    ///   specified in the final result order.
5018    ///
5019    ///
5020    /// Example: Suppose the query is `shoes`, the
5021    /// [Condition.query_terms][google.cloud.retail.v2.Condition.query_terms] is
5022    /// `shoes` and the pin_map has `{1, "pid1"}`, then product with `pid1` will be
5023    /// pinned to the top position in the final results.
5024    ///
5025    /// If multiple PinActions are matched to a single request the actions will
5026    /// be processed from most to least recently updated.
5027    ///
5028    /// Pins to positions larger than the max allowed page size of 120 are not
5029    /// allowed.
5030    ///
5031    /// [google.cloud.retail.v2.Condition.page_categories]: crate::model::Condition::page_categories
5032    /// [google.cloud.retail.v2.Condition.query_terms]: crate::model::Condition::query_terms
5033    #[derive(Clone, Default, PartialEq)]
5034    #[non_exhaustive]
5035    pub struct PinAction {
5036        /// Required. A map of positions to product_ids.
5037        ///
5038        /// Partial matches per action are allowed, if a certain position in the map
5039        /// is already filled that `[position, product_id]` pair will be ignored
5040        /// but the rest may still be applied. This case will only occur if multiple
5041        /// pin actions are matched to a single request, as the map guarantees that
5042        /// pin positions are unique within the same action.
5043        ///
5044        /// Duplicate product_ids are not permitted within a single pin map.
5045        ///
5046        /// The max size of this map is 120, equivalent to the max [request page
5047        /// size](https://cloud.google.com/retail/docs/reference/rest/v2/projects.locations.catalogs.placements/search#request-body).
5048        pub pin_map: std::collections::HashMap<i64, std::string::String>,
5049
5050        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5051    }
5052
5053    impl PinAction {
5054        /// Creates a new default instance.
5055        pub fn new() -> Self {
5056            std::default::Default::default()
5057        }
5058
5059        /// Sets the value of [pin_map][crate::model::rule::PinAction::pin_map].
5060        ///
5061        /// # Example
5062        /// ```ignore,no_run
5063        /// # use google_cloud_retail_v2::model::rule::PinAction;
5064        /// let x = PinAction::new().set_pin_map([
5065        ///     (0, "abc"),
5066        ///     (1, "xyz"),
5067        /// ]);
5068        /// ```
5069        pub fn set_pin_map<T, K, V>(mut self, v: T) -> Self
5070        where
5071            T: std::iter::IntoIterator<Item = (K, V)>,
5072            K: std::convert::Into<i64>,
5073            V: std::convert::Into<std::string::String>,
5074        {
5075            use std::iter::Iterator;
5076            self.pin_map = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
5077            self
5078        }
5079    }
5080
5081    impl wkt::message::Message for PinAction {
5082        fn typename() -> &'static str {
5083            "type.googleapis.com/google.cloud.retail.v2.Rule.PinAction"
5084        }
5085    }
5086
5087    /// An action must be provided.
5088    #[derive(Clone, Debug, PartialEq)]
5089    #[non_exhaustive]
5090    pub enum Action {
5091        /// A boost action.
5092        BoostAction(std::boxed::Box<crate::model::rule::BoostAction>),
5093        /// Redirects a shopper to a specific page.
5094        RedirectAction(std::boxed::Box<crate::model::rule::RedirectAction>),
5095        /// Treats specific term as a synonym with a group of terms.
5096        /// Group of terms will not be treated as synonyms with the specific term.
5097        OnewaySynonymsAction(std::boxed::Box<crate::model::rule::OnewaySynonymsAction>),
5098        /// Prevents term from being associated with other terms.
5099        DoNotAssociateAction(std::boxed::Box<crate::model::rule::DoNotAssociateAction>),
5100        /// Replaces specific terms in the query.
5101        ReplacementAction(std::boxed::Box<crate::model::rule::ReplacementAction>),
5102        /// Ignores specific terms from query during search.
5103        IgnoreAction(std::boxed::Box<crate::model::rule::IgnoreAction>),
5104        /// Filters results.
5105        FilterAction(std::boxed::Box<crate::model::rule::FilterAction>),
5106        /// Treats a set of terms as synonyms of one another.
5107        TwowaySynonymsAction(std::boxed::Box<crate::model::rule::TwowaySynonymsAction>),
5108        /// Force returns an attribute as a facet in the request.
5109        ForceReturnFacetAction(std::boxed::Box<crate::model::rule::ForceReturnFacetAction>),
5110        /// Remove an attribute as a facet in the request (if present).
5111        RemoveFacetAction(std::boxed::Box<crate::model::rule::RemoveFacetAction>),
5112        /// Pins one or more specified products to a specific position in the
5113        /// results.
5114        PinAction(std::boxed::Box<crate::model::rule::PinAction>),
5115    }
5116}
5117
5118/// An intended audience of the [Product][google.cloud.retail.v2.Product] for
5119/// whom it's sold.
5120///
5121/// [google.cloud.retail.v2.Product]: crate::model::Product
5122#[derive(Clone, Default, PartialEq)]
5123#[non_exhaustive]
5124pub struct Audience {
5125    /// The genders of the audience. Strongly encouraged to use the standard
5126    /// values: "male", "female", "unisex".
5127    ///
5128    /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5129    /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5130    /// is returned.
5131    ///
5132    /// Google Merchant Center property
5133    /// [gender](https://support.google.com/merchants/answer/6324479). Schema.org
5134    /// property
5135    /// [Product.audience.suggestedGender](https://schema.org/suggestedGender).
5136    pub genders: std::vec::Vec<std::string::String>,
5137
5138    /// The age groups of the audience. Strongly encouraged to use the standard
5139    /// values: "newborn" (up to 3 months old), "infant" (3–12 months old),
5140    /// "toddler" (1–5 years old), "kids" (5–13 years old), "adult" (typically
5141    /// teens or older).
5142    ///
5143    /// At most 5 values are allowed. Each value must be a UTF-8 encoded string
5144    /// with a length limit of 128 characters. Otherwise, an INVALID_ARGUMENT error
5145    /// is returned.
5146    ///
5147    /// Google Merchant Center property
5148    /// [age_group](https://support.google.com/merchants/answer/6324463).
5149    /// Schema.org property
5150    /// [Product.audience.suggestedMinAge](https://schema.org/suggestedMinAge) and
5151    /// [Product.audience.suggestedMaxAge](https://schema.org/suggestedMaxAge).
5152    pub age_groups: std::vec::Vec<std::string::String>,
5153
5154    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5155}
5156
5157impl Audience {
5158    /// Creates a new default instance.
5159    pub fn new() -> Self {
5160        std::default::Default::default()
5161    }
5162
5163    /// Sets the value of [genders][crate::model::Audience::genders].
5164    ///
5165    /// # Example
5166    /// ```ignore,no_run
5167    /// # use google_cloud_retail_v2::model::Audience;
5168    /// let x = Audience::new().set_genders(["a", "b", "c"]);
5169    /// ```
5170    pub fn set_genders<T, V>(mut self, v: T) -> Self
5171    where
5172        T: std::iter::IntoIterator<Item = V>,
5173        V: std::convert::Into<std::string::String>,
5174    {
5175        use std::iter::Iterator;
5176        self.genders = v.into_iter().map(|i| i.into()).collect();
5177        self
5178    }
5179
5180    /// Sets the value of [age_groups][crate::model::Audience::age_groups].
5181    ///
5182    /// # Example
5183    /// ```ignore,no_run
5184    /// # use google_cloud_retail_v2::model::Audience;
5185    /// let x = Audience::new().set_age_groups(["a", "b", "c"]);
5186    /// ```
5187    pub fn set_age_groups<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.age_groups = v.into_iter().map(|i| i.into()).collect();
5194        self
5195    }
5196}
5197
5198impl wkt::message::Message for Audience {
5199    fn typename() -> &'static str {
5200        "type.googleapis.com/google.cloud.retail.v2.Audience"
5201    }
5202}
5203
5204/// The color information of a [Product][google.cloud.retail.v2.Product].
5205///
5206/// [google.cloud.retail.v2.Product]: crate::model::Product
5207#[derive(Clone, Default, PartialEq)]
5208#[non_exhaustive]
5209pub struct ColorInfo {
5210    /// The standard color families. Strongly recommended to use the following
5211    /// standard color groups: "Red", "Pink", "Orange", "Yellow", "Purple",
5212    /// "Green", "Cyan", "Blue", "Brown", "White", "Gray", "Black" and "Mixed".
5213    /// Normally it is expected to have only 1 color family. May consider using
5214    /// single "Mixed" instead of multiple values.
5215    ///
5216    /// A maximum of 5 values are allowed. Each value must be a UTF-8 encoded
5217    /// string with a length limit of 128 characters. Otherwise, an
5218    /// INVALID_ARGUMENT error is returned.
5219    ///
5220    /// Google Merchant Center property
5221    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5222    /// property [Product.color](https://schema.org/color).
5223    ///
5224    /// The colorFamilies field as a system attribute is not a required field but
5225    /// strongly recommended to be specified. Google Search models treat this field
5226    /// as more important than a custom product attribute when specified.
5227    pub color_families: std::vec::Vec<std::string::String>,
5228
5229    /// The color display names, which may be different from standard color family
5230    /// names, such as the color aliases used in the website frontend. Normally
5231    /// it is expected to have only 1 color. May consider using single "Mixed"
5232    /// instead of multiple values.
5233    ///
5234    /// A maximum of 75 colors are allowed. Each value must be a UTF-8 encoded
5235    /// string with a length limit of 128 characters. Otherwise, an
5236    /// INVALID_ARGUMENT error is returned.
5237    ///
5238    /// Google Merchant Center property
5239    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
5240    /// property [Product.color](https://schema.org/color).
5241    pub colors: std::vec::Vec<std::string::String>,
5242
5243    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5244}
5245
5246impl ColorInfo {
5247    /// Creates a new default instance.
5248    pub fn new() -> Self {
5249        std::default::Default::default()
5250    }
5251
5252    /// Sets the value of [color_families][crate::model::ColorInfo::color_families].
5253    ///
5254    /// # Example
5255    /// ```ignore,no_run
5256    /// # use google_cloud_retail_v2::model::ColorInfo;
5257    /// let x = ColorInfo::new().set_color_families(["a", "b", "c"]);
5258    /// ```
5259    pub fn set_color_families<T, V>(mut self, v: T) -> Self
5260    where
5261        T: std::iter::IntoIterator<Item = V>,
5262        V: std::convert::Into<std::string::String>,
5263    {
5264        use std::iter::Iterator;
5265        self.color_families = v.into_iter().map(|i| i.into()).collect();
5266        self
5267    }
5268
5269    /// Sets the value of [colors][crate::model::ColorInfo::colors].
5270    ///
5271    /// # Example
5272    /// ```ignore,no_run
5273    /// # use google_cloud_retail_v2::model::ColorInfo;
5274    /// let x = ColorInfo::new().set_colors(["a", "b", "c"]);
5275    /// ```
5276    pub fn set_colors<T, V>(mut self, v: T) -> Self
5277    where
5278        T: std::iter::IntoIterator<Item = V>,
5279        V: std::convert::Into<std::string::String>,
5280    {
5281        use std::iter::Iterator;
5282        self.colors = v.into_iter().map(|i| i.into()).collect();
5283        self
5284    }
5285}
5286
5287impl wkt::message::Message for ColorInfo {
5288    fn typename() -> &'static str {
5289        "type.googleapis.com/google.cloud.retail.v2.ColorInfo"
5290    }
5291}
5292
5293/// A custom attribute that is not explicitly modeled in
5294/// [Product][google.cloud.retail.v2.Product].
5295///
5296/// [google.cloud.retail.v2.Product]: crate::model::Product
5297#[derive(Clone, Default, PartialEq)]
5298#[non_exhaustive]
5299pub struct CustomAttribute {
5300    /// The textual values of this custom attribute. For example, `["yellow",
5301    /// "green"]` when the key is "color".
5302    ///
5303    /// Empty string is not allowed. Otherwise, an INVALID_ARGUMENT error is
5304    /// returned.
5305    ///
5306    /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5307    /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5308    /// Otherwise, an INVALID_ARGUMENT error is returned.
5309    ///
5310    /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5311    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5312    pub text: std::vec::Vec<std::string::String>,
5313
5314    /// The numerical values of this custom attribute. For example, `[2.3, 15.4]`
5315    /// when the key is "lengths_cm".
5316    ///
5317    /// Exactly one of [text][google.cloud.retail.v2.CustomAttribute.text] or
5318    /// [numbers][google.cloud.retail.v2.CustomAttribute.numbers] should be set.
5319    /// Otherwise, an INVALID_ARGUMENT error is returned.
5320    ///
5321    /// [google.cloud.retail.v2.CustomAttribute.numbers]: crate::model::CustomAttribute::numbers
5322    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5323    pub numbers: std::vec::Vec<f64>,
5324
5325    /// This field is normally ignored unless
5326    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5327    /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5328    /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5329    /// attribute configuration, see [Configuration
5330    /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5331    /// If true, custom attribute values are searchable by text queries in
5332    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5333    ///
5334    /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5335    ///
5336    /// Only set if type [text][google.cloud.retail.v2.CustomAttribute.text] is
5337    /// set. Otherwise, a INVALID_ARGUMENT error is returned.
5338    ///
5339    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5340    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5341    /// [google.cloud.retail.v2.CustomAttribute.text]: crate::model::CustomAttribute::text
5342    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5343    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5344    #[deprecated]
5345    pub searchable: std::option::Option<bool>,
5346
5347    /// This field is normally ignored unless
5348    /// [AttributesConfig.attribute_config_level][google.cloud.retail.v2.AttributesConfig.attribute_config_level]
5349    /// of the [Catalog][google.cloud.retail.v2.Catalog] is set to the deprecated
5350    /// 'PRODUCT_LEVEL_ATTRIBUTE_CONFIG' mode. For information about product-level
5351    /// attribute configuration, see [Configuration
5352    /// modes](https://cloud.google.com/retail/docs/attribute-config#config-modes).
5353    /// If true, custom attribute values are indexed, so that they can be filtered,
5354    /// faceted or boosted in
5355    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
5356    ///
5357    /// This field is ignored in a [UserEvent][google.cloud.retail.v2.UserEvent].
5358    ///
5359    /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],
5360    /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
5361    /// and
5362    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
5363    /// for more details.
5364    ///
5365    /// [google.cloud.retail.v2.AttributesConfig.attribute_config_level]: crate::model::AttributesConfig::attribute_config_level
5366    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
5367    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
5368    /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
5369    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
5370    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
5371    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
5372    #[deprecated]
5373    pub indexable: std::option::Option<bool>,
5374
5375    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5376}
5377
5378impl CustomAttribute {
5379    /// Creates a new default instance.
5380    pub fn new() -> Self {
5381        std::default::Default::default()
5382    }
5383
5384    /// Sets the value of [text][crate::model::CustomAttribute::text].
5385    ///
5386    /// # Example
5387    /// ```ignore,no_run
5388    /// # use google_cloud_retail_v2::model::CustomAttribute;
5389    /// let x = CustomAttribute::new().set_text(["a", "b", "c"]);
5390    /// ```
5391    pub fn set_text<T, V>(mut self, v: T) -> Self
5392    where
5393        T: std::iter::IntoIterator<Item = V>,
5394        V: std::convert::Into<std::string::String>,
5395    {
5396        use std::iter::Iterator;
5397        self.text = v.into_iter().map(|i| i.into()).collect();
5398        self
5399    }
5400
5401    /// Sets the value of [numbers][crate::model::CustomAttribute::numbers].
5402    ///
5403    /// # Example
5404    /// ```ignore,no_run
5405    /// # use google_cloud_retail_v2::model::CustomAttribute;
5406    /// let x = CustomAttribute::new().set_numbers([1.0, 2.0, 3.0]);
5407    /// ```
5408    pub fn set_numbers<T, V>(mut self, v: T) -> Self
5409    where
5410        T: std::iter::IntoIterator<Item = V>,
5411        V: std::convert::Into<f64>,
5412    {
5413        use std::iter::Iterator;
5414        self.numbers = v.into_iter().map(|i| i.into()).collect();
5415        self
5416    }
5417
5418    /// Sets the value of [searchable][crate::model::CustomAttribute::searchable].
5419    ///
5420    /// # Example
5421    /// ```ignore,no_run
5422    /// # use google_cloud_retail_v2::model::CustomAttribute;
5423    /// let x = CustomAttribute::new().set_searchable(true);
5424    /// ```
5425    #[deprecated]
5426    pub fn set_searchable<T>(mut self, v: T) -> Self
5427    where
5428        T: std::convert::Into<bool>,
5429    {
5430        self.searchable = std::option::Option::Some(v.into());
5431        self
5432    }
5433
5434    /// Sets or clears the value of [searchable][crate::model::CustomAttribute::searchable].
5435    ///
5436    /// # Example
5437    /// ```ignore,no_run
5438    /// # use google_cloud_retail_v2::model::CustomAttribute;
5439    /// let x = CustomAttribute::new().set_or_clear_searchable(Some(false));
5440    /// let x = CustomAttribute::new().set_or_clear_searchable(None::<bool>);
5441    /// ```
5442    #[deprecated]
5443    pub fn set_or_clear_searchable<T>(mut self, v: std::option::Option<T>) -> Self
5444    where
5445        T: std::convert::Into<bool>,
5446    {
5447        self.searchable = v.map(|x| x.into());
5448        self
5449    }
5450
5451    /// Sets the value of [indexable][crate::model::CustomAttribute::indexable].
5452    ///
5453    /// # Example
5454    /// ```ignore,no_run
5455    /// # use google_cloud_retail_v2::model::CustomAttribute;
5456    /// let x = CustomAttribute::new().set_indexable(true);
5457    /// ```
5458    #[deprecated]
5459    pub fn set_indexable<T>(mut self, v: T) -> Self
5460    where
5461        T: std::convert::Into<bool>,
5462    {
5463        self.indexable = std::option::Option::Some(v.into());
5464        self
5465    }
5466
5467    /// Sets or clears the value of [indexable][crate::model::CustomAttribute::indexable].
5468    ///
5469    /// # Example
5470    /// ```ignore,no_run
5471    /// # use google_cloud_retail_v2::model::CustomAttribute;
5472    /// let x = CustomAttribute::new().set_or_clear_indexable(Some(false));
5473    /// let x = CustomAttribute::new().set_or_clear_indexable(None::<bool>);
5474    /// ```
5475    #[deprecated]
5476    pub fn set_or_clear_indexable<T>(mut self, v: std::option::Option<T>) -> Self
5477    where
5478        T: std::convert::Into<bool>,
5479    {
5480        self.indexable = v.map(|x| x.into());
5481        self
5482    }
5483}
5484
5485impl wkt::message::Message for CustomAttribute {
5486    fn typename() -> &'static str {
5487        "type.googleapis.com/google.cloud.retail.v2.CustomAttribute"
5488    }
5489}
5490
5491/// Fulfillment information, such as the store IDs for in-store pickup or region
5492/// IDs for different shipping methods.
5493#[derive(Clone, Default, PartialEq)]
5494#[non_exhaustive]
5495pub struct FulfillmentInfo {
5496    /// The fulfillment type, including commonly used types (such as pickup in
5497    /// store and same day delivery), and custom types. Customers have to map
5498    /// custom types to their display names before rendering UI.
5499    ///
5500    /// Supported values:
5501    ///
5502    /// * "pickup-in-store"
5503    /// * "ship-to-store"
5504    /// * "same-day-delivery"
5505    /// * "next-day-delivery"
5506    /// * "custom-type-1"
5507    /// * "custom-type-2"
5508    /// * "custom-type-3"
5509    /// * "custom-type-4"
5510    /// * "custom-type-5"
5511    ///
5512    /// If this field is set to an invalid value other than these, an
5513    /// INVALID_ARGUMENT error is returned.
5514    pub r#type: std::string::String,
5515
5516    /// The IDs for this [type][google.cloud.retail.v2.FulfillmentInfo.type], such
5517    /// as the store IDs for
5518    /// [FulfillmentInfo.type.pickup-in-store][google.cloud.retail.v2.FulfillmentInfo.type]
5519    /// or the region IDs for
5520    /// [FulfillmentInfo.type.same-day-delivery][google.cloud.retail.v2.FulfillmentInfo.type].
5521    ///
5522    /// A maximum of 3000 values are allowed. Each value must be a string with a
5523    /// length limit of 30 characters, matching the pattern `[a-zA-Z0-9_-]+`, such
5524    /// as "store1" or "REGION-2". Otherwise, an INVALID_ARGUMENT error is
5525    /// returned.
5526    ///
5527    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
5528    pub place_ids: std::vec::Vec<std::string::String>,
5529
5530    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5531}
5532
5533impl FulfillmentInfo {
5534    /// Creates a new default instance.
5535    pub fn new() -> Self {
5536        std::default::Default::default()
5537    }
5538
5539    /// Sets the value of [r#type][crate::model::FulfillmentInfo::type].
5540    ///
5541    /// # Example
5542    /// ```ignore,no_run
5543    /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5544    /// let x = FulfillmentInfo::new().set_type("example");
5545    /// ```
5546    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5547        self.r#type = v.into();
5548        self
5549    }
5550
5551    /// Sets the value of [place_ids][crate::model::FulfillmentInfo::place_ids].
5552    ///
5553    /// # Example
5554    /// ```ignore,no_run
5555    /// # use google_cloud_retail_v2::model::FulfillmentInfo;
5556    /// let x = FulfillmentInfo::new().set_place_ids(["a", "b", "c"]);
5557    /// ```
5558    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
5559    where
5560        T: std::iter::IntoIterator<Item = V>,
5561        V: std::convert::Into<std::string::String>,
5562    {
5563        use std::iter::Iterator;
5564        self.place_ids = v.into_iter().map(|i| i.into()).collect();
5565        self
5566    }
5567}
5568
5569impl wkt::message::Message for FulfillmentInfo {
5570    fn typename() -> &'static str {
5571        "type.googleapis.com/google.cloud.retail.v2.FulfillmentInfo"
5572    }
5573}
5574
5575/// [Product][google.cloud.retail.v2.Product] image. Recommendations AI and
5576/// Retail Search use product images to improve prediction and search results.
5577/// Product images can be returned in results, and are shown in prediction or
5578/// search previews in the console. Please try to provide correct product images
5579/// and avoid using images with size too small.
5580///
5581/// [google.cloud.retail.v2.Product]: crate::model::Product
5582#[derive(Clone, Default, PartialEq)]
5583#[non_exhaustive]
5584pub struct Image {
5585    /// Required. URI of the image.
5586    ///
5587    /// This field must be a valid UTF-8 encoded URI with a length limit of 5,000
5588    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
5589    ///
5590    /// Google Merchant Center property
5591    /// [image_link](https://support.google.com/merchants/answer/6324350).
5592    /// Schema.org property [Product.image](https://schema.org/image).
5593    pub uri: std::string::String,
5594
5595    /// Height of the image in number of pixels.
5596    ///
5597    /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5598    /// returned.
5599    pub height: i32,
5600
5601    /// Width of the image in number of pixels.
5602    ///
5603    /// This field must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
5604    /// returned.
5605    pub width: i32,
5606
5607    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5608}
5609
5610impl Image {
5611    /// Creates a new default instance.
5612    pub fn new() -> Self {
5613        std::default::Default::default()
5614    }
5615
5616    /// Sets the value of [uri][crate::model::Image::uri].
5617    ///
5618    /// # Example
5619    /// ```ignore,no_run
5620    /// # use google_cloud_retail_v2::model::Image;
5621    /// let x = Image::new().set_uri("example");
5622    /// ```
5623    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5624        self.uri = v.into();
5625        self
5626    }
5627
5628    /// Sets the value of [height][crate::model::Image::height].
5629    ///
5630    /// # Example
5631    /// ```ignore,no_run
5632    /// # use google_cloud_retail_v2::model::Image;
5633    /// let x = Image::new().set_height(42);
5634    /// ```
5635    pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5636        self.height = v.into();
5637        self
5638    }
5639
5640    /// Sets the value of [width][crate::model::Image::width].
5641    ///
5642    /// # Example
5643    /// ```ignore,no_run
5644    /// # use google_cloud_retail_v2::model::Image;
5645    /// let x = Image::new().set_width(42);
5646    /// ```
5647    pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5648        self.width = v.into();
5649        self
5650    }
5651}
5652
5653impl wkt::message::Message for Image {
5654    fn typename() -> &'static str {
5655        "type.googleapis.com/google.cloud.retail.v2.Image"
5656    }
5657}
5658
5659/// A floating point interval.
5660#[derive(Clone, Default, PartialEq)]
5661#[non_exhaustive]
5662pub struct Interval {
5663    /// The lower bound of the interval. If neither of the min fields are set, then
5664    /// the lower bound is negative infinity.
5665    ///
5666    /// This field must not be larger than max.
5667    /// Otherwise, an INVALID_ARGUMENT error is returned.
5668    pub min: std::option::Option<crate::model::interval::Min>,
5669
5670    /// The upper bound of the interval. If neither of the max fields are set, then
5671    /// the upper bound is positive infinity.
5672    ///
5673    /// This field must be not smaller than min.
5674    /// Otherwise, an INVALID_ARGUMENT error is returned.
5675    pub max: std::option::Option<crate::model::interval::Max>,
5676
5677    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5678}
5679
5680impl Interval {
5681    /// Creates a new default instance.
5682    pub fn new() -> Self {
5683        std::default::Default::default()
5684    }
5685
5686    /// Sets the value of [min][crate::model::Interval::min].
5687    ///
5688    /// Note that all the setters affecting `min` are mutually
5689    /// exclusive.
5690    ///
5691    /// # Example
5692    /// ```ignore,no_run
5693    /// # use google_cloud_retail_v2::model::Interval;
5694    /// use google_cloud_retail_v2::model::interval::Min;
5695    /// let x = Interval::new().set_min(Some(Min::Minimum(42.0)));
5696    /// ```
5697    pub fn set_min<T: std::convert::Into<std::option::Option<crate::model::interval::Min>>>(
5698        mut self,
5699        v: T,
5700    ) -> Self {
5701        self.min = v.into();
5702        self
5703    }
5704
5705    /// The value of [min][crate::model::Interval::min]
5706    /// if it holds a `Minimum`, `None` if the field is not set or
5707    /// holds a different branch.
5708    pub fn minimum(&self) -> std::option::Option<&f64> {
5709        #[allow(unreachable_patterns)]
5710        self.min.as_ref().and_then(|v| match v {
5711            crate::model::interval::Min::Minimum(v) => std::option::Option::Some(v),
5712            _ => std::option::Option::None,
5713        })
5714    }
5715
5716    /// Sets the value of [min][crate::model::Interval::min]
5717    /// to hold a `Minimum`.
5718    ///
5719    /// Note that all the setters affecting `min` are
5720    /// mutually exclusive.
5721    ///
5722    /// # Example
5723    /// ```ignore,no_run
5724    /// # use google_cloud_retail_v2::model::Interval;
5725    /// let x = Interval::new().set_minimum(42.0);
5726    /// assert!(x.minimum().is_some());
5727    /// assert!(x.exclusive_minimum().is_none());
5728    /// ```
5729    pub fn set_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5730        self.min = std::option::Option::Some(crate::model::interval::Min::Minimum(v.into()));
5731        self
5732    }
5733
5734    /// The value of [min][crate::model::Interval::min]
5735    /// if it holds a `ExclusiveMinimum`, `None` if the field is not set or
5736    /// holds a different branch.
5737    pub fn exclusive_minimum(&self) -> std::option::Option<&f64> {
5738        #[allow(unreachable_patterns)]
5739        self.min.as_ref().and_then(|v| match v {
5740            crate::model::interval::Min::ExclusiveMinimum(v) => std::option::Option::Some(v),
5741            _ => std::option::Option::None,
5742        })
5743    }
5744
5745    /// Sets the value of [min][crate::model::Interval::min]
5746    /// to hold a `ExclusiveMinimum`.
5747    ///
5748    /// Note that all the setters affecting `min` are
5749    /// mutually exclusive.
5750    ///
5751    /// # Example
5752    /// ```ignore,no_run
5753    /// # use google_cloud_retail_v2::model::Interval;
5754    /// let x = Interval::new().set_exclusive_minimum(42.0);
5755    /// assert!(x.exclusive_minimum().is_some());
5756    /// assert!(x.minimum().is_none());
5757    /// ```
5758    pub fn set_exclusive_minimum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5759        self.min =
5760            std::option::Option::Some(crate::model::interval::Min::ExclusiveMinimum(v.into()));
5761        self
5762    }
5763
5764    /// Sets the value of [max][crate::model::Interval::max].
5765    ///
5766    /// Note that all the setters affecting `max` are mutually
5767    /// exclusive.
5768    ///
5769    /// # Example
5770    /// ```ignore,no_run
5771    /// # use google_cloud_retail_v2::model::Interval;
5772    /// use google_cloud_retail_v2::model::interval::Max;
5773    /// let x = Interval::new().set_max(Some(Max::Maximum(42.0)));
5774    /// ```
5775    pub fn set_max<T: std::convert::Into<std::option::Option<crate::model::interval::Max>>>(
5776        mut self,
5777        v: T,
5778    ) -> Self {
5779        self.max = v.into();
5780        self
5781    }
5782
5783    /// The value of [max][crate::model::Interval::max]
5784    /// if it holds a `Maximum`, `None` if the field is not set or
5785    /// holds a different branch.
5786    pub fn maximum(&self) -> std::option::Option<&f64> {
5787        #[allow(unreachable_patterns)]
5788        self.max.as_ref().and_then(|v| match v {
5789            crate::model::interval::Max::Maximum(v) => std::option::Option::Some(v),
5790            _ => std::option::Option::None,
5791        })
5792    }
5793
5794    /// Sets the value of [max][crate::model::Interval::max]
5795    /// to hold a `Maximum`.
5796    ///
5797    /// Note that all the setters affecting `max` are
5798    /// mutually exclusive.
5799    ///
5800    /// # Example
5801    /// ```ignore,no_run
5802    /// # use google_cloud_retail_v2::model::Interval;
5803    /// let x = Interval::new().set_maximum(42.0);
5804    /// assert!(x.maximum().is_some());
5805    /// assert!(x.exclusive_maximum().is_none());
5806    /// ```
5807    pub fn set_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5808        self.max = std::option::Option::Some(crate::model::interval::Max::Maximum(v.into()));
5809        self
5810    }
5811
5812    /// The value of [max][crate::model::Interval::max]
5813    /// if it holds a `ExclusiveMaximum`, `None` if the field is not set or
5814    /// holds a different branch.
5815    pub fn exclusive_maximum(&self) -> std::option::Option<&f64> {
5816        #[allow(unreachable_patterns)]
5817        self.max.as_ref().and_then(|v| match v {
5818            crate::model::interval::Max::ExclusiveMaximum(v) => std::option::Option::Some(v),
5819            _ => std::option::Option::None,
5820        })
5821    }
5822
5823    /// Sets the value of [max][crate::model::Interval::max]
5824    /// to hold a `ExclusiveMaximum`.
5825    ///
5826    /// Note that all the setters affecting `max` are
5827    /// mutually exclusive.
5828    ///
5829    /// # Example
5830    /// ```ignore,no_run
5831    /// # use google_cloud_retail_v2::model::Interval;
5832    /// let x = Interval::new().set_exclusive_maximum(42.0);
5833    /// assert!(x.exclusive_maximum().is_some());
5834    /// assert!(x.maximum().is_none());
5835    /// ```
5836    pub fn set_exclusive_maximum<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
5837        self.max =
5838            std::option::Option::Some(crate::model::interval::Max::ExclusiveMaximum(v.into()));
5839        self
5840    }
5841}
5842
5843impl wkt::message::Message for Interval {
5844    fn typename() -> &'static str {
5845        "type.googleapis.com/google.cloud.retail.v2.Interval"
5846    }
5847}
5848
5849/// Defines additional types related to [Interval].
5850pub mod interval {
5851    #[allow(unused_imports)]
5852    use super::*;
5853
5854    /// The lower bound of the interval. If neither of the min fields are set, then
5855    /// the lower bound is negative infinity.
5856    ///
5857    /// This field must not be larger than max.
5858    /// Otherwise, an INVALID_ARGUMENT error is returned.
5859    #[derive(Clone, Debug, PartialEq)]
5860    #[non_exhaustive]
5861    pub enum Min {
5862        /// Inclusive lower bound.
5863        Minimum(f64),
5864        /// Exclusive lower bound.
5865        ExclusiveMinimum(f64),
5866    }
5867
5868    /// The upper bound of the interval. If neither of the max fields are set, then
5869    /// the upper bound is positive infinity.
5870    ///
5871    /// This field must be not smaller than min.
5872    /// Otherwise, an INVALID_ARGUMENT error is returned.
5873    #[derive(Clone, Debug, PartialEq)]
5874    #[non_exhaustive]
5875    pub enum Max {
5876        /// Inclusive upper bound.
5877        Maximum(f64),
5878        /// Exclusive upper bound.
5879        ExclusiveMaximum(f64),
5880    }
5881}
5882
5883/// The price information of a [Product][google.cloud.retail.v2.Product].
5884///
5885/// [google.cloud.retail.v2.Product]: crate::model::Product
5886#[derive(Clone, Default, PartialEq)]
5887#[non_exhaustive]
5888pub struct PriceInfo {
5889    /// The 3-letter currency code defined in [ISO
5890    /// 4217](https://www.iso.org/iso-4217-currency-codes.html).
5891    ///
5892    /// If this field is an unrecognizable currency code, an INVALID_ARGUMENT
5893    /// error is returned.
5894    ///
5895    /// The [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5896    /// [Product][google.cloud.retail.v2.Product]s with the same
5897    /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id]
5898    /// must share the same
5899    /// [currency_code][google.cloud.retail.v2.PriceInfo.currency_code]. Otherwise,
5900    /// a FAILED_PRECONDITION error is returned.
5901    ///
5902    /// [google.cloud.retail.v2.PriceInfo.currency_code]: crate::model::PriceInfo::currency_code
5903    /// [google.cloud.retail.v2.Product]: crate::model::Product
5904    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5905    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
5906    pub currency_code: std::string::String,
5907
5908    /// Price of the product.
5909    ///
5910    /// Google Merchant Center property
5911    /// [price](https://support.google.com/merchants/answer/6324371). Schema.org
5912    /// property [Offer.price](https://schema.org/price).
5913    pub price: f32,
5914
5915    /// Price of the product without any discount. If zero, by default set to be
5916    /// the [price][google.cloud.retail.v2.PriceInfo.price]. If set,
5917    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] should be
5918    /// greater than or equal to [price][google.cloud.retail.v2.PriceInfo.price],
5919    /// otherwise an INVALID_ARGUMENT error is thrown.
5920    ///
5921    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5922    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5923    pub original_price: f32,
5924
5925    /// The costs associated with the sale of a particular product. Used for gross
5926    /// profit reporting.
5927    ///
5928    /// * Profit = [price][google.cloud.retail.v2.PriceInfo.price] -
5929    ///   [cost][google.cloud.retail.v2.PriceInfo.cost]
5930    ///
5931    /// Google Merchant Center property
5932    /// [cost_of_goods_sold](https://support.google.com/merchants/answer/9017895).
5933    ///
5934    /// [google.cloud.retail.v2.PriceInfo.cost]: crate::model::PriceInfo::cost
5935    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5936    pub cost: f32,
5937
5938    /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5939    /// starts to be effective. This can be set as a future timestamp, and the
5940    /// [price][google.cloud.retail.v2.PriceInfo.price] is only used for search
5941    /// after
5942    /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5943    /// If so, the
5944    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5945    /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5946    /// is used before
5947    /// [price_effective_time][google.cloud.retail.v2.PriceInfo.price_effective_time].
5948    ///
5949    /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5950    /// effective because it will cause additional latency during search.
5951    ///
5952    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5953    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5954    /// [google.cloud.retail.v2.PriceInfo.price_effective_time]: crate::model::PriceInfo::price_effective_time
5955    pub price_effective_time: std::option::Option<wkt::Timestamp>,
5956
5957    /// The timestamp when the [price][google.cloud.retail.v2.PriceInfo.price]
5958    /// stops to be effective. The [price][google.cloud.retail.v2.PriceInfo.price]
5959    /// is used for search before
5960    /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time]. If
5961    /// this field is set, the
5962    /// [original_price][google.cloud.retail.v2.PriceInfo.original_price] must be
5963    /// set and [original_price][google.cloud.retail.v2.PriceInfo.original_price]
5964    /// is used after
5965    /// [price_expire_time][google.cloud.retail.v2.PriceInfo.price_expire_time].
5966    ///
5967    /// Do not set if [price][google.cloud.retail.v2.PriceInfo.price] is always
5968    /// effective because it will cause additional latency during search.
5969    ///
5970    /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
5971    /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
5972    /// [google.cloud.retail.v2.PriceInfo.price_expire_time]: crate::model::PriceInfo::price_expire_time
5973    pub price_expire_time: std::option::Option<wkt::Timestamp>,
5974
5975    /// Output only. The price range of all the child
5976    /// [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
5977    /// [Product][google.cloud.retail.v2.Product]s grouped together on the
5978    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5979    /// [Product][google.cloud.retail.v2.Product]. Only populated for
5980    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
5981    /// [Product][google.cloud.retail.v2.Product]s.
5982    ///
5983    /// Note: This field is OUTPUT_ONLY for
5984    /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
5985    /// Do not set this field in API requests.
5986    ///
5987    /// [google.cloud.retail.v2.Product]: crate::model::Product
5988    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
5989    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
5990    /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
5991    pub price_range: std::option::Option<crate::model::price_info::PriceRange>,
5992
5993    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5994}
5995
5996impl PriceInfo {
5997    /// Creates a new default instance.
5998    pub fn new() -> Self {
5999        std::default::Default::default()
6000    }
6001
6002    /// Sets the value of [currency_code][crate::model::PriceInfo::currency_code].
6003    ///
6004    /// # Example
6005    /// ```ignore,no_run
6006    /// # use google_cloud_retail_v2::model::PriceInfo;
6007    /// let x = PriceInfo::new().set_currency_code("example");
6008    /// ```
6009    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6010        self.currency_code = v.into();
6011        self
6012    }
6013
6014    /// Sets the value of [price][crate::model::PriceInfo::price].
6015    ///
6016    /// # Example
6017    /// ```ignore,no_run
6018    /// # use google_cloud_retail_v2::model::PriceInfo;
6019    /// let x = PriceInfo::new().set_price(42.0);
6020    /// ```
6021    pub fn set_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6022        self.price = v.into();
6023        self
6024    }
6025
6026    /// Sets the value of [original_price][crate::model::PriceInfo::original_price].
6027    ///
6028    /// # Example
6029    /// ```ignore,no_run
6030    /// # use google_cloud_retail_v2::model::PriceInfo;
6031    /// let x = PriceInfo::new().set_original_price(42.0);
6032    /// ```
6033    pub fn set_original_price<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6034        self.original_price = v.into();
6035        self
6036    }
6037
6038    /// Sets the value of [cost][crate::model::PriceInfo::cost].
6039    ///
6040    /// # Example
6041    /// ```ignore,no_run
6042    /// # use google_cloud_retail_v2::model::PriceInfo;
6043    /// let x = PriceInfo::new().set_cost(42.0);
6044    /// ```
6045    pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6046        self.cost = v.into();
6047        self
6048    }
6049
6050    /// Sets the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
6051    ///
6052    /// # Example
6053    /// ```ignore,no_run
6054    /// # use google_cloud_retail_v2::model::PriceInfo;
6055    /// use wkt::Timestamp;
6056    /// let x = PriceInfo::new().set_price_effective_time(Timestamp::default()/* use setters */);
6057    /// ```
6058    pub fn set_price_effective_time<T>(mut self, v: T) -> Self
6059    where
6060        T: std::convert::Into<wkt::Timestamp>,
6061    {
6062        self.price_effective_time = std::option::Option::Some(v.into());
6063        self
6064    }
6065
6066    /// Sets or clears the value of [price_effective_time][crate::model::PriceInfo::price_effective_time].
6067    ///
6068    /// # Example
6069    /// ```ignore,no_run
6070    /// # use google_cloud_retail_v2::model::PriceInfo;
6071    /// use wkt::Timestamp;
6072    /// let x = PriceInfo::new().set_or_clear_price_effective_time(Some(Timestamp::default()/* use setters */));
6073    /// let x = PriceInfo::new().set_or_clear_price_effective_time(None::<Timestamp>);
6074    /// ```
6075    pub fn set_or_clear_price_effective_time<T>(mut self, v: std::option::Option<T>) -> Self
6076    where
6077        T: std::convert::Into<wkt::Timestamp>,
6078    {
6079        self.price_effective_time = v.map(|x| x.into());
6080        self
6081    }
6082
6083    /// Sets the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6084    ///
6085    /// # Example
6086    /// ```ignore,no_run
6087    /// # use google_cloud_retail_v2::model::PriceInfo;
6088    /// use wkt::Timestamp;
6089    /// let x = PriceInfo::new().set_price_expire_time(Timestamp::default()/* use setters */);
6090    /// ```
6091    pub fn set_price_expire_time<T>(mut self, v: T) -> Self
6092    where
6093        T: std::convert::Into<wkt::Timestamp>,
6094    {
6095        self.price_expire_time = std::option::Option::Some(v.into());
6096        self
6097    }
6098
6099    /// Sets or clears the value of [price_expire_time][crate::model::PriceInfo::price_expire_time].
6100    ///
6101    /// # Example
6102    /// ```ignore,no_run
6103    /// # use google_cloud_retail_v2::model::PriceInfo;
6104    /// use wkt::Timestamp;
6105    /// let x = PriceInfo::new().set_or_clear_price_expire_time(Some(Timestamp::default()/* use setters */));
6106    /// let x = PriceInfo::new().set_or_clear_price_expire_time(None::<Timestamp>);
6107    /// ```
6108    pub fn set_or_clear_price_expire_time<T>(mut self, v: std::option::Option<T>) -> Self
6109    where
6110        T: std::convert::Into<wkt::Timestamp>,
6111    {
6112        self.price_expire_time = v.map(|x| x.into());
6113        self
6114    }
6115
6116    /// Sets the value of [price_range][crate::model::PriceInfo::price_range].
6117    ///
6118    /// # Example
6119    /// ```ignore,no_run
6120    /// # use google_cloud_retail_v2::model::PriceInfo;
6121    /// use google_cloud_retail_v2::model::price_info::PriceRange;
6122    /// let x = PriceInfo::new().set_price_range(PriceRange::default()/* use setters */);
6123    /// ```
6124    pub fn set_price_range<T>(mut self, v: T) -> Self
6125    where
6126        T: std::convert::Into<crate::model::price_info::PriceRange>,
6127    {
6128        self.price_range = std::option::Option::Some(v.into());
6129        self
6130    }
6131
6132    /// Sets or clears the value of [price_range][crate::model::PriceInfo::price_range].
6133    ///
6134    /// # Example
6135    /// ```ignore,no_run
6136    /// # use google_cloud_retail_v2::model::PriceInfo;
6137    /// use google_cloud_retail_v2::model::price_info::PriceRange;
6138    /// let x = PriceInfo::new().set_or_clear_price_range(Some(PriceRange::default()/* use setters */));
6139    /// let x = PriceInfo::new().set_or_clear_price_range(None::<PriceRange>);
6140    /// ```
6141    pub fn set_or_clear_price_range<T>(mut self, v: std::option::Option<T>) -> Self
6142    where
6143        T: std::convert::Into<crate::model::price_info::PriceRange>,
6144    {
6145        self.price_range = v.map(|x| x.into());
6146        self
6147    }
6148}
6149
6150impl wkt::message::Message for PriceInfo {
6151    fn typename() -> &'static str {
6152        "type.googleapis.com/google.cloud.retail.v2.PriceInfo"
6153    }
6154}
6155
6156/// Defines additional types related to [PriceInfo].
6157pub mod price_info {
6158    #[allow(unused_imports)]
6159    use super::*;
6160
6161    /// The price range of all
6162    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6163    /// [Product][google.cloud.retail.v2.Product] having the same
6164    /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6165    ///
6166    /// [google.cloud.retail.v2.Product]: crate::model::Product
6167    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6168    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6169    #[derive(Clone, Default, PartialEq)]
6170    #[non_exhaustive]
6171    pub struct PriceRange {
6172        /// The inclusive
6173        /// [Product.pricing_info.price][google.cloud.retail.v2.PriceInfo.price]
6174        /// interval of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6175        /// [Product][google.cloud.retail.v2.Product] having the same
6176        /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6177        ///
6178        /// [google.cloud.retail.v2.PriceInfo.price]: crate::model::PriceInfo::price
6179        /// [google.cloud.retail.v2.Product]: crate::model::Product
6180        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6181        /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6182        pub price: std::option::Option<crate::model::Interval>,
6183
6184        /// The inclusive
6185        /// [Product.pricing_info.original_price][google.cloud.retail.v2.PriceInfo.original_price]
6186        /// internal of all [variant][google.cloud.retail.v2.Product.Type.VARIANT]
6187        /// [Product][google.cloud.retail.v2.Product] having the same
6188        /// [Product.primary_product_id][google.cloud.retail.v2.Product.primary_product_id].
6189        ///
6190        /// [google.cloud.retail.v2.PriceInfo.original_price]: crate::model::PriceInfo::original_price
6191        /// [google.cloud.retail.v2.Product]: crate::model::Product
6192        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
6193        /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
6194        pub original_price: std::option::Option<crate::model::Interval>,
6195
6196        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6197    }
6198
6199    impl PriceRange {
6200        /// Creates a new default instance.
6201        pub fn new() -> Self {
6202            std::default::Default::default()
6203        }
6204
6205        /// Sets the value of [price][crate::model::price_info::PriceRange::price].
6206        ///
6207        /// # Example
6208        /// ```ignore,no_run
6209        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6210        /// use google_cloud_retail_v2::model::Interval;
6211        /// let x = PriceRange::new().set_price(Interval::default()/* use setters */);
6212        /// ```
6213        pub fn set_price<T>(mut self, v: T) -> Self
6214        where
6215            T: std::convert::Into<crate::model::Interval>,
6216        {
6217            self.price = std::option::Option::Some(v.into());
6218            self
6219        }
6220
6221        /// Sets or clears the value of [price][crate::model::price_info::PriceRange::price].
6222        ///
6223        /// # Example
6224        /// ```ignore,no_run
6225        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6226        /// use google_cloud_retail_v2::model::Interval;
6227        /// let x = PriceRange::new().set_or_clear_price(Some(Interval::default()/* use setters */));
6228        /// let x = PriceRange::new().set_or_clear_price(None::<Interval>);
6229        /// ```
6230        pub fn set_or_clear_price<T>(mut self, v: std::option::Option<T>) -> Self
6231        where
6232            T: std::convert::Into<crate::model::Interval>,
6233        {
6234            self.price = v.map(|x| x.into());
6235            self
6236        }
6237
6238        /// Sets the value of [original_price][crate::model::price_info::PriceRange::original_price].
6239        ///
6240        /// # Example
6241        /// ```ignore,no_run
6242        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6243        /// use google_cloud_retail_v2::model::Interval;
6244        /// let x = PriceRange::new().set_original_price(Interval::default()/* use setters */);
6245        /// ```
6246        pub fn set_original_price<T>(mut self, v: T) -> Self
6247        where
6248            T: std::convert::Into<crate::model::Interval>,
6249        {
6250            self.original_price = std::option::Option::Some(v.into());
6251            self
6252        }
6253
6254        /// Sets or clears the value of [original_price][crate::model::price_info::PriceRange::original_price].
6255        ///
6256        /// # Example
6257        /// ```ignore,no_run
6258        /// # use google_cloud_retail_v2::model::price_info::PriceRange;
6259        /// use google_cloud_retail_v2::model::Interval;
6260        /// let x = PriceRange::new().set_or_clear_original_price(Some(Interval::default()/* use setters */));
6261        /// let x = PriceRange::new().set_or_clear_original_price(None::<Interval>);
6262        /// ```
6263        pub fn set_or_clear_original_price<T>(mut self, v: std::option::Option<T>) -> Self
6264        where
6265            T: std::convert::Into<crate::model::Interval>,
6266        {
6267            self.original_price = v.map(|x| x.into());
6268            self
6269        }
6270    }
6271
6272    impl wkt::message::Message for PriceRange {
6273        fn typename() -> &'static str {
6274            "type.googleapis.com/google.cloud.retail.v2.PriceInfo.PriceRange"
6275        }
6276    }
6277}
6278
6279/// The rating of a [Product][google.cloud.retail.v2.Product].
6280///
6281/// [google.cloud.retail.v2.Product]: crate::model::Product
6282#[derive(Clone, Default, PartialEq)]
6283#[non_exhaustive]
6284pub struct Rating {
6285    /// The total number of ratings. This value is independent of the value of
6286    /// [rating_histogram][google.cloud.retail.v2.Rating.rating_histogram].
6287    ///
6288    /// This value must be nonnegative. Otherwise, an INVALID_ARGUMENT error is
6289    /// returned.
6290    ///
6291    /// [google.cloud.retail.v2.Rating.rating_histogram]: crate::model::Rating::rating_histogram
6292    pub rating_count: i32,
6293
6294    /// The average rating of the [Product][google.cloud.retail.v2.Product].
6295    ///
6296    /// The rating is scaled at 1-5. Otherwise, an INVALID_ARGUMENT error is
6297    /// returned.
6298    ///
6299    /// [google.cloud.retail.v2.Product]: crate::model::Product
6300    pub average_rating: f32,
6301
6302    /// List of rating counts per rating value (index = rating - 1). The list is
6303    /// empty if there is no rating. If the list is non-empty, its size is
6304    /// always 5. Otherwise, an INVALID_ARGUMENT error is returned.
6305    ///
6306    /// For example, [41, 14, 13, 47, 303]. It means that the
6307    /// [Product][google.cloud.retail.v2.Product] got 41 ratings with 1 star, 14
6308    /// ratings with 2 star, and so on.
6309    ///
6310    /// [google.cloud.retail.v2.Product]: crate::model::Product
6311    pub rating_histogram: std::vec::Vec<i32>,
6312
6313    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6314}
6315
6316impl Rating {
6317    /// Creates a new default instance.
6318    pub fn new() -> Self {
6319        std::default::Default::default()
6320    }
6321
6322    /// Sets the value of [rating_count][crate::model::Rating::rating_count].
6323    ///
6324    /// # Example
6325    /// ```ignore,no_run
6326    /// # use google_cloud_retail_v2::model::Rating;
6327    /// let x = Rating::new().set_rating_count(42);
6328    /// ```
6329    pub fn set_rating_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6330        self.rating_count = v.into();
6331        self
6332    }
6333
6334    /// Sets the value of [average_rating][crate::model::Rating::average_rating].
6335    ///
6336    /// # Example
6337    /// ```ignore,no_run
6338    /// # use google_cloud_retail_v2::model::Rating;
6339    /// let x = Rating::new().set_average_rating(42.0);
6340    /// ```
6341    pub fn set_average_rating<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6342        self.average_rating = v.into();
6343        self
6344    }
6345
6346    /// Sets the value of [rating_histogram][crate::model::Rating::rating_histogram].
6347    ///
6348    /// # Example
6349    /// ```ignore,no_run
6350    /// # use google_cloud_retail_v2::model::Rating;
6351    /// let x = Rating::new().set_rating_histogram([1, 2, 3]);
6352    /// ```
6353    pub fn set_rating_histogram<T, V>(mut self, v: T) -> Self
6354    where
6355        T: std::iter::IntoIterator<Item = V>,
6356        V: std::convert::Into<i32>,
6357    {
6358        use std::iter::Iterator;
6359        self.rating_histogram = v.into_iter().map(|i| i.into()).collect();
6360        self
6361    }
6362}
6363
6364impl wkt::message::Message for Rating {
6365    fn typename() -> &'static str {
6366        "type.googleapis.com/google.cloud.retail.v2.Rating"
6367    }
6368}
6369
6370/// Information of an end user.
6371#[derive(Clone, Default, PartialEq)]
6372#[non_exhaustive]
6373pub struct UserInfo {
6374    /// Highly recommended for logged-in users. Unique identifier for logged-in
6375    /// user, such as a user name. Don't set for anonymous users.
6376    ///
6377    /// Always use a hashed value for this ID.
6378    ///
6379    /// Don't set the field to the same fixed ID for different users. This mixes
6380    /// the event history of those users together, which results in degraded
6381    /// model quality.
6382    ///
6383    /// The field must be a UTF-8 encoded string with a length limit of 128
6384    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6385    pub user_id: std::string::String,
6386
6387    /// The end user's IP address. This field is used to extract location
6388    /// information for personalization.
6389    ///
6390    /// This field must be either an IPv4 address (e.g. "104.133.9.80") or an IPv6
6391    /// address (e.g. "2001:0db8:85a3:0000:0000:8a2e:0370:7334"). Otherwise, an
6392    /// INVALID_ARGUMENT error is returned.
6393    ///
6394    /// This should not be set when:
6395    ///
6396    /// * setting
6397    ///   [SearchRequest.user_info][google.cloud.retail.v2.SearchRequest.user_info].
6398    /// * using the JavaScript tag in
6399    ///   [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6400    ///   or if
6401    ///   [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6402    ///   is set.
6403    ///
6404    /// [google.cloud.retail.v2.SearchRequest.user_info]: crate::model::SearchRequest::user_info
6405    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6406    /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6407    pub ip_address: std::string::String,
6408
6409    /// User agent as included in the HTTP header.
6410    /// The field must be a UTF-8 encoded string with a length limit of 1,000
6411    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6412    ///
6413    /// This should not be set when using the client side event reporting with
6414    /// GTM or JavaScript tag in
6415    /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent]
6416    /// or if
6417    /// [direct_user_request][google.cloud.retail.v2.UserInfo.direct_user_request]
6418    /// is set.
6419    ///
6420    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6421    /// [google.cloud.retail.v2.UserInfo.direct_user_request]: crate::model::UserInfo::direct_user_request
6422    pub user_agent: std::string::String,
6423
6424    /// True if the request is made directly from the end user, in which case the
6425    /// [ip_address][google.cloud.retail.v2.UserInfo.ip_address] and
6426    /// [user_agent][google.cloud.retail.v2.UserInfo.user_agent] can be populated
6427    /// from the HTTP request. This flag should be set only if the API request is
6428    /// made directly from the end user such as a mobile app (and not if a gateway
6429    /// or a server is processing and pushing the user events).
6430    ///
6431    /// This should not be set when using the JavaScript tag in
6432    /// [UserEventService.CollectUserEvent][google.cloud.retail.v2.UserEventService.CollectUserEvent].
6433    ///
6434    /// [google.cloud.retail.v2.UserEventService.CollectUserEvent]: crate::client::UserEventService::collect_user_event
6435    /// [google.cloud.retail.v2.UserInfo.ip_address]: crate::model::UserInfo::ip_address
6436    /// [google.cloud.retail.v2.UserInfo.user_agent]: crate::model::UserInfo::user_agent
6437    pub direct_user_request: bool,
6438
6439    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6440}
6441
6442impl UserInfo {
6443    /// Creates a new default instance.
6444    pub fn new() -> Self {
6445        std::default::Default::default()
6446    }
6447
6448    /// Sets the value of [user_id][crate::model::UserInfo::user_id].
6449    ///
6450    /// # Example
6451    /// ```ignore,no_run
6452    /// # use google_cloud_retail_v2::model::UserInfo;
6453    /// let x = UserInfo::new().set_user_id("example");
6454    /// ```
6455    pub fn set_user_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6456        self.user_id = v.into();
6457        self
6458    }
6459
6460    /// Sets the value of [ip_address][crate::model::UserInfo::ip_address].
6461    ///
6462    /// # Example
6463    /// ```ignore,no_run
6464    /// # use google_cloud_retail_v2::model::UserInfo;
6465    /// let x = UserInfo::new().set_ip_address("example");
6466    /// ```
6467    pub fn set_ip_address<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6468        self.ip_address = v.into();
6469        self
6470    }
6471
6472    /// Sets the value of [user_agent][crate::model::UserInfo::user_agent].
6473    ///
6474    /// # Example
6475    /// ```ignore,no_run
6476    /// # use google_cloud_retail_v2::model::UserInfo;
6477    /// let x = UserInfo::new().set_user_agent("example");
6478    /// ```
6479    pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6480        self.user_agent = v.into();
6481        self
6482    }
6483
6484    /// Sets the value of [direct_user_request][crate::model::UserInfo::direct_user_request].
6485    ///
6486    /// # Example
6487    /// ```ignore,no_run
6488    /// # use google_cloud_retail_v2::model::UserInfo;
6489    /// let x = UserInfo::new().set_direct_user_request(true);
6490    /// ```
6491    pub fn set_direct_user_request<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6492        self.direct_user_request = v.into();
6493        self
6494    }
6495}
6496
6497impl wkt::message::Message for UserInfo {
6498    fn typename() -> &'static str {
6499        "type.googleapis.com/google.cloud.retail.v2.UserInfo"
6500    }
6501}
6502
6503/// The inventory information at a place (e.g. a store) identified
6504/// by a place ID.
6505#[derive(Clone, Default, PartialEq)]
6506#[non_exhaustive]
6507pub struct LocalInventory {
6508    /// Optional. The place ID for the current set of inventory information.
6509    pub place_id: std::string::String,
6510
6511    /// Optional. Product price and cost information.
6512    ///
6513    /// Google Merchant Center property
6514    /// [price](https://support.google.com/merchants/answer/6324371).
6515    pub price_info: std::option::Option<crate::model::PriceInfo>,
6516
6517    /// Optional. Additional local inventory attributes, for example, store name,
6518    /// promotion tags, etc.
6519    ///
6520    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
6521    /// error is returned:
6522    ///
6523    /// * At most 30 attributes are allowed.
6524    /// * The key must be a UTF-8 encoded string with a length limit of 32
6525    ///   characters.
6526    /// * The key must match the pattern: `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example,
6527    ///   key0LikeThis or KEY_1_LIKE_THIS.
6528    /// * The attribute values must be of the same type (text or number).
6529    /// * Only 1 value is allowed for each attribute.
6530    /// * For text values, the length limit is 256 UTF-8 characters.
6531    /// * The attribute does not support search. The `searchable` field should be
6532    ///   unset or set to false.
6533    /// * The max summed total bytes of custom attribute keys and values per
6534    ///   product is 5MiB.
6535    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
6536
6537    /// Optional. Supported fulfillment types. Valid fulfillment type values
6538    /// include commonly used types (such as pickup in store and same day
6539    /// delivery), and custom types. Customers have to map custom types to their
6540    /// display names before rendering UI.
6541    ///
6542    /// Supported values:
6543    ///
6544    /// * "pickup-in-store"
6545    /// * "ship-to-store"
6546    /// * "same-day-delivery"
6547    /// * "next-day-delivery"
6548    /// * "custom-type-1"
6549    /// * "custom-type-2"
6550    /// * "custom-type-3"
6551    /// * "custom-type-4"
6552    /// * "custom-type-5"
6553    ///
6554    /// If this field is set to an invalid value other than these, an
6555    /// INVALID_ARGUMENT error is returned.
6556    ///
6557    /// All the elements must be distinct. Otherwise, an INVALID_ARGUMENT error is
6558    /// returned.
6559    pub fulfillment_types: std::vec::Vec<std::string::String>,
6560
6561    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6562}
6563
6564impl LocalInventory {
6565    /// Creates a new default instance.
6566    pub fn new() -> Self {
6567        std::default::Default::default()
6568    }
6569
6570    /// Sets the value of [place_id][crate::model::LocalInventory::place_id].
6571    ///
6572    /// # Example
6573    /// ```ignore,no_run
6574    /// # use google_cloud_retail_v2::model::LocalInventory;
6575    /// let x = LocalInventory::new().set_place_id("example");
6576    /// ```
6577    pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6578        self.place_id = v.into();
6579        self
6580    }
6581
6582    /// Sets the value of [price_info][crate::model::LocalInventory::price_info].
6583    ///
6584    /// # Example
6585    /// ```ignore,no_run
6586    /// # use google_cloud_retail_v2::model::LocalInventory;
6587    /// use google_cloud_retail_v2::model::PriceInfo;
6588    /// let x = LocalInventory::new().set_price_info(PriceInfo::default()/* use setters */);
6589    /// ```
6590    pub fn set_price_info<T>(mut self, v: T) -> Self
6591    where
6592        T: std::convert::Into<crate::model::PriceInfo>,
6593    {
6594        self.price_info = std::option::Option::Some(v.into());
6595        self
6596    }
6597
6598    /// Sets or clears the value of [price_info][crate::model::LocalInventory::price_info].
6599    ///
6600    /// # Example
6601    /// ```ignore,no_run
6602    /// # use google_cloud_retail_v2::model::LocalInventory;
6603    /// use google_cloud_retail_v2::model::PriceInfo;
6604    /// let x = LocalInventory::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
6605    /// let x = LocalInventory::new().set_or_clear_price_info(None::<PriceInfo>);
6606    /// ```
6607    pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
6608    where
6609        T: std::convert::Into<crate::model::PriceInfo>,
6610    {
6611        self.price_info = v.map(|x| x.into());
6612        self
6613    }
6614
6615    /// Sets the value of [attributes][crate::model::LocalInventory::attributes].
6616    ///
6617    /// # Example
6618    /// ```ignore,no_run
6619    /// # use google_cloud_retail_v2::model::LocalInventory;
6620    /// use google_cloud_retail_v2::model::CustomAttribute;
6621    /// let x = LocalInventory::new().set_attributes([
6622    ///     ("key0", CustomAttribute::default()/* use setters */),
6623    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
6624    /// ]);
6625    /// ```
6626    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
6627    where
6628        T: std::iter::IntoIterator<Item = (K, V)>,
6629        K: std::convert::Into<std::string::String>,
6630        V: std::convert::Into<crate::model::CustomAttribute>,
6631    {
6632        use std::iter::Iterator;
6633        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6634        self
6635    }
6636
6637    /// Sets the value of [fulfillment_types][crate::model::LocalInventory::fulfillment_types].
6638    ///
6639    /// # Example
6640    /// ```ignore,no_run
6641    /// # use google_cloud_retail_v2::model::LocalInventory;
6642    /// let x = LocalInventory::new().set_fulfillment_types(["a", "b", "c"]);
6643    /// ```
6644    pub fn set_fulfillment_types<T, V>(mut self, v: T) -> Self
6645    where
6646        T: std::iter::IntoIterator<Item = V>,
6647        V: std::convert::Into<std::string::String>,
6648    {
6649        use std::iter::Iterator;
6650        self.fulfillment_types = v.into_iter().map(|i| i.into()).collect();
6651        self
6652    }
6653}
6654
6655impl wkt::message::Message for LocalInventory {
6656    fn typename() -> &'static str {
6657        "type.googleapis.com/google.cloud.retail.v2.LocalInventory"
6658    }
6659}
6660
6661/// Metadata for pinning to be returned in the response.
6662/// This is used for distinguishing between applied vs dropped pins.
6663#[derive(Clone, Default, PartialEq)]
6664#[non_exhaustive]
6665pub struct PinControlMetadata {
6666    /// Map of all matched pins, keyed by pin position.
6667    pub all_matched_pins:
6668        std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6669
6670    /// Map of pins that were dropped due to overlap with other matching pins,
6671    /// keyed by pin position.
6672    pub dropped_pins:
6673        std::collections::HashMap<i64, crate::model::pin_control_metadata::ProductPins>,
6674
6675    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6676}
6677
6678impl PinControlMetadata {
6679    /// Creates a new default instance.
6680    pub fn new() -> Self {
6681        std::default::Default::default()
6682    }
6683
6684    /// Sets the value of [all_matched_pins][crate::model::PinControlMetadata::all_matched_pins].
6685    ///
6686    /// # Example
6687    /// ```ignore,no_run
6688    /// # use google_cloud_retail_v2::model::PinControlMetadata;
6689    /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6690    /// let x = PinControlMetadata::new().set_all_matched_pins([
6691    ///     (0, ProductPins::default()/* use setters */),
6692    ///     (1, ProductPins::default()/* use (different) setters */),
6693    /// ]);
6694    /// ```
6695    pub fn set_all_matched_pins<T, K, V>(mut self, v: T) -> Self
6696    where
6697        T: std::iter::IntoIterator<Item = (K, V)>,
6698        K: std::convert::Into<i64>,
6699        V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6700    {
6701        use std::iter::Iterator;
6702        self.all_matched_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6703        self
6704    }
6705
6706    /// Sets the value of [dropped_pins][crate::model::PinControlMetadata::dropped_pins].
6707    ///
6708    /// # Example
6709    /// ```ignore,no_run
6710    /// # use google_cloud_retail_v2::model::PinControlMetadata;
6711    /// use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6712    /// let x = PinControlMetadata::new().set_dropped_pins([
6713    ///     (0, ProductPins::default()/* use setters */),
6714    ///     (1, ProductPins::default()/* use (different) setters */),
6715    /// ]);
6716    /// ```
6717    pub fn set_dropped_pins<T, K, V>(mut self, v: T) -> Self
6718    where
6719        T: std::iter::IntoIterator<Item = (K, V)>,
6720        K: std::convert::Into<i64>,
6721        V: std::convert::Into<crate::model::pin_control_metadata::ProductPins>,
6722    {
6723        use std::iter::Iterator;
6724        self.dropped_pins = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
6725        self
6726    }
6727}
6728
6729impl wkt::message::Message for PinControlMetadata {
6730    fn typename() -> &'static str {
6731        "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata"
6732    }
6733}
6734
6735/// Defines additional types related to [PinControlMetadata].
6736pub mod pin_control_metadata {
6737    #[allow(unused_imports)]
6738    use super::*;
6739
6740    /// List of product ids which have associated pins.
6741    #[derive(Clone, Default, PartialEq)]
6742    #[non_exhaustive]
6743    pub struct ProductPins {
6744        /// List of product ids which have associated pins.
6745        pub product_id: std::vec::Vec<std::string::String>,
6746
6747        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6748    }
6749
6750    impl ProductPins {
6751        /// Creates a new default instance.
6752        pub fn new() -> Self {
6753            std::default::Default::default()
6754        }
6755
6756        /// Sets the value of [product_id][crate::model::pin_control_metadata::ProductPins::product_id].
6757        ///
6758        /// # Example
6759        /// ```ignore,no_run
6760        /// # use google_cloud_retail_v2::model::pin_control_metadata::ProductPins;
6761        /// let x = ProductPins::new().set_product_id(["a", "b", "c"]);
6762        /// ```
6763        pub fn set_product_id<T, V>(mut self, v: T) -> Self
6764        where
6765            T: std::iter::IntoIterator<Item = V>,
6766            V: std::convert::Into<std::string::String>,
6767        {
6768            use std::iter::Iterator;
6769            self.product_id = v.into_iter().map(|i| i.into()).collect();
6770            self
6771        }
6772    }
6773
6774    impl wkt::message::Message for ProductPins {
6775        fn typename() -> &'static str {
6776            "type.googleapis.com/google.cloud.retail.v2.PinControlMetadata.ProductPins"
6777        }
6778    }
6779}
6780
6781/// A list of string values.
6782#[derive(Clone, Default, PartialEq)]
6783#[non_exhaustive]
6784pub struct StringList {
6785    /// String values.
6786    pub values: std::vec::Vec<std::string::String>,
6787
6788    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6789}
6790
6791impl StringList {
6792    /// Creates a new default instance.
6793    pub fn new() -> Self {
6794        std::default::Default::default()
6795    }
6796
6797    /// Sets the value of [values][crate::model::StringList::values].
6798    ///
6799    /// # Example
6800    /// ```ignore,no_run
6801    /// # use google_cloud_retail_v2::model::StringList;
6802    /// let x = StringList::new().set_values(["a", "b", "c"]);
6803    /// ```
6804    pub fn set_values<T, V>(mut self, v: T) -> Self
6805    where
6806        T: std::iter::IntoIterator<Item = V>,
6807        V: std::convert::Into<std::string::String>,
6808    {
6809        use std::iter::Iterator;
6810        self.values = v.into_iter().map(|i| i.into()).collect();
6811        self
6812    }
6813}
6814
6815impl wkt::message::Message for StringList {
6816    fn typename() -> &'static str {
6817        "type.googleapis.com/google.cloud.retail.v2.StringList"
6818    }
6819}
6820
6821/// A message with a list of double values.
6822#[derive(Clone, Default, PartialEq)]
6823#[non_exhaustive]
6824pub struct DoubleList {
6825    /// The list of double values.
6826    pub values: std::vec::Vec<f64>,
6827
6828    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6829}
6830
6831impl DoubleList {
6832    /// Creates a new default instance.
6833    pub fn new() -> Self {
6834        std::default::Default::default()
6835    }
6836
6837    /// Sets the value of [values][crate::model::DoubleList::values].
6838    ///
6839    /// # Example
6840    /// ```ignore,no_run
6841    /// # use google_cloud_retail_v2::model::DoubleList;
6842    /// let x = DoubleList::new().set_values([1.0, 2.0, 3.0]);
6843    /// ```
6844    pub fn set_values<T, V>(mut self, v: T) -> Self
6845    where
6846        T: std::iter::IntoIterator<Item = V>,
6847        V: std::convert::Into<f64>,
6848    {
6849        use std::iter::Iterator;
6850        self.values = v.into_iter().map(|i| i.into()).collect();
6851        self
6852    }
6853}
6854
6855impl wkt::message::Message for DoubleList {
6856    fn typename() -> &'static str {
6857        "type.googleapis.com/google.cloud.retail.v2.DoubleList"
6858    }
6859}
6860
6861/// Autocomplete parameters.
6862#[derive(Clone, Default, PartialEq)]
6863#[non_exhaustive]
6864pub struct CompleteQueryRequest {
6865    /// Required. Catalog for which the completion is performed.
6866    ///
6867    /// Full resource name of catalog, such as
6868    /// `projects/*/locations/global/catalogs/default_catalog`.
6869    pub catalog: std::string::String,
6870
6871    /// Required. The query used to generate suggestions.
6872    ///
6873    /// The maximum number of allowed characters is 255.
6874    pub query: std::string::String,
6875
6876    /// Recommended field. A unique identifier for tracking visitors. For example,
6877    /// this could be implemented with an HTTP cookie, which should be able to
6878    /// uniquely identify a visitor on a single device. This unique identifier
6879    /// should not change if the visitor logs in or out of the website.
6880    ///
6881    /// The field must be a UTF-8 encoded string with a length limit of 128
6882    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
6883    pub visitor_id: std::string::String,
6884
6885    /// Note that this field applies for `user-data` dataset only. For requests
6886    /// with `cloud-retail` dataset, setting this field has no effect.
6887    ///
6888    /// The language filters applied to the output suggestions. If set, it should
6889    /// contain the language of the query. If not set, suggestions are returned
6890    /// without considering language restrictions. This is the BCP-47 language
6891    /// code, such as "en-US" or "sr-Latn". For more information, see [Tags for
6892    /// Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum
6893    /// number of language codes is 3.
6894    pub language_codes: std::vec::Vec<std::string::String>,
6895
6896    /// The device type context for completion suggestions. We recommend that you
6897    /// leave this field empty.
6898    ///
6899    /// It can apply different suggestions on different device types, e.g.
6900    /// `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device
6901    /// types.
6902    ///
6903    /// Supported formats:
6904    ///
6905    /// * `UNKNOWN_DEVICE_TYPE`
6906    ///
6907    /// * `DESKTOP`
6908    ///
6909    /// * `MOBILE`
6910    ///
6911    /// * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`.
6912    ///
6913    pub device_type: std::string::String,
6914
6915    /// Determines which dataset to use for fetching completion. "user-data" will
6916    /// use the dataset imported through
6917    /// [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData].
6918    /// `cloud-retail` will use the dataset generated by Cloud Retail based on user
6919    /// events. If left empty, completions will be fetched from the `user-data`
6920    /// dataset.
6921    ///
6922    /// Current supported values:
6923    ///
6924    /// * user-data
6925    ///
6926    /// * cloud-retail:
6927    ///   This option requires enabling auto-learning function first. See
6928    ///   [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset).
6929    ///
6930    ///
6931    /// [google.cloud.retail.v2.CompletionService.ImportCompletionData]: crate::client::CompletionService::import_completion_data
6932    pub dataset: std::string::String,
6933
6934    /// Completion max suggestions. If left unset or set to 0, then will fallback
6935    /// to the configured value
6936    /// [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions].
6937    ///
6938    /// The maximum allowed max suggestions is 20. If it is set higher, it will be
6939    /// capped by 20.
6940    ///
6941    /// [google.cloud.retail.v2.CompletionConfig.max_suggestions]: crate::model::CompletionConfig::max_suggestions
6942    pub max_suggestions: i32,
6943
6944    /// If true, attribute suggestions are enabled and provided in the response.
6945    ///
6946    /// This field is only available for the `cloud-retail` dataset.
6947    pub enable_attribute_suggestions: bool,
6948
6949    /// The entity for customers who run multiple entities, domains, sites, or
6950    /// regions, for example, `Google US`, `Google Ads`, `Waymo`,
6951    /// `google.com`, `youtube.com`, etc.
6952    /// If this is set, it must be an exact match with
6953    /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get
6954    /// per-entity autocomplete results. This field will be applied to
6955    /// `completion_results` only. It has no effect on the `attribute_results`.
6956    /// Also, this entity should be limited to 256 characters, if too long, it will
6957    /// be truncated to 256 characters in both generation and serving time, and may
6958    /// lead to mis-match. To ensure it works, please set the entity with string
6959    /// within 256 characters.
6960    ///
6961    /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
6962    pub entity: std::string::String,
6963
6964    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6965}
6966
6967impl CompleteQueryRequest {
6968    /// Creates a new default instance.
6969    pub fn new() -> Self {
6970        std::default::Default::default()
6971    }
6972
6973    /// Sets the value of [catalog][crate::model::CompleteQueryRequest::catalog].
6974    ///
6975    /// # Example
6976    /// ```ignore,no_run
6977    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6978    /// # let project_id = "project_id";
6979    /// # let location_id = "location_id";
6980    /// # let catalog_id = "catalog_id";
6981    /// let x = CompleteQueryRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
6982    /// ```
6983    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6984        self.catalog = v.into();
6985        self
6986    }
6987
6988    /// Sets the value of [query][crate::model::CompleteQueryRequest::query].
6989    ///
6990    /// # Example
6991    /// ```ignore,no_run
6992    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
6993    /// let x = CompleteQueryRequest::new().set_query("example");
6994    /// ```
6995    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6996        self.query = v.into();
6997        self
6998    }
6999
7000    /// Sets the value of [visitor_id][crate::model::CompleteQueryRequest::visitor_id].
7001    ///
7002    /// # Example
7003    /// ```ignore,no_run
7004    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7005    /// let x = CompleteQueryRequest::new().set_visitor_id("example");
7006    /// ```
7007    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7008        self.visitor_id = v.into();
7009        self
7010    }
7011
7012    /// Sets the value of [language_codes][crate::model::CompleteQueryRequest::language_codes].
7013    ///
7014    /// # Example
7015    /// ```ignore,no_run
7016    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7017    /// let x = CompleteQueryRequest::new().set_language_codes(["a", "b", "c"]);
7018    /// ```
7019    pub fn set_language_codes<T, V>(mut self, v: T) -> Self
7020    where
7021        T: std::iter::IntoIterator<Item = V>,
7022        V: std::convert::Into<std::string::String>,
7023    {
7024        use std::iter::Iterator;
7025        self.language_codes = v.into_iter().map(|i| i.into()).collect();
7026        self
7027    }
7028
7029    /// Sets the value of [device_type][crate::model::CompleteQueryRequest::device_type].
7030    ///
7031    /// # Example
7032    /// ```ignore,no_run
7033    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7034    /// let x = CompleteQueryRequest::new().set_device_type("example");
7035    /// ```
7036    pub fn set_device_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7037        self.device_type = v.into();
7038        self
7039    }
7040
7041    /// Sets the value of [dataset][crate::model::CompleteQueryRequest::dataset].
7042    ///
7043    /// # Example
7044    /// ```ignore,no_run
7045    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7046    /// let x = CompleteQueryRequest::new().set_dataset("example");
7047    /// ```
7048    pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7049        self.dataset = v.into();
7050        self
7051    }
7052
7053    /// Sets the value of [max_suggestions][crate::model::CompleteQueryRequest::max_suggestions].
7054    ///
7055    /// # Example
7056    /// ```ignore,no_run
7057    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7058    /// let x = CompleteQueryRequest::new().set_max_suggestions(42);
7059    /// ```
7060    pub fn set_max_suggestions<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7061        self.max_suggestions = v.into();
7062        self
7063    }
7064
7065    /// Sets the value of [enable_attribute_suggestions][crate::model::CompleteQueryRequest::enable_attribute_suggestions].
7066    ///
7067    /// # Example
7068    /// ```ignore,no_run
7069    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7070    /// let x = CompleteQueryRequest::new().set_enable_attribute_suggestions(true);
7071    /// ```
7072    pub fn set_enable_attribute_suggestions<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7073        self.enable_attribute_suggestions = v.into();
7074        self
7075    }
7076
7077    /// Sets the value of [entity][crate::model::CompleteQueryRequest::entity].
7078    ///
7079    /// # Example
7080    /// ```ignore,no_run
7081    /// # use google_cloud_retail_v2::model::CompleteQueryRequest;
7082    /// let x = CompleteQueryRequest::new().set_entity("example");
7083    /// ```
7084    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7085        self.entity = v.into();
7086        self
7087    }
7088}
7089
7090impl wkt::message::Message for CompleteQueryRequest {
7091    fn typename() -> &'static str {
7092        "type.googleapis.com/google.cloud.retail.v2.CompleteQueryRequest"
7093    }
7094}
7095
7096/// Response of the autocomplete query.
7097#[derive(Clone, Default, PartialEq)]
7098#[non_exhaustive]
7099pub struct CompleteQueryResponse {
7100    /// Results of the matching suggestions. The result list is ordered and the
7101    /// first result is top suggestion.
7102    pub completion_results: std::vec::Vec<crate::model::complete_query_response::CompletionResult>,
7103
7104    /// A unique complete token. This should be included in the
7105    /// [UserEvent.completion_detail][google.cloud.retail.v2.UserEvent.completion_detail]
7106    /// for search events resulting from this completion, which enables accurate
7107    /// attribution of complete model performance.
7108    ///
7109    /// [google.cloud.retail.v2.UserEvent.completion_detail]: crate::model::UserEvent::completion_detail
7110    pub attribution_token: std::string::String,
7111
7112    /// Deprecated. Matched recent searches of this user. The maximum number of
7113    /// recent searches is 10. This field is a restricted feature. If you want to
7114    /// enable it, contact Retail Search support.
7115    ///
7116    /// This feature is only available when
7117    /// [CompleteQueryRequest.visitor_id][google.cloud.retail.v2.CompleteQueryRequest.visitor_id]
7118    /// field is set and [UserEvent][google.cloud.retail.v2.UserEvent] is imported.
7119    /// The recent searches satisfy the follow rules:
7120    ///
7121    /// * They are ordered from latest to oldest.
7122    ///
7123    /// * They are matched with
7124    ///   [CompleteQueryRequest.query][google.cloud.retail.v2.CompleteQueryRequest.query]
7125    ///   case insensitively.
7126    ///
7127    /// * They are transformed to lower case.
7128    ///
7129    /// * They are UTF-8 safe.
7130    ///
7131    ///
7132    /// Recent searches are deduplicated. More recent searches will be reserved
7133    /// when duplication happens.
7134    ///
7135    /// [google.cloud.retail.v2.CompleteQueryRequest.query]: crate::model::CompleteQueryRequest::query
7136    /// [google.cloud.retail.v2.CompleteQueryRequest.visitor_id]: crate::model::CompleteQueryRequest::visitor_id
7137    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
7138    #[deprecated]
7139    pub recent_search_results:
7140        std::vec::Vec<crate::model::complete_query_response::RecentSearchResult>,
7141
7142    /// A map of matched attribute suggestions. This field is only available for
7143    /// `cloud-retail` dataset.
7144    ///
7145    /// Current supported keys:
7146    ///
7147    /// * `brands`
7148    ///
7149    /// * `categories`
7150    ///
7151    pub attribute_results: std::collections::HashMap<
7152        std::string::String,
7153        crate::model::complete_query_response::AttributeResult,
7154    >,
7155
7156    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7157}
7158
7159impl CompleteQueryResponse {
7160    /// Creates a new default instance.
7161    pub fn new() -> Self {
7162        std::default::Default::default()
7163    }
7164
7165    /// Sets the value of [completion_results][crate::model::CompleteQueryResponse::completion_results].
7166    ///
7167    /// # Example
7168    /// ```ignore,no_run
7169    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7170    /// use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7171    /// let x = CompleteQueryResponse::new()
7172    ///     .set_completion_results([
7173    ///         CompletionResult::default()/* use setters */,
7174    ///         CompletionResult::default()/* use (different) setters */,
7175    ///     ]);
7176    /// ```
7177    pub fn set_completion_results<T, V>(mut self, v: T) -> Self
7178    where
7179        T: std::iter::IntoIterator<Item = V>,
7180        V: std::convert::Into<crate::model::complete_query_response::CompletionResult>,
7181    {
7182        use std::iter::Iterator;
7183        self.completion_results = v.into_iter().map(|i| i.into()).collect();
7184        self
7185    }
7186
7187    /// Sets the value of [attribution_token][crate::model::CompleteQueryResponse::attribution_token].
7188    ///
7189    /// # Example
7190    /// ```ignore,no_run
7191    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7192    /// let x = CompleteQueryResponse::new().set_attribution_token("example");
7193    /// ```
7194    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
7195        mut self,
7196        v: T,
7197    ) -> Self {
7198        self.attribution_token = v.into();
7199        self
7200    }
7201
7202    /// Sets the value of [recent_search_results][crate::model::CompleteQueryResponse::recent_search_results].
7203    ///
7204    /// # Example
7205    /// ```ignore,no_run
7206    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7207    /// use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7208    /// let x = CompleteQueryResponse::new()
7209    ///     .set_recent_search_results([
7210    ///         RecentSearchResult::default()/* use setters */,
7211    ///         RecentSearchResult::default()/* use (different) setters */,
7212    ///     ]);
7213    /// ```
7214    #[deprecated]
7215    pub fn set_recent_search_results<T, V>(mut self, v: T) -> Self
7216    where
7217        T: std::iter::IntoIterator<Item = V>,
7218        V: std::convert::Into<crate::model::complete_query_response::RecentSearchResult>,
7219    {
7220        use std::iter::Iterator;
7221        self.recent_search_results = v.into_iter().map(|i| i.into()).collect();
7222        self
7223    }
7224
7225    /// Sets the value of [attribute_results][crate::model::CompleteQueryResponse::attribute_results].
7226    ///
7227    /// # Example
7228    /// ```ignore,no_run
7229    /// # use google_cloud_retail_v2::model::CompleteQueryResponse;
7230    /// use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7231    /// let x = CompleteQueryResponse::new().set_attribute_results([
7232    ///     ("key0", AttributeResult::default()/* use setters */),
7233    ///     ("key1", AttributeResult::default()/* use (different) setters */),
7234    /// ]);
7235    /// ```
7236    pub fn set_attribute_results<T, K, V>(mut self, v: T) -> Self
7237    where
7238        T: std::iter::IntoIterator<Item = (K, V)>,
7239        K: std::convert::Into<std::string::String>,
7240        V: std::convert::Into<crate::model::complete_query_response::AttributeResult>,
7241    {
7242        use std::iter::Iterator;
7243        self.attribute_results = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7244        self
7245    }
7246}
7247
7248impl wkt::message::Message for CompleteQueryResponse {
7249    fn typename() -> &'static str {
7250        "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse"
7251    }
7252}
7253
7254/// Defines additional types related to [CompleteQueryResponse].
7255pub mod complete_query_response {
7256    #[allow(unused_imports)]
7257    use super::*;
7258
7259    /// Resource that represents completion results.
7260    #[derive(Clone, Default, PartialEq)]
7261    #[non_exhaustive]
7262    pub struct CompletionResult {
7263        /// The suggestion for the query.
7264        pub suggestion: std::string::String,
7265
7266        /// Custom attributes for the suggestion term.
7267        ///
7268        /// * For `user-data`, the attributes are additional custom attributes
7269        ///   ingested through BigQuery.
7270        ///
7271        /// * For `cloud-retail`, the attributes are product attributes generated
7272        ///   by Cloud Retail. It requires
7273        ///   [UserEvent.product_details][google.cloud.retail.v2.UserEvent.product_details]
7274        ///   is imported properly.
7275        ///
7276        ///
7277        /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
7278        pub attributes:
7279            std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
7280
7281        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7282    }
7283
7284    impl CompletionResult {
7285        /// Creates a new default instance.
7286        pub fn new() -> Self {
7287            std::default::Default::default()
7288        }
7289
7290        /// Sets the value of [suggestion][crate::model::complete_query_response::CompletionResult::suggestion].
7291        ///
7292        /// # Example
7293        /// ```ignore,no_run
7294        /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7295        /// let x = CompletionResult::new().set_suggestion("example");
7296        /// ```
7297        pub fn set_suggestion<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7298            self.suggestion = v.into();
7299            self
7300        }
7301
7302        /// Sets the value of [attributes][crate::model::complete_query_response::CompletionResult::attributes].
7303        ///
7304        /// # Example
7305        /// ```ignore,no_run
7306        /// # use google_cloud_retail_v2::model::complete_query_response::CompletionResult;
7307        /// use google_cloud_retail_v2::model::CustomAttribute;
7308        /// let x = CompletionResult::new().set_attributes([
7309        ///     ("key0", CustomAttribute::default()/* use setters */),
7310        ///     ("key1", CustomAttribute::default()/* use (different) setters */),
7311        /// ]);
7312        /// ```
7313        pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
7314        where
7315            T: std::iter::IntoIterator<Item = (K, V)>,
7316            K: std::convert::Into<std::string::String>,
7317            V: std::convert::Into<crate::model::CustomAttribute>,
7318        {
7319            use std::iter::Iterator;
7320            self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
7321            self
7322        }
7323    }
7324
7325    impl wkt::message::Message for CompletionResult {
7326        fn typename() -> &'static str {
7327            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.CompletionResult"
7328        }
7329    }
7330
7331    /// Deprecated: Recent search of this user.
7332    #[derive(Clone, Default, PartialEq)]
7333    #[non_exhaustive]
7334    #[deprecated]
7335    pub struct RecentSearchResult {
7336        /// The recent search query.
7337        pub recent_search: std::string::String,
7338
7339        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7340    }
7341
7342    impl RecentSearchResult {
7343        /// Creates a new default instance.
7344        pub fn new() -> Self {
7345            std::default::Default::default()
7346        }
7347
7348        /// Sets the value of [recent_search][crate::model::complete_query_response::RecentSearchResult::recent_search].
7349        ///
7350        /// # Example
7351        /// ```ignore,no_run
7352        /// # use google_cloud_retail_v2::model::complete_query_response::RecentSearchResult;
7353        /// let x = RecentSearchResult::new().set_recent_search("example");
7354        /// ```
7355        pub fn set_recent_search<T: std::convert::Into<std::string::String>>(
7356            mut self,
7357            v: T,
7358        ) -> Self {
7359            self.recent_search = v.into();
7360            self
7361        }
7362    }
7363
7364    impl wkt::message::Message for RecentSearchResult {
7365        fn typename() -> &'static str {
7366            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.RecentSearchResult"
7367        }
7368    }
7369
7370    /// Resource that represents attribute results.
7371    #[derive(Clone, Default, PartialEq)]
7372    #[non_exhaustive]
7373    pub struct AttributeResult {
7374        /// The list of suggestions for the attribute.
7375        pub suggestions: std::vec::Vec<std::string::String>,
7376
7377        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7378    }
7379
7380    impl AttributeResult {
7381        /// Creates a new default instance.
7382        pub fn new() -> Self {
7383            std::default::Default::default()
7384        }
7385
7386        /// Sets the value of [suggestions][crate::model::complete_query_response::AttributeResult::suggestions].
7387        ///
7388        /// # Example
7389        /// ```ignore,no_run
7390        /// # use google_cloud_retail_v2::model::complete_query_response::AttributeResult;
7391        /// let x = AttributeResult::new().set_suggestions(["a", "b", "c"]);
7392        /// ```
7393        pub fn set_suggestions<T, V>(mut self, v: T) -> Self
7394        where
7395            T: std::iter::IntoIterator<Item = V>,
7396            V: std::convert::Into<std::string::String>,
7397        {
7398            use std::iter::Iterator;
7399            self.suggestions = v.into_iter().map(|i| i.into()).collect();
7400            self
7401        }
7402    }
7403
7404    impl wkt::message::Message for AttributeResult {
7405        fn typename() -> &'static str {
7406            "type.googleapis.com/google.cloud.retail.v2.CompleteQueryResponse.AttributeResult"
7407        }
7408    }
7409}
7410
7411/// Configures dynamic metadata that can be linked to a
7412/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and affect search or
7413/// recommendation results at serving time.
7414///
7415/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7416#[derive(Clone, Default, PartialEq)]
7417#[non_exhaustive]
7418pub struct Control {
7419    /// Immutable. Fully qualified name
7420    /// `projects/*/locations/global/catalogs/*/controls/*`
7421    pub name: std::string::String,
7422
7423    /// Required. The human readable control display name. Used in Retail UI.
7424    ///
7425    /// This field must be a UTF-8 encoded string with a length limit of 128
7426    /// characters. Otherwise, an INVALID_ARGUMENT error is thrown.
7427    pub display_name: std::string::String,
7428
7429    /// Output only. List of [serving config][google.cloud.retail.v2.ServingConfig]
7430    /// ids that are associated with this control in the same
7431    /// [Catalog][google.cloud.retail.v2.Catalog].
7432    ///
7433    /// Note the association is managed via the
7434    /// [ServingConfig][google.cloud.retail.v2.ServingConfig], this is an output
7435    /// only denormalized view.
7436    ///
7437    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
7438    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
7439    pub associated_serving_config_ids: std::vec::Vec<std::string::String>,
7440
7441    /// Required. Immutable. The solution types that the control is used for.
7442    /// Currently we support setting only one type of solution at creation time.
7443    ///
7444    /// Only `SOLUTION_TYPE_SEARCH` value is supported at the moment.
7445    /// If no solution type is provided at creation time, will default to
7446    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
7447    ///
7448    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
7449    pub solution_types: std::vec::Vec<crate::model::SolutionType>,
7450
7451    /// Specifies the use case for the control.
7452    /// Affects what condition fields can be set.
7453    /// Only settable by search controls.
7454    /// Will default to
7455    /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]
7456    /// if not specified. Currently only allow one search_solution_use_case per
7457    /// control.
7458    ///
7459    /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
7460    pub search_solution_use_case: std::vec::Vec<crate::model::SearchSolutionUseCase>,
7461
7462    /// The behavior/type of the control
7463    ///
7464    /// A behavior/type must be specified on creation. Type cannot be changed once
7465    /// specified (e.g. A Rule control will always be a Rule control.). An
7466    /// INVALID_ARGUMENT will be returned if either condition is violated.
7467    pub control: std::option::Option<crate::model::control::Control>,
7468
7469    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7470}
7471
7472impl Control {
7473    /// Creates a new default instance.
7474    pub fn new() -> Self {
7475        std::default::Default::default()
7476    }
7477
7478    /// Sets the value of [name][crate::model::Control::name].
7479    ///
7480    /// # Example
7481    /// ```ignore,no_run
7482    /// # use google_cloud_retail_v2::model::Control;
7483    /// # let project_id = "project_id";
7484    /// # let location_id = "location_id";
7485    /// # let catalog_id = "catalog_id";
7486    /// # let control_id = "control_id";
7487    /// let x = Control::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}"));
7488    /// ```
7489    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7490        self.name = v.into();
7491        self
7492    }
7493
7494    /// Sets the value of [display_name][crate::model::Control::display_name].
7495    ///
7496    /// # Example
7497    /// ```ignore,no_run
7498    /// # use google_cloud_retail_v2::model::Control;
7499    /// let x = Control::new().set_display_name("example");
7500    /// ```
7501    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7502        self.display_name = v.into();
7503        self
7504    }
7505
7506    /// Sets the value of [associated_serving_config_ids][crate::model::Control::associated_serving_config_ids].
7507    ///
7508    /// # Example
7509    /// ```ignore,no_run
7510    /// # use google_cloud_retail_v2::model::Control;
7511    /// let x = Control::new().set_associated_serving_config_ids(["a", "b", "c"]);
7512    /// ```
7513    pub fn set_associated_serving_config_ids<T, V>(mut self, v: T) -> Self
7514    where
7515        T: std::iter::IntoIterator<Item = V>,
7516        V: std::convert::Into<std::string::String>,
7517    {
7518        use std::iter::Iterator;
7519        self.associated_serving_config_ids = v.into_iter().map(|i| i.into()).collect();
7520        self
7521    }
7522
7523    /// Sets the value of [solution_types][crate::model::Control::solution_types].
7524    ///
7525    /// # Example
7526    /// ```ignore,no_run
7527    /// # use google_cloud_retail_v2::model::Control;
7528    /// use google_cloud_retail_v2::model::SolutionType;
7529    /// let x = Control::new().set_solution_types([
7530    ///     SolutionType::Recommendation,
7531    ///     SolutionType::Search,
7532    /// ]);
7533    /// ```
7534    pub fn set_solution_types<T, V>(mut self, v: T) -> Self
7535    where
7536        T: std::iter::IntoIterator<Item = V>,
7537        V: std::convert::Into<crate::model::SolutionType>,
7538    {
7539        use std::iter::Iterator;
7540        self.solution_types = v.into_iter().map(|i| i.into()).collect();
7541        self
7542    }
7543
7544    /// Sets the value of [search_solution_use_case][crate::model::Control::search_solution_use_case].
7545    ///
7546    /// # Example
7547    /// ```ignore,no_run
7548    /// # use google_cloud_retail_v2::model::Control;
7549    /// use google_cloud_retail_v2::model::SearchSolutionUseCase;
7550    /// let x = Control::new().set_search_solution_use_case([
7551    ///     SearchSolutionUseCase::Search,
7552    ///     SearchSolutionUseCase::Browse,
7553    /// ]);
7554    /// ```
7555    pub fn set_search_solution_use_case<T, V>(mut self, v: T) -> Self
7556    where
7557        T: std::iter::IntoIterator<Item = V>,
7558        V: std::convert::Into<crate::model::SearchSolutionUseCase>,
7559    {
7560        use std::iter::Iterator;
7561        self.search_solution_use_case = v.into_iter().map(|i| i.into()).collect();
7562        self
7563    }
7564
7565    /// Sets the value of [control][crate::model::Control::control].
7566    ///
7567    /// Note that all the setters affecting `control` are mutually
7568    /// exclusive.
7569    ///
7570    /// # Example
7571    /// ```ignore,no_run
7572    /// # use google_cloud_retail_v2::model::Control;
7573    /// use google_cloud_retail_v2::model::Rule;
7574    /// let x = Control::new().set_control(Some(
7575    ///     google_cloud_retail_v2::model::control::Control::Rule(Rule::default().into())));
7576    /// ```
7577    pub fn set_control<
7578        T: std::convert::Into<std::option::Option<crate::model::control::Control>>,
7579    >(
7580        mut self,
7581        v: T,
7582    ) -> Self {
7583        self.control = v.into();
7584        self
7585    }
7586
7587    /// The value of [control][crate::model::Control::control]
7588    /// if it holds a `Rule`, `None` if the field is not set or
7589    /// holds a different branch.
7590    pub fn rule(&self) -> std::option::Option<&std::boxed::Box<crate::model::Rule>> {
7591        #[allow(unreachable_patterns)]
7592        self.control.as_ref().and_then(|v| match v {
7593            crate::model::control::Control::Rule(v) => std::option::Option::Some(v),
7594            _ => std::option::Option::None,
7595        })
7596    }
7597
7598    /// Sets the value of [control][crate::model::Control::control]
7599    /// to hold a `Rule`.
7600    ///
7601    /// Note that all the setters affecting `control` are
7602    /// mutually exclusive.
7603    ///
7604    /// # Example
7605    /// ```ignore,no_run
7606    /// # use google_cloud_retail_v2::model::Control;
7607    /// use google_cloud_retail_v2::model::Rule;
7608    /// let x = Control::new().set_rule(Rule::default()/* use setters */);
7609    /// assert!(x.rule().is_some());
7610    /// ```
7611    pub fn set_rule<T: std::convert::Into<std::boxed::Box<crate::model::Rule>>>(
7612        mut self,
7613        v: T,
7614    ) -> Self {
7615        self.control = std::option::Option::Some(crate::model::control::Control::Rule(v.into()));
7616        self
7617    }
7618}
7619
7620impl wkt::message::Message for Control {
7621    fn typename() -> &'static str {
7622        "type.googleapis.com/google.cloud.retail.v2.Control"
7623    }
7624}
7625
7626/// Defines additional types related to [Control].
7627pub mod control {
7628    #[allow(unused_imports)]
7629    use super::*;
7630
7631    /// The behavior/type of the control
7632    ///
7633    /// A behavior/type must be specified on creation. Type cannot be changed once
7634    /// specified (e.g. A Rule control will always be a Rule control.). An
7635    /// INVALID_ARGUMENT will be returned if either condition is violated.
7636    #[derive(Clone, Debug, PartialEq)]
7637    #[non_exhaustive]
7638    pub enum Control {
7639        /// A rule control - a condition-action pair.
7640        /// Enacts a set action when the condition is triggered.
7641        /// For example: Boost "gShoe" when query full matches "Running Shoes".
7642        Rule(std::boxed::Box<crate::model::Rule>),
7643    }
7644}
7645
7646/// Request for CreateControl method.
7647#[derive(Clone, Default, PartialEq)]
7648#[non_exhaustive]
7649pub struct CreateControlRequest {
7650    /// Required. Full resource name of parent catalog. Format:
7651    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7652    pub parent: std::string::String,
7653
7654    /// Required. The Control to create.
7655    pub control: std::option::Option<crate::model::Control>,
7656
7657    /// Required. The ID to use for the Control, which will become the final
7658    /// component of the Control's resource name.
7659    ///
7660    /// This value should be 4-63 characters, and valid characters
7661    /// are /[a-z][0-9]-_/.
7662    pub control_id: std::string::String,
7663
7664    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7665}
7666
7667impl CreateControlRequest {
7668    /// Creates a new default instance.
7669    pub fn new() -> Self {
7670        std::default::Default::default()
7671    }
7672
7673    /// Sets the value of [parent][crate::model::CreateControlRequest::parent].
7674    ///
7675    /// # Example
7676    /// ```ignore,no_run
7677    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7678    /// # let project_id = "project_id";
7679    /// # let location_id = "location_id";
7680    /// # let catalog_id = "catalog_id";
7681    /// let x = CreateControlRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
7682    /// ```
7683    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7684        self.parent = v.into();
7685        self
7686    }
7687
7688    /// Sets the value of [control][crate::model::CreateControlRequest::control].
7689    ///
7690    /// # Example
7691    /// ```ignore,no_run
7692    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7693    /// use google_cloud_retail_v2::model::Control;
7694    /// let x = CreateControlRequest::new().set_control(Control::default()/* use setters */);
7695    /// ```
7696    pub fn set_control<T>(mut self, v: T) -> Self
7697    where
7698        T: std::convert::Into<crate::model::Control>,
7699    {
7700        self.control = std::option::Option::Some(v.into());
7701        self
7702    }
7703
7704    /// Sets or clears the value of [control][crate::model::CreateControlRequest::control].
7705    ///
7706    /// # Example
7707    /// ```ignore,no_run
7708    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7709    /// use google_cloud_retail_v2::model::Control;
7710    /// let x = CreateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7711    /// let x = CreateControlRequest::new().set_or_clear_control(None::<Control>);
7712    /// ```
7713    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7714    where
7715        T: std::convert::Into<crate::model::Control>,
7716    {
7717        self.control = v.map(|x| x.into());
7718        self
7719    }
7720
7721    /// Sets the value of [control_id][crate::model::CreateControlRequest::control_id].
7722    ///
7723    /// # Example
7724    /// ```ignore,no_run
7725    /// # use google_cloud_retail_v2::model::CreateControlRequest;
7726    /// let x = CreateControlRequest::new().set_control_id("example");
7727    /// ```
7728    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7729        self.control_id = v.into();
7730        self
7731    }
7732}
7733
7734impl wkt::message::Message for CreateControlRequest {
7735    fn typename() -> &'static str {
7736        "type.googleapis.com/google.cloud.retail.v2.CreateControlRequest"
7737    }
7738}
7739
7740/// Request for UpdateControl method.
7741#[derive(Clone, Default, PartialEq)]
7742#[non_exhaustive]
7743pub struct UpdateControlRequest {
7744    /// Required. The Control to update.
7745    pub control: std::option::Option<crate::model::Control>,
7746
7747    /// Indicates which fields in the provided
7748    /// [Control][google.cloud.retail.v2.Control] to update. The following are NOT
7749    /// supported:
7750    ///
7751    /// * [Control.name][google.cloud.retail.v2.Control.name]
7752    ///
7753    /// If not set or empty, all supported fields are updated.
7754    ///
7755    /// [google.cloud.retail.v2.Control]: crate::model::Control
7756    /// [google.cloud.retail.v2.Control.name]: crate::model::Control::name
7757    pub update_mask: std::option::Option<wkt::FieldMask>,
7758
7759    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7760}
7761
7762impl UpdateControlRequest {
7763    /// Creates a new default instance.
7764    pub fn new() -> Self {
7765        std::default::Default::default()
7766    }
7767
7768    /// Sets the value of [control][crate::model::UpdateControlRequest::control].
7769    ///
7770    /// # Example
7771    /// ```ignore,no_run
7772    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7773    /// use google_cloud_retail_v2::model::Control;
7774    /// let x = UpdateControlRequest::new().set_control(Control::default()/* use setters */);
7775    /// ```
7776    pub fn set_control<T>(mut self, v: T) -> Self
7777    where
7778        T: std::convert::Into<crate::model::Control>,
7779    {
7780        self.control = std::option::Option::Some(v.into());
7781        self
7782    }
7783
7784    /// Sets or clears the value of [control][crate::model::UpdateControlRequest::control].
7785    ///
7786    /// # Example
7787    /// ```ignore,no_run
7788    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7789    /// use google_cloud_retail_v2::model::Control;
7790    /// let x = UpdateControlRequest::new().set_or_clear_control(Some(Control::default()/* use setters */));
7791    /// let x = UpdateControlRequest::new().set_or_clear_control(None::<Control>);
7792    /// ```
7793    pub fn set_or_clear_control<T>(mut self, v: std::option::Option<T>) -> Self
7794    where
7795        T: std::convert::Into<crate::model::Control>,
7796    {
7797        self.control = v.map(|x| x.into());
7798        self
7799    }
7800
7801    /// Sets the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7802    ///
7803    /// # Example
7804    /// ```ignore,no_run
7805    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7806    /// use wkt::FieldMask;
7807    /// let x = UpdateControlRequest::new().set_update_mask(FieldMask::default()/* use setters */);
7808    /// ```
7809    pub fn set_update_mask<T>(mut self, v: T) -> Self
7810    where
7811        T: std::convert::Into<wkt::FieldMask>,
7812    {
7813        self.update_mask = std::option::Option::Some(v.into());
7814        self
7815    }
7816
7817    /// Sets or clears the value of [update_mask][crate::model::UpdateControlRequest::update_mask].
7818    ///
7819    /// # Example
7820    /// ```ignore,no_run
7821    /// # use google_cloud_retail_v2::model::UpdateControlRequest;
7822    /// use wkt::FieldMask;
7823    /// let x = UpdateControlRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
7824    /// let x = UpdateControlRequest::new().set_or_clear_update_mask(None::<FieldMask>);
7825    /// ```
7826    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
7827    where
7828        T: std::convert::Into<wkt::FieldMask>,
7829    {
7830        self.update_mask = v.map(|x| x.into());
7831        self
7832    }
7833}
7834
7835impl wkt::message::Message for UpdateControlRequest {
7836    fn typename() -> &'static str {
7837        "type.googleapis.com/google.cloud.retail.v2.UpdateControlRequest"
7838    }
7839}
7840
7841/// Request for DeleteControl method.
7842#[derive(Clone, Default, PartialEq)]
7843#[non_exhaustive]
7844pub struct DeleteControlRequest {
7845    /// Required. The resource name of the Control to delete. Format:
7846    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7847    pub name: std::string::String,
7848
7849    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7850}
7851
7852impl DeleteControlRequest {
7853    /// Creates a new default instance.
7854    pub fn new() -> Self {
7855        std::default::Default::default()
7856    }
7857
7858    /// Sets the value of [name][crate::model::DeleteControlRequest::name].
7859    ///
7860    /// # Example
7861    /// ```ignore,no_run
7862    /// # use google_cloud_retail_v2::model::DeleteControlRequest;
7863    /// # let project_id = "project_id";
7864    /// # let location_id = "location_id";
7865    /// # let catalog_id = "catalog_id";
7866    /// # let control_id = "control_id";
7867    /// let x = DeleteControlRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}"));
7868    /// ```
7869    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7870        self.name = v.into();
7871        self
7872    }
7873}
7874
7875impl wkt::message::Message for DeleteControlRequest {
7876    fn typename() -> &'static str {
7877        "type.googleapis.com/google.cloud.retail.v2.DeleteControlRequest"
7878    }
7879}
7880
7881/// Request for GetControl method.
7882#[derive(Clone, Default, PartialEq)]
7883#[non_exhaustive]
7884pub struct GetControlRequest {
7885    /// Required. The resource name of the Control to get. Format:
7886    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
7887    pub name: std::string::String,
7888
7889    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7890}
7891
7892impl GetControlRequest {
7893    /// Creates a new default instance.
7894    pub fn new() -> Self {
7895        std::default::Default::default()
7896    }
7897
7898    /// Sets the value of [name][crate::model::GetControlRequest::name].
7899    ///
7900    /// # Example
7901    /// ```ignore,no_run
7902    /// # use google_cloud_retail_v2::model::GetControlRequest;
7903    /// # let project_id = "project_id";
7904    /// # let location_id = "location_id";
7905    /// # let catalog_id = "catalog_id";
7906    /// # let control_id = "control_id";
7907    /// let x = GetControlRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}"));
7908    /// ```
7909    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7910        self.name = v.into();
7911        self
7912    }
7913}
7914
7915impl wkt::message::Message for GetControlRequest {
7916    fn typename() -> &'static str {
7917        "type.googleapis.com/google.cloud.retail.v2.GetControlRequest"
7918    }
7919}
7920
7921/// Request for ListControls method.
7922#[derive(Clone, Default, PartialEq)]
7923#[non_exhaustive]
7924pub struct ListControlsRequest {
7925    /// Required. The catalog resource name. Format:
7926    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
7927    pub parent: std::string::String,
7928
7929    /// Optional. Maximum number of results to return. If unspecified, defaults
7930    /// to 50. Max allowed value is 1000.
7931    pub page_size: i32,
7932
7933    /// Optional. A page token, received from a previous `ListControls` call.
7934    /// Provide this to retrieve the subsequent page.
7935    pub page_token: std::string::String,
7936
7937    /// Optional. A filter to apply on the list results. Supported features:
7938    ///
7939    /// * List all the products under the parent branch if
7940    ///   [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
7941    /// * List controls that are used in a single ServingConfig:
7942    ///   'serving_config = "boosted_home_page_cvr"'
7943    ///
7944    /// [google.cloud.retail.v2.ListControlsRequest.filter]: crate::model::ListControlsRequest::filter
7945    pub filter: std::string::String,
7946
7947    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7948}
7949
7950impl ListControlsRequest {
7951    /// Creates a new default instance.
7952    pub fn new() -> Self {
7953        std::default::Default::default()
7954    }
7955
7956    /// Sets the value of [parent][crate::model::ListControlsRequest::parent].
7957    ///
7958    /// # Example
7959    /// ```ignore,no_run
7960    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7961    /// # let project_id = "project_id";
7962    /// # let location_id = "location_id";
7963    /// # let catalog_id = "catalog_id";
7964    /// let x = ListControlsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
7965    /// ```
7966    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7967        self.parent = v.into();
7968        self
7969    }
7970
7971    /// Sets the value of [page_size][crate::model::ListControlsRequest::page_size].
7972    ///
7973    /// # Example
7974    /// ```ignore,no_run
7975    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7976    /// let x = ListControlsRequest::new().set_page_size(42);
7977    /// ```
7978    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7979        self.page_size = v.into();
7980        self
7981    }
7982
7983    /// Sets the value of [page_token][crate::model::ListControlsRequest::page_token].
7984    ///
7985    /// # Example
7986    /// ```ignore,no_run
7987    /// # use google_cloud_retail_v2::model::ListControlsRequest;
7988    /// let x = ListControlsRequest::new().set_page_token("example");
7989    /// ```
7990    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7991        self.page_token = v.into();
7992        self
7993    }
7994
7995    /// Sets the value of [filter][crate::model::ListControlsRequest::filter].
7996    ///
7997    /// # Example
7998    /// ```ignore,no_run
7999    /// # use google_cloud_retail_v2::model::ListControlsRequest;
8000    /// let x = ListControlsRequest::new().set_filter("example");
8001    /// ```
8002    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8003        self.filter = v.into();
8004        self
8005    }
8006}
8007
8008impl wkt::message::Message for ListControlsRequest {
8009    fn typename() -> &'static str {
8010        "type.googleapis.com/google.cloud.retail.v2.ListControlsRequest"
8011    }
8012}
8013
8014/// Response for ListControls method.
8015#[derive(Clone, Default, PartialEq)]
8016#[non_exhaustive]
8017pub struct ListControlsResponse {
8018    /// All the Controls for a given catalog.
8019    pub controls: std::vec::Vec<crate::model::Control>,
8020
8021    /// Pagination token, if not returned indicates the last page.
8022    pub next_page_token: std::string::String,
8023
8024    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8025}
8026
8027impl ListControlsResponse {
8028    /// Creates a new default instance.
8029    pub fn new() -> Self {
8030        std::default::Default::default()
8031    }
8032
8033    /// Sets the value of [controls][crate::model::ListControlsResponse::controls].
8034    ///
8035    /// # Example
8036    /// ```ignore,no_run
8037    /// # use google_cloud_retail_v2::model::ListControlsResponse;
8038    /// use google_cloud_retail_v2::model::Control;
8039    /// let x = ListControlsResponse::new()
8040    ///     .set_controls([
8041    ///         Control::default()/* use setters */,
8042    ///         Control::default()/* use (different) setters */,
8043    ///     ]);
8044    /// ```
8045    pub fn set_controls<T, V>(mut self, v: T) -> Self
8046    where
8047        T: std::iter::IntoIterator<Item = V>,
8048        V: std::convert::Into<crate::model::Control>,
8049    {
8050        use std::iter::Iterator;
8051        self.controls = v.into_iter().map(|i| i.into()).collect();
8052        self
8053    }
8054
8055    /// Sets the value of [next_page_token][crate::model::ListControlsResponse::next_page_token].
8056    ///
8057    /// # Example
8058    /// ```ignore,no_run
8059    /// # use google_cloud_retail_v2::model::ListControlsResponse;
8060    /// let x = ListControlsResponse::new().set_next_page_token("example");
8061    /// ```
8062    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8063        self.next_page_token = v.into();
8064        self
8065    }
8066}
8067
8068impl wkt::message::Message for ListControlsResponse {
8069    fn typename() -> &'static str {
8070        "type.googleapis.com/google.cloud.retail.v2.ListControlsResponse"
8071    }
8072}
8073
8074#[doc(hidden)]
8075impl google_cloud_gax::paginator::internal::PageableResponse for ListControlsResponse {
8076    type PageItem = crate::model::Control;
8077
8078    fn items(self) -> std::vec::Vec<Self::PageItem> {
8079        self.controls
8080    }
8081
8082    fn next_page_token(&self) -> std::string::String {
8083        use std::clone::Clone;
8084        self.next_page_token.clone()
8085    }
8086}
8087
8088/// Request message for
8089/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
8090/// method.
8091#[derive(Clone, Default, PartialEq)]
8092#[non_exhaustive]
8093pub struct ConversationalSearchRequest {
8094    /// Required. The resource name of the search engine placement, such as
8095    /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`
8096    /// or
8097    /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
8098    /// This field is used to identify the serving config name and the set
8099    /// of models that will be used to make the search.
8100    pub placement: std::string::String,
8101
8102    /// Required. The branch resource name, such as
8103    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
8104    ///
8105    /// Use "default_branch" as the branch ID or leave this field empty, to search
8106    /// products under the default branch.
8107    pub branch: std::string::String,
8108
8109    /// Optional. Raw search query to be searched for.
8110    ///
8111    /// If this field is empty, the request is considered a category browsing
8112    /// request.
8113    pub query: std::string::String,
8114
8115    /// Optional. The categories associated with a category page. Must be set for
8116    /// category navigation queries to achieve good search quality. The format
8117    /// should be the same as
8118    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
8119    ///
8120    /// To represent full path of category, use '>' sign to separate different
8121    /// hierarchies. If '>' is part of the category name, replace it with
8122    /// other character(s).
8123    ///
8124    /// Category pages include special pages such as sales or promotions. For
8125    /// instance, a special sale page may have the category hierarchy:
8126    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
8127    ///
8128    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
8129    pub page_categories: std::vec::Vec<std::string::String>,
8130
8131    /// Optional. This field specifies the conversation id, which maintains the
8132    /// state of the conversation between client side and server side. Use the
8133    /// value from the previous
8134    /// [ConversationalSearchResponse.conversation_id][google.cloud.retail.v2.ConversationalSearchResponse.conversation_id].
8135    /// For the initial request, this should be empty.
8136    ///
8137    /// [google.cloud.retail.v2.ConversationalSearchResponse.conversation_id]: crate::model::ConversationalSearchResponse::conversation_id
8138    pub conversation_id: std::string::String,
8139
8140    /// Optional. Search parameters.
8141    pub search_params:
8142        std::option::Option<crate::model::conversational_search_request::SearchParams>,
8143
8144    /// Required. A unique identifier for tracking visitors. For example, this
8145    /// could be implemented with an HTTP cookie, which should be able to uniquely
8146    /// identify a visitor on a single device. This unique identifier should not
8147    /// change if the visitor logs in or out of the website.
8148    ///
8149    /// This should be the same identifier as
8150    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
8151    ///
8152    /// The field must be a UTF-8 encoded string with a length limit of 128
8153    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
8154    ///
8155    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
8156    pub visitor_id: std::string::String,
8157
8158    /// Optional. User information.
8159    pub user_info: std::option::Option<crate::model::UserInfo>,
8160
8161    /// Optional. This field specifies all conversational filtering related
8162    /// parameters.
8163    pub conversational_filtering_spec: std::option::Option<
8164        crate::model::conversational_search_request::ConversationalFilteringSpec,
8165    >,
8166
8167    /// Optional. The user labels applied to a resource must meet the following
8168    /// requirements:
8169    ///
8170    /// * Each resource can have multiple labels, up to a maximum of 64.
8171    /// * Each label must be a key-value pair.
8172    /// * Keys have a minimum length of 1 character and a maximum length of 63
8173    ///   characters and cannot be empty. Values can be empty and have a maximum
8174    ///   length of 63 characters.
8175    /// * Keys and values can contain only lowercase letters, numeric characters,
8176    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
8177    ///   international characters are allowed.
8178    /// * The key portion of a label must be unique. However, you can use the same
8179    ///   key with multiple resources.
8180    /// * Keys must start with a lowercase letter or international character.
8181    ///
8182    /// See [Google Cloud
8183    /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
8184    /// for more details.
8185    pub user_labels: std::collections::HashMap<std::string::String, std::string::String>,
8186
8187    /// Optional. The safety settings to be applied to the generated content.
8188    pub safety_settings: std::vec::Vec<crate::model::SafetySetting>,
8189
8190    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8191}
8192
8193impl ConversationalSearchRequest {
8194    /// Creates a new default instance.
8195    pub fn new() -> Self {
8196        std::default::Default::default()
8197    }
8198
8199    /// Sets the value of [placement][crate::model::ConversationalSearchRequest::placement].
8200    ///
8201    /// # Example
8202    /// ```ignore,no_run
8203    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8204    /// let x = ConversationalSearchRequest::new().set_placement("example");
8205    /// ```
8206    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8207        self.placement = v.into();
8208        self
8209    }
8210
8211    /// Sets the value of [branch][crate::model::ConversationalSearchRequest::branch].
8212    ///
8213    /// # Example
8214    /// ```ignore,no_run
8215    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8216    /// let x = ConversationalSearchRequest::new().set_branch("example");
8217    /// ```
8218    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8219        self.branch = v.into();
8220        self
8221    }
8222
8223    /// Sets the value of [query][crate::model::ConversationalSearchRequest::query].
8224    ///
8225    /// # Example
8226    /// ```ignore,no_run
8227    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8228    /// let x = ConversationalSearchRequest::new().set_query("example");
8229    /// ```
8230    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8231        self.query = v.into();
8232        self
8233    }
8234
8235    /// Sets the value of [page_categories][crate::model::ConversationalSearchRequest::page_categories].
8236    ///
8237    /// # Example
8238    /// ```ignore,no_run
8239    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8240    /// let x = ConversationalSearchRequest::new().set_page_categories(["a", "b", "c"]);
8241    /// ```
8242    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
8243    where
8244        T: std::iter::IntoIterator<Item = V>,
8245        V: std::convert::Into<std::string::String>,
8246    {
8247        use std::iter::Iterator;
8248        self.page_categories = v.into_iter().map(|i| i.into()).collect();
8249        self
8250    }
8251
8252    /// Sets the value of [conversation_id][crate::model::ConversationalSearchRequest::conversation_id].
8253    ///
8254    /// # Example
8255    /// ```ignore,no_run
8256    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8257    /// let x = ConversationalSearchRequest::new().set_conversation_id("example");
8258    /// ```
8259    pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8260        self.conversation_id = v.into();
8261        self
8262    }
8263
8264    /// Sets the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8265    ///
8266    /// # Example
8267    /// ```ignore,no_run
8268    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8269    /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8270    /// let x = ConversationalSearchRequest::new().set_search_params(SearchParams::default()/* use setters */);
8271    /// ```
8272    pub fn set_search_params<T>(mut self, v: T) -> Self
8273    where
8274        T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8275    {
8276        self.search_params = std::option::Option::Some(v.into());
8277        self
8278    }
8279
8280    /// Sets or clears the value of [search_params][crate::model::ConversationalSearchRequest::search_params].
8281    ///
8282    /// # Example
8283    /// ```ignore,no_run
8284    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8285    /// use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8286    /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(Some(SearchParams::default()/* use setters */));
8287    /// let x = ConversationalSearchRequest::new().set_or_clear_search_params(None::<SearchParams>);
8288    /// ```
8289    pub fn set_or_clear_search_params<T>(mut self, v: std::option::Option<T>) -> Self
8290    where
8291        T: std::convert::Into<crate::model::conversational_search_request::SearchParams>,
8292    {
8293        self.search_params = v.map(|x| x.into());
8294        self
8295    }
8296
8297    /// Sets the value of [visitor_id][crate::model::ConversationalSearchRequest::visitor_id].
8298    ///
8299    /// # Example
8300    /// ```ignore,no_run
8301    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8302    /// let x = ConversationalSearchRequest::new().set_visitor_id("example");
8303    /// ```
8304    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8305        self.visitor_id = v.into();
8306        self
8307    }
8308
8309    /// Sets the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8310    ///
8311    /// # Example
8312    /// ```ignore,no_run
8313    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8314    /// use google_cloud_retail_v2::model::UserInfo;
8315    /// let x = ConversationalSearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
8316    /// ```
8317    pub fn set_user_info<T>(mut self, v: T) -> Self
8318    where
8319        T: std::convert::Into<crate::model::UserInfo>,
8320    {
8321        self.user_info = std::option::Option::Some(v.into());
8322        self
8323    }
8324
8325    /// Sets or clears the value of [user_info][crate::model::ConversationalSearchRequest::user_info].
8326    ///
8327    /// # Example
8328    /// ```ignore,no_run
8329    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8330    /// use google_cloud_retail_v2::model::UserInfo;
8331    /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
8332    /// let x = ConversationalSearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
8333    /// ```
8334    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
8335    where
8336        T: std::convert::Into<crate::model::UserInfo>,
8337    {
8338        self.user_info = v.map(|x| x.into());
8339        self
8340    }
8341
8342    /// Sets the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8343    ///
8344    /// # Example
8345    /// ```ignore,no_run
8346    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8347    /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8348    /// let x = ConversationalSearchRequest::new().set_conversational_filtering_spec(ConversationalFilteringSpec::default()/* use setters */);
8349    /// ```
8350    pub fn set_conversational_filtering_spec<T>(mut self, v: T) -> Self
8351    where
8352        T: std::convert::Into<
8353                crate::model::conversational_search_request::ConversationalFilteringSpec,
8354            >,
8355    {
8356        self.conversational_filtering_spec = std::option::Option::Some(v.into());
8357        self
8358    }
8359
8360    /// Sets or clears the value of [conversational_filtering_spec][crate::model::ConversationalSearchRequest::conversational_filtering_spec].
8361    ///
8362    /// # Example
8363    /// ```ignore,no_run
8364    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8365    /// use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8366    /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(Some(ConversationalFilteringSpec::default()/* use setters */));
8367    /// let x = ConversationalSearchRequest::new().set_or_clear_conversational_filtering_spec(None::<ConversationalFilteringSpec>);
8368    /// ```
8369    pub fn set_or_clear_conversational_filtering_spec<T>(
8370        mut self,
8371        v: std::option::Option<T>,
8372    ) -> Self
8373    where
8374        T: std::convert::Into<
8375                crate::model::conversational_search_request::ConversationalFilteringSpec,
8376            >,
8377    {
8378        self.conversational_filtering_spec = v.map(|x| x.into());
8379        self
8380    }
8381
8382    /// Sets the value of [user_labels][crate::model::ConversationalSearchRequest::user_labels].
8383    ///
8384    /// # Example
8385    /// ```ignore,no_run
8386    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8387    /// let x = ConversationalSearchRequest::new().set_user_labels([
8388    ///     ("key0", "abc"),
8389    ///     ("key1", "xyz"),
8390    /// ]);
8391    /// ```
8392    pub fn set_user_labels<T, K, V>(mut self, v: T) -> Self
8393    where
8394        T: std::iter::IntoIterator<Item = (K, V)>,
8395        K: std::convert::Into<std::string::String>,
8396        V: std::convert::Into<std::string::String>,
8397    {
8398        use std::iter::Iterator;
8399        self.user_labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
8400        self
8401    }
8402
8403    /// Sets the value of [safety_settings][crate::model::ConversationalSearchRequest::safety_settings].
8404    ///
8405    /// # Example
8406    /// ```ignore,no_run
8407    /// # use google_cloud_retail_v2::model::ConversationalSearchRequest;
8408    /// use google_cloud_retail_v2::model::SafetySetting;
8409    /// let x = ConversationalSearchRequest::new()
8410    ///     .set_safety_settings([
8411    ///         SafetySetting::default()/* use setters */,
8412    ///         SafetySetting::default()/* use (different) setters */,
8413    ///     ]);
8414    /// ```
8415    pub fn set_safety_settings<T, V>(mut self, v: T) -> Self
8416    where
8417        T: std::iter::IntoIterator<Item = V>,
8418        V: std::convert::Into<crate::model::SafetySetting>,
8419    {
8420        use std::iter::Iterator;
8421        self.safety_settings = v.into_iter().map(|i| i.into()).collect();
8422        self
8423    }
8424}
8425
8426impl wkt::message::Message for ConversationalSearchRequest {
8427    fn typename() -> &'static str {
8428        "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest"
8429    }
8430}
8431
8432/// Defines additional types related to [ConversationalSearchRequest].
8433pub mod conversational_search_request {
8434    #[allow(unused_imports)]
8435    use super::*;
8436
8437    /// Search parameters.
8438    #[derive(Clone, Default, PartialEq)]
8439    #[non_exhaustive]
8440    pub struct SearchParams {
8441        /// Optional. The filter string to restrict search results.
8442        ///
8443        /// The syntax of the filter string is the same as
8444        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
8445        ///
8446        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
8447        pub filter: std::string::String,
8448
8449        /// Optional. The canonical filter string to restrict search results.
8450        ///
8451        /// The syntax of the canonical filter string is the same as
8452        /// [SearchRequest.canonical_filter][google.cloud.retail.v2.SearchRequest.canonical_filter].
8453        ///
8454        /// [google.cloud.retail.v2.SearchRequest.canonical_filter]: crate::model::SearchRequest::canonical_filter
8455        pub canonical_filter: std::string::String,
8456
8457        /// Optional. The sort string to specify the sorting of search results.
8458        ///
8459        /// The syntax of the sort string is the same as
8460        /// [SearchRequest.sort][].
8461        pub sort_by: std::string::String,
8462
8463        /// Optional. The boost spec to specify the boosting of search results.
8464        ///
8465        /// The syntax of the boost spec is the same as
8466        /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec].
8467        ///
8468        /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
8469        pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
8470
8471        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8472    }
8473
8474    impl SearchParams {
8475        /// Creates a new default instance.
8476        pub fn new() -> Self {
8477            std::default::Default::default()
8478        }
8479
8480        /// Sets the value of [filter][crate::model::conversational_search_request::SearchParams::filter].
8481        ///
8482        /// # Example
8483        /// ```ignore,no_run
8484        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8485        /// let x = SearchParams::new().set_filter("example");
8486        /// ```
8487        pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8488            self.filter = v.into();
8489            self
8490        }
8491
8492        /// Sets the value of [canonical_filter][crate::model::conversational_search_request::SearchParams::canonical_filter].
8493        ///
8494        /// # Example
8495        /// ```ignore,no_run
8496        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8497        /// let x = SearchParams::new().set_canonical_filter("example");
8498        /// ```
8499        pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
8500            mut self,
8501            v: T,
8502        ) -> Self {
8503            self.canonical_filter = v.into();
8504            self
8505        }
8506
8507        /// Sets the value of [sort_by][crate::model::conversational_search_request::SearchParams::sort_by].
8508        ///
8509        /// # Example
8510        /// ```ignore,no_run
8511        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8512        /// let x = SearchParams::new().set_sort_by("example");
8513        /// ```
8514        pub fn set_sort_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8515            self.sort_by = v.into();
8516            self
8517        }
8518
8519        /// Sets the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8520        ///
8521        /// # Example
8522        /// ```ignore,no_run
8523        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8524        /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8525        /// let x = SearchParams::new().set_boost_spec(BoostSpec::default()/* use setters */);
8526        /// ```
8527        pub fn set_boost_spec<T>(mut self, v: T) -> Self
8528        where
8529            T: std::convert::Into<crate::model::search_request::BoostSpec>,
8530        {
8531            self.boost_spec = std::option::Option::Some(v.into());
8532            self
8533        }
8534
8535        /// Sets or clears the value of [boost_spec][crate::model::conversational_search_request::SearchParams::boost_spec].
8536        ///
8537        /// # Example
8538        /// ```ignore,no_run
8539        /// # use google_cloud_retail_v2::model::conversational_search_request::SearchParams;
8540        /// use google_cloud_retail_v2::model::search_request::BoostSpec;
8541        /// let x = SearchParams::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
8542        /// let x = SearchParams::new().set_or_clear_boost_spec(None::<BoostSpec>);
8543        /// ```
8544        pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
8545        where
8546            T: std::convert::Into<crate::model::search_request::BoostSpec>,
8547        {
8548            self.boost_spec = v.map(|x| x.into());
8549            self
8550        }
8551    }
8552
8553    impl wkt::message::Message for SearchParams {
8554        fn typename() -> &'static str {
8555            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.SearchParams"
8556        }
8557    }
8558
8559    /// This field specifies the current user answer during the conversational
8560    /// filtering search. This can be either user selected from suggested answers
8561    /// or user input plain text.
8562    #[derive(Clone, Default, PartialEq)]
8563    #[non_exhaustive]
8564    pub struct UserAnswer {
8565        /// This field specifies the type of user answer.
8566        pub r#type:
8567            std::option::Option<crate::model::conversational_search_request::user_answer::Type>,
8568
8569        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8570    }
8571
8572    impl UserAnswer {
8573        /// Creates a new default instance.
8574        pub fn new() -> Self {
8575            std::default::Default::default()
8576        }
8577
8578        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::type].
8579        ///
8580        /// Note that all the setters affecting `r#type` are mutually
8581        /// exclusive.
8582        ///
8583        /// # Example
8584        /// ```ignore,no_run
8585        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8586        /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::Type;
8587        /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
8588        /// ```
8589        pub fn set_type<
8590            T: std::convert::Into<
8591                    std::option::Option<
8592                        crate::model::conversational_search_request::user_answer::Type,
8593                    >,
8594                >,
8595        >(
8596            mut self,
8597            v: T,
8598        ) -> Self {
8599            self.r#type = v.into();
8600            self
8601        }
8602
8603        /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8604        /// if it holds a `TextAnswer`, `None` if the field is not set or
8605        /// holds a different branch.
8606        pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
8607            #[allow(unreachable_patterns)]
8608            self.r#type.as_ref().and_then(|v| match v {
8609                crate::model::conversational_search_request::user_answer::Type::TextAnswer(v) => {
8610                    std::option::Option::Some(v)
8611                }
8612                _ => std::option::Option::None,
8613            })
8614        }
8615
8616        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8617        /// to hold a `TextAnswer`.
8618        ///
8619        /// Note that all the setters affecting `r#type` are
8620        /// mutually exclusive.
8621        ///
8622        /// # Example
8623        /// ```ignore,no_run
8624        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8625        /// let x = UserAnswer::new().set_text_answer("example");
8626        /// assert!(x.text_answer().is_some());
8627        /// assert!(x.selected_answer().is_none());
8628        /// ```
8629        pub fn set_text_answer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8630            self.r#type = std::option::Option::Some(
8631                crate::model::conversational_search_request::user_answer::Type::TextAnswer(
8632                    v.into(),
8633                ),
8634            );
8635            self
8636        }
8637
8638        /// The value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8639        /// if it holds a `SelectedAnswer`, `None` if the field is not set or
8640        /// holds a different branch.
8641        pub fn selected_answer(
8642            &self,
8643        ) -> std::option::Option<
8644            &std::boxed::Box<
8645                crate::model::conversational_search_request::user_answer::SelectedAnswer,
8646            >,
8647        > {
8648            #[allow(unreachable_patterns)]
8649            self.r#type.as_ref().and_then(|v| match v {
8650                crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8651                    v,
8652                ) => std::option::Option::Some(v),
8653                _ => std::option::Option::None,
8654            })
8655        }
8656
8657        /// Sets the value of [r#type][crate::model::conversational_search_request::UserAnswer::r#type]
8658        /// to hold a `SelectedAnswer`.
8659        ///
8660        /// Note that all the setters affecting `r#type` are
8661        /// mutually exclusive.
8662        ///
8663        /// # Example
8664        /// ```ignore,no_run
8665        /// # use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8666        /// use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8667        /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
8668        /// assert!(x.selected_answer().is_some());
8669        /// assert!(x.text_answer().is_none());
8670        /// ```
8671        pub fn set_selected_answer<
8672            T: std::convert::Into<
8673                    std::boxed::Box<
8674                        crate::model::conversational_search_request::user_answer::SelectedAnswer,
8675                    >,
8676                >,
8677        >(
8678            mut self,
8679            v: T,
8680        ) -> Self {
8681            self.r#type = std::option::Option::Some(
8682                crate::model::conversational_search_request::user_answer::Type::SelectedAnswer(
8683                    v.into(),
8684                ),
8685            );
8686            self
8687        }
8688    }
8689
8690    impl wkt::message::Message for UserAnswer {
8691        fn typename() -> &'static str {
8692            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer"
8693        }
8694    }
8695
8696    /// Defines additional types related to [UserAnswer].
8697    pub mod user_answer {
8698        #[allow(unused_imports)]
8699        use super::*;
8700
8701        /// This field specifies the selected answers during the conversational
8702        /// search.
8703        #[derive(Clone, Default, PartialEq)]
8704        #[non_exhaustive]
8705        pub struct SelectedAnswer {
8706            /// Optional. This field specifies the selected answer which is a attribute
8707            /// key-value.
8708            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
8709
8710            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8711        }
8712
8713        impl SelectedAnswer {
8714            /// Creates a new default instance.
8715            pub fn new() -> Self {
8716                std::default::Default::default()
8717            }
8718
8719            /// Sets the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8720            ///
8721            /// # Example
8722            /// ```ignore,no_run
8723            /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8724            /// use google_cloud_retail_v2::model::ProductAttributeValue;
8725            /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
8726            /// ```
8727            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
8728            where
8729                T: std::convert::Into<crate::model::ProductAttributeValue>,
8730            {
8731                self.product_attribute_value = std::option::Option::Some(v.into());
8732                self
8733            }
8734
8735            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_request::user_answer::SelectedAnswer::product_attribute_value].
8736            ///
8737            /// # Example
8738            /// ```ignore,no_run
8739            /// # use google_cloud_retail_v2::model::conversational_search_request::user_answer::SelectedAnswer;
8740            /// use google_cloud_retail_v2::model::ProductAttributeValue;
8741            /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
8742            /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
8743            /// ```
8744            pub fn set_or_clear_product_attribute_value<T>(
8745                mut self,
8746                v: std::option::Option<T>,
8747            ) -> Self
8748            where
8749                T: std::convert::Into<crate::model::ProductAttributeValue>,
8750            {
8751                self.product_attribute_value = v.map(|x| x.into());
8752                self
8753            }
8754        }
8755
8756        impl wkt::message::Message for SelectedAnswer {
8757            fn typename() -> &'static str {
8758                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.UserAnswer.SelectedAnswer"
8759            }
8760        }
8761
8762        /// This field specifies the type of user answer.
8763        #[derive(Clone, Debug, PartialEq)]
8764        #[non_exhaustive]
8765        pub enum Type {
8766            /// This field specifies the incremental input text from the user during
8767            /// the conversational search.
8768            TextAnswer(std::string::String),
8769            /// Optional. This field specifies the selected answer during the
8770            /// conversational search. This should be a subset of
8771            /// [ConversationalSearchResponse.followup_question.suggested_answers][].
8772            SelectedAnswer(
8773                std::boxed::Box<
8774                    crate::model::conversational_search_request::user_answer::SelectedAnswer,
8775                >,
8776            ),
8777        }
8778    }
8779
8780    /// This field specifies all conversational filtering related parameters
8781    /// addition to conversational retail search.
8782    #[derive(Clone, Default, PartialEq)]
8783    #[non_exhaustive]
8784    pub struct ConversationalFilteringSpec {
8785        /// Optional. This field is deprecated. Please use
8786        /// [ConversationalFilteringSpec.conversational_filtering_mode][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]
8787        /// instead.
8788        ///
8789        /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.conversational_filtering_mode]: crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode
8790        #[deprecated]
8791        pub enable_conversational_filtering: bool,
8792
8793        /// Optional. This field specifies the current user answer during the
8794        /// conversational filtering search. It can be either user selected from
8795        /// suggested answers or user input plain text.
8796        pub user_answer:
8797            std::option::Option<crate::model::conversational_search_request::UserAnswer>,
8798
8799        /// Optional. Mode to control Conversational Filtering.
8800        /// Defaults to
8801        /// [Mode.DISABLED][google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]
8802        /// if it's unset.
8803        ///
8804        /// [google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode.DISABLED]: crate::model::conversational_search_request::conversational_filtering_spec::Mode::Disabled
8805        pub conversational_filtering_mode:
8806            crate::model::conversational_search_request::conversational_filtering_spec::Mode,
8807
8808        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8809    }
8810
8811    impl ConversationalFilteringSpec {
8812        /// Creates a new default instance.
8813        pub fn new() -> Self {
8814            std::default::Default::default()
8815        }
8816
8817        /// Sets the value of [enable_conversational_filtering][crate::model::conversational_search_request::ConversationalFilteringSpec::enable_conversational_filtering].
8818        ///
8819        /// # Example
8820        /// ```ignore,no_run
8821        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8822        /// let x = ConversationalFilteringSpec::new().set_enable_conversational_filtering(true);
8823        /// ```
8824        #[deprecated]
8825        pub fn set_enable_conversational_filtering<T: std::convert::Into<bool>>(
8826            mut self,
8827            v: T,
8828        ) -> Self {
8829            self.enable_conversational_filtering = v.into();
8830            self
8831        }
8832
8833        /// Sets the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8834        ///
8835        /// # Example
8836        /// ```ignore,no_run
8837        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8838        /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8839        /// let x = ConversationalFilteringSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
8840        /// ```
8841        pub fn set_user_answer<T>(mut self, v: T) -> Self
8842        where
8843            T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8844        {
8845            self.user_answer = std::option::Option::Some(v.into());
8846            self
8847        }
8848
8849        /// Sets or clears the value of [user_answer][crate::model::conversational_search_request::ConversationalFilteringSpec::user_answer].
8850        ///
8851        /// # Example
8852        /// ```ignore,no_run
8853        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8854        /// use google_cloud_retail_v2::model::conversational_search_request::UserAnswer;
8855        /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
8856        /// let x = ConversationalFilteringSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
8857        /// ```
8858        pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
8859        where
8860            T: std::convert::Into<crate::model::conversational_search_request::UserAnswer>,
8861        {
8862            self.user_answer = v.map(|x| x.into());
8863            self
8864        }
8865
8866        /// Sets the value of [conversational_filtering_mode][crate::model::conversational_search_request::ConversationalFilteringSpec::conversational_filtering_mode].
8867        ///
8868        /// # Example
8869        /// ```ignore,no_run
8870        /// # use google_cloud_retail_v2::model::conversational_search_request::ConversationalFilteringSpec;
8871        /// use google_cloud_retail_v2::model::conversational_search_request::conversational_filtering_spec::Mode;
8872        /// let x0 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Disabled);
8873        /// let x1 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::Enabled);
8874        /// let x2 = ConversationalFilteringSpec::new().set_conversational_filtering_mode(Mode::ConversationalFilterOnly);
8875        /// ```
8876        pub fn set_conversational_filtering_mode<T: std::convert::Into<crate::model::conversational_search_request::conversational_filtering_spec::Mode>>(mut self, v: T) -> Self{
8877            self.conversational_filtering_mode = v.into();
8878            self
8879        }
8880    }
8881
8882    impl wkt::message::Message for ConversationalFilteringSpec {
8883        fn typename() -> &'static str {
8884            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec"
8885        }
8886    }
8887
8888    /// Defines additional types related to [ConversationalFilteringSpec].
8889    pub mod conversational_filtering_spec {
8890        #[allow(unused_imports)]
8891        use super::*;
8892
8893        /// Enum to control Conversational Filtering mode.
8894        /// A single conversation session including multiple turns supports modes for
8895        /// Conversational Search OR Conversational Filtering without
8896        /// Conversational Search, but not both.
8897        ///
8898        /// # Working with unknown values
8899        ///
8900        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8901        /// additional enum variants at any time. Adding new variants is not considered
8902        /// a breaking change. Applications should write their code in anticipation of:
8903        ///
8904        /// - New values appearing in future releases of the client library, **and**
8905        /// - New values received dynamically, without application changes.
8906        ///
8907        /// Please consult the [Working with enums] section in the user guide for some
8908        /// guidelines.
8909        ///
8910        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8911        #[derive(Clone, Debug, PartialEq)]
8912        #[non_exhaustive]
8913        pub enum Mode {
8914            /// Default value.
8915            Unspecified,
8916            /// Disables Conversational Filtering when using Conversational Search.
8917            Disabled,
8918            /// Enables Conversational Filtering when using Conversational Search.
8919            Enabled,
8920            /// Enables Conversational Filtering without Conversational Search.
8921            ConversationalFilterOnly,
8922            /// If set, the enum was initialized with an unknown value.
8923            ///
8924            /// Applications can examine the value using [Mode::value] or
8925            /// [Mode::name].
8926            UnknownValue(mode::UnknownValue),
8927        }
8928
8929        #[doc(hidden)]
8930        pub mod mode {
8931            #[allow(unused_imports)]
8932            use super::*;
8933            #[derive(Clone, Debug, PartialEq)]
8934            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8935        }
8936
8937        impl Mode {
8938            /// Gets the enum value.
8939            ///
8940            /// Returns `None` if the enum contains an unknown value deserialized from
8941            /// the string representation of enums.
8942            pub fn value(&self) -> std::option::Option<i32> {
8943                match self {
8944                    Self::Unspecified => std::option::Option::Some(0),
8945                    Self::Disabled => std::option::Option::Some(1),
8946                    Self::Enabled => std::option::Option::Some(2),
8947                    Self::ConversationalFilterOnly => std::option::Option::Some(3),
8948                    Self::UnknownValue(u) => u.0.value(),
8949                }
8950            }
8951
8952            /// Gets the enum value as a string.
8953            ///
8954            /// Returns `None` if the enum contains an unknown value deserialized from
8955            /// the integer representation of enums.
8956            pub fn name(&self) -> std::option::Option<&str> {
8957                match self {
8958                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
8959                    Self::Disabled => std::option::Option::Some("DISABLED"),
8960                    Self::Enabled => std::option::Option::Some("ENABLED"),
8961                    Self::ConversationalFilterOnly => {
8962                        std::option::Option::Some("CONVERSATIONAL_FILTER_ONLY")
8963                    }
8964                    Self::UnknownValue(u) => u.0.name(),
8965                }
8966            }
8967        }
8968
8969        impl std::default::Default for Mode {
8970            fn default() -> Self {
8971                use std::convert::From;
8972                Self::from(0)
8973            }
8974        }
8975
8976        impl std::fmt::Display for Mode {
8977            fn fmt(
8978                &self,
8979                f: &mut std::fmt::Formatter<'_>,
8980            ) -> std::result::Result<(), std::fmt::Error> {
8981                wkt::internal::display_enum(f, self.name(), self.value())
8982            }
8983        }
8984
8985        impl std::convert::From<i32> for Mode {
8986            fn from(value: i32) -> Self {
8987                match value {
8988                    0 => Self::Unspecified,
8989                    1 => Self::Disabled,
8990                    2 => Self::Enabled,
8991                    3 => Self::ConversationalFilterOnly,
8992                    _ => Self::UnknownValue(mode::UnknownValue(
8993                        wkt::internal::UnknownEnumValue::Integer(value),
8994                    )),
8995                }
8996            }
8997        }
8998
8999        impl std::convert::From<&str> for Mode {
9000            fn from(value: &str) -> Self {
9001                use std::string::ToString;
9002                match value {
9003                    "MODE_UNSPECIFIED" => Self::Unspecified,
9004                    "DISABLED" => Self::Disabled,
9005                    "ENABLED" => Self::Enabled,
9006                    "CONVERSATIONAL_FILTER_ONLY" => Self::ConversationalFilterOnly,
9007                    _ => Self::UnknownValue(mode::UnknownValue(
9008                        wkt::internal::UnknownEnumValue::String(value.to_string()),
9009                    )),
9010                }
9011            }
9012        }
9013
9014        impl serde::ser::Serialize for Mode {
9015            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9016            where
9017                S: serde::Serializer,
9018            {
9019                match self {
9020                    Self::Unspecified => serializer.serialize_i32(0),
9021                    Self::Disabled => serializer.serialize_i32(1),
9022                    Self::Enabled => serializer.serialize_i32(2),
9023                    Self::ConversationalFilterOnly => serializer.serialize_i32(3),
9024                    Self::UnknownValue(u) => u.0.serialize(serializer),
9025                }
9026            }
9027        }
9028
9029        impl<'de> serde::de::Deserialize<'de> for Mode {
9030            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9031            where
9032                D: serde::Deserializer<'de>,
9033            {
9034                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
9035                    ".google.cloud.retail.v2.ConversationalSearchRequest.ConversationalFilteringSpec.Mode"))
9036            }
9037        }
9038    }
9039}
9040
9041/// Response message for
9042/// [ConversationalSearchService.ConversationalSearch][google.cloud.retail.v2.ConversationalSearchService.ConversationalSearch]
9043/// method.
9044#[derive(Clone, Default, PartialEq)]
9045#[non_exhaustive]
9046pub struct ConversationalSearchResponse {
9047    /// The types Retail classifies the search query as.
9048    ///
9049    /// Supported values are:
9050    ///
9051    /// - "ORDER_SUPPORT"
9052    /// - "SIMPLE_PRODUCT_SEARCH"
9053    /// - "INTENT_REFINEMENT"
9054    /// - "PRODUCT_DETAILS"
9055    /// - "PRODUCT_COMPARISON"
9056    /// - "DEALS_AND_COUPONS"
9057    /// - "STORE_RELEVANT"
9058    /// - "BLOCKLISTED"
9059    /// - "BEST_PRODUCT"
9060    /// - "RETAIL_SUPPORT"
9061    /// - "DISABLED"
9062    pub user_query_types: std::vec::Vec<std::string::String>,
9063
9064    /// The conversational answer-based text response generated by the Server.
9065    pub conversational_text_response: std::string::String,
9066
9067    /// The conversational followup question generated for Intent refinement.
9068    pub followup_question:
9069        std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9070
9071    /// Conversation UUID. This field will be stored in client side storage to
9072    /// maintain the conversation session with server and will be used for next
9073    /// search request's
9074    /// [ConversationalSearchRequest.conversation_id][google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]
9075    /// to restore conversation state in server.
9076    ///
9077    /// [google.cloud.retail.v2.ConversationalSearchRequest.conversation_id]: crate::model::ConversationalSearchRequest::conversation_id
9078    pub conversation_id: std::string::String,
9079
9080    /// The proposed refined search queries. They can be used to fetch the relevant
9081    /// search results. When using CONVERSATIONAL_FILTER_ONLY mode, the
9082    /// refined_query from search response will be populated here.
9083    pub refined_search: std::vec::Vec<crate::model::conversational_search_response::RefinedSearch>,
9084
9085    /// This field specifies all related information that is needed on client
9086    /// side for UI rendering of conversational filtering search.
9087    pub conversational_filtering_result: std::option::Option<
9088        crate::model::conversational_search_response::ConversationalFilteringResult,
9089    >,
9090
9091    /// Output only. The state of the response generation.
9092    pub state: crate::model::conversational_search_response::State,
9093
9094    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9095}
9096
9097impl ConversationalSearchResponse {
9098    /// Creates a new default instance.
9099    pub fn new() -> Self {
9100        std::default::Default::default()
9101    }
9102
9103    /// Sets the value of [user_query_types][crate::model::ConversationalSearchResponse::user_query_types].
9104    ///
9105    /// # Example
9106    /// ```ignore,no_run
9107    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9108    /// let x = ConversationalSearchResponse::new().set_user_query_types(["a", "b", "c"]);
9109    /// ```
9110    pub fn set_user_query_types<T, V>(mut self, v: T) -> Self
9111    where
9112        T: std::iter::IntoIterator<Item = V>,
9113        V: std::convert::Into<std::string::String>,
9114    {
9115        use std::iter::Iterator;
9116        self.user_query_types = v.into_iter().map(|i| i.into()).collect();
9117        self
9118    }
9119
9120    /// Sets the value of [conversational_text_response][crate::model::ConversationalSearchResponse::conversational_text_response].
9121    ///
9122    /// # Example
9123    /// ```ignore,no_run
9124    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9125    /// let x = ConversationalSearchResponse::new().set_conversational_text_response("example");
9126    /// ```
9127    pub fn set_conversational_text_response<T: std::convert::Into<std::string::String>>(
9128        mut self,
9129        v: T,
9130    ) -> Self {
9131        self.conversational_text_response = v.into();
9132        self
9133    }
9134
9135    /// Sets the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9136    ///
9137    /// # Example
9138    /// ```ignore,no_run
9139    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9140    /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9141    /// let x = ConversationalSearchResponse::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9142    /// ```
9143    pub fn set_followup_question<T>(mut self, v: T) -> Self
9144    where
9145        T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9146    {
9147        self.followup_question = std::option::Option::Some(v.into());
9148        self
9149    }
9150
9151    /// Sets or clears the value of [followup_question][crate::model::ConversationalSearchResponse::followup_question].
9152    ///
9153    /// # Example
9154    /// ```ignore,no_run
9155    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9156    /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9157    /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9158    /// let x = ConversationalSearchResponse::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9159    /// ```
9160    pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9161    where
9162        T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9163    {
9164        self.followup_question = v.map(|x| x.into());
9165        self
9166    }
9167
9168    /// Sets the value of [conversation_id][crate::model::ConversationalSearchResponse::conversation_id].
9169    ///
9170    /// # Example
9171    /// ```ignore,no_run
9172    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9173    /// let x = ConversationalSearchResponse::new().set_conversation_id("example");
9174    /// ```
9175    pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9176        self.conversation_id = v.into();
9177        self
9178    }
9179
9180    /// Sets the value of [refined_search][crate::model::ConversationalSearchResponse::refined_search].
9181    ///
9182    /// # Example
9183    /// ```ignore,no_run
9184    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9185    /// use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9186    /// let x = ConversationalSearchResponse::new()
9187    ///     .set_refined_search([
9188    ///         RefinedSearch::default()/* use setters */,
9189    ///         RefinedSearch::default()/* use (different) setters */,
9190    ///     ]);
9191    /// ```
9192    pub fn set_refined_search<T, V>(mut self, v: T) -> Self
9193    where
9194        T: std::iter::IntoIterator<Item = V>,
9195        V: std::convert::Into<crate::model::conversational_search_response::RefinedSearch>,
9196    {
9197        use std::iter::Iterator;
9198        self.refined_search = v.into_iter().map(|i| i.into()).collect();
9199        self
9200    }
9201
9202    /// Sets the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9203    ///
9204    /// # Example
9205    /// ```ignore,no_run
9206    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9207    /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9208    /// let x = ConversationalSearchResponse::new().set_conversational_filtering_result(ConversationalFilteringResult::default()/* use setters */);
9209    /// ```
9210    pub fn set_conversational_filtering_result<T>(mut self, v: T) -> Self
9211    where
9212        T: std::convert::Into<
9213                crate::model::conversational_search_response::ConversationalFilteringResult,
9214            >,
9215    {
9216        self.conversational_filtering_result = std::option::Option::Some(v.into());
9217        self
9218    }
9219
9220    /// Sets or clears the value of [conversational_filtering_result][crate::model::ConversationalSearchResponse::conversational_filtering_result].
9221    ///
9222    /// # Example
9223    /// ```ignore,no_run
9224    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9225    /// use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9226    /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(Some(ConversationalFilteringResult::default()/* use setters */));
9227    /// let x = ConversationalSearchResponse::new().set_or_clear_conversational_filtering_result(None::<ConversationalFilteringResult>);
9228    /// ```
9229    pub fn set_or_clear_conversational_filtering_result<T>(
9230        mut self,
9231        v: std::option::Option<T>,
9232    ) -> Self
9233    where
9234        T: std::convert::Into<
9235                crate::model::conversational_search_response::ConversationalFilteringResult,
9236            >,
9237    {
9238        self.conversational_filtering_result = v.map(|x| x.into());
9239        self
9240    }
9241
9242    /// Sets the value of [state][crate::model::ConversationalSearchResponse::state].
9243    ///
9244    /// # Example
9245    /// ```ignore,no_run
9246    /// # use google_cloud_retail_v2::model::ConversationalSearchResponse;
9247    /// use google_cloud_retail_v2::model::conversational_search_response::State;
9248    /// let x0 = ConversationalSearchResponse::new().set_state(State::Streaming);
9249    /// let x1 = ConversationalSearchResponse::new().set_state(State::Succeeded);
9250    /// ```
9251    pub fn set_state<T: std::convert::Into<crate::model::conversational_search_response::State>>(
9252        mut self,
9253        v: T,
9254    ) -> Self {
9255        self.state = v.into();
9256        self
9257    }
9258}
9259
9260impl wkt::message::Message for ConversationalSearchResponse {
9261    fn typename() -> &'static str {
9262        "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse"
9263    }
9264}
9265
9266/// Defines additional types related to [ConversationalSearchResponse].
9267pub mod conversational_search_response {
9268    #[allow(unused_imports)]
9269    use super::*;
9270
9271    /// The conversational followup question generated for Intent refinement.
9272    #[derive(Clone, Default, PartialEq)]
9273    #[non_exhaustive]
9274    pub struct FollowupQuestion {
9275        /// The conversational followup question generated for Intent refinement.
9276        pub followup_question: std::string::String,
9277
9278        /// The answer options provided to client for the follow-up question.
9279        pub suggested_answers: std::vec::Vec<
9280            crate::model::conversational_search_response::followup_question::SuggestedAnswer,
9281        >,
9282
9283        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9284    }
9285
9286    impl FollowupQuestion {
9287        /// Creates a new default instance.
9288        pub fn new() -> Self {
9289            std::default::Default::default()
9290        }
9291
9292        /// Sets the value of [followup_question][crate::model::conversational_search_response::FollowupQuestion::followup_question].
9293        ///
9294        /// # Example
9295        /// ```ignore,no_run
9296        /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9297        /// let x = FollowupQuestion::new().set_followup_question("example");
9298        /// ```
9299        pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
9300            mut self,
9301            v: T,
9302        ) -> Self {
9303            self.followup_question = v.into();
9304            self
9305        }
9306
9307        /// Sets the value of [suggested_answers][crate::model::conversational_search_response::FollowupQuestion::suggested_answers].
9308        ///
9309        /// # Example
9310        /// ```ignore,no_run
9311        /// # use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9312        /// use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9313        /// let x = FollowupQuestion::new()
9314        ///     .set_suggested_answers([
9315        ///         SuggestedAnswer::default()/* use setters */,
9316        ///         SuggestedAnswer::default()/* use (different) setters */,
9317        ///     ]);
9318        /// ```
9319        pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
9320        where
9321            T: std::iter::IntoIterator<Item = V>,
9322            V: std::convert::Into<crate::model::conversational_search_response::followup_question::SuggestedAnswer>
9323        {
9324            use std::iter::Iterator;
9325            self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
9326            self
9327        }
9328    }
9329
9330    impl wkt::message::Message for FollowupQuestion {
9331        fn typename() -> &'static str {
9332            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion"
9333        }
9334    }
9335
9336    /// Defines additional types related to [FollowupQuestion].
9337    pub mod followup_question {
9338        #[allow(unused_imports)]
9339        use super::*;
9340
9341        /// Suggested answers to the follow-up question.
9342        /// If it's numerical attribute, only ProductAttributeInterval will be set.
9343        /// If it's textual attribute, only productAttributeValue will be set.
9344        #[derive(Clone, Default, PartialEq)]
9345        #[non_exhaustive]
9346        pub struct SuggestedAnswer {
9347            /// Product attribute value, including an attribute key and an
9348            /// attribute value. Other types can be added here in the future.
9349            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9350
9351            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9352        }
9353
9354        impl SuggestedAnswer {
9355            /// Creates a new default instance.
9356            pub fn new() -> Self {
9357                std::default::Default::default()
9358            }
9359
9360            /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9361            ///
9362            /// # Example
9363            /// ```ignore,no_run
9364            /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9365            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9366            /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9367            /// ```
9368            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9369            where
9370                T: std::convert::Into<crate::model::ProductAttributeValue>,
9371            {
9372                self.product_attribute_value = std::option::Option::Some(v.into());
9373                self
9374            }
9375
9376            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::followup_question::SuggestedAnswer::product_attribute_value].
9377            ///
9378            /// # Example
9379            /// ```ignore,no_run
9380            /// # use google_cloud_retail_v2::model::conversational_search_response::followup_question::SuggestedAnswer;
9381            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9382            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9383            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9384            /// ```
9385            pub fn set_or_clear_product_attribute_value<T>(
9386                mut self,
9387                v: std::option::Option<T>,
9388            ) -> Self
9389            where
9390                T: std::convert::Into<crate::model::ProductAttributeValue>,
9391            {
9392                self.product_attribute_value = v.map(|x| x.into());
9393                self
9394            }
9395        }
9396
9397        impl wkt::message::Message for SuggestedAnswer {
9398            fn typename() -> &'static str {
9399                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.FollowupQuestion.SuggestedAnswer"
9400            }
9401        }
9402    }
9403
9404    /// The proposed refined search for intent-refinement/bundled shopping
9405    /// conversation. When using CONVERSATIONAL_FILTER_ONLY mode, the
9406    /// refined_query from search response will be populated here.
9407    #[derive(Clone, Default, PartialEq)]
9408    #[non_exhaustive]
9409    pub struct RefinedSearch {
9410        /// The query to be used for search.
9411        pub query: std::string::String,
9412
9413        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9414    }
9415
9416    impl RefinedSearch {
9417        /// Creates a new default instance.
9418        pub fn new() -> Self {
9419            std::default::Default::default()
9420        }
9421
9422        /// Sets the value of [query][crate::model::conversational_search_response::RefinedSearch::query].
9423        ///
9424        /// # Example
9425        /// ```ignore,no_run
9426        /// # use google_cloud_retail_v2::model::conversational_search_response::RefinedSearch;
9427        /// let x = RefinedSearch::new().set_query("example");
9428        /// ```
9429        pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9430            self.query = v.into();
9431            self
9432        }
9433    }
9434
9435    impl wkt::message::Message for RefinedSearch {
9436        fn typename() -> &'static str {
9437            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.RefinedSearch"
9438        }
9439    }
9440
9441    /// This field specifies all related information that is needed on client
9442    /// side for UI rendering of conversational filtering search.
9443    #[derive(Clone, Default, PartialEq)]
9444    #[non_exhaustive]
9445    pub struct ConversationalFilteringResult {
9446
9447        /// The conversational filtering question.
9448        pub followup_question: std::option::Option<crate::model::conversational_search_response::FollowupQuestion>,
9449
9450        /// This is the incremental additional filters implied from the current
9451        /// user answer. User should add the suggested addition filters to the
9452        /// previous [ConversationalSearchRequest.search_params.filter][] and
9453        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],  and
9454        /// use the merged filter in the follow up requests.
9455        pub additional_filter: std::option::Option<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>,
9456
9457        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9458    }
9459
9460    impl ConversationalFilteringResult {
9461        /// Creates a new default instance.
9462        pub fn new() -> Self {
9463            std::default::Default::default()
9464        }
9465
9466        /// Sets the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9467        ///
9468        /// # Example
9469        /// ```ignore,no_run
9470        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9471        /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9472        /// let x = ConversationalFilteringResult::new().set_followup_question(FollowupQuestion::default()/* use setters */);
9473        /// ```
9474        pub fn set_followup_question<T>(mut self, v: T) -> Self
9475        where
9476            T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9477        {
9478            self.followup_question = std::option::Option::Some(v.into());
9479            self
9480        }
9481
9482        /// Sets or clears the value of [followup_question][crate::model::conversational_search_response::ConversationalFilteringResult::followup_question].
9483        ///
9484        /// # Example
9485        /// ```ignore,no_run
9486        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9487        /// use google_cloud_retail_v2::model::conversational_search_response::FollowupQuestion;
9488        /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(Some(FollowupQuestion::default()/* use setters */));
9489        /// let x = ConversationalFilteringResult::new().set_or_clear_followup_question(None::<FollowupQuestion>);
9490        /// ```
9491        pub fn set_or_clear_followup_question<T>(mut self, v: std::option::Option<T>) -> Self
9492        where
9493            T: std::convert::Into<crate::model::conversational_search_response::FollowupQuestion>,
9494        {
9495            self.followup_question = v.map(|x| x.into());
9496            self
9497        }
9498
9499        /// Sets the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9500        ///
9501        /// # Example
9502        /// ```ignore,no_run
9503        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9504        /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9505        /// let x = ConversationalFilteringResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
9506        /// ```
9507        pub fn set_additional_filter<T>(mut self, v: T) -> Self
9508        where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9509        {
9510            self.additional_filter = std::option::Option::Some(v.into());
9511            self
9512        }
9513
9514        /// Sets or clears the value of [additional_filter][crate::model::conversational_search_response::ConversationalFilteringResult::additional_filter].
9515        ///
9516        /// # Example
9517        /// ```ignore,no_run
9518        /// # use google_cloud_retail_v2::model::conversational_search_response::ConversationalFilteringResult;
9519        /// use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9520        /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
9521        /// let x = ConversationalFilteringResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
9522        /// ```
9523        pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
9524        where T: std::convert::Into<crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter>
9525        {
9526            self.additional_filter = v.map(|x| x.into());
9527            self
9528        }
9529    }
9530
9531    impl wkt::message::Message for ConversationalFilteringResult {
9532        fn typename() -> &'static str {
9533            "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult"
9534        }
9535    }
9536
9537    /// Defines additional types related to [ConversationalFilteringResult].
9538    pub mod conversational_filtering_result {
9539        #[allow(unused_imports)]
9540        use super::*;
9541
9542        /// Additional filter that client side need to apply.
9543        #[derive(Clone, Default, PartialEq)]
9544        #[non_exhaustive]
9545        pub struct AdditionalFilter {
9546            /// Product attribute value, including an attribute key and an
9547            /// attribute value. Other types can be added here in the future.
9548            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
9549
9550            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9551        }
9552
9553        impl AdditionalFilter {
9554            /// Creates a new default instance.
9555            pub fn new() -> Self {
9556                std::default::Default::default()
9557            }
9558
9559            /// Sets the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9560            ///
9561            /// # Example
9562            /// ```ignore,no_run
9563            /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9564            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9565            /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
9566            /// ```
9567            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
9568            where
9569                T: std::convert::Into<crate::model::ProductAttributeValue>,
9570            {
9571                self.product_attribute_value = std::option::Option::Some(v.into());
9572                self
9573            }
9574
9575            /// Sets or clears the value of [product_attribute_value][crate::model::conversational_search_response::conversational_filtering_result::AdditionalFilter::product_attribute_value].
9576            ///
9577            /// # Example
9578            /// ```ignore,no_run
9579            /// # use google_cloud_retail_v2::model::conversational_search_response::conversational_filtering_result::AdditionalFilter;
9580            /// use google_cloud_retail_v2::model::ProductAttributeValue;
9581            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
9582            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
9583            /// ```
9584            pub fn set_or_clear_product_attribute_value<T>(
9585                mut self,
9586                v: std::option::Option<T>,
9587            ) -> Self
9588            where
9589                T: std::convert::Into<crate::model::ProductAttributeValue>,
9590            {
9591                self.product_attribute_value = v.map(|x| x.into());
9592                self
9593            }
9594        }
9595
9596        impl wkt::message::Message for AdditionalFilter {
9597            fn typename() -> &'static str {
9598                "type.googleapis.com/google.cloud.retail.v2.ConversationalSearchResponse.ConversationalFilteringResult.AdditionalFilter"
9599            }
9600        }
9601    }
9602
9603    /// The state of the response generation.
9604    ///
9605    /// # Working with unknown values
9606    ///
9607    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
9608    /// additional enum variants at any time. Adding new variants is not considered
9609    /// a breaking change. Applications should write their code in anticipation of:
9610    ///
9611    /// - New values appearing in future releases of the client library, **and**
9612    /// - New values received dynamically, without application changes.
9613    ///
9614    /// Please consult the [Working with enums] section in the user guide for some
9615    /// guidelines.
9616    ///
9617    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
9618    #[derive(Clone, Debug, PartialEq)]
9619    #[non_exhaustive]
9620    pub enum State {
9621        /// Unknown.
9622        Unspecified,
9623        /// Response generation is being streamed.
9624        Streaming,
9625        /// Response generation has succeeded.
9626        Succeeded,
9627        /// If set, the enum was initialized with an unknown value.
9628        ///
9629        /// Applications can examine the value using [State::value] or
9630        /// [State::name].
9631        UnknownValue(state::UnknownValue),
9632    }
9633
9634    #[doc(hidden)]
9635    pub mod state {
9636        #[allow(unused_imports)]
9637        use super::*;
9638        #[derive(Clone, Debug, PartialEq)]
9639        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
9640    }
9641
9642    impl State {
9643        /// Gets the enum value.
9644        ///
9645        /// Returns `None` if the enum contains an unknown value deserialized from
9646        /// the string representation of enums.
9647        pub fn value(&self) -> std::option::Option<i32> {
9648            match self {
9649                Self::Unspecified => std::option::Option::Some(0),
9650                Self::Streaming => std::option::Option::Some(1),
9651                Self::Succeeded => std::option::Option::Some(2),
9652                Self::UnknownValue(u) => u.0.value(),
9653            }
9654        }
9655
9656        /// Gets the enum value as a string.
9657        ///
9658        /// Returns `None` if the enum contains an unknown value deserialized from
9659        /// the integer representation of enums.
9660        pub fn name(&self) -> std::option::Option<&str> {
9661            match self {
9662                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
9663                Self::Streaming => std::option::Option::Some("STREAMING"),
9664                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
9665                Self::UnknownValue(u) => u.0.name(),
9666            }
9667        }
9668    }
9669
9670    impl std::default::Default for State {
9671        fn default() -> Self {
9672            use std::convert::From;
9673            Self::from(0)
9674        }
9675    }
9676
9677    impl std::fmt::Display for State {
9678        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
9679            wkt::internal::display_enum(f, self.name(), self.value())
9680        }
9681    }
9682
9683    impl std::convert::From<i32> for State {
9684        fn from(value: i32) -> Self {
9685            match value {
9686                0 => Self::Unspecified,
9687                1 => Self::Streaming,
9688                2 => Self::Succeeded,
9689                _ => Self::UnknownValue(state::UnknownValue(
9690                    wkt::internal::UnknownEnumValue::Integer(value),
9691                )),
9692            }
9693        }
9694    }
9695
9696    impl std::convert::From<&str> for State {
9697        fn from(value: &str) -> Self {
9698            use std::string::ToString;
9699            match value {
9700                "STATE_UNSPECIFIED" => Self::Unspecified,
9701                "STREAMING" => Self::Streaming,
9702                "SUCCEEDED" => Self::Succeeded,
9703                _ => Self::UnknownValue(state::UnknownValue(
9704                    wkt::internal::UnknownEnumValue::String(value.to_string()),
9705                )),
9706            }
9707        }
9708    }
9709
9710    impl serde::ser::Serialize for State {
9711        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9712        where
9713            S: serde::Serializer,
9714        {
9715            match self {
9716                Self::Unspecified => serializer.serialize_i32(0),
9717                Self::Streaming => serializer.serialize_i32(1),
9718                Self::Succeeded => serializer.serialize_i32(2),
9719                Self::UnknownValue(u) => u.0.serialize(serializer),
9720            }
9721        }
9722    }
9723
9724    impl<'de> serde::de::Deserialize<'de> for State {
9725        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9726        where
9727            D: serde::Deserializer<'de>,
9728        {
9729            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
9730                ".google.cloud.retail.v2.ConversationalSearchResponse.State",
9731            ))
9732        }
9733    }
9734}
9735
9736/// The output configuration setting.
9737#[derive(Clone, Default, PartialEq)]
9738#[non_exhaustive]
9739pub struct OutputConfig {
9740    /// The configuration of destination for holding output data.
9741    pub destination: std::option::Option<crate::model::output_config::Destination>,
9742
9743    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9744}
9745
9746impl OutputConfig {
9747    /// Creates a new default instance.
9748    pub fn new() -> Self {
9749        std::default::Default::default()
9750    }
9751
9752    /// Sets the value of [destination][crate::model::OutputConfig::destination].
9753    ///
9754    /// Note that all the setters affecting `destination` are mutually
9755    /// exclusive.
9756    ///
9757    /// # Example
9758    /// ```ignore,no_run
9759    /// # use google_cloud_retail_v2::model::OutputConfig;
9760    /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9761    /// let x = OutputConfig::new().set_destination(Some(
9762    ///     google_cloud_retail_v2::model::output_config::Destination::GcsDestination(GcsDestination::default().into())));
9763    /// ```
9764    pub fn set_destination<
9765        T: std::convert::Into<std::option::Option<crate::model::output_config::Destination>>,
9766    >(
9767        mut self,
9768        v: T,
9769    ) -> Self {
9770        self.destination = v.into();
9771        self
9772    }
9773
9774    /// The value of [destination][crate::model::OutputConfig::destination]
9775    /// if it holds a `GcsDestination`, `None` if the field is not set or
9776    /// holds a different branch.
9777    pub fn gcs_destination(
9778        &self,
9779    ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::GcsDestination>> {
9780        #[allow(unreachable_patterns)]
9781        self.destination.as_ref().and_then(|v| match v {
9782            crate::model::output_config::Destination::GcsDestination(v) => {
9783                std::option::Option::Some(v)
9784            }
9785            _ => std::option::Option::None,
9786        })
9787    }
9788
9789    /// Sets the value of [destination][crate::model::OutputConfig::destination]
9790    /// to hold a `GcsDestination`.
9791    ///
9792    /// Note that all the setters affecting `destination` are
9793    /// mutually exclusive.
9794    ///
9795    /// # Example
9796    /// ```ignore,no_run
9797    /// # use google_cloud_retail_v2::model::OutputConfig;
9798    /// use google_cloud_retail_v2::model::output_config::GcsDestination;
9799    /// let x = OutputConfig::new().set_gcs_destination(GcsDestination::default()/* use setters */);
9800    /// assert!(x.gcs_destination().is_some());
9801    /// assert!(x.bigquery_destination().is_none());
9802    /// ```
9803    pub fn set_gcs_destination<
9804        T: std::convert::Into<std::boxed::Box<crate::model::output_config::GcsDestination>>,
9805    >(
9806        mut self,
9807        v: T,
9808    ) -> Self {
9809        self.destination = std::option::Option::Some(
9810            crate::model::output_config::Destination::GcsDestination(v.into()),
9811        );
9812        self
9813    }
9814
9815    /// The value of [destination][crate::model::OutputConfig::destination]
9816    /// if it holds a `BigqueryDestination`, `None` if the field is not set or
9817    /// holds a different branch.
9818    pub fn bigquery_destination(
9819        &self,
9820    ) -> std::option::Option<&std::boxed::Box<crate::model::output_config::BigQueryDestination>>
9821    {
9822        #[allow(unreachable_patterns)]
9823        self.destination.as_ref().and_then(|v| match v {
9824            crate::model::output_config::Destination::BigqueryDestination(v) => {
9825                std::option::Option::Some(v)
9826            }
9827            _ => std::option::Option::None,
9828        })
9829    }
9830
9831    /// Sets the value of [destination][crate::model::OutputConfig::destination]
9832    /// to hold a `BigqueryDestination`.
9833    ///
9834    /// Note that all the setters affecting `destination` are
9835    /// mutually exclusive.
9836    ///
9837    /// # Example
9838    /// ```ignore,no_run
9839    /// # use google_cloud_retail_v2::model::OutputConfig;
9840    /// use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9841    /// let x = OutputConfig::new().set_bigquery_destination(BigQueryDestination::default()/* use setters */);
9842    /// assert!(x.bigquery_destination().is_some());
9843    /// assert!(x.gcs_destination().is_none());
9844    /// ```
9845    pub fn set_bigquery_destination<
9846        T: std::convert::Into<std::boxed::Box<crate::model::output_config::BigQueryDestination>>,
9847    >(
9848        mut self,
9849        v: T,
9850    ) -> Self {
9851        self.destination = std::option::Option::Some(
9852            crate::model::output_config::Destination::BigqueryDestination(v.into()),
9853        );
9854        self
9855    }
9856}
9857
9858impl wkt::message::Message for OutputConfig {
9859    fn typename() -> &'static str {
9860        "type.googleapis.com/google.cloud.retail.v2.OutputConfig"
9861    }
9862}
9863
9864/// Defines additional types related to [OutputConfig].
9865pub mod output_config {
9866    #[allow(unused_imports)]
9867    use super::*;
9868
9869    /// The Google Cloud Storage output destination configuration.
9870    #[derive(Clone, Default, PartialEq)]
9871    #[non_exhaustive]
9872    pub struct GcsDestination {
9873        /// Required. The output uri prefix for saving output data to json files.
9874        /// Some mapping examples are as follows:
9875        /// output_uri_prefix         sample output(assuming the object is foo.json)
9876        /// ========================  =============================================
9877        /// gs://bucket/              gs://bucket/foo.json
9878        /// gs://bucket/folder/       gs://bucket/folder/foo.json
9879        /// gs://bucket/folder/item_  gs://bucket/folder/item_foo.json
9880        pub output_uri_prefix: std::string::String,
9881
9882        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9883    }
9884
9885    impl GcsDestination {
9886        /// Creates a new default instance.
9887        pub fn new() -> Self {
9888            std::default::Default::default()
9889        }
9890
9891        /// Sets the value of [output_uri_prefix][crate::model::output_config::GcsDestination::output_uri_prefix].
9892        ///
9893        /// # Example
9894        /// ```ignore,no_run
9895        /// # use google_cloud_retail_v2::model::output_config::GcsDestination;
9896        /// let x = GcsDestination::new().set_output_uri_prefix("example");
9897        /// ```
9898        pub fn set_output_uri_prefix<T: std::convert::Into<std::string::String>>(
9899            mut self,
9900            v: T,
9901        ) -> Self {
9902            self.output_uri_prefix = v.into();
9903            self
9904        }
9905    }
9906
9907    impl wkt::message::Message for GcsDestination {
9908        fn typename() -> &'static str {
9909            "type.googleapis.com/google.cloud.retail.v2.OutputConfig.GcsDestination"
9910        }
9911    }
9912
9913    /// The BigQuery output destination configuration.
9914    #[derive(Clone, Default, PartialEq)]
9915    #[non_exhaustive]
9916    pub struct BigQueryDestination {
9917        /// Required. The ID of a BigQuery Dataset.
9918        pub dataset_id: std::string::String,
9919
9920        /// Required. The prefix of exported BigQuery tables.
9921        pub table_id_prefix: std::string::String,
9922
9923        /// Required. Describes the table type. The following values are supported:
9924        ///
9925        /// * `table`: A BigQuery native table.
9926        /// * `view`: A virtual table defined by a SQL query.
9927        pub table_type: std::string::String,
9928
9929        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9930    }
9931
9932    impl BigQueryDestination {
9933        /// Creates a new default instance.
9934        pub fn new() -> Self {
9935            std::default::Default::default()
9936        }
9937
9938        /// Sets the value of [dataset_id][crate::model::output_config::BigQueryDestination::dataset_id].
9939        ///
9940        /// # Example
9941        /// ```ignore,no_run
9942        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9943        /// let x = BigQueryDestination::new().set_dataset_id("example");
9944        /// ```
9945        pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9946            self.dataset_id = v.into();
9947            self
9948        }
9949
9950        /// Sets the value of [table_id_prefix][crate::model::output_config::BigQueryDestination::table_id_prefix].
9951        ///
9952        /// # Example
9953        /// ```ignore,no_run
9954        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9955        /// let x = BigQueryDestination::new().set_table_id_prefix("example");
9956        /// ```
9957        pub fn set_table_id_prefix<T: std::convert::Into<std::string::String>>(
9958            mut self,
9959            v: T,
9960        ) -> Self {
9961            self.table_id_prefix = v.into();
9962            self
9963        }
9964
9965        /// Sets the value of [table_type][crate::model::output_config::BigQueryDestination::table_type].
9966        ///
9967        /// # Example
9968        /// ```ignore,no_run
9969        /// # use google_cloud_retail_v2::model::output_config::BigQueryDestination;
9970        /// let x = BigQueryDestination::new().set_table_type("example");
9971        /// ```
9972        pub fn set_table_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9973            self.table_type = v.into();
9974            self
9975        }
9976    }
9977
9978    impl wkt::message::Message for BigQueryDestination {
9979        fn typename() -> &'static str {
9980            "type.googleapis.com/google.cloud.retail.v2.OutputConfig.BigQueryDestination"
9981        }
9982    }
9983
9984    /// The configuration of destination for holding output data.
9985    #[derive(Clone, Debug, PartialEq)]
9986    #[non_exhaustive]
9987    pub enum Destination {
9988        /// The Google Cloud Storage location where the output is to be written to.
9989        GcsDestination(std::boxed::Box<crate::model::output_config::GcsDestination>),
9990        /// The BigQuery location where the output is to be written to.
9991        BigqueryDestination(std::boxed::Box<crate::model::output_config::BigQueryDestination>),
9992    }
9993}
9994
9995/// Configuration of destination for Export related errors.
9996#[derive(Clone, Default, PartialEq)]
9997#[non_exhaustive]
9998pub struct ExportErrorsConfig {
9999    /// Required. Errors destination.
10000    pub destination: std::option::Option<crate::model::export_errors_config::Destination>,
10001
10002    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10003}
10004
10005impl ExportErrorsConfig {
10006    /// Creates a new default instance.
10007    pub fn new() -> Self {
10008        std::default::Default::default()
10009    }
10010
10011    /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination].
10012    ///
10013    /// Note that all the setters affecting `destination` are mutually
10014    /// exclusive.
10015    ///
10016    /// # Example
10017    /// ```ignore,no_run
10018    /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
10019    /// use google_cloud_retail_v2::model::export_errors_config::Destination;
10020    /// let x = ExportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
10021    /// ```
10022    pub fn set_destination<
10023        T: std::convert::Into<std::option::Option<crate::model::export_errors_config::Destination>>,
10024    >(
10025        mut self,
10026        v: T,
10027    ) -> Self {
10028        self.destination = v.into();
10029        self
10030    }
10031
10032    /// The value of [destination][crate::model::ExportErrorsConfig::destination]
10033    /// if it holds a `GcsPrefix`, `None` if the field is not set or
10034    /// holds a different branch.
10035    pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
10036        #[allow(unreachable_patterns)]
10037        self.destination.as_ref().and_then(|v| match v {
10038            crate::model::export_errors_config::Destination::GcsPrefix(v) => {
10039                std::option::Option::Some(v)
10040            }
10041            _ => std::option::Option::None,
10042        })
10043    }
10044
10045    /// Sets the value of [destination][crate::model::ExportErrorsConfig::destination]
10046    /// to hold a `GcsPrefix`.
10047    ///
10048    /// Note that all the setters affecting `destination` are
10049    /// mutually exclusive.
10050    ///
10051    /// # Example
10052    /// ```ignore,no_run
10053    /// # use google_cloud_retail_v2::model::ExportErrorsConfig;
10054    /// let x = ExportErrorsConfig::new().set_gcs_prefix("example");
10055    /// assert!(x.gcs_prefix().is_some());
10056    /// ```
10057    pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10058        self.destination = std::option::Option::Some(
10059            crate::model::export_errors_config::Destination::GcsPrefix(v.into()),
10060        );
10061        self
10062    }
10063}
10064
10065impl wkt::message::Message for ExportErrorsConfig {
10066    fn typename() -> &'static str {
10067        "type.googleapis.com/google.cloud.retail.v2.ExportErrorsConfig"
10068    }
10069}
10070
10071/// Defines additional types related to [ExportErrorsConfig].
10072pub mod export_errors_config {
10073    #[allow(unused_imports)]
10074    use super::*;
10075
10076    /// Required. Errors destination.
10077    #[derive(Clone, Debug, PartialEq)]
10078    #[non_exhaustive]
10079    pub enum Destination {
10080        /// Google Cloud Storage path for import errors. This must be an empty,
10081        /// existing Cloud Storage bucket. Export errors will be written to a file in
10082        /// this bucket, one per line, as a JSON-encoded
10083        /// `google.rpc.Status` message.
10084        GcsPrefix(std::string::String),
10085    }
10086}
10087
10088/// Request message for the `ExportAnalyticsMetrics` method.
10089#[derive(Clone, Default, PartialEq)]
10090#[non_exhaustive]
10091pub struct ExportAnalyticsMetricsRequest {
10092    /// Required. Full resource name of the parent catalog.
10093    /// Expected format: `projects/*/locations/*/catalogs/*`
10094    pub catalog: std::string::String,
10095
10096    /// Required. The output location of the data.
10097    pub output_config: std::option::Option<crate::model::OutputConfig>,
10098
10099    /// A filtering expression to specify restrictions on returned metrics.
10100    /// The expression is a sequence of terms. Each term applies a restriction to
10101    /// the returned metrics. Use this expression to restrict results to a
10102    /// specific time range.
10103    ///
10104    /// Currently we expect only one types of fields:
10105    ///
10106    /// * `timestamp`: This can be specified twice, once with a
10107    ///   less than operator and once with a greater than operator. The
10108    ///   `timestamp` restriction should result in one, contiguous, valid,
10109    ///   `timestamp` range.
10110    ///
10111    /// Some examples of valid filters expressions:
10112    ///
10113    /// * Example 1: `timestamp > "2012-04-23T18:25:43.511Z"
10114    ///   timestamp < "2012-04-23T18:30:43.511Z"`
10115    /// * Example 2: `timestamp > "2012-04-23T18:25:43.511Z"`
10116    pub filter: std::string::String,
10117
10118    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10119}
10120
10121impl ExportAnalyticsMetricsRequest {
10122    /// Creates a new default instance.
10123    pub fn new() -> Self {
10124        std::default::Default::default()
10125    }
10126
10127    /// Sets the value of [catalog][crate::model::ExportAnalyticsMetricsRequest::catalog].
10128    ///
10129    /// # Example
10130    /// ```ignore,no_run
10131    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10132    /// let x = ExportAnalyticsMetricsRequest::new().set_catalog("example");
10133    /// ```
10134    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10135        self.catalog = v.into();
10136        self
10137    }
10138
10139    /// Sets the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10140    ///
10141    /// # Example
10142    /// ```ignore,no_run
10143    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10144    /// use google_cloud_retail_v2::model::OutputConfig;
10145    /// let x = ExportAnalyticsMetricsRequest::new().set_output_config(OutputConfig::default()/* use setters */);
10146    /// ```
10147    pub fn set_output_config<T>(mut self, v: T) -> Self
10148    where
10149        T: std::convert::Into<crate::model::OutputConfig>,
10150    {
10151        self.output_config = std::option::Option::Some(v.into());
10152        self
10153    }
10154
10155    /// Sets or clears the value of [output_config][crate::model::ExportAnalyticsMetricsRequest::output_config].
10156    ///
10157    /// # Example
10158    /// ```ignore,no_run
10159    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10160    /// use google_cloud_retail_v2::model::OutputConfig;
10161    /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(Some(OutputConfig::default()/* use setters */));
10162    /// let x = ExportAnalyticsMetricsRequest::new().set_or_clear_output_config(None::<OutputConfig>);
10163    /// ```
10164    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10165    where
10166        T: std::convert::Into<crate::model::OutputConfig>,
10167    {
10168        self.output_config = v.map(|x| x.into());
10169        self
10170    }
10171
10172    /// Sets the value of [filter][crate::model::ExportAnalyticsMetricsRequest::filter].
10173    ///
10174    /// # Example
10175    /// ```ignore,no_run
10176    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsRequest;
10177    /// let x = ExportAnalyticsMetricsRequest::new().set_filter("example");
10178    /// ```
10179    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10180        self.filter = v.into();
10181        self
10182    }
10183}
10184
10185impl wkt::message::Message for ExportAnalyticsMetricsRequest {
10186    fn typename() -> &'static str {
10187        "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsRequest"
10188    }
10189}
10190
10191/// Metadata related to the progress of the Export operation. This is
10192/// returned by the google.longrunning.Operation.metadata field.
10193#[derive(Clone, Default, PartialEq)]
10194#[non_exhaustive]
10195pub struct ExportMetadata {
10196    /// Operation create time.
10197    pub create_time: std::option::Option<wkt::Timestamp>,
10198
10199    /// Operation last update time. If the operation is done, this is also the
10200    /// finish time.
10201    pub update_time: std::option::Option<wkt::Timestamp>,
10202
10203    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10204}
10205
10206impl ExportMetadata {
10207    /// Creates a new default instance.
10208    pub fn new() -> Self {
10209        std::default::Default::default()
10210    }
10211
10212    /// Sets the value of [create_time][crate::model::ExportMetadata::create_time].
10213    ///
10214    /// # Example
10215    /// ```ignore,no_run
10216    /// # use google_cloud_retail_v2::model::ExportMetadata;
10217    /// use wkt::Timestamp;
10218    /// let x = ExportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10219    /// ```
10220    pub fn set_create_time<T>(mut self, v: T) -> Self
10221    where
10222        T: std::convert::Into<wkt::Timestamp>,
10223    {
10224        self.create_time = std::option::Option::Some(v.into());
10225        self
10226    }
10227
10228    /// Sets or clears the value of [create_time][crate::model::ExportMetadata::create_time].
10229    ///
10230    /// # Example
10231    /// ```ignore,no_run
10232    /// # use google_cloud_retail_v2::model::ExportMetadata;
10233    /// use wkt::Timestamp;
10234    /// let x = ExportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10235    /// let x = ExportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10236    /// ```
10237    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10238    where
10239        T: std::convert::Into<wkt::Timestamp>,
10240    {
10241        self.create_time = v.map(|x| x.into());
10242        self
10243    }
10244
10245    /// Sets the value of [update_time][crate::model::ExportMetadata::update_time].
10246    ///
10247    /// # Example
10248    /// ```ignore,no_run
10249    /// # use google_cloud_retail_v2::model::ExportMetadata;
10250    /// use wkt::Timestamp;
10251    /// let x = ExportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10252    /// ```
10253    pub fn set_update_time<T>(mut self, v: T) -> Self
10254    where
10255        T: std::convert::Into<wkt::Timestamp>,
10256    {
10257        self.update_time = std::option::Option::Some(v.into());
10258        self
10259    }
10260
10261    /// Sets or clears the value of [update_time][crate::model::ExportMetadata::update_time].
10262    ///
10263    /// # Example
10264    /// ```ignore,no_run
10265    /// # use google_cloud_retail_v2::model::ExportMetadata;
10266    /// use wkt::Timestamp;
10267    /// let x = ExportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10268    /// let x = ExportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10269    /// ```
10270    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10271    where
10272        T: std::convert::Into<wkt::Timestamp>,
10273    {
10274        self.update_time = v.map(|x| x.into());
10275        self
10276    }
10277}
10278
10279impl wkt::message::Message for ExportMetadata {
10280    fn typename() -> &'static str {
10281        "type.googleapis.com/google.cloud.retail.v2.ExportMetadata"
10282    }
10283}
10284
10285/// Response of the ExportAnalyticsMetricsRequest. If the long running
10286/// operation was successful, then this message is returned by the
10287/// google.longrunning.Operations.response field if the operation was successful.
10288#[derive(Clone, Default, PartialEq)]
10289#[non_exhaustive]
10290pub struct ExportAnalyticsMetricsResponse {
10291    /// A sample of errors encountered while processing the request.
10292    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
10293
10294    /// This field is never set.
10295    pub errors_config: std::option::Option<crate::model::ExportErrorsConfig>,
10296
10297    /// Output result indicating where the data were exported to.
10298    pub output_result: std::option::Option<crate::model::OutputResult>,
10299
10300    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10301}
10302
10303impl ExportAnalyticsMetricsResponse {
10304    /// Creates a new default instance.
10305    pub fn new() -> Self {
10306        std::default::Default::default()
10307    }
10308
10309    /// Sets the value of [error_samples][crate::model::ExportAnalyticsMetricsResponse::error_samples].
10310    ///
10311    /// # Example
10312    /// ```ignore,no_run
10313    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10314    /// use google_cloud_rpc::model::Status;
10315    /// let x = ExportAnalyticsMetricsResponse::new()
10316    ///     .set_error_samples([
10317    ///         Status::default()/* use setters */,
10318    ///         Status::default()/* use (different) setters */,
10319    ///     ]);
10320    /// ```
10321    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
10322    where
10323        T: std::iter::IntoIterator<Item = V>,
10324        V: std::convert::Into<google_cloud_rpc::model::Status>,
10325    {
10326        use std::iter::Iterator;
10327        self.error_samples = v.into_iter().map(|i| i.into()).collect();
10328        self
10329    }
10330
10331    /// Sets the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10332    ///
10333    /// # Example
10334    /// ```ignore,no_run
10335    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10336    /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10337    /// let x = ExportAnalyticsMetricsResponse::new().set_errors_config(ExportErrorsConfig::default()/* use setters */);
10338    /// ```
10339    pub fn set_errors_config<T>(mut self, v: T) -> Self
10340    where
10341        T: std::convert::Into<crate::model::ExportErrorsConfig>,
10342    {
10343        self.errors_config = std::option::Option::Some(v.into());
10344        self
10345    }
10346
10347    /// Sets or clears the value of [errors_config][crate::model::ExportAnalyticsMetricsResponse::errors_config].
10348    ///
10349    /// # Example
10350    /// ```ignore,no_run
10351    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10352    /// use google_cloud_retail_v2::model::ExportErrorsConfig;
10353    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(Some(ExportErrorsConfig::default()/* use setters */));
10354    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_errors_config(None::<ExportErrorsConfig>);
10355    /// ```
10356    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
10357    where
10358        T: std::convert::Into<crate::model::ExportErrorsConfig>,
10359    {
10360        self.errors_config = v.map(|x| x.into());
10361        self
10362    }
10363
10364    /// Sets the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10365    ///
10366    /// # Example
10367    /// ```ignore,no_run
10368    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10369    /// use google_cloud_retail_v2::model::OutputResult;
10370    /// let x = ExportAnalyticsMetricsResponse::new().set_output_result(OutputResult::default()/* use setters */);
10371    /// ```
10372    pub fn set_output_result<T>(mut self, v: T) -> Self
10373    where
10374        T: std::convert::Into<crate::model::OutputResult>,
10375    {
10376        self.output_result = std::option::Option::Some(v.into());
10377        self
10378    }
10379
10380    /// Sets or clears the value of [output_result][crate::model::ExportAnalyticsMetricsResponse::output_result].
10381    ///
10382    /// # Example
10383    /// ```ignore,no_run
10384    /// # use google_cloud_retail_v2::model::ExportAnalyticsMetricsResponse;
10385    /// use google_cloud_retail_v2::model::OutputResult;
10386    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(Some(OutputResult::default()/* use setters */));
10387    /// let x = ExportAnalyticsMetricsResponse::new().set_or_clear_output_result(None::<OutputResult>);
10388    /// ```
10389    pub fn set_or_clear_output_result<T>(mut self, v: std::option::Option<T>) -> Self
10390    where
10391        T: std::convert::Into<crate::model::OutputResult>,
10392    {
10393        self.output_result = v.map(|x| x.into());
10394        self
10395    }
10396}
10397
10398impl wkt::message::Message for ExportAnalyticsMetricsResponse {
10399    fn typename() -> &'static str {
10400        "type.googleapis.com/google.cloud.retail.v2.ExportAnalyticsMetricsResponse"
10401    }
10402}
10403
10404/// Output result that stores the information about where the exported data is
10405/// stored.
10406#[derive(Clone, Default, PartialEq)]
10407#[non_exhaustive]
10408pub struct OutputResult {
10409    /// The BigQuery location where the result is stored.
10410    pub bigquery_result: std::vec::Vec<crate::model::BigQueryOutputResult>,
10411
10412    /// The Google Cloud Storage location where the result is stored.
10413    pub gcs_result: std::vec::Vec<crate::model::GcsOutputResult>,
10414
10415    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10416}
10417
10418impl OutputResult {
10419    /// Creates a new default instance.
10420    pub fn new() -> Self {
10421        std::default::Default::default()
10422    }
10423
10424    /// Sets the value of [bigquery_result][crate::model::OutputResult::bigquery_result].
10425    ///
10426    /// # Example
10427    /// ```ignore,no_run
10428    /// # use google_cloud_retail_v2::model::OutputResult;
10429    /// use google_cloud_retail_v2::model::BigQueryOutputResult;
10430    /// let x = OutputResult::new()
10431    ///     .set_bigquery_result([
10432    ///         BigQueryOutputResult::default()/* use setters */,
10433    ///         BigQueryOutputResult::default()/* use (different) setters */,
10434    ///     ]);
10435    /// ```
10436    pub fn set_bigquery_result<T, V>(mut self, v: T) -> Self
10437    where
10438        T: std::iter::IntoIterator<Item = V>,
10439        V: std::convert::Into<crate::model::BigQueryOutputResult>,
10440    {
10441        use std::iter::Iterator;
10442        self.bigquery_result = v.into_iter().map(|i| i.into()).collect();
10443        self
10444    }
10445
10446    /// Sets the value of [gcs_result][crate::model::OutputResult::gcs_result].
10447    ///
10448    /// # Example
10449    /// ```ignore,no_run
10450    /// # use google_cloud_retail_v2::model::OutputResult;
10451    /// use google_cloud_retail_v2::model::GcsOutputResult;
10452    /// let x = OutputResult::new()
10453    ///     .set_gcs_result([
10454    ///         GcsOutputResult::default()/* use setters */,
10455    ///         GcsOutputResult::default()/* use (different) setters */,
10456    ///     ]);
10457    /// ```
10458    pub fn set_gcs_result<T, V>(mut self, v: T) -> Self
10459    where
10460        T: std::iter::IntoIterator<Item = V>,
10461        V: std::convert::Into<crate::model::GcsOutputResult>,
10462    {
10463        use std::iter::Iterator;
10464        self.gcs_result = v.into_iter().map(|i| i.into()).collect();
10465        self
10466    }
10467}
10468
10469impl wkt::message::Message for OutputResult {
10470    fn typename() -> &'static str {
10471        "type.googleapis.com/google.cloud.retail.v2.OutputResult"
10472    }
10473}
10474
10475/// A BigQuery output result.
10476#[derive(Clone, Default, PartialEq)]
10477#[non_exhaustive]
10478pub struct BigQueryOutputResult {
10479    /// The ID of a BigQuery Dataset.
10480    pub dataset_id: std::string::String,
10481
10482    /// The ID of a BigQuery Table.
10483    pub table_id: std::string::String,
10484
10485    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10486}
10487
10488impl BigQueryOutputResult {
10489    /// Creates a new default instance.
10490    pub fn new() -> Self {
10491        std::default::Default::default()
10492    }
10493
10494    /// Sets the value of [dataset_id][crate::model::BigQueryOutputResult::dataset_id].
10495    ///
10496    /// # Example
10497    /// ```ignore,no_run
10498    /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10499    /// let x = BigQueryOutputResult::new().set_dataset_id("example");
10500    /// ```
10501    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10502        self.dataset_id = v.into();
10503        self
10504    }
10505
10506    /// Sets the value of [table_id][crate::model::BigQueryOutputResult::table_id].
10507    ///
10508    /// # Example
10509    /// ```ignore,no_run
10510    /// # use google_cloud_retail_v2::model::BigQueryOutputResult;
10511    /// let x = BigQueryOutputResult::new().set_table_id("example");
10512    /// ```
10513    pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10514        self.table_id = v.into();
10515        self
10516    }
10517}
10518
10519impl wkt::message::Message for BigQueryOutputResult {
10520    fn typename() -> &'static str {
10521        "type.googleapis.com/google.cloud.retail.v2.BigQueryOutputResult"
10522    }
10523}
10524
10525/// A Gcs output result.
10526#[derive(Clone, Default, PartialEq)]
10527#[non_exhaustive]
10528pub struct GcsOutputResult {
10529    /// The uri of Gcs output
10530    pub output_uri: std::string::String,
10531
10532    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10533}
10534
10535impl GcsOutputResult {
10536    /// Creates a new default instance.
10537    pub fn new() -> Self {
10538        std::default::Default::default()
10539    }
10540
10541    /// Sets the value of [output_uri][crate::model::GcsOutputResult::output_uri].
10542    ///
10543    /// # Example
10544    /// ```ignore,no_run
10545    /// # use google_cloud_retail_v2::model::GcsOutputResult;
10546    /// let x = GcsOutputResult::new().set_output_uri("example");
10547    /// ```
10548    pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10549        self.output_uri = v.into();
10550        self
10551    }
10552}
10553
10554impl wkt::message::Message for GcsOutputResult {
10555    fn typename() -> &'static str {
10556        "type.googleapis.com/google.cloud.retail.v2.GcsOutputResult"
10557    }
10558}
10559
10560/// Configuration for overall generative question feature state.
10561#[derive(Clone, Default, PartialEq)]
10562#[non_exhaustive]
10563pub struct GenerativeQuestionsFeatureConfig {
10564    /// Required. Resource name of the affected catalog.
10565    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10566    pub catalog: std::string::String,
10567
10568    /// Optional. Determines whether questions will be used at serving time.
10569    /// Note: This feature cannot be enabled until initial data requirements are
10570    /// satisfied.
10571    pub feature_enabled: bool,
10572
10573    /// Optional. Minimum number of products in the response to trigger follow-up
10574    /// questions. Value must be 0 or positive.
10575    pub minimum_products: i32,
10576
10577    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10578}
10579
10580impl GenerativeQuestionsFeatureConfig {
10581    /// Creates a new default instance.
10582    pub fn new() -> Self {
10583        std::default::Default::default()
10584    }
10585
10586    /// Sets the value of [catalog][crate::model::GenerativeQuestionsFeatureConfig::catalog].
10587    ///
10588    /// # Example
10589    /// ```ignore,no_run
10590    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10591    /// let x = GenerativeQuestionsFeatureConfig::new().set_catalog("example");
10592    /// ```
10593    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10594        self.catalog = v.into();
10595        self
10596    }
10597
10598    /// Sets the value of [feature_enabled][crate::model::GenerativeQuestionsFeatureConfig::feature_enabled].
10599    ///
10600    /// # Example
10601    /// ```ignore,no_run
10602    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10603    /// let x = GenerativeQuestionsFeatureConfig::new().set_feature_enabled(true);
10604    /// ```
10605    pub fn set_feature_enabled<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10606        self.feature_enabled = v.into();
10607        self
10608    }
10609
10610    /// Sets the value of [minimum_products][crate::model::GenerativeQuestionsFeatureConfig::minimum_products].
10611    ///
10612    /// # Example
10613    /// ```ignore,no_run
10614    /// # use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10615    /// let x = GenerativeQuestionsFeatureConfig::new().set_minimum_products(42);
10616    /// ```
10617    pub fn set_minimum_products<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10618        self.minimum_products = v.into();
10619        self
10620    }
10621}
10622
10623impl wkt::message::Message for GenerativeQuestionsFeatureConfig {
10624    fn typename() -> &'static str {
10625        "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionsFeatureConfig"
10626    }
10627}
10628
10629/// Configuration for a single generated question.
10630#[derive(Clone, Default, PartialEq)]
10631#[non_exhaustive]
10632pub struct GenerativeQuestionConfig {
10633    /// Required. Resource name of the catalog.
10634    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10635    pub catalog: std::string::String,
10636
10637    /// Required. The facet to which the question is associated.
10638    pub facet: std::string::String,
10639
10640    /// Output only. The LLM generated question.
10641    pub generated_question: std::string::String,
10642
10643    /// Optional. The question that will be used at serving time.
10644    /// Question can have a max length of 300 bytes.
10645    /// When not populated, generated_question should be used.
10646    pub final_question: std::string::String,
10647
10648    /// Output only. Values that can be used to answer the question.
10649    pub example_values: std::vec::Vec<std::string::String>,
10650
10651    /// Output only. The ratio of how often a question was asked.
10652    pub frequency: f32,
10653
10654    /// Optional. Whether the question is asked at serving time.
10655    pub allowed_in_conversation: bool,
10656
10657    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10658}
10659
10660impl GenerativeQuestionConfig {
10661    /// Creates a new default instance.
10662    pub fn new() -> Self {
10663        std::default::Default::default()
10664    }
10665
10666    /// Sets the value of [catalog][crate::model::GenerativeQuestionConfig::catalog].
10667    ///
10668    /// # Example
10669    /// ```ignore,no_run
10670    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10671    /// let x = GenerativeQuestionConfig::new().set_catalog("example");
10672    /// ```
10673    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10674        self.catalog = v.into();
10675        self
10676    }
10677
10678    /// Sets the value of [facet][crate::model::GenerativeQuestionConfig::facet].
10679    ///
10680    /// # Example
10681    /// ```ignore,no_run
10682    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10683    /// let x = GenerativeQuestionConfig::new().set_facet("example");
10684    /// ```
10685    pub fn set_facet<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10686        self.facet = v.into();
10687        self
10688    }
10689
10690    /// Sets the value of [generated_question][crate::model::GenerativeQuestionConfig::generated_question].
10691    ///
10692    /// # Example
10693    /// ```ignore,no_run
10694    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10695    /// let x = GenerativeQuestionConfig::new().set_generated_question("example");
10696    /// ```
10697    pub fn set_generated_question<T: std::convert::Into<std::string::String>>(
10698        mut self,
10699        v: T,
10700    ) -> Self {
10701        self.generated_question = v.into();
10702        self
10703    }
10704
10705    /// Sets the value of [final_question][crate::model::GenerativeQuestionConfig::final_question].
10706    ///
10707    /// # Example
10708    /// ```ignore,no_run
10709    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10710    /// let x = GenerativeQuestionConfig::new().set_final_question("example");
10711    /// ```
10712    pub fn set_final_question<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10713        self.final_question = v.into();
10714        self
10715    }
10716
10717    /// Sets the value of [example_values][crate::model::GenerativeQuestionConfig::example_values].
10718    ///
10719    /// # Example
10720    /// ```ignore,no_run
10721    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10722    /// let x = GenerativeQuestionConfig::new().set_example_values(["a", "b", "c"]);
10723    /// ```
10724    pub fn set_example_values<T, V>(mut self, v: T) -> Self
10725    where
10726        T: std::iter::IntoIterator<Item = V>,
10727        V: std::convert::Into<std::string::String>,
10728    {
10729        use std::iter::Iterator;
10730        self.example_values = v.into_iter().map(|i| i.into()).collect();
10731        self
10732    }
10733
10734    /// Sets the value of [frequency][crate::model::GenerativeQuestionConfig::frequency].
10735    ///
10736    /// # Example
10737    /// ```ignore,no_run
10738    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10739    /// let x = GenerativeQuestionConfig::new().set_frequency(42.0);
10740    /// ```
10741    pub fn set_frequency<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
10742        self.frequency = v.into();
10743        self
10744    }
10745
10746    /// Sets the value of [allowed_in_conversation][crate::model::GenerativeQuestionConfig::allowed_in_conversation].
10747    ///
10748    /// # Example
10749    /// ```ignore,no_run
10750    /// # use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10751    /// let x = GenerativeQuestionConfig::new().set_allowed_in_conversation(true);
10752    /// ```
10753    pub fn set_allowed_in_conversation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10754        self.allowed_in_conversation = v.into();
10755        self
10756    }
10757}
10758
10759impl wkt::message::Message for GenerativeQuestionConfig {
10760    fn typename() -> &'static str {
10761        "type.googleapis.com/google.cloud.retail.v2.GenerativeQuestionConfig"
10762    }
10763}
10764
10765/// Request for UpdateGenerativeQuestionsFeatureConfig method.
10766#[derive(Clone, Default, PartialEq)]
10767#[non_exhaustive]
10768pub struct UpdateGenerativeQuestionsFeatureConfigRequest {
10769    /// Required. The configuration managing the feature state.
10770    pub generative_questions_feature_config:
10771        std::option::Option<crate::model::GenerativeQuestionsFeatureConfig>,
10772
10773    /// Optional. Indicates which fields in the provided
10774    /// [GenerativeQuestionsFeatureConfig][google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]
10775    /// to update. If not set or empty, all supported fields are updated.
10776    ///
10777    /// [google.cloud.retail.v2.GenerativeQuestionsFeatureConfig]: crate::model::GenerativeQuestionsFeatureConfig
10778    pub update_mask: std::option::Option<wkt::FieldMask>,
10779
10780    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10781}
10782
10783impl UpdateGenerativeQuestionsFeatureConfigRequest {
10784    /// Creates a new default instance.
10785    pub fn new() -> Self {
10786        std::default::Default::default()
10787    }
10788
10789    /// Sets the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10790    ///
10791    /// # Example
10792    /// ```ignore,no_run
10793    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10794    /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10795    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_generative_questions_feature_config(GenerativeQuestionsFeatureConfig::default()/* use setters */);
10796    /// ```
10797    pub fn set_generative_questions_feature_config<T>(mut self, v: T) -> Self
10798    where
10799        T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10800    {
10801        self.generative_questions_feature_config = std::option::Option::Some(v.into());
10802        self
10803    }
10804
10805    /// Sets or clears the value of [generative_questions_feature_config][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::generative_questions_feature_config].
10806    ///
10807    /// # Example
10808    /// ```ignore,no_run
10809    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10810    /// use google_cloud_retail_v2::model::GenerativeQuestionsFeatureConfig;
10811    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(Some(GenerativeQuestionsFeatureConfig::default()/* use setters */));
10812    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_generative_questions_feature_config(None::<GenerativeQuestionsFeatureConfig>);
10813    /// ```
10814    pub fn set_or_clear_generative_questions_feature_config<T>(
10815        mut self,
10816        v: std::option::Option<T>,
10817    ) -> Self
10818    where
10819        T: std::convert::Into<crate::model::GenerativeQuestionsFeatureConfig>,
10820    {
10821        self.generative_questions_feature_config = v.map(|x| x.into());
10822        self
10823    }
10824
10825    /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10826    ///
10827    /// # Example
10828    /// ```ignore,no_run
10829    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10830    /// use wkt::FieldMask;
10831    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
10832    /// ```
10833    pub fn set_update_mask<T>(mut self, v: T) -> Self
10834    where
10835        T: std::convert::Into<wkt::FieldMask>,
10836    {
10837        self.update_mask = std::option::Option::Some(v.into());
10838        self
10839    }
10840
10841    /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionsFeatureConfigRequest::update_mask].
10842    ///
10843    /// # Example
10844    /// ```ignore,no_run
10845    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionsFeatureConfigRequest;
10846    /// use wkt::FieldMask;
10847    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
10848    /// let x = UpdateGenerativeQuestionsFeatureConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
10849    /// ```
10850    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
10851    where
10852        T: std::convert::Into<wkt::FieldMask>,
10853    {
10854        self.update_mask = v.map(|x| x.into());
10855        self
10856    }
10857}
10858
10859impl wkt::message::Message for UpdateGenerativeQuestionsFeatureConfigRequest {
10860    fn typename() -> &'static str {
10861        "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionsFeatureConfigRequest"
10862    }
10863}
10864
10865/// Request for GetGenerativeQuestionsFeatureConfig method.
10866#[derive(Clone, Default, PartialEq)]
10867#[non_exhaustive]
10868pub struct GetGenerativeQuestionsFeatureConfigRequest {
10869    /// Required. Resource name of the parent catalog.
10870    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10871    pub catalog: std::string::String,
10872
10873    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10874}
10875
10876impl GetGenerativeQuestionsFeatureConfigRequest {
10877    /// Creates a new default instance.
10878    pub fn new() -> Self {
10879        std::default::Default::default()
10880    }
10881
10882    /// Sets the value of [catalog][crate::model::GetGenerativeQuestionsFeatureConfigRequest::catalog].
10883    ///
10884    /// # Example
10885    /// ```ignore,no_run
10886    /// # use google_cloud_retail_v2::model::GetGenerativeQuestionsFeatureConfigRequest;
10887    /// # let project_id = "project_id";
10888    /// # let location_id = "location_id";
10889    /// # let catalog_id = "catalog_id";
10890    /// let x = GetGenerativeQuestionsFeatureConfigRequest::new().set_catalog(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
10891    /// ```
10892    pub fn set_catalog<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10893        self.catalog = v.into();
10894        self
10895    }
10896}
10897
10898impl wkt::message::Message for GetGenerativeQuestionsFeatureConfigRequest {
10899    fn typename() -> &'static str {
10900        "type.googleapis.com/google.cloud.retail.v2.GetGenerativeQuestionsFeatureConfigRequest"
10901    }
10902}
10903
10904/// Request for ListQuestions method.
10905#[derive(Clone, Default, PartialEq)]
10906#[non_exhaustive]
10907pub struct ListGenerativeQuestionConfigsRequest {
10908    /// Required. Resource name of the parent catalog.
10909    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
10910    pub parent: std::string::String,
10911
10912    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10913}
10914
10915impl ListGenerativeQuestionConfigsRequest {
10916    /// Creates a new default instance.
10917    pub fn new() -> Self {
10918        std::default::Default::default()
10919    }
10920
10921    /// Sets the value of [parent][crate::model::ListGenerativeQuestionConfigsRequest::parent].
10922    ///
10923    /// # Example
10924    /// ```ignore,no_run
10925    /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsRequest;
10926    /// # let project_id = "project_id";
10927    /// # let location_id = "location_id";
10928    /// # let catalog_id = "catalog_id";
10929    /// let x = ListGenerativeQuestionConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
10930    /// ```
10931    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10932        self.parent = v.into();
10933        self
10934    }
10935}
10936
10937impl wkt::message::Message for ListGenerativeQuestionConfigsRequest {
10938    fn typename() -> &'static str {
10939        "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsRequest"
10940    }
10941}
10942
10943/// Response for ListQuestions method.
10944#[derive(Clone, Default, PartialEq)]
10945#[non_exhaustive]
10946pub struct ListGenerativeQuestionConfigsResponse {
10947    /// All the questions for a given catalog.
10948    pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
10949
10950    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10951}
10952
10953impl ListGenerativeQuestionConfigsResponse {
10954    /// Creates a new default instance.
10955    pub fn new() -> Self {
10956        std::default::Default::default()
10957    }
10958
10959    /// Sets the value of [generative_question_configs][crate::model::ListGenerativeQuestionConfigsResponse::generative_question_configs].
10960    ///
10961    /// # Example
10962    /// ```ignore,no_run
10963    /// # use google_cloud_retail_v2::model::ListGenerativeQuestionConfigsResponse;
10964    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
10965    /// let x = ListGenerativeQuestionConfigsResponse::new()
10966    ///     .set_generative_question_configs([
10967    ///         GenerativeQuestionConfig::default()/* use setters */,
10968    ///         GenerativeQuestionConfig::default()/* use (different) setters */,
10969    ///     ]);
10970    /// ```
10971    pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
10972    where
10973        T: std::iter::IntoIterator<Item = V>,
10974        V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
10975    {
10976        use std::iter::Iterator;
10977        self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
10978        self
10979    }
10980}
10981
10982impl wkt::message::Message for ListGenerativeQuestionConfigsResponse {
10983    fn typename() -> &'static str {
10984        "type.googleapis.com/google.cloud.retail.v2.ListGenerativeQuestionConfigsResponse"
10985    }
10986}
10987
10988/// Request for UpdateGenerativeQuestionConfig method.
10989#[derive(Clone, Default, PartialEq)]
10990#[non_exhaustive]
10991pub struct UpdateGenerativeQuestionConfigRequest {
10992    /// Required. The question to update.
10993    pub generative_question_config: std::option::Option<crate::model::GenerativeQuestionConfig>,
10994
10995    /// Optional. Indicates which fields in the provided
10996    /// [GenerativeQuestionConfig][google.cloud.retail.v2.GenerativeQuestionConfig]
10997    /// to update. The following are NOT supported:
10998    ///
10999    /// * [GenerativeQuestionConfig.frequency][google.cloud.retail.v2.GenerativeQuestionConfig.frequency]
11000    ///
11001    /// If not set or empty, all supported fields are updated.
11002    ///
11003    /// [google.cloud.retail.v2.GenerativeQuestionConfig]: crate::model::GenerativeQuestionConfig
11004    /// [google.cloud.retail.v2.GenerativeQuestionConfig.frequency]: crate::model::GenerativeQuestionConfig::frequency
11005    pub update_mask: std::option::Option<wkt::FieldMask>,
11006
11007    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11008}
11009
11010impl UpdateGenerativeQuestionConfigRequest {
11011    /// Creates a new default instance.
11012    pub fn new() -> Self {
11013        std::default::Default::default()
11014    }
11015
11016    /// Sets the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
11017    ///
11018    /// # Example
11019    /// ```ignore,no_run
11020    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11021    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11022    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_generative_question_config(GenerativeQuestionConfig::default()/* use setters */);
11023    /// ```
11024    pub fn set_generative_question_config<T>(mut self, v: T) -> Self
11025    where
11026        T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11027    {
11028        self.generative_question_config = std::option::Option::Some(v.into());
11029        self
11030    }
11031
11032    /// Sets or clears the value of [generative_question_config][crate::model::UpdateGenerativeQuestionConfigRequest::generative_question_config].
11033    ///
11034    /// # Example
11035    /// ```ignore,no_run
11036    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11037    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11038    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(Some(GenerativeQuestionConfig::default()/* use setters */));
11039    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_generative_question_config(None::<GenerativeQuestionConfig>);
11040    /// ```
11041    pub fn set_or_clear_generative_question_config<T>(mut self, v: std::option::Option<T>) -> Self
11042    where
11043        T: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11044    {
11045        self.generative_question_config = v.map(|x| x.into());
11046        self
11047    }
11048
11049    /// Sets the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
11050    ///
11051    /// # Example
11052    /// ```ignore,no_run
11053    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11054    /// use wkt::FieldMask;
11055    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11056    /// ```
11057    pub fn set_update_mask<T>(mut self, v: T) -> Self
11058    where
11059        T: std::convert::Into<wkt::FieldMask>,
11060    {
11061        self.update_mask = std::option::Option::Some(v.into());
11062        self
11063    }
11064
11065    /// Sets or clears the value of [update_mask][crate::model::UpdateGenerativeQuestionConfigRequest::update_mask].
11066    ///
11067    /// # Example
11068    /// ```ignore,no_run
11069    /// # use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11070    /// use wkt::FieldMask;
11071    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11072    /// let x = UpdateGenerativeQuestionConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11073    /// ```
11074    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11075    where
11076        T: std::convert::Into<wkt::FieldMask>,
11077    {
11078        self.update_mask = v.map(|x| x.into());
11079        self
11080    }
11081}
11082
11083impl wkt::message::Message for UpdateGenerativeQuestionConfigRequest {
11084    fn typename() -> &'static str {
11085        "type.googleapis.com/google.cloud.retail.v2.UpdateGenerativeQuestionConfigRequest"
11086    }
11087}
11088
11089/// Request for BatchUpdateGenerativeQuestionConfig method.
11090#[derive(Clone, Default, PartialEq)]
11091#[non_exhaustive]
11092pub struct BatchUpdateGenerativeQuestionConfigsRequest {
11093    /// Optional. Resource name of the parent catalog.
11094    /// Format: projects/{project}/locations/{location}/catalogs/{catalog}
11095    pub parent: std::string::String,
11096
11097    /// Required. The updates question configs.
11098    pub requests: std::vec::Vec<crate::model::UpdateGenerativeQuestionConfigRequest>,
11099
11100    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11101}
11102
11103impl BatchUpdateGenerativeQuestionConfigsRequest {
11104    /// Creates a new default instance.
11105    pub fn new() -> Self {
11106        std::default::Default::default()
11107    }
11108
11109    /// Sets the value of [parent][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::parent].
11110    ///
11111    /// # Example
11112    /// ```ignore,no_run
11113    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
11114    /// # let project_id = "project_id";
11115    /// # let location_id = "location_id";
11116    /// # let catalog_id = "catalog_id";
11117    /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
11118    /// ```
11119    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11120        self.parent = v.into();
11121        self
11122    }
11123
11124    /// Sets the value of [requests][crate::model::BatchUpdateGenerativeQuestionConfigsRequest::requests].
11125    ///
11126    /// # Example
11127    /// ```ignore,no_run
11128    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsRequest;
11129    /// use google_cloud_retail_v2::model::UpdateGenerativeQuestionConfigRequest;
11130    /// let x = BatchUpdateGenerativeQuestionConfigsRequest::new()
11131    ///     .set_requests([
11132    ///         UpdateGenerativeQuestionConfigRequest::default()/* use setters */,
11133    ///         UpdateGenerativeQuestionConfigRequest::default()/* use (different) setters */,
11134    ///     ]);
11135    /// ```
11136    pub fn set_requests<T, V>(mut self, v: T) -> Self
11137    where
11138        T: std::iter::IntoIterator<Item = V>,
11139        V: std::convert::Into<crate::model::UpdateGenerativeQuestionConfigRequest>,
11140    {
11141        use std::iter::Iterator;
11142        self.requests = v.into_iter().map(|i| i.into()).collect();
11143        self
11144    }
11145}
11146
11147impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsRequest {
11148    fn typename() -> &'static str {
11149        "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsRequest"
11150    }
11151}
11152
11153/// Aggregated response for UpdateGenerativeQuestionConfig method.
11154#[derive(Clone, Default, PartialEq)]
11155#[non_exhaustive]
11156pub struct BatchUpdateGenerativeQuestionConfigsResponse {
11157    /// Optional. The updates question configs.
11158    pub generative_question_configs: std::vec::Vec<crate::model::GenerativeQuestionConfig>,
11159
11160    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11161}
11162
11163impl BatchUpdateGenerativeQuestionConfigsResponse {
11164    /// Creates a new default instance.
11165    pub fn new() -> Self {
11166        std::default::Default::default()
11167    }
11168
11169    /// Sets the value of [generative_question_configs][crate::model::BatchUpdateGenerativeQuestionConfigsResponse::generative_question_configs].
11170    ///
11171    /// # Example
11172    /// ```ignore,no_run
11173    /// # use google_cloud_retail_v2::model::BatchUpdateGenerativeQuestionConfigsResponse;
11174    /// use google_cloud_retail_v2::model::GenerativeQuestionConfig;
11175    /// let x = BatchUpdateGenerativeQuestionConfigsResponse::new()
11176    ///     .set_generative_question_configs([
11177    ///         GenerativeQuestionConfig::default()/* use setters */,
11178    ///         GenerativeQuestionConfig::default()/* use (different) setters */,
11179    ///     ]);
11180    /// ```
11181    pub fn set_generative_question_configs<T, V>(mut self, v: T) -> Self
11182    where
11183        T: std::iter::IntoIterator<Item = V>,
11184        V: std::convert::Into<crate::model::GenerativeQuestionConfig>,
11185    {
11186        use std::iter::Iterator;
11187        self.generative_question_configs = v.into_iter().map(|i| i.into()).collect();
11188        self
11189    }
11190}
11191
11192impl wkt::message::Message for BatchUpdateGenerativeQuestionConfigsResponse {
11193    fn typename() -> &'static str {
11194        "type.googleapis.com/google.cloud.retail.v2.BatchUpdateGenerativeQuestionConfigsResponse"
11195    }
11196}
11197
11198/// Google Cloud Storage location for input content.
11199#[derive(Clone, Default, PartialEq)]
11200#[non_exhaustive]
11201pub struct GcsSource {
11202    /// Required. Google Cloud Storage URIs to input files. URI can be up to
11203    /// 2000 characters long. URIs can match the full object path (for example,
11204    /// `gs://bucket/directory/object.json`) or a pattern matching one or more
11205    /// files, such as `gs://bucket/directory/*.json`. A request can
11206    /// contain at most 100 files, and each file can be up to 2 GB. See
11207    /// [Importing product
11208    /// information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
11209    /// for the expected file format and setup instructions.
11210    pub input_uris: std::vec::Vec<std::string::String>,
11211
11212    /// The schema to use when parsing the data from the source.
11213    ///
11214    /// Supported values for product imports:
11215    ///
11216    /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11217    ///   per line. Each product must
11218    ///   have a valid [Product.id][google.cloud.retail.v2.Product.id].
11219    /// * `product_merchant_center`: See [Importing catalog data from Merchant
11220    ///   Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11221    ///
11222    /// Supported values for user events imports:
11223    ///
11224    /// * `user_event` (default): One JSON
11225    ///   [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11226    /// * `user_event_ga360`: Using
11227    ///   <https://support.google.com/analytics/answer/3437719>.
11228    ///
11229    /// Supported values for control imports:
11230    ///
11231    /// * `control` (default): One JSON [Control][google.cloud.retail.v2.Control]
11232    ///   per line.
11233    ///
11234    /// Supported values for catalog attribute imports:
11235    ///
11236    /// * `catalog_attribute` (default): One CSV
11237    ///   [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line.
11238    ///
11239    /// [google.cloud.retail.v2.CatalogAttribute]: crate::model::CatalogAttribute
11240    /// [google.cloud.retail.v2.Control]: crate::model::Control
11241    /// [google.cloud.retail.v2.Product]: crate::model::Product
11242    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11243    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11244    pub data_schema: std::string::String,
11245
11246    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11247}
11248
11249impl GcsSource {
11250    /// Creates a new default instance.
11251    pub fn new() -> Self {
11252        std::default::Default::default()
11253    }
11254
11255    /// Sets the value of [input_uris][crate::model::GcsSource::input_uris].
11256    ///
11257    /// # Example
11258    /// ```ignore,no_run
11259    /// # use google_cloud_retail_v2::model::GcsSource;
11260    /// let x = GcsSource::new().set_input_uris(["a", "b", "c"]);
11261    /// ```
11262    pub fn set_input_uris<T, V>(mut self, v: T) -> Self
11263    where
11264        T: std::iter::IntoIterator<Item = V>,
11265        V: std::convert::Into<std::string::String>,
11266    {
11267        use std::iter::Iterator;
11268        self.input_uris = v.into_iter().map(|i| i.into()).collect();
11269        self
11270    }
11271
11272    /// Sets the value of [data_schema][crate::model::GcsSource::data_schema].
11273    ///
11274    /// # Example
11275    /// ```ignore,no_run
11276    /// # use google_cloud_retail_v2::model::GcsSource;
11277    /// let x = GcsSource::new().set_data_schema("example");
11278    /// ```
11279    pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11280        self.data_schema = v.into();
11281        self
11282    }
11283}
11284
11285impl wkt::message::Message for GcsSource {
11286    fn typename() -> &'static str {
11287        "type.googleapis.com/google.cloud.retail.v2.GcsSource"
11288    }
11289}
11290
11291/// BigQuery source import data from.
11292#[derive(Clone, Default, PartialEq)]
11293#[non_exhaustive]
11294pub struct BigQuerySource {
11295    /// The project ID (can be project # or ID) that the BigQuery source is in with
11296    /// a length limit of 128 characters. If not specified, inherits the project
11297    /// ID from the parent request.
11298    pub project_id: std::string::String,
11299
11300    /// Required. The BigQuery data set to copy the data from with a length limit
11301    /// of 1,024 characters.
11302    pub dataset_id: std::string::String,
11303
11304    /// Required. The BigQuery table to copy the data from with a length limit of
11305    /// 1,024 characters.
11306    pub table_id: std::string::String,
11307
11308    /// Intermediate Cloud Storage directory used for the import with a length
11309    /// limit of 2,000 characters. Can be specified if one wants to have the
11310    /// BigQuery export to a specific Cloud Storage directory.
11311    pub gcs_staging_dir: std::string::String,
11312
11313    /// The schema to use when parsing the data from the source.
11314    ///
11315    /// Supported values for product imports:
11316    ///
11317    /// * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
11318    ///   per line. Each product must
11319    ///   have a valid [Product.id][google.cloud.retail.v2.Product.id].
11320    /// * `product_merchant_center`: See [Importing catalog data from Merchant
11321    ///   Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
11322    ///
11323    /// Supported values for user events imports:
11324    ///
11325    /// * `user_event` (default): One JSON
11326    ///   [UserEvent][google.cloud.retail.v2.UserEvent] per line.
11327    /// * `user_event_ga360`:
11328    ///   The schema is available here:
11329    ///   <https://support.google.com/analytics/answer/3437719>.
11330    /// * `user_event_ga4`:
11331    ///   The schema is available here:
11332    ///   <https://support.google.com/analytics/answer/7029846>.
11333    ///
11334    /// Supported values for autocomplete imports:
11335    ///
11336    /// * `suggestions` (default): One JSON completion suggestion per line.
11337    /// * `denylist`:  One JSON deny suggestion per line.
11338    /// * `allowlist`:  One JSON allow suggestion per line.
11339    ///
11340    /// [google.cloud.retail.v2.Product]: crate::model::Product
11341    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11342    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
11343    pub data_schema: std::string::String,
11344
11345    /// BigQuery table partition info. Leave this empty if the BigQuery table
11346    /// is not partitioned.
11347    pub partition: std::option::Option<crate::model::big_query_source::Partition>,
11348
11349    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11350}
11351
11352impl BigQuerySource {
11353    /// Creates a new default instance.
11354    pub fn new() -> Self {
11355        std::default::Default::default()
11356    }
11357
11358    /// Sets the value of [project_id][crate::model::BigQuerySource::project_id].
11359    ///
11360    /// # Example
11361    /// ```ignore,no_run
11362    /// # use google_cloud_retail_v2::model::BigQuerySource;
11363    /// let x = BigQuerySource::new().set_project_id("example");
11364    /// ```
11365    pub fn set_project_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11366        self.project_id = v.into();
11367        self
11368    }
11369
11370    /// Sets the value of [dataset_id][crate::model::BigQuerySource::dataset_id].
11371    ///
11372    /// # Example
11373    /// ```ignore,no_run
11374    /// # use google_cloud_retail_v2::model::BigQuerySource;
11375    /// let x = BigQuerySource::new().set_dataset_id("example");
11376    /// ```
11377    pub fn set_dataset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11378        self.dataset_id = v.into();
11379        self
11380    }
11381
11382    /// Sets the value of [table_id][crate::model::BigQuerySource::table_id].
11383    ///
11384    /// # Example
11385    /// ```ignore,no_run
11386    /// # use google_cloud_retail_v2::model::BigQuerySource;
11387    /// let x = BigQuerySource::new().set_table_id("example");
11388    /// ```
11389    pub fn set_table_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11390        self.table_id = v.into();
11391        self
11392    }
11393
11394    /// Sets the value of [gcs_staging_dir][crate::model::BigQuerySource::gcs_staging_dir].
11395    ///
11396    /// # Example
11397    /// ```ignore,no_run
11398    /// # use google_cloud_retail_v2::model::BigQuerySource;
11399    /// let x = BigQuerySource::new().set_gcs_staging_dir("example");
11400    /// ```
11401    pub fn set_gcs_staging_dir<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11402        self.gcs_staging_dir = v.into();
11403        self
11404    }
11405
11406    /// Sets the value of [data_schema][crate::model::BigQuerySource::data_schema].
11407    ///
11408    /// # Example
11409    /// ```ignore,no_run
11410    /// # use google_cloud_retail_v2::model::BigQuerySource;
11411    /// let x = BigQuerySource::new().set_data_schema("example");
11412    /// ```
11413    pub fn set_data_schema<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11414        self.data_schema = v.into();
11415        self
11416    }
11417
11418    /// Sets the value of [partition][crate::model::BigQuerySource::partition].
11419    ///
11420    /// Note that all the setters affecting `partition` are mutually
11421    /// exclusive.
11422    ///
11423    /// # Example
11424    /// ```ignore,no_run
11425    /// # use google_cloud_retail_v2::model::BigQuerySource;
11426    /// use google_cloud_type::model::Date;
11427    /// let x = BigQuerySource::new().set_partition(Some(
11428    ///     google_cloud_retail_v2::model::big_query_source::Partition::PartitionDate(Date::default().into())));
11429    /// ```
11430    pub fn set_partition<
11431        T: std::convert::Into<std::option::Option<crate::model::big_query_source::Partition>>,
11432    >(
11433        mut self,
11434        v: T,
11435    ) -> Self {
11436        self.partition = v.into();
11437        self
11438    }
11439
11440    /// The value of [partition][crate::model::BigQuerySource::partition]
11441    /// if it holds a `PartitionDate`, `None` if the field is not set or
11442    /// holds a different branch.
11443    pub fn partition_date(
11444        &self,
11445    ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
11446        #[allow(unreachable_patterns)]
11447        self.partition.as_ref().and_then(|v| match v {
11448            crate::model::big_query_source::Partition::PartitionDate(v) => {
11449                std::option::Option::Some(v)
11450            }
11451            _ => std::option::Option::None,
11452        })
11453    }
11454
11455    /// Sets the value of [partition][crate::model::BigQuerySource::partition]
11456    /// to hold a `PartitionDate`.
11457    ///
11458    /// Note that all the setters affecting `partition` are
11459    /// mutually exclusive.
11460    ///
11461    /// # Example
11462    /// ```ignore,no_run
11463    /// # use google_cloud_retail_v2::model::BigQuerySource;
11464    /// use google_cloud_type::model::Date;
11465    /// let x = BigQuerySource::new().set_partition_date(Date::default()/* use setters */);
11466    /// assert!(x.partition_date().is_some());
11467    /// ```
11468    pub fn set_partition_date<
11469        T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
11470    >(
11471        mut self,
11472        v: T,
11473    ) -> Self {
11474        self.partition = std::option::Option::Some(
11475            crate::model::big_query_source::Partition::PartitionDate(v.into()),
11476        );
11477        self
11478    }
11479}
11480
11481impl wkt::message::Message for BigQuerySource {
11482    fn typename() -> &'static str {
11483        "type.googleapis.com/google.cloud.retail.v2.BigQuerySource"
11484    }
11485}
11486
11487/// Defines additional types related to [BigQuerySource].
11488pub mod big_query_source {
11489    #[allow(unused_imports)]
11490    use super::*;
11491
11492    /// BigQuery table partition info. Leave this empty if the BigQuery table
11493    /// is not partitioned.
11494    #[derive(Clone, Debug, PartialEq)]
11495    #[non_exhaustive]
11496    pub enum Partition {
11497        /// BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
11498        PartitionDate(std::boxed::Box<google_cloud_type::model::Date>),
11499    }
11500}
11501
11502/// The inline source for the input config for ImportProducts method.
11503#[derive(Clone, Default, PartialEq)]
11504#[non_exhaustive]
11505pub struct ProductInlineSource {
11506    /// Required. A list of products to update/create. Each product must have a
11507    /// valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
11508    /// 100 items.
11509    ///
11510    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
11511    pub products: std::vec::Vec<crate::model::Product>,
11512
11513    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11514}
11515
11516impl ProductInlineSource {
11517    /// Creates a new default instance.
11518    pub fn new() -> Self {
11519        std::default::Default::default()
11520    }
11521
11522    /// Sets the value of [products][crate::model::ProductInlineSource::products].
11523    ///
11524    /// # Example
11525    /// ```ignore,no_run
11526    /// # use google_cloud_retail_v2::model::ProductInlineSource;
11527    /// use google_cloud_retail_v2::model::Product;
11528    /// let x = ProductInlineSource::new()
11529    ///     .set_products([
11530    ///         Product::default()/* use setters */,
11531    ///         Product::default()/* use (different) setters */,
11532    ///     ]);
11533    /// ```
11534    pub fn set_products<T, V>(mut self, v: T) -> Self
11535    where
11536        T: std::iter::IntoIterator<Item = V>,
11537        V: std::convert::Into<crate::model::Product>,
11538    {
11539        use std::iter::Iterator;
11540        self.products = v.into_iter().map(|i| i.into()).collect();
11541        self
11542    }
11543}
11544
11545impl wkt::message::Message for ProductInlineSource {
11546    fn typename() -> &'static str {
11547        "type.googleapis.com/google.cloud.retail.v2.ProductInlineSource"
11548    }
11549}
11550
11551/// The inline source for the input config for ImportUserEvents method.
11552#[derive(Clone, Default, PartialEq)]
11553#[non_exhaustive]
11554pub struct UserEventInlineSource {
11555    /// Required. A list of user events to import. Recommended max of 10k items.
11556    pub user_events: std::vec::Vec<crate::model::UserEvent>,
11557
11558    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11559}
11560
11561impl UserEventInlineSource {
11562    /// Creates a new default instance.
11563    pub fn new() -> Self {
11564        std::default::Default::default()
11565    }
11566
11567    /// Sets the value of [user_events][crate::model::UserEventInlineSource::user_events].
11568    ///
11569    /// # Example
11570    /// ```ignore,no_run
11571    /// # use google_cloud_retail_v2::model::UserEventInlineSource;
11572    /// use google_cloud_retail_v2::model::UserEvent;
11573    /// let x = UserEventInlineSource::new()
11574    ///     .set_user_events([
11575    ///         UserEvent::default()/* use setters */,
11576    ///         UserEvent::default()/* use (different) setters */,
11577    ///     ]);
11578    /// ```
11579    pub fn set_user_events<T, V>(mut self, v: T) -> Self
11580    where
11581        T: std::iter::IntoIterator<Item = V>,
11582        V: std::convert::Into<crate::model::UserEvent>,
11583    {
11584        use std::iter::Iterator;
11585        self.user_events = v.into_iter().map(|i| i.into()).collect();
11586        self
11587    }
11588}
11589
11590impl wkt::message::Message for UserEventInlineSource {
11591    fn typename() -> &'static str {
11592        "type.googleapis.com/google.cloud.retail.v2.UserEventInlineSource"
11593    }
11594}
11595
11596/// Configuration of destination for Import related errors.
11597#[derive(Clone, Default, PartialEq)]
11598#[non_exhaustive]
11599pub struct ImportErrorsConfig {
11600    /// Required. Errors destination.
11601    pub destination: std::option::Option<crate::model::import_errors_config::Destination>,
11602
11603    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11604}
11605
11606impl ImportErrorsConfig {
11607    /// Creates a new default instance.
11608    pub fn new() -> Self {
11609        std::default::Default::default()
11610    }
11611
11612    /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination].
11613    ///
11614    /// Note that all the setters affecting `destination` are mutually
11615    /// exclusive.
11616    ///
11617    /// # Example
11618    /// ```ignore,no_run
11619    /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11620    /// use google_cloud_retail_v2::model::import_errors_config::Destination;
11621    /// let x = ImportErrorsConfig::new().set_destination(Some(Destination::GcsPrefix("example".to_string())));
11622    /// ```
11623    pub fn set_destination<
11624        T: std::convert::Into<std::option::Option<crate::model::import_errors_config::Destination>>,
11625    >(
11626        mut self,
11627        v: T,
11628    ) -> Self {
11629        self.destination = v.into();
11630        self
11631    }
11632
11633    /// The value of [destination][crate::model::ImportErrorsConfig::destination]
11634    /// if it holds a `GcsPrefix`, `None` if the field is not set or
11635    /// holds a different branch.
11636    pub fn gcs_prefix(&self) -> std::option::Option<&std::string::String> {
11637        #[allow(unreachable_patterns)]
11638        self.destination.as_ref().and_then(|v| match v {
11639            crate::model::import_errors_config::Destination::GcsPrefix(v) => {
11640                std::option::Option::Some(v)
11641            }
11642            _ => std::option::Option::None,
11643        })
11644    }
11645
11646    /// Sets the value of [destination][crate::model::ImportErrorsConfig::destination]
11647    /// to hold a `GcsPrefix`.
11648    ///
11649    /// Note that all the setters affecting `destination` are
11650    /// mutually exclusive.
11651    ///
11652    /// # Example
11653    /// ```ignore,no_run
11654    /// # use google_cloud_retail_v2::model::ImportErrorsConfig;
11655    /// let x = ImportErrorsConfig::new().set_gcs_prefix("example");
11656    /// assert!(x.gcs_prefix().is_some());
11657    /// ```
11658    pub fn set_gcs_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11659        self.destination = std::option::Option::Some(
11660            crate::model::import_errors_config::Destination::GcsPrefix(v.into()),
11661        );
11662        self
11663    }
11664}
11665
11666impl wkt::message::Message for ImportErrorsConfig {
11667    fn typename() -> &'static str {
11668        "type.googleapis.com/google.cloud.retail.v2.ImportErrorsConfig"
11669    }
11670}
11671
11672/// Defines additional types related to [ImportErrorsConfig].
11673pub mod import_errors_config {
11674    #[allow(unused_imports)]
11675    use super::*;
11676
11677    /// Required. Errors destination.
11678    #[derive(Clone, Debug, PartialEq)]
11679    #[non_exhaustive]
11680    pub enum Destination {
11681        /// Google Cloud Storage prefix for import errors. This must be an empty,
11682        /// existing Cloud Storage directory. Import errors are written to
11683        /// sharded files in this directory, one per line, as a JSON-encoded
11684        /// `google.rpc.Status` message.
11685        GcsPrefix(std::string::String),
11686    }
11687}
11688
11689/// Request message for Import methods.
11690#[derive(Clone, Default, PartialEq)]
11691#[non_exhaustive]
11692pub struct ImportProductsRequest {
11693    /// Required.
11694    /// `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
11695    ///
11696    /// If no updateMask is specified, requires products.create permission.
11697    /// If updateMask is specified, requires products.update permission.
11698    pub parent: std::string::String,
11699
11700    /// Deprecated. This field has no effect.
11701    #[deprecated]
11702    pub request_id: std::string::String,
11703
11704    /// Required. The desired input location of the data.
11705    pub input_config: std::option::Option<crate::model::ProductInputConfig>,
11706
11707    /// The desired location of errors incurred during the Import.
11708    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
11709
11710    /// Indicates which fields in the provided imported `products` to update. If
11711    /// not set, all fields are updated. If provided, only the existing product
11712    /// fields are updated. Missing products will not be created.
11713    pub update_mask: std::option::Option<wkt::FieldMask>,
11714
11715    /// The mode of reconciliation between existing products and the products to be
11716    /// imported. Defaults to
11717    /// [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
11718    ///
11719    /// [google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL]: crate::model::import_products_request::ReconciliationMode::Incremental
11720    pub reconciliation_mode: crate::model::import_products_request::ReconciliationMode,
11721
11722    /// Full Pub/Sub topic name for receiving notification. If this field is set,
11723    /// when the import is finished, a notification is sent to
11724    /// specified Pub/Sub topic. The message data is JSON string of a
11725    /// [Operation][google.longrunning.Operation].
11726    ///
11727    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
11728    /// to be within the same project as
11729    /// [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
11730    /// Make sure that both
11731    /// `cloud-retail-customer-data-access@system.gserviceaccount.com` and
11732    /// `service-<project number>@gcp-sa-retail.iam.gserviceaccount.com`
11733    /// have the `pubsub.topics.publish` IAM permission on the topic.
11734    ///
11735    /// Only supported when
11736    /// [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]
11737    /// is set to `FULL`.
11738    ///
11739    /// [google.cloud.retail.v2.ImportProductsRequest.parent]: crate::model::ImportProductsRequest::parent
11740    /// [google.cloud.retail.v2.ImportProductsRequest.reconciliation_mode]: crate::model::ImportProductsRequest::reconciliation_mode
11741    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
11742    pub notification_pubsub_topic: std::string::String,
11743
11744    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11745}
11746
11747impl ImportProductsRequest {
11748    /// Creates a new default instance.
11749    pub fn new() -> Self {
11750        std::default::Default::default()
11751    }
11752
11753    /// Sets the value of [parent][crate::model::ImportProductsRequest::parent].
11754    ///
11755    /// # Example
11756    /// ```ignore,no_run
11757    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11758    /// let x = ImportProductsRequest::new().set_parent("example");
11759    /// ```
11760    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11761        self.parent = v.into();
11762        self
11763    }
11764
11765    /// Sets the value of [request_id][crate::model::ImportProductsRequest::request_id].
11766    ///
11767    /// # Example
11768    /// ```ignore,no_run
11769    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11770    /// let x = ImportProductsRequest::new().set_request_id("example");
11771    /// ```
11772    #[deprecated]
11773    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11774        self.request_id = v.into();
11775        self
11776    }
11777
11778    /// Sets the value of [input_config][crate::model::ImportProductsRequest::input_config].
11779    ///
11780    /// # Example
11781    /// ```ignore,no_run
11782    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11783    /// use google_cloud_retail_v2::model::ProductInputConfig;
11784    /// let x = ImportProductsRequest::new().set_input_config(ProductInputConfig::default()/* use setters */);
11785    /// ```
11786    pub fn set_input_config<T>(mut self, v: T) -> Self
11787    where
11788        T: std::convert::Into<crate::model::ProductInputConfig>,
11789    {
11790        self.input_config = std::option::Option::Some(v.into());
11791        self
11792    }
11793
11794    /// Sets or clears the value of [input_config][crate::model::ImportProductsRequest::input_config].
11795    ///
11796    /// # Example
11797    /// ```ignore,no_run
11798    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11799    /// use google_cloud_retail_v2::model::ProductInputConfig;
11800    /// let x = ImportProductsRequest::new().set_or_clear_input_config(Some(ProductInputConfig::default()/* use setters */));
11801    /// let x = ImportProductsRequest::new().set_or_clear_input_config(None::<ProductInputConfig>);
11802    /// ```
11803    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
11804    where
11805        T: std::convert::Into<crate::model::ProductInputConfig>,
11806    {
11807        self.input_config = v.map(|x| x.into());
11808        self
11809    }
11810
11811    /// Sets the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11812    ///
11813    /// # Example
11814    /// ```ignore,no_run
11815    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11816    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11817    /// let x = ImportProductsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
11818    /// ```
11819    pub fn set_errors_config<T>(mut self, v: T) -> Self
11820    where
11821        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11822    {
11823        self.errors_config = std::option::Option::Some(v.into());
11824        self
11825    }
11826
11827    /// Sets or clears the value of [errors_config][crate::model::ImportProductsRequest::errors_config].
11828    ///
11829    /// # Example
11830    /// ```ignore,no_run
11831    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11832    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
11833    /// let x = ImportProductsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
11834    /// let x = ImportProductsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
11835    /// ```
11836    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
11837    where
11838        T: std::convert::Into<crate::model::ImportErrorsConfig>,
11839    {
11840        self.errors_config = v.map(|x| x.into());
11841        self
11842    }
11843
11844    /// Sets the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11845    ///
11846    /// # Example
11847    /// ```ignore,no_run
11848    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11849    /// use wkt::FieldMask;
11850    /// let x = ImportProductsRequest::new().set_update_mask(FieldMask::default()/* use setters */);
11851    /// ```
11852    pub fn set_update_mask<T>(mut self, v: T) -> Self
11853    where
11854        T: std::convert::Into<wkt::FieldMask>,
11855    {
11856        self.update_mask = std::option::Option::Some(v.into());
11857        self
11858    }
11859
11860    /// Sets or clears the value of [update_mask][crate::model::ImportProductsRequest::update_mask].
11861    ///
11862    /// # Example
11863    /// ```ignore,no_run
11864    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11865    /// use wkt::FieldMask;
11866    /// let x = ImportProductsRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
11867    /// let x = ImportProductsRequest::new().set_or_clear_update_mask(None::<FieldMask>);
11868    /// ```
11869    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
11870    where
11871        T: std::convert::Into<wkt::FieldMask>,
11872    {
11873        self.update_mask = v.map(|x| x.into());
11874        self
11875    }
11876
11877    /// Sets the value of [reconciliation_mode][crate::model::ImportProductsRequest::reconciliation_mode].
11878    ///
11879    /// # Example
11880    /// ```ignore,no_run
11881    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11882    /// use google_cloud_retail_v2::model::import_products_request::ReconciliationMode;
11883    /// let x0 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Incremental);
11884    /// let x1 = ImportProductsRequest::new().set_reconciliation_mode(ReconciliationMode::Full);
11885    /// ```
11886    pub fn set_reconciliation_mode<
11887        T: std::convert::Into<crate::model::import_products_request::ReconciliationMode>,
11888    >(
11889        mut self,
11890        v: T,
11891    ) -> Self {
11892        self.reconciliation_mode = v.into();
11893        self
11894    }
11895
11896    /// Sets the value of [notification_pubsub_topic][crate::model::ImportProductsRequest::notification_pubsub_topic].
11897    ///
11898    /// # Example
11899    /// ```ignore,no_run
11900    /// # use google_cloud_retail_v2::model::ImportProductsRequest;
11901    /// let x = ImportProductsRequest::new().set_notification_pubsub_topic("example");
11902    /// ```
11903    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
11904        mut self,
11905        v: T,
11906    ) -> Self {
11907        self.notification_pubsub_topic = v.into();
11908        self
11909    }
11910}
11911
11912impl wkt::message::Message for ImportProductsRequest {
11913    fn typename() -> &'static str {
11914        "type.googleapis.com/google.cloud.retail.v2.ImportProductsRequest"
11915    }
11916}
11917
11918/// Defines additional types related to [ImportProductsRequest].
11919pub mod import_products_request {
11920    #[allow(unused_imports)]
11921    use super::*;
11922
11923    /// Indicates how imported products are reconciled with the existing products
11924    /// created or imported before.
11925    ///
11926    /// # Working with unknown values
11927    ///
11928    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11929    /// additional enum variants at any time. Adding new variants is not considered
11930    /// a breaking change. Applications should write their code in anticipation of:
11931    ///
11932    /// - New values appearing in future releases of the client library, **and**
11933    /// - New values received dynamically, without application changes.
11934    ///
11935    /// Please consult the [Working with enums] section in the user guide for some
11936    /// guidelines.
11937    ///
11938    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11939    #[derive(Clone, Debug, PartialEq)]
11940    #[non_exhaustive]
11941    pub enum ReconciliationMode {
11942        /// Defaults to INCREMENTAL.
11943        Unspecified,
11944        /// Inserts new products or updates existing products.
11945        Incremental,
11946        /// Calculates diff and replaces the entire product dataset. Existing
11947        /// products may be deleted if they are not present in the source location.
11948        Full,
11949        /// If set, the enum was initialized with an unknown value.
11950        ///
11951        /// Applications can examine the value using [ReconciliationMode::value] or
11952        /// [ReconciliationMode::name].
11953        UnknownValue(reconciliation_mode::UnknownValue),
11954    }
11955
11956    #[doc(hidden)]
11957    pub mod reconciliation_mode {
11958        #[allow(unused_imports)]
11959        use super::*;
11960        #[derive(Clone, Debug, PartialEq)]
11961        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11962    }
11963
11964    impl ReconciliationMode {
11965        /// Gets the enum value.
11966        ///
11967        /// Returns `None` if the enum contains an unknown value deserialized from
11968        /// the string representation of enums.
11969        pub fn value(&self) -> std::option::Option<i32> {
11970            match self {
11971                Self::Unspecified => std::option::Option::Some(0),
11972                Self::Incremental => std::option::Option::Some(1),
11973                Self::Full => std::option::Option::Some(2),
11974                Self::UnknownValue(u) => u.0.value(),
11975            }
11976        }
11977
11978        /// Gets the enum value as a string.
11979        ///
11980        /// Returns `None` if the enum contains an unknown value deserialized from
11981        /// the integer representation of enums.
11982        pub fn name(&self) -> std::option::Option<&str> {
11983            match self {
11984                Self::Unspecified => std::option::Option::Some("RECONCILIATION_MODE_UNSPECIFIED"),
11985                Self::Incremental => std::option::Option::Some("INCREMENTAL"),
11986                Self::Full => std::option::Option::Some("FULL"),
11987                Self::UnknownValue(u) => u.0.name(),
11988            }
11989        }
11990    }
11991
11992    impl std::default::Default for ReconciliationMode {
11993        fn default() -> Self {
11994            use std::convert::From;
11995            Self::from(0)
11996        }
11997    }
11998
11999    impl std::fmt::Display for ReconciliationMode {
12000        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
12001            wkt::internal::display_enum(f, self.name(), self.value())
12002        }
12003    }
12004
12005    impl std::convert::From<i32> for ReconciliationMode {
12006        fn from(value: i32) -> Self {
12007            match value {
12008                0 => Self::Unspecified,
12009                1 => Self::Incremental,
12010                2 => Self::Full,
12011                _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
12012                    wkt::internal::UnknownEnumValue::Integer(value),
12013                )),
12014            }
12015        }
12016    }
12017
12018    impl std::convert::From<&str> for ReconciliationMode {
12019        fn from(value: &str) -> Self {
12020            use std::string::ToString;
12021            match value {
12022                "RECONCILIATION_MODE_UNSPECIFIED" => Self::Unspecified,
12023                "INCREMENTAL" => Self::Incremental,
12024                "FULL" => Self::Full,
12025                _ => Self::UnknownValue(reconciliation_mode::UnknownValue(
12026                    wkt::internal::UnknownEnumValue::String(value.to_string()),
12027                )),
12028            }
12029        }
12030    }
12031
12032    impl serde::ser::Serialize for ReconciliationMode {
12033        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12034        where
12035            S: serde::Serializer,
12036        {
12037            match self {
12038                Self::Unspecified => serializer.serialize_i32(0),
12039                Self::Incremental => serializer.serialize_i32(1),
12040                Self::Full => serializer.serialize_i32(2),
12041                Self::UnknownValue(u) => u.0.serialize(serializer),
12042            }
12043        }
12044    }
12045
12046    impl<'de> serde::de::Deserialize<'de> for ReconciliationMode {
12047        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12048        where
12049            D: serde::Deserializer<'de>,
12050        {
12051            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ReconciliationMode>::new(
12052                ".google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode",
12053            ))
12054        }
12055    }
12056}
12057
12058/// Request message for the ImportUserEvents request.
12059#[derive(Clone, Default, PartialEq)]
12060#[non_exhaustive]
12061pub struct ImportUserEventsRequest {
12062    /// Required. `projects/1234/locations/global/catalogs/default_catalog`
12063    pub parent: std::string::String,
12064
12065    /// Required. The desired input location of the data.
12066    pub input_config: std::option::Option<crate::model::UserEventInputConfig>,
12067
12068    /// The desired location of errors incurred during the Import. Cannot be set
12069    /// for inline user event imports.
12070    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12071
12072    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12073}
12074
12075impl ImportUserEventsRequest {
12076    /// Creates a new default instance.
12077    pub fn new() -> Self {
12078        std::default::Default::default()
12079    }
12080
12081    /// Sets the value of [parent][crate::model::ImportUserEventsRequest::parent].
12082    ///
12083    /// # Example
12084    /// ```ignore,no_run
12085    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12086    /// # let project_id = "project_id";
12087    /// # let location_id = "location_id";
12088    /// # let catalog_id = "catalog_id";
12089    /// let x = ImportUserEventsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
12090    /// ```
12091    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12092        self.parent = v.into();
12093        self
12094    }
12095
12096    /// Sets the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
12097    ///
12098    /// # Example
12099    /// ```ignore,no_run
12100    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12101    /// use google_cloud_retail_v2::model::UserEventInputConfig;
12102    /// let x = ImportUserEventsRequest::new().set_input_config(UserEventInputConfig::default()/* use setters */);
12103    /// ```
12104    pub fn set_input_config<T>(mut self, v: T) -> Self
12105    where
12106        T: std::convert::Into<crate::model::UserEventInputConfig>,
12107    {
12108        self.input_config = std::option::Option::Some(v.into());
12109        self
12110    }
12111
12112    /// Sets or clears the value of [input_config][crate::model::ImportUserEventsRequest::input_config].
12113    ///
12114    /// # Example
12115    /// ```ignore,no_run
12116    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12117    /// use google_cloud_retail_v2::model::UserEventInputConfig;
12118    /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(Some(UserEventInputConfig::default()/* use setters */));
12119    /// let x = ImportUserEventsRequest::new().set_or_clear_input_config(None::<UserEventInputConfig>);
12120    /// ```
12121    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12122    where
12123        T: std::convert::Into<crate::model::UserEventInputConfig>,
12124    {
12125        self.input_config = v.map(|x| x.into());
12126        self
12127    }
12128
12129    /// Sets the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
12130    ///
12131    /// # Example
12132    /// ```ignore,no_run
12133    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12134    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12135    /// let x = ImportUserEventsRequest::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12136    /// ```
12137    pub fn set_errors_config<T>(mut self, v: T) -> Self
12138    where
12139        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12140    {
12141        self.errors_config = std::option::Option::Some(v.into());
12142        self
12143    }
12144
12145    /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsRequest::errors_config].
12146    ///
12147    /// # Example
12148    /// ```ignore,no_run
12149    /// # use google_cloud_retail_v2::model::ImportUserEventsRequest;
12150    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12151    /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12152    /// let x = ImportUserEventsRequest::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12153    /// ```
12154    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12155    where
12156        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12157    {
12158        self.errors_config = v.map(|x| x.into());
12159        self
12160    }
12161}
12162
12163impl wkt::message::Message for ImportUserEventsRequest {
12164    fn typename() -> &'static str {
12165        "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsRequest"
12166    }
12167}
12168
12169/// Request message for ImportCompletionData methods.
12170#[derive(Clone, Default, PartialEq)]
12171#[non_exhaustive]
12172pub struct ImportCompletionDataRequest {
12173    /// Required. The catalog which the suggestions dataset belongs to.
12174    ///
12175    /// Format: `projects/1234/locations/global/catalogs/default_catalog`.
12176    pub parent: std::string::String,
12177
12178    /// Required. The desired input location of the data.
12179    pub input_config: std::option::Option<crate::model::CompletionDataInputConfig>,
12180
12181    /// Pub/Sub topic for receiving notification. If this field is set,
12182    /// when the import is finished, a notification is sent to
12183    /// specified Pub/Sub topic. The message data is JSON string of a
12184    /// [Operation][google.longrunning.Operation].
12185    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12186    ///
12187    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12188    pub notification_pubsub_topic: std::string::String,
12189
12190    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12191}
12192
12193impl ImportCompletionDataRequest {
12194    /// Creates a new default instance.
12195    pub fn new() -> Self {
12196        std::default::Default::default()
12197    }
12198
12199    /// Sets the value of [parent][crate::model::ImportCompletionDataRequest::parent].
12200    ///
12201    /// # Example
12202    /// ```ignore,no_run
12203    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12204    /// # let project_id = "project_id";
12205    /// # let location_id = "location_id";
12206    /// # let catalog_id = "catalog_id";
12207    /// let x = ImportCompletionDataRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
12208    /// ```
12209    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12210        self.parent = v.into();
12211        self
12212    }
12213
12214    /// Sets the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12215    ///
12216    /// # Example
12217    /// ```ignore,no_run
12218    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12219    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12220    /// let x = ImportCompletionDataRequest::new().set_input_config(CompletionDataInputConfig::default()/* use setters */);
12221    /// ```
12222    pub fn set_input_config<T>(mut self, v: T) -> Self
12223    where
12224        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12225    {
12226        self.input_config = std::option::Option::Some(v.into());
12227        self
12228    }
12229
12230    /// Sets or clears the value of [input_config][crate::model::ImportCompletionDataRequest::input_config].
12231    ///
12232    /// # Example
12233    /// ```ignore,no_run
12234    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12235    /// use google_cloud_retail_v2::model::CompletionDataInputConfig;
12236    /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(Some(CompletionDataInputConfig::default()/* use setters */));
12237    /// let x = ImportCompletionDataRequest::new().set_or_clear_input_config(None::<CompletionDataInputConfig>);
12238    /// ```
12239    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
12240    where
12241        T: std::convert::Into<crate::model::CompletionDataInputConfig>,
12242    {
12243        self.input_config = v.map(|x| x.into());
12244        self
12245    }
12246
12247    /// Sets the value of [notification_pubsub_topic][crate::model::ImportCompletionDataRequest::notification_pubsub_topic].
12248    ///
12249    /// # Example
12250    /// ```ignore,no_run
12251    /// # use google_cloud_retail_v2::model::ImportCompletionDataRequest;
12252    /// let x = ImportCompletionDataRequest::new().set_notification_pubsub_topic("example");
12253    /// ```
12254    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12255        mut self,
12256        v: T,
12257    ) -> Self {
12258        self.notification_pubsub_topic = v.into();
12259        self
12260    }
12261}
12262
12263impl wkt::message::Message for ImportCompletionDataRequest {
12264    fn typename() -> &'static str {
12265        "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataRequest"
12266    }
12267}
12268
12269/// The input config source for products.
12270#[derive(Clone, Default, PartialEq)]
12271#[non_exhaustive]
12272pub struct ProductInputConfig {
12273    /// Required. The source of the input.
12274    pub source: std::option::Option<crate::model::product_input_config::Source>,
12275
12276    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12277}
12278
12279impl ProductInputConfig {
12280    /// Creates a new default instance.
12281    pub fn new() -> Self {
12282        std::default::Default::default()
12283    }
12284
12285    /// Sets the value of [source][crate::model::ProductInputConfig::source].
12286    ///
12287    /// Note that all the setters affecting `source` are mutually
12288    /// exclusive.
12289    ///
12290    /// # Example
12291    /// ```ignore,no_run
12292    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12293    /// use google_cloud_retail_v2::model::ProductInlineSource;
12294    /// let x = ProductInputConfig::new().set_source(Some(
12295    ///     google_cloud_retail_v2::model::product_input_config::Source::ProductInlineSource(ProductInlineSource::default().into())));
12296    /// ```
12297    pub fn set_source<
12298        T: std::convert::Into<std::option::Option<crate::model::product_input_config::Source>>,
12299    >(
12300        mut self,
12301        v: T,
12302    ) -> Self {
12303        self.source = v.into();
12304        self
12305    }
12306
12307    /// The value of [source][crate::model::ProductInputConfig::source]
12308    /// if it holds a `ProductInlineSource`, `None` if the field is not set or
12309    /// holds a different branch.
12310    pub fn product_inline_source(
12311        &self,
12312    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductInlineSource>> {
12313        #[allow(unreachable_patterns)]
12314        self.source.as_ref().and_then(|v| match v {
12315            crate::model::product_input_config::Source::ProductInlineSource(v) => {
12316                std::option::Option::Some(v)
12317            }
12318            _ => std::option::Option::None,
12319        })
12320    }
12321
12322    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12323    /// to hold a `ProductInlineSource`.
12324    ///
12325    /// Note that all the setters affecting `source` are
12326    /// mutually exclusive.
12327    ///
12328    /// # Example
12329    /// ```ignore,no_run
12330    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12331    /// use google_cloud_retail_v2::model::ProductInlineSource;
12332    /// let x = ProductInputConfig::new().set_product_inline_source(ProductInlineSource::default()/* use setters */);
12333    /// assert!(x.product_inline_source().is_some());
12334    /// assert!(x.gcs_source().is_none());
12335    /// assert!(x.big_query_source().is_none());
12336    /// ```
12337    pub fn set_product_inline_source<
12338        T: std::convert::Into<std::boxed::Box<crate::model::ProductInlineSource>>,
12339    >(
12340        mut self,
12341        v: T,
12342    ) -> Self {
12343        self.source = std::option::Option::Some(
12344            crate::model::product_input_config::Source::ProductInlineSource(v.into()),
12345        );
12346        self
12347    }
12348
12349    /// The value of [source][crate::model::ProductInputConfig::source]
12350    /// if it holds a `GcsSource`, `None` if the field is not set or
12351    /// holds a different branch.
12352    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12353        #[allow(unreachable_patterns)]
12354        self.source.as_ref().and_then(|v| match v {
12355            crate::model::product_input_config::Source::GcsSource(v) => {
12356                std::option::Option::Some(v)
12357            }
12358            _ => std::option::Option::None,
12359        })
12360    }
12361
12362    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12363    /// to hold a `GcsSource`.
12364    ///
12365    /// Note that all the setters affecting `source` are
12366    /// mutually exclusive.
12367    ///
12368    /// # Example
12369    /// ```ignore,no_run
12370    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12371    /// use google_cloud_retail_v2::model::GcsSource;
12372    /// let x = ProductInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12373    /// assert!(x.gcs_source().is_some());
12374    /// assert!(x.product_inline_source().is_none());
12375    /// assert!(x.big_query_source().is_none());
12376    /// ```
12377    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12378        mut self,
12379        v: T,
12380    ) -> Self {
12381        self.source = std::option::Option::Some(
12382            crate::model::product_input_config::Source::GcsSource(v.into()),
12383        );
12384        self
12385    }
12386
12387    /// The value of [source][crate::model::ProductInputConfig::source]
12388    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12389    /// holds a different branch.
12390    pub fn big_query_source(
12391        &self,
12392    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12393        #[allow(unreachable_patterns)]
12394        self.source.as_ref().and_then(|v| match v {
12395            crate::model::product_input_config::Source::BigQuerySource(v) => {
12396                std::option::Option::Some(v)
12397            }
12398            _ => std::option::Option::None,
12399        })
12400    }
12401
12402    /// Sets the value of [source][crate::model::ProductInputConfig::source]
12403    /// to hold a `BigQuerySource`.
12404    ///
12405    /// Note that all the setters affecting `source` are
12406    /// mutually exclusive.
12407    ///
12408    /// # Example
12409    /// ```ignore,no_run
12410    /// # use google_cloud_retail_v2::model::ProductInputConfig;
12411    /// use google_cloud_retail_v2::model::BigQuerySource;
12412    /// let x = ProductInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12413    /// assert!(x.big_query_source().is_some());
12414    /// assert!(x.product_inline_source().is_none());
12415    /// assert!(x.gcs_source().is_none());
12416    /// ```
12417    pub fn set_big_query_source<
12418        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12419    >(
12420        mut self,
12421        v: T,
12422    ) -> Self {
12423        self.source = std::option::Option::Some(
12424            crate::model::product_input_config::Source::BigQuerySource(v.into()),
12425        );
12426        self
12427    }
12428}
12429
12430impl wkt::message::Message for ProductInputConfig {
12431    fn typename() -> &'static str {
12432        "type.googleapis.com/google.cloud.retail.v2.ProductInputConfig"
12433    }
12434}
12435
12436/// Defines additional types related to [ProductInputConfig].
12437pub mod product_input_config {
12438    #[allow(unused_imports)]
12439    use super::*;
12440
12441    /// Required. The source of the input.
12442    #[derive(Clone, Debug, PartialEq)]
12443    #[non_exhaustive]
12444    pub enum Source {
12445        /// The Inline source for the input content for products.
12446        ProductInlineSource(std::boxed::Box<crate::model::ProductInlineSource>),
12447        /// Google Cloud Storage location for the input content.
12448        GcsSource(std::boxed::Box<crate::model::GcsSource>),
12449        /// BigQuery input source.
12450        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12451    }
12452}
12453
12454/// The input config source for user events.
12455#[derive(Clone, Default, PartialEq)]
12456#[non_exhaustive]
12457pub struct UserEventInputConfig {
12458    /// The source of the input.
12459    pub source: std::option::Option<crate::model::user_event_input_config::Source>,
12460
12461    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12462}
12463
12464impl UserEventInputConfig {
12465    /// Creates a new default instance.
12466    pub fn new() -> Self {
12467        std::default::Default::default()
12468    }
12469
12470    /// Sets the value of [source][crate::model::UserEventInputConfig::source].
12471    ///
12472    /// Note that all the setters affecting `source` are mutually
12473    /// exclusive.
12474    ///
12475    /// # Example
12476    /// ```ignore,no_run
12477    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12478    /// use google_cloud_retail_v2::model::UserEventInlineSource;
12479    /// let x = UserEventInputConfig::new().set_source(Some(
12480    ///     google_cloud_retail_v2::model::user_event_input_config::Source::UserEventInlineSource(UserEventInlineSource::default().into())));
12481    /// ```
12482    pub fn set_source<
12483        T: std::convert::Into<std::option::Option<crate::model::user_event_input_config::Source>>,
12484    >(
12485        mut self,
12486        v: T,
12487    ) -> Self {
12488        self.source = v.into();
12489        self
12490    }
12491
12492    /// The value of [source][crate::model::UserEventInputConfig::source]
12493    /// if it holds a `UserEventInlineSource`, `None` if the field is not set or
12494    /// holds a different branch.
12495    pub fn user_event_inline_source(
12496        &self,
12497    ) -> std::option::Option<&std::boxed::Box<crate::model::UserEventInlineSource>> {
12498        #[allow(unreachable_patterns)]
12499        self.source.as_ref().and_then(|v| match v {
12500            crate::model::user_event_input_config::Source::UserEventInlineSource(v) => {
12501                std::option::Option::Some(v)
12502            }
12503            _ => std::option::Option::None,
12504        })
12505    }
12506
12507    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12508    /// to hold a `UserEventInlineSource`.
12509    ///
12510    /// Note that all the setters affecting `source` are
12511    /// mutually exclusive.
12512    ///
12513    /// # Example
12514    /// ```ignore,no_run
12515    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12516    /// use google_cloud_retail_v2::model::UserEventInlineSource;
12517    /// let x = UserEventInputConfig::new().set_user_event_inline_source(UserEventInlineSource::default()/* use setters */);
12518    /// assert!(x.user_event_inline_source().is_some());
12519    /// assert!(x.gcs_source().is_none());
12520    /// assert!(x.big_query_source().is_none());
12521    /// ```
12522    pub fn set_user_event_inline_source<
12523        T: std::convert::Into<std::boxed::Box<crate::model::UserEventInlineSource>>,
12524    >(
12525        mut self,
12526        v: T,
12527    ) -> Self {
12528        self.source = std::option::Option::Some(
12529            crate::model::user_event_input_config::Source::UserEventInlineSource(v.into()),
12530        );
12531        self
12532    }
12533
12534    /// The value of [source][crate::model::UserEventInputConfig::source]
12535    /// if it holds a `GcsSource`, `None` if the field is not set or
12536    /// holds a different branch.
12537    pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
12538        #[allow(unreachable_patterns)]
12539        self.source.as_ref().and_then(|v| match v {
12540            crate::model::user_event_input_config::Source::GcsSource(v) => {
12541                std::option::Option::Some(v)
12542            }
12543            _ => std::option::Option::None,
12544        })
12545    }
12546
12547    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12548    /// to hold a `GcsSource`.
12549    ///
12550    /// Note that all the setters affecting `source` are
12551    /// mutually exclusive.
12552    ///
12553    /// # Example
12554    /// ```ignore,no_run
12555    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12556    /// use google_cloud_retail_v2::model::GcsSource;
12557    /// let x = UserEventInputConfig::new().set_gcs_source(GcsSource::default()/* use setters */);
12558    /// assert!(x.gcs_source().is_some());
12559    /// assert!(x.user_event_inline_source().is_none());
12560    /// assert!(x.big_query_source().is_none());
12561    /// ```
12562    pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
12563        mut self,
12564        v: T,
12565    ) -> Self {
12566        self.source = std::option::Option::Some(
12567            crate::model::user_event_input_config::Source::GcsSource(v.into()),
12568        );
12569        self
12570    }
12571
12572    /// The value of [source][crate::model::UserEventInputConfig::source]
12573    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12574    /// holds a different branch.
12575    pub fn big_query_source(
12576        &self,
12577    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12578        #[allow(unreachable_patterns)]
12579        self.source.as_ref().and_then(|v| match v {
12580            crate::model::user_event_input_config::Source::BigQuerySource(v) => {
12581                std::option::Option::Some(v)
12582            }
12583            _ => std::option::Option::None,
12584        })
12585    }
12586
12587    /// Sets the value of [source][crate::model::UserEventInputConfig::source]
12588    /// to hold a `BigQuerySource`.
12589    ///
12590    /// Note that all the setters affecting `source` are
12591    /// mutually exclusive.
12592    ///
12593    /// # Example
12594    /// ```ignore,no_run
12595    /// # use google_cloud_retail_v2::model::UserEventInputConfig;
12596    /// use google_cloud_retail_v2::model::BigQuerySource;
12597    /// let x = UserEventInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12598    /// assert!(x.big_query_source().is_some());
12599    /// assert!(x.user_event_inline_source().is_none());
12600    /// assert!(x.gcs_source().is_none());
12601    /// ```
12602    pub fn set_big_query_source<
12603        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12604    >(
12605        mut self,
12606        v: T,
12607    ) -> Self {
12608        self.source = std::option::Option::Some(
12609            crate::model::user_event_input_config::Source::BigQuerySource(v.into()),
12610        );
12611        self
12612    }
12613}
12614
12615impl wkt::message::Message for UserEventInputConfig {
12616    fn typename() -> &'static str {
12617        "type.googleapis.com/google.cloud.retail.v2.UserEventInputConfig"
12618    }
12619}
12620
12621/// Defines additional types related to [UserEventInputConfig].
12622pub mod user_event_input_config {
12623    #[allow(unused_imports)]
12624    use super::*;
12625
12626    /// The source of the input.
12627    #[derive(Clone, Debug, PartialEq)]
12628    #[non_exhaustive]
12629    pub enum Source {
12630        /// Required. The Inline source for the input content for UserEvents.
12631        UserEventInlineSource(std::boxed::Box<crate::model::UserEventInlineSource>),
12632        /// Required. Google Cloud Storage location for the input content.
12633        GcsSource(std::boxed::Box<crate::model::GcsSource>),
12634        /// Required. BigQuery input source.
12635        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12636    }
12637}
12638
12639/// The input config source for completion data.
12640#[derive(Clone, Default, PartialEq)]
12641#[non_exhaustive]
12642pub struct CompletionDataInputConfig {
12643    /// The source of the input.
12644    ///
12645    /// Supported
12646    /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12647    /// values for suggestions imports:
12648    ///
12649    /// * `suggestions` (default): One JSON completion suggestion per line.
12650    /// * `denylist`:  One JSON deny suggestion per line.
12651    /// * `allowlist`:  One JSON allow suggestion per line.
12652    ///
12653    /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12654    pub source: std::option::Option<crate::model::completion_data_input_config::Source>,
12655
12656    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12657}
12658
12659impl CompletionDataInputConfig {
12660    /// Creates a new default instance.
12661    pub fn new() -> Self {
12662        std::default::Default::default()
12663    }
12664
12665    /// Sets the value of [source][crate::model::CompletionDataInputConfig::source].
12666    ///
12667    /// Note that all the setters affecting `source` are mutually
12668    /// exclusive.
12669    ///
12670    /// # Example
12671    /// ```ignore,no_run
12672    /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12673    /// use google_cloud_retail_v2::model::BigQuerySource;
12674    /// let x = CompletionDataInputConfig::new().set_source(Some(
12675    ///     google_cloud_retail_v2::model::completion_data_input_config::Source::BigQuerySource(BigQuerySource::default().into())));
12676    /// ```
12677    pub fn set_source<
12678        T: std::convert::Into<std::option::Option<crate::model::completion_data_input_config::Source>>,
12679    >(
12680        mut self,
12681        v: T,
12682    ) -> Self {
12683        self.source = v.into();
12684        self
12685    }
12686
12687    /// The value of [source][crate::model::CompletionDataInputConfig::source]
12688    /// if it holds a `BigQuerySource`, `None` if the field is not set or
12689    /// holds a different branch.
12690    pub fn big_query_source(
12691        &self,
12692    ) -> std::option::Option<&std::boxed::Box<crate::model::BigQuerySource>> {
12693        #[allow(unreachable_patterns)]
12694        self.source.as_ref().and_then(|v| match v {
12695            crate::model::completion_data_input_config::Source::BigQuerySource(v) => {
12696                std::option::Option::Some(v)
12697            }
12698            _ => std::option::Option::None,
12699        })
12700    }
12701
12702    /// Sets the value of [source][crate::model::CompletionDataInputConfig::source]
12703    /// to hold a `BigQuerySource`.
12704    ///
12705    /// Note that all the setters affecting `source` are
12706    /// mutually exclusive.
12707    ///
12708    /// # Example
12709    /// ```ignore,no_run
12710    /// # use google_cloud_retail_v2::model::CompletionDataInputConfig;
12711    /// use google_cloud_retail_v2::model::BigQuerySource;
12712    /// let x = CompletionDataInputConfig::new().set_big_query_source(BigQuerySource::default()/* use setters */);
12713    /// assert!(x.big_query_source().is_some());
12714    /// ```
12715    pub fn set_big_query_source<
12716        T: std::convert::Into<std::boxed::Box<crate::model::BigQuerySource>>,
12717    >(
12718        mut self,
12719        v: T,
12720    ) -> Self {
12721        self.source = std::option::Option::Some(
12722            crate::model::completion_data_input_config::Source::BigQuerySource(v.into()),
12723        );
12724        self
12725    }
12726}
12727
12728impl wkt::message::Message for CompletionDataInputConfig {
12729    fn typename() -> &'static str {
12730        "type.googleapis.com/google.cloud.retail.v2.CompletionDataInputConfig"
12731    }
12732}
12733
12734/// Defines additional types related to [CompletionDataInputConfig].
12735pub mod completion_data_input_config {
12736    #[allow(unused_imports)]
12737    use super::*;
12738
12739    /// The source of the input.
12740    ///
12741    /// Supported
12742    /// [BigQuerySource.data_schema][google.cloud.retail.v2.BigQuerySource.data_schema]
12743    /// values for suggestions imports:
12744    ///
12745    /// * `suggestions` (default): One JSON completion suggestion per line.
12746    /// * `denylist`:  One JSON deny suggestion per line.
12747    /// * `allowlist`:  One JSON allow suggestion per line.
12748    ///
12749    /// [google.cloud.retail.v2.BigQuerySource.data_schema]: crate::model::BigQuerySource::data_schema
12750    #[derive(Clone, Debug, PartialEq)]
12751    #[non_exhaustive]
12752    pub enum Source {
12753        /// Required. BigQuery input source.
12754        ///
12755        /// Add the IAM permission "BigQuery Data Viewer" for
12756        /// cloud-retail-customer-data-access@system.gserviceaccount.com before
12757        /// using this feature otherwise an error is thrown.
12758        BigQuerySource(std::boxed::Box<crate::model::BigQuerySource>),
12759    }
12760}
12761
12762/// Metadata related to the progress of the Import operation. This is
12763/// returned by the google.longrunning.Operation.metadata field.
12764#[derive(Clone, Default, PartialEq)]
12765#[non_exhaustive]
12766pub struct ImportMetadata {
12767    /// Operation create time.
12768    pub create_time: std::option::Option<wkt::Timestamp>,
12769
12770    /// Operation last update time. If the operation is done, this is also the
12771    /// finish time.
12772    pub update_time: std::option::Option<wkt::Timestamp>,
12773
12774    /// Count of entries that were processed successfully.
12775    pub success_count: i64,
12776
12777    /// Count of entries that encountered errors while processing.
12778    pub failure_count: i64,
12779
12780    /// Deprecated. This field is never set.
12781    #[deprecated]
12782    pub request_id: std::string::String,
12783
12784    /// Pub/Sub topic for receiving notification. If this field is set,
12785    /// when the import is finished, a notification is sent to
12786    /// specified Pub/Sub topic. The message data is JSON string of a
12787    /// [Operation][google.longrunning.Operation].
12788    /// Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
12789    ///
12790    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
12791    pub notification_pubsub_topic: std::string::String,
12792
12793    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12794}
12795
12796impl ImportMetadata {
12797    /// Creates a new default instance.
12798    pub fn new() -> Self {
12799        std::default::Default::default()
12800    }
12801
12802    /// Sets the value of [create_time][crate::model::ImportMetadata::create_time].
12803    ///
12804    /// # Example
12805    /// ```ignore,no_run
12806    /// # use google_cloud_retail_v2::model::ImportMetadata;
12807    /// use wkt::Timestamp;
12808    /// let x = ImportMetadata::new().set_create_time(Timestamp::default()/* use setters */);
12809    /// ```
12810    pub fn set_create_time<T>(mut self, v: T) -> Self
12811    where
12812        T: std::convert::Into<wkt::Timestamp>,
12813    {
12814        self.create_time = std::option::Option::Some(v.into());
12815        self
12816    }
12817
12818    /// Sets or clears the value of [create_time][crate::model::ImportMetadata::create_time].
12819    ///
12820    /// # Example
12821    /// ```ignore,no_run
12822    /// # use google_cloud_retail_v2::model::ImportMetadata;
12823    /// use wkt::Timestamp;
12824    /// let x = ImportMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
12825    /// let x = ImportMetadata::new().set_or_clear_create_time(None::<Timestamp>);
12826    /// ```
12827    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
12828    where
12829        T: std::convert::Into<wkt::Timestamp>,
12830    {
12831        self.create_time = v.map(|x| x.into());
12832        self
12833    }
12834
12835    /// Sets the value of [update_time][crate::model::ImportMetadata::update_time].
12836    ///
12837    /// # Example
12838    /// ```ignore,no_run
12839    /// # use google_cloud_retail_v2::model::ImportMetadata;
12840    /// use wkt::Timestamp;
12841    /// let x = ImportMetadata::new().set_update_time(Timestamp::default()/* use setters */);
12842    /// ```
12843    pub fn set_update_time<T>(mut self, v: T) -> Self
12844    where
12845        T: std::convert::Into<wkt::Timestamp>,
12846    {
12847        self.update_time = std::option::Option::Some(v.into());
12848        self
12849    }
12850
12851    /// Sets or clears the value of [update_time][crate::model::ImportMetadata::update_time].
12852    ///
12853    /// # Example
12854    /// ```ignore,no_run
12855    /// # use google_cloud_retail_v2::model::ImportMetadata;
12856    /// use wkt::Timestamp;
12857    /// let x = ImportMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
12858    /// let x = ImportMetadata::new().set_or_clear_update_time(None::<Timestamp>);
12859    /// ```
12860    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
12861    where
12862        T: std::convert::Into<wkt::Timestamp>,
12863    {
12864        self.update_time = v.map(|x| x.into());
12865        self
12866    }
12867
12868    /// Sets the value of [success_count][crate::model::ImportMetadata::success_count].
12869    ///
12870    /// # Example
12871    /// ```ignore,no_run
12872    /// # use google_cloud_retail_v2::model::ImportMetadata;
12873    /// let x = ImportMetadata::new().set_success_count(42);
12874    /// ```
12875    pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12876        self.success_count = v.into();
12877        self
12878    }
12879
12880    /// Sets the value of [failure_count][crate::model::ImportMetadata::failure_count].
12881    ///
12882    /// # Example
12883    /// ```ignore,no_run
12884    /// # use google_cloud_retail_v2::model::ImportMetadata;
12885    /// let x = ImportMetadata::new().set_failure_count(42);
12886    /// ```
12887    pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
12888        self.failure_count = v.into();
12889        self
12890    }
12891
12892    /// Sets the value of [request_id][crate::model::ImportMetadata::request_id].
12893    ///
12894    /// # Example
12895    /// ```ignore,no_run
12896    /// # use google_cloud_retail_v2::model::ImportMetadata;
12897    /// let x = ImportMetadata::new().set_request_id("example");
12898    /// ```
12899    #[deprecated]
12900    pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12901        self.request_id = v.into();
12902        self
12903    }
12904
12905    /// Sets the value of [notification_pubsub_topic][crate::model::ImportMetadata::notification_pubsub_topic].
12906    ///
12907    /// # Example
12908    /// ```ignore,no_run
12909    /// # use google_cloud_retail_v2::model::ImportMetadata;
12910    /// let x = ImportMetadata::new().set_notification_pubsub_topic("example");
12911    /// ```
12912    pub fn set_notification_pubsub_topic<T: std::convert::Into<std::string::String>>(
12913        mut self,
12914        v: T,
12915    ) -> Self {
12916        self.notification_pubsub_topic = v.into();
12917        self
12918    }
12919}
12920
12921impl wkt::message::Message for ImportMetadata {
12922    fn typename() -> &'static str {
12923        "type.googleapis.com/google.cloud.retail.v2.ImportMetadata"
12924    }
12925}
12926
12927/// Response of the
12928/// [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
12929/// long running operation is done, then this message is returned by the
12930/// google.longrunning.Operations.response field if the operation was successful.
12931///
12932/// [google.cloud.retail.v2.ImportProductsRequest]: crate::model::ImportProductsRequest
12933#[derive(Clone, Default, PartialEq)]
12934#[non_exhaustive]
12935pub struct ImportProductsResponse {
12936    /// A sample of errors encountered while processing the request.
12937    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
12938
12939    /// Echoes the destination for the complete errors in the request if set.
12940    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
12941
12942    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12943}
12944
12945impl ImportProductsResponse {
12946    /// Creates a new default instance.
12947    pub fn new() -> Self {
12948        std::default::Default::default()
12949    }
12950
12951    /// Sets the value of [error_samples][crate::model::ImportProductsResponse::error_samples].
12952    ///
12953    /// # Example
12954    /// ```ignore,no_run
12955    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12956    /// use google_cloud_rpc::model::Status;
12957    /// let x = ImportProductsResponse::new()
12958    ///     .set_error_samples([
12959    ///         Status::default()/* use setters */,
12960    ///         Status::default()/* use (different) setters */,
12961    ///     ]);
12962    /// ```
12963    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
12964    where
12965        T: std::iter::IntoIterator<Item = V>,
12966        V: std::convert::Into<google_cloud_rpc::model::Status>,
12967    {
12968        use std::iter::Iterator;
12969        self.error_samples = v.into_iter().map(|i| i.into()).collect();
12970        self
12971    }
12972
12973    /// Sets the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12974    ///
12975    /// # Example
12976    /// ```ignore,no_run
12977    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12978    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12979    /// let x = ImportProductsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
12980    /// ```
12981    pub fn set_errors_config<T>(mut self, v: T) -> Self
12982    where
12983        T: std::convert::Into<crate::model::ImportErrorsConfig>,
12984    {
12985        self.errors_config = std::option::Option::Some(v.into());
12986        self
12987    }
12988
12989    /// Sets or clears the value of [errors_config][crate::model::ImportProductsResponse::errors_config].
12990    ///
12991    /// # Example
12992    /// ```ignore,no_run
12993    /// # use google_cloud_retail_v2::model::ImportProductsResponse;
12994    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
12995    /// let x = ImportProductsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
12996    /// let x = ImportProductsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
12997    /// ```
12998    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
12999    where
13000        T: std::convert::Into<crate::model::ImportErrorsConfig>,
13001    {
13002        self.errors_config = v.map(|x| x.into());
13003        self
13004    }
13005}
13006
13007impl wkt::message::Message for ImportProductsResponse {
13008    fn typename() -> &'static str {
13009        "type.googleapis.com/google.cloud.retail.v2.ImportProductsResponse"
13010    }
13011}
13012
13013/// Response of the ImportUserEventsRequest. If the long running
13014/// operation was successful, then this message is returned by the
13015/// google.longrunning.Operations.response field if the operation was successful.
13016#[derive(Clone, Default, PartialEq)]
13017#[non_exhaustive]
13018pub struct ImportUserEventsResponse {
13019    /// A sample of errors encountered while processing the request.
13020    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
13021
13022    /// Echoes the destination for the complete errors if this field was set in
13023    /// the request.
13024    pub errors_config: std::option::Option<crate::model::ImportErrorsConfig>,
13025
13026    /// Aggregated statistics of user event import status.
13027    pub import_summary: std::option::Option<crate::model::UserEventImportSummary>,
13028
13029    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13030}
13031
13032impl ImportUserEventsResponse {
13033    /// Creates a new default instance.
13034    pub fn new() -> Self {
13035        std::default::Default::default()
13036    }
13037
13038    /// Sets the value of [error_samples][crate::model::ImportUserEventsResponse::error_samples].
13039    ///
13040    /// # Example
13041    /// ```ignore,no_run
13042    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13043    /// use google_cloud_rpc::model::Status;
13044    /// let x = ImportUserEventsResponse::new()
13045    ///     .set_error_samples([
13046    ///         Status::default()/* use setters */,
13047    ///         Status::default()/* use (different) setters */,
13048    ///     ]);
13049    /// ```
13050    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13051    where
13052        T: std::iter::IntoIterator<Item = V>,
13053        V: std::convert::Into<google_cloud_rpc::model::Status>,
13054    {
13055        use std::iter::Iterator;
13056        self.error_samples = v.into_iter().map(|i| i.into()).collect();
13057        self
13058    }
13059
13060    /// Sets the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
13061    ///
13062    /// # Example
13063    /// ```ignore,no_run
13064    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13065    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
13066    /// let x = ImportUserEventsResponse::new().set_errors_config(ImportErrorsConfig::default()/* use setters */);
13067    /// ```
13068    pub fn set_errors_config<T>(mut self, v: T) -> Self
13069    where
13070        T: std::convert::Into<crate::model::ImportErrorsConfig>,
13071    {
13072        self.errors_config = std::option::Option::Some(v.into());
13073        self
13074    }
13075
13076    /// Sets or clears the value of [errors_config][crate::model::ImportUserEventsResponse::errors_config].
13077    ///
13078    /// # Example
13079    /// ```ignore,no_run
13080    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13081    /// use google_cloud_retail_v2::model::ImportErrorsConfig;
13082    /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(Some(ImportErrorsConfig::default()/* use setters */));
13083    /// let x = ImportUserEventsResponse::new().set_or_clear_errors_config(None::<ImportErrorsConfig>);
13084    /// ```
13085    pub fn set_or_clear_errors_config<T>(mut self, v: std::option::Option<T>) -> Self
13086    where
13087        T: std::convert::Into<crate::model::ImportErrorsConfig>,
13088    {
13089        self.errors_config = v.map(|x| x.into());
13090        self
13091    }
13092
13093    /// Sets the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
13094    ///
13095    /// # Example
13096    /// ```ignore,no_run
13097    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13098    /// use google_cloud_retail_v2::model::UserEventImportSummary;
13099    /// let x = ImportUserEventsResponse::new().set_import_summary(UserEventImportSummary::default()/* use setters */);
13100    /// ```
13101    pub fn set_import_summary<T>(mut self, v: T) -> Self
13102    where
13103        T: std::convert::Into<crate::model::UserEventImportSummary>,
13104    {
13105        self.import_summary = std::option::Option::Some(v.into());
13106        self
13107    }
13108
13109    /// Sets or clears the value of [import_summary][crate::model::ImportUserEventsResponse::import_summary].
13110    ///
13111    /// # Example
13112    /// ```ignore,no_run
13113    /// # use google_cloud_retail_v2::model::ImportUserEventsResponse;
13114    /// use google_cloud_retail_v2::model::UserEventImportSummary;
13115    /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(Some(UserEventImportSummary::default()/* use setters */));
13116    /// let x = ImportUserEventsResponse::new().set_or_clear_import_summary(None::<UserEventImportSummary>);
13117    /// ```
13118    pub fn set_or_clear_import_summary<T>(mut self, v: std::option::Option<T>) -> Self
13119    where
13120        T: std::convert::Into<crate::model::UserEventImportSummary>,
13121    {
13122        self.import_summary = v.map(|x| x.into());
13123        self
13124    }
13125}
13126
13127impl wkt::message::Message for ImportUserEventsResponse {
13128    fn typename() -> &'static str {
13129        "type.googleapis.com/google.cloud.retail.v2.ImportUserEventsResponse"
13130    }
13131}
13132
13133/// A summary of import result. The UserEventImportSummary summarizes
13134/// the import status for user events.
13135#[derive(Clone, Default, PartialEq)]
13136#[non_exhaustive]
13137pub struct UserEventImportSummary {
13138    /// Count of user events imported with complete existing catalog information.
13139    pub joined_events_count: i64,
13140
13141    /// Count of user events imported, but with catalog information not found
13142    /// in the imported catalog.
13143    pub unjoined_events_count: i64,
13144
13145    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13146}
13147
13148impl UserEventImportSummary {
13149    /// Creates a new default instance.
13150    pub fn new() -> Self {
13151        std::default::Default::default()
13152    }
13153
13154    /// Sets the value of [joined_events_count][crate::model::UserEventImportSummary::joined_events_count].
13155    ///
13156    /// # Example
13157    /// ```ignore,no_run
13158    /// # use google_cloud_retail_v2::model::UserEventImportSummary;
13159    /// let x = UserEventImportSummary::new().set_joined_events_count(42);
13160    /// ```
13161    pub fn set_joined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13162        self.joined_events_count = v.into();
13163        self
13164    }
13165
13166    /// Sets the value of [unjoined_events_count][crate::model::UserEventImportSummary::unjoined_events_count].
13167    ///
13168    /// # Example
13169    /// ```ignore,no_run
13170    /// # use google_cloud_retail_v2::model::UserEventImportSummary;
13171    /// let x = UserEventImportSummary::new().set_unjoined_events_count(42);
13172    /// ```
13173    pub fn set_unjoined_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
13174        self.unjoined_events_count = v.into();
13175        self
13176    }
13177}
13178
13179impl wkt::message::Message for UserEventImportSummary {
13180    fn typename() -> &'static str {
13181        "type.googleapis.com/google.cloud.retail.v2.UserEventImportSummary"
13182    }
13183}
13184
13185/// Response of the
13186/// [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest].
13187/// If the long running operation is done, this message is returned by the
13188/// google.longrunning.Operations.response field if the operation is successful.
13189///
13190/// [google.cloud.retail.v2.ImportCompletionDataRequest]: crate::model::ImportCompletionDataRequest
13191#[derive(Clone, Default, PartialEq)]
13192#[non_exhaustive]
13193pub struct ImportCompletionDataResponse {
13194    /// A sample of errors encountered while processing the request.
13195    pub error_samples: std::vec::Vec<google_cloud_rpc::model::Status>,
13196
13197    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13198}
13199
13200impl ImportCompletionDataResponse {
13201    /// Creates a new default instance.
13202    pub fn new() -> Self {
13203        std::default::Default::default()
13204    }
13205
13206    /// Sets the value of [error_samples][crate::model::ImportCompletionDataResponse::error_samples].
13207    ///
13208    /// # Example
13209    /// ```ignore,no_run
13210    /// # use google_cloud_retail_v2::model::ImportCompletionDataResponse;
13211    /// use google_cloud_rpc::model::Status;
13212    /// let x = ImportCompletionDataResponse::new()
13213    ///     .set_error_samples([
13214    ///         Status::default()/* use setters */,
13215    ///         Status::default()/* use (different) setters */,
13216    ///     ]);
13217    /// ```
13218    pub fn set_error_samples<T, V>(mut self, v: T) -> Self
13219    where
13220        T: std::iter::IntoIterator<Item = V>,
13221        V: std::convert::Into<google_cloud_rpc::model::Status>,
13222    {
13223        use std::iter::Iterator;
13224        self.error_samples = v.into_iter().map(|i| i.into()).collect();
13225        self
13226    }
13227}
13228
13229impl wkt::message::Message for ImportCompletionDataResponse {
13230    fn typename() -> &'static str {
13231        "type.googleapis.com/google.cloud.retail.v2.ImportCompletionDataResponse"
13232    }
13233}
13234
13235/// Metadata that describes the training and serving parameters of a
13236/// [Model][google.cloud.retail.v2.Model]. A
13237/// [Model][google.cloud.retail.v2.Model] can be associated with a
13238/// [ServingConfig][google.cloud.retail.v2.ServingConfig] and then queried
13239/// through the Predict API.
13240///
13241/// [google.cloud.retail.v2.Model]: crate::model::Model
13242/// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
13243#[derive(Clone, Default, PartialEq)]
13244#[non_exhaustive]
13245pub struct Model {
13246    /// Required. The fully qualified resource name of the model.
13247    ///
13248    /// Format:
13249    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
13250    /// catalog_id has char limit of 50.
13251    /// recommendation_model_id has char limit of 40.
13252    pub name: std::string::String,
13253
13254    /// Required. The display name of the model.
13255    ///
13256    /// Should be human readable, used to display Recommendation Models in the
13257    /// Retail Cloud Console Dashboard. UTF-8 encoded string with limit of 1024
13258    /// characters.
13259    pub display_name: std::string::String,
13260
13261    /// Optional. The training state that the model is in (e.g.
13262    /// `TRAINING` or `PAUSED`).
13263    ///
13264    /// Since part of the cost of running the service
13265    /// is frequency of training - this can be used to determine when to train
13266    /// model in order to control cost. If not specified: the default value for
13267    /// `CreateModel` method is `TRAINING`. The default value for
13268    /// `UpdateModel` method is to keep the state the same as before.
13269    pub training_state: crate::model::model::TrainingState,
13270
13271    /// Output only. The serving state of the model: `ACTIVE`, `NOT_ACTIVE`.
13272    pub serving_state: crate::model::model::ServingState,
13273
13274    /// Output only. Timestamp the Recommendation Model was created at.
13275    pub create_time: std::option::Option<wkt::Timestamp>,
13276
13277    /// Output only. Timestamp the Recommendation Model was last updated. E.g.
13278    /// if a Recommendation Model was paused - this would be the time the pause was
13279    /// initiated.
13280    pub update_time: std::option::Option<wkt::Timestamp>,
13281
13282    /// Required. The type of model e.g. `home-page`.
13283    ///
13284    /// Currently supported values: `recommended-for-you`, `others-you-may-like`,
13285    /// `frequently-bought-together`, `page-optimization`, `similar-items`,
13286    /// `buy-it-again`, `on-sale-items`, and `recently-viewed`(readonly value).
13287    ///
13288    /// This field together with
13289    /// [optimization_objective][google.cloud.retail.v2.Model.optimization_objective]
13290    /// describe model metadata to use to control model training and serving.
13291    /// See <https://cloud.google.com/retail/docs/models>
13292    /// for more details on what the model metadata control and which combination
13293    /// of parameters are valid. For invalid combinations of parameters (e.g. type
13294    /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13295    /// receive an error 400 if you try to create/update a recommendation with
13296    /// this set of knobs.
13297    ///
13298    /// [google.cloud.retail.v2.Model.optimization_objective]: crate::model::Model::optimization_objective
13299    pub r#type: std::string::String,
13300
13301    /// Optional. The optimization objective e.g. `cvr`.
13302    ///
13303    /// Currently supported
13304    /// values: `ctr`, `cvr`, `revenue-per-order`.
13305    ///
13306    /// If not specified, we choose default based on model type.
13307    /// Default depends on type of recommendation:
13308    ///
13309    /// `recommended-for-you` => `ctr`
13310    ///
13311    /// `others-you-may-like` => `ctr`
13312    ///
13313    /// `frequently-bought-together` => `revenue_per_order`
13314    ///
13315    /// This field together with
13316    /// [optimization_objective][google.cloud.retail.v2.Model.type]
13317    /// describe model metadata to use to control model training and serving.
13318    /// See <https://cloud.google.com/retail/docs/models>
13319    /// for more details on what the model metadata control and which combination
13320    /// of parameters are valid. For invalid combinations of parameters (e.g. type
13321    /// = `frequently-bought-together` and optimization_objective = `ctr`), you
13322    /// receive an error 400 if you try to create/update a recommendation with
13323    /// this set of knobs.
13324    ///
13325    /// [google.cloud.retail.v2.Model.type]: crate::model::Model::type
13326    pub optimization_objective: std::string::String,
13327
13328    /// Optional. The state of periodic tuning.
13329    ///
13330    /// The period we use is 3 months - to do a
13331    /// one-off tune earlier use the `TuneModel` method. Default value
13332    /// is `PERIODIC_TUNING_ENABLED`.
13333    pub periodic_tuning_state: crate::model::model::PeriodicTuningState,
13334
13335    /// Output only. The timestamp when the latest successful tune finished.
13336    pub last_tune_time: std::option::Option<wkt::Timestamp>,
13337
13338    /// Output only. The tune operation associated with the model.
13339    ///
13340    /// Can be used to determine if there is an ongoing tune for this
13341    /// recommendation. Empty field implies no tune is goig on.
13342    pub tuning_operation: std::string::String,
13343
13344    /// Output only. The state of data requirements for this model: `DATA_OK` and
13345    /// `DATA_ERROR`.
13346    ///
13347    /// Recommendation model cannot be trained if the data is in
13348    /// `DATA_ERROR` state. Recommendation model can have `DATA_ERROR` state even
13349    /// if serving state is `ACTIVE`: models were trained successfully before, but
13350    /// cannot be refreshed because model no longer has sufficient
13351    /// data for training.
13352    pub data_state: crate::model::model::DataState,
13353
13354    /// Optional. If `RECOMMENDATIONS_FILTERING_ENABLED`, recommendation filtering
13355    /// by attributes is enabled for the model.
13356    pub filtering_option: crate::model::RecommendationsFilteringOption,
13357
13358    /// Output only. The list of valid serving configs associated with the
13359    /// PageOptimizationConfig.
13360    pub serving_config_lists: std::vec::Vec<crate::model::model::ServingConfigList>,
13361
13362    /// Optional. Additional model features config.
13363    pub model_features_config: std::option::Option<crate::model::model::ModelFeaturesConfig>,
13364
13365    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13366}
13367
13368impl Model {
13369    /// Creates a new default instance.
13370    pub fn new() -> Self {
13371        std::default::Default::default()
13372    }
13373
13374    /// Sets the value of [name][crate::model::Model::name].
13375    ///
13376    /// # Example
13377    /// ```ignore,no_run
13378    /// # use google_cloud_retail_v2::model::Model;
13379    /// # let project_id = "project_id";
13380    /// # let location_id = "location_id";
13381    /// # let catalog_id = "catalog_id";
13382    /// # let model_id = "model_id";
13383    /// let x = Model::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
13384    /// ```
13385    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13386        self.name = v.into();
13387        self
13388    }
13389
13390    /// Sets the value of [display_name][crate::model::Model::display_name].
13391    ///
13392    /// # Example
13393    /// ```ignore,no_run
13394    /// # use google_cloud_retail_v2::model::Model;
13395    /// let x = Model::new().set_display_name("example");
13396    /// ```
13397    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13398        self.display_name = v.into();
13399        self
13400    }
13401
13402    /// Sets the value of [training_state][crate::model::Model::training_state].
13403    ///
13404    /// # Example
13405    /// ```ignore,no_run
13406    /// # use google_cloud_retail_v2::model::Model;
13407    /// use google_cloud_retail_v2::model::model::TrainingState;
13408    /// let x0 = Model::new().set_training_state(TrainingState::Paused);
13409    /// let x1 = Model::new().set_training_state(TrainingState::Training);
13410    /// ```
13411    pub fn set_training_state<T: std::convert::Into<crate::model::model::TrainingState>>(
13412        mut self,
13413        v: T,
13414    ) -> Self {
13415        self.training_state = v.into();
13416        self
13417    }
13418
13419    /// Sets the value of [serving_state][crate::model::Model::serving_state].
13420    ///
13421    /// # Example
13422    /// ```ignore,no_run
13423    /// # use google_cloud_retail_v2::model::Model;
13424    /// use google_cloud_retail_v2::model::model::ServingState;
13425    /// let x0 = Model::new().set_serving_state(ServingState::Inactive);
13426    /// let x1 = Model::new().set_serving_state(ServingState::Active);
13427    /// let x2 = Model::new().set_serving_state(ServingState::Tuned);
13428    /// ```
13429    pub fn set_serving_state<T: std::convert::Into<crate::model::model::ServingState>>(
13430        mut self,
13431        v: T,
13432    ) -> Self {
13433        self.serving_state = v.into();
13434        self
13435    }
13436
13437    /// Sets the value of [create_time][crate::model::Model::create_time].
13438    ///
13439    /// # Example
13440    /// ```ignore,no_run
13441    /// # use google_cloud_retail_v2::model::Model;
13442    /// use wkt::Timestamp;
13443    /// let x = Model::new().set_create_time(Timestamp::default()/* use setters */);
13444    /// ```
13445    pub fn set_create_time<T>(mut self, v: T) -> Self
13446    where
13447        T: std::convert::Into<wkt::Timestamp>,
13448    {
13449        self.create_time = std::option::Option::Some(v.into());
13450        self
13451    }
13452
13453    /// Sets or clears the value of [create_time][crate::model::Model::create_time].
13454    ///
13455    /// # Example
13456    /// ```ignore,no_run
13457    /// # use google_cloud_retail_v2::model::Model;
13458    /// use wkt::Timestamp;
13459    /// let x = Model::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
13460    /// let x = Model::new().set_or_clear_create_time(None::<Timestamp>);
13461    /// ```
13462    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
13463    where
13464        T: std::convert::Into<wkt::Timestamp>,
13465    {
13466        self.create_time = v.map(|x| x.into());
13467        self
13468    }
13469
13470    /// Sets the value of [update_time][crate::model::Model::update_time].
13471    ///
13472    /// # Example
13473    /// ```ignore,no_run
13474    /// # use google_cloud_retail_v2::model::Model;
13475    /// use wkt::Timestamp;
13476    /// let x = Model::new().set_update_time(Timestamp::default()/* use setters */);
13477    /// ```
13478    pub fn set_update_time<T>(mut self, v: T) -> Self
13479    where
13480        T: std::convert::Into<wkt::Timestamp>,
13481    {
13482        self.update_time = std::option::Option::Some(v.into());
13483        self
13484    }
13485
13486    /// Sets or clears the value of [update_time][crate::model::Model::update_time].
13487    ///
13488    /// # Example
13489    /// ```ignore,no_run
13490    /// # use google_cloud_retail_v2::model::Model;
13491    /// use wkt::Timestamp;
13492    /// let x = Model::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
13493    /// let x = Model::new().set_or_clear_update_time(None::<Timestamp>);
13494    /// ```
13495    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
13496    where
13497        T: std::convert::Into<wkt::Timestamp>,
13498    {
13499        self.update_time = v.map(|x| x.into());
13500        self
13501    }
13502
13503    /// Sets the value of [r#type][crate::model::Model::type].
13504    ///
13505    /// # Example
13506    /// ```ignore,no_run
13507    /// # use google_cloud_retail_v2::model::Model;
13508    /// let x = Model::new().set_type("example");
13509    /// ```
13510    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13511        self.r#type = v.into();
13512        self
13513    }
13514
13515    /// Sets the value of [optimization_objective][crate::model::Model::optimization_objective].
13516    ///
13517    /// # Example
13518    /// ```ignore,no_run
13519    /// # use google_cloud_retail_v2::model::Model;
13520    /// let x = Model::new().set_optimization_objective("example");
13521    /// ```
13522    pub fn set_optimization_objective<T: std::convert::Into<std::string::String>>(
13523        mut self,
13524        v: T,
13525    ) -> Self {
13526        self.optimization_objective = v.into();
13527        self
13528    }
13529
13530    /// Sets the value of [periodic_tuning_state][crate::model::Model::periodic_tuning_state].
13531    ///
13532    /// # Example
13533    /// ```ignore,no_run
13534    /// # use google_cloud_retail_v2::model::Model;
13535    /// use google_cloud_retail_v2::model::model::PeriodicTuningState;
13536    /// let x0 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningDisabled);
13537    /// let x1 = Model::new().set_periodic_tuning_state(PeriodicTuningState::AllTuningDisabled);
13538    /// let x2 = Model::new().set_periodic_tuning_state(PeriodicTuningState::PeriodicTuningEnabled);
13539    /// ```
13540    pub fn set_periodic_tuning_state<
13541        T: std::convert::Into<crate::model::model::PeriodicTuningState>,
13542    >(
13543        mut self,
13544        v: T,
13545    ) -> Self {
13546        self.periodic_tuning_state = v.into();
13547        self
13548    }
13549
13550    /// Sets the value of [last_tune_time][crate::model::Model::last_tune_time].
13551    ///
13552    /// # Example
13553    /// ```ignore,no_run
13554    /// # use google_cloud_retail_v2::model::Model;
13555    /// use wkt::Timestamp;
13556    /// let x = Model::new().set_last_tune_time(Timestamp::default()/* use setters */);
13557    /// ```
13558    pub fn set_last_tune_time<T>(mut self, v: T) -> Self
13559    where
13560        T: std::convert::Into<wkt::Timestamp>,
13561    {
13562        self.last_tune_time = std::option::Option::Some(v.into());
13563        self
13564    }
13565
13566    /// Sets or clears the value of [last_tune_time][crate::model::Model::last_tune_time].
13567    ///
13568    /// # Example
13569    /// ```ignore,no_run
13570    /// # use google_cloud_retail_v2::model::Model;
13571    /// use wkt::Timestamp;
13572    /// let x = Model::new().set_or_clear_last_tune_time(Some(Timestamp::default()/* use setters */));
13573    /// let x = Model::new().set_or_clear_last_tune_time(None::<Timestamp>);
13574    /// ```
13575    pub fn set_or_clear_last_tune_time<T>(mut self, v: std::option::Option<T>) -> Self
13576    where
13577        T: std::convert::Into<wkt::Timestamp>,
13578    {
13579        self.last_tune_time = v.map(|x| x.into());
13580        self
13581    }
13582
13583    /// Sets the value of [tuning_operation][crate::model::Model::tuning_operation].
13584    ///
13585    /// # Example
13586    /// ```ignore,no_run
13587    /// # use google_cloud_retail_v2::model::Model;
13588    /// let x = Model::new().set_tuning_operation("example");
13589    /// ```
13590    pub fn set_tuning_operation<T: std::convert::Into<std::string::String>>(
13591        mut self,
13592        v: T,
13593    ) -> Self {
13594        self.tuning_operation = v.into();
13595        self
13596    }
13597
13598    /// Sets the value of [data_state][crate::model::Model::data_state].
13599    ///
13600    /// # Example
13601    /// ```ignore,no_run
13602    /// # use google_cloud_retail_v2::model::Model;
13603    /// use google_cloud_retail_v2::model::model::DataState;
13604    /// let x0 = Model::new().set_data_state(DataState::DataOk);
13605    /// let x1 = Model::new().set_data_state(DataState::DataError);
13606    /// ```
13607    pub fn set_data_state<T: std::convert::Into<crate::model::model::DataState>>(
13608        mut self,
13609        v: T,
13610    ) -> Self {
13611        self.data_state = v.into();
13612        self
13613    }
13614
13615    /// Sets the value of [filtering_option][crate::model::Model::filtering_option].
13616    ///
13617    /// # Example
13618    /// ```ignore,no_run
13619    /// # use google_cloud_retail_v2::model::Model;
13620    /// use google_cloud_retail_v2::model::RecommendationsFilteringOption;
13621    /// let x0 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringDisabled);
13622    /// let x1 = Model::new().set_filtering_option(RecommendationsFilteringOption::RecommendationsFilteringEnabled);
13623    /// ```
13624    pub fn set_filtering_option<
13625        T: std::convert::Into<crate::model::RecommendationsFilteringOption>,
13626    >(
13627        mut self,
13628        v: T,
13629    ) -> Self {
13630        self.filtering_option = v.into();
13631        self
13632    }
13633
13634    /// Sets the value of [serving_config_lists][crate::model::Model::serving_config_lists].
13635    ///
13636    /// # Example
13637    /// ```ignore,no_run
13638    /// # use google_cloud_retail_v2::model::Model;
13639    /// use google_cloud_retail_v2::model::model::ServingConfigList;
13640    /// let x = Model::new()
13641    ///     .set_serving_config_lists([
13642    ///         ServingConfigList::default()/* use setters */,
13643    ///         ServingConfigList::default()/* use (different) setters */,
13644    ///     ]);
13645    /// ```
13646    pub fn set_serving_config_lists<T, V>(mut self, v: T) -> Self
13647    where
13648        T: std::iter::IntoIterator<Item = V>,
13649        V: std::convert::Into<crate::model::model::ServingConfigList>,
13650    {
13651        use std::iter::Iterator;
13652        self.serving_config_lists = v.into_iter().map(|i| i.into()).collect();
13653        self
13654    }
13655
13656    /// Sets the value of [model_features_config][crate::model::Model::model_features_config].
13657    ///
13658    /// # Example
13659    /// ```ignore,no_run
13660    /// # use google_cloud_retail_v2::model::Model;
13661    /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13662    /// let x = Model::new().set_model_features_config(ModelFeaturesConfig::default()/* use setters */);
13663    /// ```
13664    pub fn set_model_features_config<T>(mut self, v: T) -> Self
13665    where
13666        T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13667    {
13668        self.model_features_config = std::option::Option::Some(v.into());
13669        self
13670    }
13671
13672    /// Sets or clears the value of [model_features_config][crate::model::Model::model_features_config].
13673    ///
13674    /// # Example
13675    /// ```ignore,no_run
13676    /// # use google_cloud_retail_v2::model::Model;
13677    /// use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13678    /// let x = Model::new().set_or_clear_model_features_config(Some(ModelFeaturesConfig::default()/* use setters */));
13679    /// let x = Model::new().set_or_clear_model_features_config(None::<ModelFeaturesConfig>);
13680    /// ```
13681    pub fn set_or_clear_model_features_config<T>(mut self, v: std::option::Option<T>) -> Self
13682    where
13683        T: std::convert::Into<crate::model::model::ModelFeaturesConfig>,
13684    {
13685        self.model_features_config = v.map(|x| x.into());
13686        self
13687    }
13688}
13689
13690impl wkt::message::Message for Model {
13691    fn typename() -> &'static str {
13692        "type.googleapis.com/google.cloud.retail.v2.Model"
13693    }
13694}
13695
13696/// Defines additional types related to [Model].
13697pub mod model {
13698    #[allow(unused_imports)]
13699    use super::*;
13700
13701    /// Represents an ordered combination of valid serving configs, which
13702    /// can be used for `PAGE_OPTIMIZATION` recommendations.
13703    #[derive(Clone, Default, PartialEq)]
13704    #[non_exhaustive]
13705    pub struct ServingConfigList {
13706        /// Optional. A set of valid serving configs that may be used for
13707        /// `PAGE_OPTIMIZATION`.
13708        pub serving_config_ids: std::vec::Vec<std::string::String>,
13709
13710        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13711    }
13712
13713    impl ServingConfigList {
13714        /// Creates a new default instance.
13715        pub fn new() -> Self {
13716            std::default::Default::default()
13717        }
13718
13719        /// Sets the value of [serving_config_ids][crate::model::model::ServingConfigList::serving_config_ids].
13720        ///
13721        /// # Example
13722        /// ```ignore,no_run
13723        /// # use google_cloud_retail_v2::model::model::ServingConfigList;
13724        /// let x = ServingConfigList::new().set_serving_config_ids(["a", "b", "c"]);
13725        /// ```
13726        pub fn set_serving_config_ids<T, V>(mut self, v: T) -> Self
13727        where
13728            T: std::iter::IntoIterator<Item = V>,
13729            V: std::convert::Into<std::string::String>,
13730        {
13731            use std::iter::Iterator;
13732            self.serving_config_ids = v.into_iter().map(|i| i.into()).collect();
13733            self
13734        }
13735    }
13736
13737    impl wkt::message::Message for ServingConfigList {
13738        fn typename() -> &'static str {
13739            "type.googleapis.com/google.cloud.retail.v2.Model.ServingConfigList"
13740        }
13741    }
13742
13743    /// Additional configs for the frequently-bought-together model type.
13744    #[derive(Clone, Default, PartialEq)]
13745    #[non_exhaustive]
13746    pub struct FrequentlyBoughtTogetherFeaturesConfig {
13747        /// Optional. Specifies the context of the model when it is used in predict
13748        /// requests. Can only be set for the `frequently-bought-together` type. If
13749        /// it isn't specified, it defaults to
13750        /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
13751        ///
13752        /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
13753        pub context_products_type: crate::model::model::ContextProductsType,
13754
13755        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13756    }
13757
13758    impl FrequentlyBoughtTogetherFeaturesConfig {
13759        /// Creates a new default instance.
13760        pub fn new() -> Self {
13761            std::default::Default::default()
13762        }
13763
13764        /// Sets the value of [context_products_type][crate::model::model::FrequentlyBoughtTogetherFeaturesConfig::context_products_type].
13765        ///
13766        /// # Example
13767        /// ```ignore,no_run
13768        /// # use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13769        /// use google_cloud_retail_v2::model::model::ContextProductsType;
13770        /// let x0 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::SingleContextProduct);
13771        /// let x1 = FrequentlyBoughtTogetherFeaturesConfig::new().set_context_products_type(ContextProductsType::MultipleContextProducts);
13772        /// ```
13773        pub fn set_context_products_type<
13774            T: std::convert::Into<crate::model::model::ContextProductsType>,
13775        >(
13776            mut self,
13777            v: T,
13778        ) -> Self {
13779            self.context_products_type = v.into();
13780            self
13781        }
13782    }
13783
13784    impl wkt::message::Message for FrequentlyBoughtTogetherFeaturesConfig {
13785        fn typename() -> &'static str {
13786            "type.googleapis.com/google.cloud.retail.v2.Model.FrequentlyBoughtTogetherFeaturesConfig"
13787        }
13788    }
13789
13790    /// Additional model features config.
13791    #[derive(Clone, Default, PartialEq)]
13792    #[non_exhaustive]
13793    pub struct ModelFeaturesConfig {
13794        #[allow(missing_docs)]
13795        pub type_dedicated_config:
13796            std::option::Option<crate::model::model::model_features_config::TypeDedicatedConfig>,
13797
13798        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13799    }
13800
13801    impl ModelFeaturesConfig {
13802        /// Creates a new default instance.
13803        pub fn new() -> Self {
13804            std::default::Default::default()
13805        }
13806
13807        /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config].
13808        ///
13809        /// Note that all the setters affecting `type_dedicated_config` are mutually
13810        /// exclusive.
13811        ///
13812        /// # Example
13813        /// ```ignore,no_run
13814        /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13815        /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13816        /// let x = ModelFeaturesConfig::new().set_type_dedicated_config(Some(
13817        ///     google_cloud_retail_v2::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(FrequentlyBoughtTogetherFeaturesConfig::default().into())));
13818        /// ```
13819        pub fn set_type_dedicated_config<
13820            T: std::convert::Into<
13821                    std::option::Option<
13822                        crate::model::model::model_features_config::TypeDedicatedConfig,
13823                    >,
13824                >,
13825        >(
13826            mut self,
13827            v: T,
13828        ) -> Self {
13829            self.type_dedicated_config = v.into();
13830            self
13831        }
13832
13833        /// The value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13834        /// if it holds a `FrequentlyBoughtTogetherConfig`, `None` if the field is not set or
13835        /// holds a different branch.
13836        pub fn frequently_bought_together_config(
13837            &self,
13838        ) -> std::option::Option<
13839            &std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13840        > {
13841            #[allow(unreachable_patterns)]
13842            self.type_dedicated_config.as_ref().and_then(|v| match v {
13843                crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(v) => std::option::Option::Some(v),
13844                _ => std::option::Option::None,
13845            })
13846        }
13847
13848        /// Sets the value of [type_dedicated_config][crate::model::model::ModelFeaturesConfig::type_dedicated_config]
13849        /// to hold a `FrequentlyBoughtTogetherConfig`.
13850        ///
13851        /// Note that all the setters affecting `type_dedicated_config` are
13852        /// mutually exclusive.
13853        ///
13854        /// # Example
13855        /// ```ignore,no_run
13856        /// # use google_cloud_retail_v2::model::model::ModelFeaturesConfig;
13857        /// use google_cloud_retail_v2::model::model::FrequentlyBoughtTogetherFeaturesConfig;
13858        /// let x = ModelFeaturesConfig::new().set_frequently_bought_together_config(FrequentlyBoughtTogetherFeaturesConfig::default()/* use setters */);
13859        /// assert!(x.frequently_bought_together_config().is_some());
13860        /// ```
13861        pub fn set_frequently_bought_together_config<
13862            T: std::convert::Into<
13863                    std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13864                >,
13865        >(
13866            mut self,
13867            v: T,
13868        ) -> Self {
13869            self.type_dedicated_config = std::option::Option::Some(
13870                crate::model::model::model_features_config::TypeDedicatedConfig::FrequentlyBoughtTogetherConfig(
13871                    v.into()
13872                )
13873            );
13874            self
13875        }
13876    }
13877
13878    impl wkt::message::Message for ModelFeaturesConfig {
13879        fn typename() -> &'static str {
13880            "type.googleapis.com/google.cloud.retail.v2.Model.ModelFeaturesConfig"
13881        }
13882    }
13883
13884    /// Defines additional types related to [ModelFeaturesConfig].
13885    pub mod model_features_config {
13886        #[allow(unused_imports)]
13887        use super::*;
13888
13889        #[allow(missing_docs)]
13890        #[derive(Clone, Debug, PartialEq)]
13891        #[non_exhaustive]
13892        pub enum TypeDedicatedConfig {
13893            /// Additional configs for frequently-bought-together models.
13894            FrequentlyBoughtTogetherConfig(
13895                std::boxed::Box<crate::model::model::FrequentlyBoughtTogetherFeaturesConfig>,
13896            ),
13897        }
13898    }
13899
13900    /// The serving state of the model.
13901    ///
13902    /// # Working with unknown values
13903    ///
13904    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13905    /// additional enum variants at any time. Adding new variants is not considered
13906    /// a breaking change. Applications should write their code in anticipation of:
13907    ///
13908    /// - New values appearing in future releases of the client library, **and**
13909    /// - New values received dynamically, without application changes.
13910    ///
13911    /// Please consult the [Working with enums] section in the user guide for some
13912    /// guidelines.
13913    ///
13914    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13915    #[derive(Clone, Debug, PartialEq)]
13916    #[non_exhaustive]
13917    pub enum ServingState {
13918        /// Unspecified serving state.
13919        Unspecified,
13920        /// The model is not serving.
13921        Inactive,
13922        /// The model is serving and can be queried.
13923        Active,
13924        /// The model is trained on tuned hyperparameters and can be
13925        /// queried.
13926        Tuned,
13927        /// If set, the enum was initialized with an unknown value.
13928        ///
13929        /// Applications can examine the value using [ServingState::value] or
13930        /// [ServingState::name].
13931        UnknownValue(serving_state::UnknownValue),
13932    }
13933
13934    #[doc(hidden)]
13935    pub mod serving_state {
13936        #[allow(unused_imports)]
13937        use super::*;
13938        #[derive(Clone, Debug, PartialEq)]
13939        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13940    }
13941
13942    impl ServingState {
13943        /// Gets the enum value.
13944        ///
13945        /// Returns `None` if the enum contains an unknown value deserialized from
13946        /// the string representation of enums.
13947        pub fn value(&self) -> std::option::Option<i32> {
13948            match self {
13949                Self::Unspecified => std::option::Option::Some(0),
13950                Self::Inactive => std::option::Option::Some(1),
13951                Self::Active => std::option::Option::Some(2),
13952                Self::Tuned => std::option::Option::Some(3),
13953                Self::UnknownValue(u) => u.0.value(),
13954            }
13955        }
13956
13957        /// Gets the enum value as a string.
13958        ///
13959        /// Returns `None` if the enum contains an unknown value deserialized from
13960        /// the integer representation of enums.
13961        pub fn name(&self) -> std::option::Option<&str> {
13962            match self {
13963                Self::Unspecified => std::option::Option::Some("SERVING_STATE_UNSPECIFIED"),
13964                Self::Inactive => std::option::Option::Some("INACTIVE"),
13965                Self::Active => std::option::Option::Some("ACTIVE"),
13966                Self::Tuned => std::option::Option::Some("TUNED"),
13967                Self::UnknownValue(u) => u.0.name(),
13968            }
13969        }
13970    }
13971
13972    impl std::default::Default for ServingState {
13973        fn default() -> Self {
13974            use std::convert::From;
13975            Self::from(0)
13976        }
13977    }
13978
13979    impl std::fmt::Display for ServingState {
13980        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13981            wkt::internal::display_enum(f, self.name(), self.value())
13982        }
13983    }
13984
13985    impl std::convert::From<i32> for ServingState {
13986        fn from(value: i32) -> Self {
13987            match value {
13988                0 => Self::Unspecified,
13989                1 => Self::Inactive,
13990                2 => Self::Active,
13991                3 => Self::Tuned,
13992                _ => Self::UnknownValue(serving_state::UnknownValue(
13993                    wkt::internal::UnknownEnumValue::Integer(value),
13994                )),
13995            }
13996        }
13997    }
13998
13999    impl std::convert::From<&str> for ServingState {
14000        fn from(value: &str) -> Self {
14001            use std::string::ToString;
14002            match value {
14003                "SERVING_STATE_UNSPECIFIED" => Self::Unspecified,
14004                "INACTIVE" => Self::Inactive,
14005                "ACTIVE" => Self::Active,
14006                "TUNED" => Self::Tuned,
14007                _ => Self::UnknownValue(serving_state::UnknownValue(
14008                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14009                )),
14010            }
14011        }
14012    }
14013
14014    impl serde::ser::Serialize for ServingState {
14015        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14016        where
14017            S: serde::Serializer,
14018        {
14019            match self {
14020                Self::Unspecified => serializer.serialize_i32(0),
14021                Self::Inactive => serializer.serialize_i32(1),
14022                Self::Active => serializer.serialize_i32(2),
14023                Self::Tuned => serializer.serialize_i32(3),
14024                Self::UnknownValue(u) => u.0.serialize(serializer),
14025            }
14026        }
14027    }
14028
14029    impl<'de> serde::de::Deserialize<'de> for ServingState {
14030        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14031        where
14032            D: serde::Deserializer<'de>,
14033        {
14034            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ServingState>::new(
14035                ".google.cloud.retail.v2.Model.ServingState",
14036            ))
14037        }
14038    }
14039
14040    /// The training state of the model.
14041    ///
14042    /// # Working with unknown values
14043    ///
14044    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14045    /// additional enum variants at any time. Adding new variants is not considered
14046    /// a breaking change. Applications should write their code in anticipation of:
14047    ///
14048    /// - New values appearing in future releases of the client library, **and**
14049    /// - New values received dynamically, without application changes.
14050    ///
14051    /// Please consult the [Working with enums] section in the user guide for some
14052    /// guidelines.
14053    ///
14054    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14055    #[derive(Clone, Debug, PartialEq)]
14056    #[non_exhaustive]
14057    pub enum TrainingState {
14058        /// Unspecified training state.
14059        Unspecified,
14060        /// The model training is paused.
14061        Paused,
14062        /// The model is training.
14063        Training,
14064        /// If set, the enum was initialized with an unknown value.
14065        ///
14066        /// Applications can examine the value using [TrainingState::value] or
14067        /// [TrainingState::name].
14068        UnknownValue(training_state::UnknownValue),
14069    }
14070
14071    #[doc(hidden)]
14072    pub mod training_state {
14073        #[allow(unused_imports)]
14074        use super::*;
14075        #[derive(Clone, Debug, PartialEq)]
14076        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14077    }
14078
14079    impl TrainingState {
14080        /// Gets the enum value.
14081        ///
14082        /// Returns `None` if the enum contains an unknown value deserialized from
14083        /// the string representation of enums.
14084        pub fn value(&self) -> std::option::Option<i32> {
14085            match self {
14086                Self::Unspecified => std::option::Option::Some(0),
14087                Self::Paused => std::option::Option::Some(1),
14088                Self::Training => std::option::Option::Some(2),
14089                Self::UnknownValue(u) => u.0.value(),
14090            }
14091        }
14092
14093        /// Gets the enum value as a string.
14094        ///
14095        /// Returns `None` if the enum contains an unknown value deserialized from
14096        /// the integer representation of enums.
14097        pub fn name(&self) -> std::option::Option<&str> {
14098            match self {
14099                Self::Unspecified => std::option::Option::Some("TRAINING_STATE_UNSPECIFIED"),
14100                Self::Paused => std::option::Option::Some("PAUSED"),
14101                Self::Training => std::option::Option::Some("TRAINING"),
14102                Self::UnknownValue(u) => u.0.name(),
14103            }
14104        }
14105    }
14106
14107    impl std::default::Default for TrainingState {
14108        fn default() -> Self {
14109            use std::convert::From;
14110            Self::from(0)
14111        }
14112    }
14113
14114    impl std::fmt::Display for TrainingState {
14115        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14116            wkt::internal::display_enum(f, self.name(), self.value())
14117        }
14118    }
14119
14120    impl std::convert::From<i32> for TrainingState {
14121        fn from(value: i32) -> Self {
14122            match value {
14123                0 => Self::Unspecified,
14124                1 => Self::Paused,
14125                2 => Self::Training,
14126                _ => Self::UnknownValue(training_state::UnknownValue(
14127                    wkt::internal::UnknownEnumValue::Integer(value),
14128                )),
14129            }
14130        }
14131    }
14132
14133    impl std::convert::From<&str> for TrainingState {
14134        fn from(value: &str) -> Self {
14135            use std::string::ToString;
14136            match value {
14137                "TRAINING_STATE_UNSPECIFIED" => Self::Unspecified,
14138                "PAUSED" => Self::Paused,
14139                "TRAINING" => Self::Training,
14140                _ => Self::UnknownValue(training_state::UnknownValue(
14141                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14142                )),
14143            }
14144        }
14145    }
14146
14147    impl serde::ser::Serialize for TrainingState {
14148        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14149        where
14150            S: serde::Serializer,
14151        {
14152            match self {
14153                Self::Unspecified => serializer.serialize_i32(0),
14154                Self::Paused => serializer.serialize_i32(1),
14155                Self::Training => serializer.serialize_i32(2),
14156                Self::UnknownValue(u) => u.0.serialize(serializer),
14157            }
14158        }
14159    }
14160
14161    impl<'de> serde::de::Deserialize<'de> for TrainingState {
14162        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14163        where
14164            D: serde::Deserializer<'de>,
14165        {
14166            deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingState>::new(
14167                ".google.cloud.retail.v2.Model.TrainingState",
14168            ))
14169        }
14170    }
14171
14172    /// Describes whether periodic tuning is enabled for this model
14173    /// or not. Periodic tuning is scheduled at most every three months. You can
14174    /// start a tuning process manually by using the `TuneModel`
14175    /// method, which starts a tuning process immediately and resets the quarterly
14176    /// schedule. Enabling or disabling periodic tuning does not affect any
14177    /// current tuning processes.
14178    ///
14179    /// # Working with unknown values
14180    ///
14181    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14182    /// additional enum variants at any time. Adding new variants is not considered
14183    /// a breaking change. Applications should write their code in anticipation of:
14184    ///
14185    /// - New values appearing in future releases of the client library, **and**
14186    /// - New values received dynamically, without application changes.
14187    ///
14188    /// Please consult the [Working with enums] section in the user guide for some
14189    /// guidelines.
14190    ///
14191    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14192    #[derive(Clone, Debug, PartialEq)]
14193    #[non_exhaustive]
14194    pub enum PeriodicTuningState {
14195        /// Unspecified default value, should never be explicitly set.
14196        Unspecified,
14197        /// The model has periodic tuning disabled. Tuning
14198        /// can be reenabled by calling the `EnableModelPeriodicTuning`
14199        /// method or by calling the `TuneModel` method.
14200        PeriodicTuningDisabled,
14201        /// The model cannot be tuned with periodic tuning OR the
14202        /// `TuneModel` method. Hide the options in customer UI and
14203        /// reject any requests through the backend self serve API.
14204        AllTuningDisabled,
14205        /// The model has periodic tuning enabled. Tuning
14206        /// can be disabled by calling the `DisableModelPeriodicTuning`
14207        /// method.
14208        PeriodicTuningEnabled,
14209        /// If set, the enum was initialized with an unknown value.
14210        ///
14211        /// Applications can examine the value using [PeriodicTuningState::value] or
14212        /// [PeriodicTuningState::name].
14213        UnknownValue(periodic_tuning_state::UnknownValue),
14214    }
14215
14216    #[doc(hidden)]
14217    pub mod periodic_tuning_state {
14218        #[allow(unused_imports)]
14219        use super::*;
14220        #[derive(Clone, Debug, PartialEq)]
14221        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14222    }
14223
14224    impl PeriodicTuningState {
14225        /// Gets the enum value.
14226        ///
14227        /// Returns `None` if the enum contains an unknown value deserialized from
14228        /// the string representation of enums.
14229        pub fn value(&self) -> std::option::Option<i32> {
14230            match self {
14231                Self::Unspecified => std::option::Option::Some(0),
14232                Self::PeriodicTuningDisabled => std::option::Option::Some(1),
14233                Self::AllTuningDisabled => std::option::Option::Some(3),
14234                Self::PeriodicTuningEnabled => std::option::Option::Some(2),
14235                Self::UnknownValue(u) => u.0.value(),
14236            }
14237        }
14238
14239        /// Gets the enum value as a string.
14240        ///
14241        /// Returns `None` if the enum contains an unknown value deserialized from
14242        /// the integer representation of enums.
14243        pub fn name(&self) -> std::option::Option<&str> {
14244            match self {
14245                Self::Unspecified => std::option::Option::Some("PERIODIC_TUNING_STATE_UNSPECIFIED"),
14246                Self::PeriodicTuningDisabled => {
14247                    std::option::Option::Some("PERIODIC_TUNING_DISABLED")
14248                }
14249                Self::AllTuningDisabled => std::option::Option::Some("ALL_TUNING_DISABLED"),
14250                Self::PeriodicTuningEnabled => std::option::Option::Some("PERIODIC_TUNING_ENABLED"),
14251                Self::UnknownValue(u) => u.0.name(),
14252            }
14253        }
14254    }
14255
14256    impl std::default::Default for PeriodicTuningState {
14257        fn default() -> Self {
14258            use std::convert::From;
14259            Self::from(0)
14260        }
14261    }
14262
14263    impl std::fmt::Display for PeriodicTuningState {
14264        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14265            wkt::internal::display_enum(f, self.name(), self.value())
14266        }
14267    }
14268
14269    impl std::convert::From<i32> for PeriodicTuningState {
14270        fn from(value: i32) -> Self {
14271            match value {
14272                0 => Self::Unspecified,
14273                1 => Self::PeriodicTuningDisabled,
14274                2 => Self::PeriodicTuningEnabled,
14275                3 => Self::AllTuningDisabled,
14276                _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14277                    wkt::internal::UnknownEnumValue::Integer(value),
14278                )),
14279            }
14280        }
14281    }
14282
14283    impl std::convert::From<&str> for PeriodicTuningState {
14284        fn from(value: &str) -> Self {
14285            use std::string::ToString;
14286            match value {
14287                "PERIODIC_TUNING_STATE_UNSPECIFIED" => Self::Unspecified,
14288                "PERIODIC_TUNING_DISABLED" => Self::PeriodicTuningDisabled,
14289                "ALL_TUNING_DISABLED" => Self::AllTuningDisabled,
14290                "PERIODIC_TUNING_ENABLED" => Self::PeriodicTuningEnabled,
14291                _ => Self::UnknownValue(periodic_tuning_state::UnknownValue(
14292                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14293                )),
14294            }
14295        }
14296    }
14297
14298    impl serde::ser::Serialize for PeriodicTuningState {
14299        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14300        where
14301            S: serde::Serializer,
14302        {
14303            match self {
14304                Self::Unspecified => serializer.serialize_i32(0),
14305                Self::PeriodicTuningDisabled => serializer.serialize_i32(1),
14306                Self::AllTuningDisabled => serializer.serialize_i32(3),
14307                Self::PeriodicTuningEnabled => serializer.serialize_i32(2),
14308                Self::UnknownValue(u) => u.0.serialize(serializer),
14309            }
14310        }
14311    }
14312
14313    impl<'de> serde::de::Deserialize<'de> for PeriodicTuningState {
14314        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14315        where
14316            D: serde::Deserializer<'de>,
14317        {
14318            deserializer.deserialize_any(wkt::internal::EnumVisitor::<PeriodicTuningState>::new(
14319                ".google.cloud.retail.v2.Model.PeriodicTuningState",
14320            ))
14321        }
14322    }
14323
14324    /// Describes whether this model have sufficient training data
14325    /// to be continuously trained.
14326    ///
14327    /// # Working with unknown values
14328    ///
14329    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14330    /// additional enum variants at any time. Adding new variants is not considered
14331    /// a breaking change. Applications should write their code in anticipation of:
14332    ///
14333    /// - New values appearing in future releases of the client library, **and**
14334    /// - New values received dynamically, without application changes.
14335    ///
14336    /// Please consult the [Working with enums] section in the user guide for some
14337    /// guidelines.
14338    ///
14339    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14340    #[derive(Clone, Debug, PartialEq)]
14341    #[non_exhaustive]
14342    pub enum DataState {
14343        /// Unspecified default value, should never be explicitly set.
14344        Unspecified,
14345        /// The model has sufficient training data.
14346        DataOk,
14347        /// The model does not have sufficient training data. Error
14348        /// messages can be queried via Stackdriver.
14349        DataError,
14350        /// If set, the enum was initialized with an unknown value.
14351        ///
14352        /// Applications can examine the value using [DataState::value] or
14353        /// [DataState::name].
14354        UnknownValue(data_state::UnknownValue),
14355    }
14356
14357    #[doc(hidden)]
14358    pub mod data_state {
14359        #[allow(unused_imports)]
14360        use super::*;
14361        #[derive(Clone, Debug, PartialEq)]
14362        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14363    }
14364
14365    impl DataState {
14366        /// Gets the enum value.
14367        ///
14368        /// Returns `None` if the enum contains an unknown value deserialized from
14369        /// the string representation of enums.
14370        pub fn value(&self) -> std::option::Option<i32> {
14371            match self {
14372                Self::Unspecified => std::option::Option::Some(0),
14373                Self::DataOk => std::option::Option::Some(1),
14374                Self::DataError => std::option::Option::Some(2),
14375                Self::UnknownValue(u) => u.0.value(),
14376            }
14377        }
14378
14379        /// Gets the enum value as a string.
14380        ///
14381        /// Returns `None` if the enum contains an unknown value deserialized from
14382        /// the integer representation of enums.
14383        pub fn name(&self) -> std::option::Option<&str> {
14384            match self {
14385                Self::Unspecified => std::option::Option::Some("DATA_STATE_UNSPECIFIED"),
14386                Self::DataOk => std::option::Option::Some("DATA_OK"),
14387                Self::DataError => std::option::Option::Some("DATA_ERROR"),
14388                Self::UnknownValue(u) => u.0.name(),
14389            }
14390        }
14391    }
14392
14393    impl std::default::Default for DataState {
14394        fn default() -> Self {
14395            use std::convert::From;
14396            Self::from(0)
14397        }
14398    }
14399
14400    impl std::fmt::Display for DataState {
14401        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14402            wkt::internal::display_enum(f, self.name(), self.value())
14403        }
14404    }
14405
14406    impl std::convert::From<i32> for DataState {
14407        fn from(value: i32) -> Self {
14408            match value {
14409                0 => Self::Unspecified,
14410                1 => Self::DataOk,
14411                2 => Self::DataError,
14412                _ => Self::UnknownValue(data_state::UnknownValue(
14413                    wkt::internal::UnknownEnumValue::Integer(value),
14414                )),
14415            }
14416        }
14417    }
14418
14419    impl std::convert::From<&str> for DataState {
14420        fn from(value: &str) -> Self {
14421            use std::string::ToString;
14422            match value {
14423                "DATA_STATE_UNSPECIFIED" => Self::Unspecified,
14424                "DATA_OK" => Self::DataOk,
14425                "DATA_ERROR" => Self::DataError,
14426                _ => Self::UnknownValue(data_state::UnknownValue(
14427                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14428                )),
14429            }
14430        }
14431    }
14432
14433    impl serde::ser::Serialize for DataState {
14434        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14435        where
14436            S: serde::Serializer,
14437        {
14438            match self {
14439                Self::Unspecified => serializer.serialize_i32(0),
14440                Self::DataOk => serializer.serialize_i32(1),
14441                Self::DataError => serializer.serialize_i32(2),
14442                Self::UnknownValue(u) => u.0.serialize(serializer),
14443            }
14444        }
14445    }
14446
14447    impl<'de> serde::de::Deserialize<'de> for DataState {
14448        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14449        where
14450            D: serde::Deserializer<'de>,
14451        {
14452            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DataState>::new(
14453                ".google.cloud.retail.v2.Model.DataState",
14454            ))
14455        }
14456    }
14457
14458    /// Use single or multiple context products for recommendations.
14459    ///
14460    /// # Working with unknown values
14461    ///
14462    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14463    /// additional enum variants at any time. Adding new variants is not considered
14464    /// a breaking change. Applications should write their code in anticipation of:
14465    ///
14466    /// - New values appearing in future releases of the client library, **and**
14467    /// - New values received dynamically, without application changes.
14468    ///
14469    /// Please consult the [Working with enums] section in the user guide for some
14470    /// guidelines.
14471    ///
14472    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14473    #[derive(Clone, Debug, PartialEq)]
14474    #[non_exhaustive]
14475    pub enum ContextProductsType {
14476        /// Unspecified default value, should never be explicitly set.
14477        /// Defaults to
14478        /// [MULTIPLE_CONTEXT_PRODUCTS][google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS].
14479        ///
14480        /// [google.cloud.retail.v2.Model.ContextProductsType.MULTIPLE_CONTEXT_PRODUCTS]: crate::model::model::ContextProductsType::MultipleContextProducts
14481        Unspecified,
14482        /// Use only a single product as context for the recommendation. Typically
14483        /// used on pages like add-to-cart or product details.
14484        SingleContextProduct,
14485        /// Use one or multiple products as context for the recommendation. Typically
14486        /// used on shopping cart pages.
14487        MultipleContextProducts,
14488        /// If set, the enum was initialized with an unknown value.
14489        ///
14490        /// Applications can examine the value using [ContextProductsType::value] or
14491        /// [ContextProductsType::name].
14492        UnknownValue(context_products_type::UnknownValue),
14493    }
14494
14495    #[doc(hidden)]
14496    pub mod context_products_type {
14497        #[allow(unused_imports)]
14498        use super::*;
14499        #[derive(Clone, Debug, PartialEq)]
14500        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14501    }
14502
14503    impl ContextProductsType {
14504        /// Gets the enum value.
14505        ///
14506        /// Returns `None` if the enum contains an unknown value deserialized from
14507        /// the string representation of enums.
14508        pub fn value(&self) -> std::option::Option<i32> {
14509            match self {
14510                Self::Unspecified => std::option::Option::Some(0),
14511                Self::SingleContextProduct => std::option::Option::Some(1),
14512                Self::MultipleContextProducts => std::option::Option::Some(2),
14513                Self::UnknownValue(u) => u.0.value(),
14514            }
14515        }
14516
14517        /// Gets the enum value as a string.
14518        ///
14519        /// Returns `None` if the enum contains an unknown value deserialized from
14520        /// the integer representation of enums.
14521        pub fn name(&self) -> std::option::Option<&str> {
14522            match self {
14523                Self::Unspecified => std::option::Option::Some("CONTEXT_PRODUCTS_TYPE_UNSPECIFIED"),
14524                Self::SingleContextProduct => std::option::Option::Some("SINGLE_CONTEXT_PRODUCT"),
14525                Self::MultipleContextProducts => {
14526                    std::option::Option::Some("MULTIPLE_CONTEXT_PRODUCTS")
14527                }
14528                Self::UnknownValue(u) => u.0.name(),
14529            }
14530        }
14531    }
14532
14533    impl std::default::Default for ContextProductsType {
14534        fn default() -> Self {
14535            use std::convert::From;
14536            Self::from(0)
14537        }
14538    }
14539
14540    impl std::fmt::Display for ContextProductsType {
14541        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14542            wkt::internal::display_enum(f, self.name(), self.value())
14543        }
14544    }
14545
14546    impl std::convert::From<i32> for ContextProductsType {
14547        fn from(value: i32) -> Self {
14548            match value {
14549                0 => Self::Unspecified,
14550                1 => Self::SingleContextProduct,
14551                2 => Self::MultipleContextProducts,
14552                _ => Self::UnknownValue(context_products_type::UnknownValue(
14553                    wkt::internal::UnknownEnumValue::Integer(value),
14554                )),
14555            }
14556        }
14557    }
14558
14559    impl std::convert::From<&str> for ContextProductsType {
14560        fn from(value: &str) -> Self {
14561            use std::string::ToString;
14562            match value {
14563                "CONTEXT_PRODUCTS_TYPE_UNSPECIFIED" => Self::Unspecified,
14564                "SINGLE_CONTEXT_PRODUCT" => Self::SingleContextProduct,
14565                "MULTIPLE_CONTEXT_PRODUCTS" => Self::MultipleContextProducts,
14566                _ => Self::UnknownValue(context_products_type::UnknownValue(
14567                    wkt::internal::UnknownEnumValue::String(value.to_string()),
14568                )),
14569            }
14570        }
14571    }
14572
14573    impl serde::ser::Serialize for ContextProductsType {
14574        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14575        where
14576            S: serde::Serializer,
14577        {
14578            match self {
14579                Self::Unspecified => serializer.serialize_i32(0),
14580                Self::SingleContextProduct => serializer.serialize_i32(1),
14581                Self::MultipleContextProducts => serializer.serialize_i32(2),
14582                Self::UnknownValue(u) => u.0.serialize(serializer),
14583            }
14584        }
14585    }
14586
14587    impl<'de> serde::de::Deserialize<'de> for ContextProductsType {
14588        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14589        where
14590            D: serde::Deserializer<'de>,
14591        {
14592            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ContextProductsType>::new(
14593                ".google.cloud.retail.v2.Model.ContextProductsType",
14594            ))
14595        }
14596    }
14597}
14598
14599/// Request for creating a model.
14600#[derive(Clone, Default, PartialEq)]
14601#[non_exhaustive]
14602pub struct CreateModelRequest {
14603    /// Required. The parent resource under which to create the model. Format:
14604    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14605    pub parent: std::string::String,
14606
14607    /// Required. The payload of the [Model][google.cloud.retail.v2.Model]  to
14608    /// create.
14609    ///
14610    /// [google.cloud.retail.v2.Model]: crate::model::Model
14611    pub model: std::option::Option<crate::model::Model>,
14612
14613    /// Optional. Whether to run a dry run to validate the request (without
14614    /// actually creating the model).
14615    pub dry_run: bool,
14616
14617    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14618}
14619
14620impl CreateModelRequest {
14621    /// Creates a new default instance.
14622    pub fn new() -> Self {
14623        std::default::Default::default()
14624    }
14625
14626    /// Sets the value of [parent][crate::model::CreateModelRequest::parent].
14627    ///
14628    /// # Example
14629    /// ```ignore,no_run
14630    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14631    /// # let project_id = "project_id";
14632    /// # let location_id = "location_id";
14633    /// # let catalog_id = "catalog_id";
14634    /// let x = CreateModelRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
14635    /// ```
14636    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14637        self.parent = v.into();
14638        self
14639    }
14640
14641    /// Sets the value of [model][crate::model::CreateModelRequest::model].
14642    ///
14643    /// # Example
14644    /// ```ignore,no_run
14645    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14646    /// use google_cloud_retail_v2::model::Model;
14647    /// let x = CreateModelRequest::new().set_model(Model::default()/* use setters */);
14648    /// ```
14649    pub fn set_model<T>(mut self, v: T) -> Self
14650    where
14651        T: std::convert::Into<crate::model::Model>,
14652    {
14653        self.model = std::option::Option::Some(v.into());
14654        self
14655    }
14656
14657    /// Sets or clears the value of [model][crate::model::CreateModelRequest::model].
14658    ///
14659    /// # Example
14660    /// ```ignore,no_run
14661    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14662    /// use google_cloud_retail_v2::model::Model;
14663    /// let x = CreateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14664    /// let x = CreateModelRequest::new().set_or_clear_model(None::<Model>);
14665    /// ```
14666    pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14667    where
14668        T: std::convert::Into<crate::model::Model>,
14669    {
14670        self.model = v.map(|x| x.into());
14671        self
14672    }
14673
14674    /// Sets the value of [dry_run][crate::model::CreateModelRequest::dry_run].
14675    ///
14676    /// # Example
14677    /// ```ignore,no_run
14678    /// # use google_cloud_retail_v2::model::CreateModelRequest;
14679    /// let x = CreateModelRequest::new().set_dry_run(true);
14680    /// ```
14681    pub fn set_dry_run<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14682        self.dry_run = v.into();
14683        self
14684    }
14685}
14686
14687impl wkt::message::Message for CreateModelRequest {
14688    fn typename() -> &'static str {
14689        "type.googleapis.com/google.cloud.retail.v2.CreateModelRequest"
14690    }
14691}
14692
14693/// Request for updating an existing model.
14694#[derive(Clone, Default, PartialEq)]
14695#[non_exhaustive]
14696pub struct UpdateModelRequest {
14697    /// Required. The body of the updated [Model][google.cloud.retail.v2.Model].
14698    ///
14699    /// [google.cloud.retail.v2.Model]: crate::model::Model
14700    pub model: std::option::Option<crate::model::Model>,
14701
14702    /// Optional. Indicates which fields in the provided 'model' to
14703    /// update. If not set, by default updates all fields.
14704    pub update_mask: std::option::Option<wkt::FieldMask>,
14705
14706    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14707}
14708
14709impl UpdateModelRequest {
14710    /// Creates a new default instance.
14711    pub fn new() -> Self {
14712        std::default::Default::default()
14713    }
14714
14715    /// Sets the value of [model][crate::model::UpdateModelRequest::model].
14716    ///
14717    /// # Example
14718    /// ```ignore,no_run
14719    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14720    /// use google_cloud_retail_v2::model::Model;
14721    /// let x = UpdateModelRequest::new().set_model(Model::default()/* use setters */);
14722    /// ```
14723    pub fn set_model<T>(mut self, v: T) -> Self
14724    where
14725        T: std::convert::Into<crate::model::Model>,
14726    {
14727        self.model = std::option::Option::Some(v.into());
14728        self
14729    }
14730
14731    /// Sets or clears the value of [model][crate::model::UpdateModelRequest::model].
14732    ///
14733    /// # Example
14734    /// ```ignore,no_run
14735    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14736    /// use google_cloud_retail_v2::model::Model;
14737    /// let x = UpdateModelRequest::new().set_or_clear_model(Some(Model::default()/* use setters */));
14738    /// let x = UpdateModelRequest::new().set_or_clear_model(None::<Model>);
14739    /// ```
14740    pub fn set_or_clear_model<T>(mut self, v: std::option::Option<T>) -> Self
14741    where
14742        T: std::convert::Into<crate::model::Model>,
14743    {
14744        self.model = v.map(|x| x.into());
14745        self
14746    }
14747
14748    /// Sets the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14749    ///
14750    /// # Example
14751    /// ```ignore,no_run
14752    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14753    /// use wkt::FieldMask;
14754    /// let x = UpdateModelRequest::new().set_update_mask(FieldMask::default()/* use setters */);
14755    /// ```
14756    pub fn set_update_mask<T>(mut self, v: T) -> Self
14757    where
14758        T: std::convert::Into<wkt::FieldMask>,
14759    {
14760        self.update_mask = std::option::Option::Some(v.into());
14761        self
14762    }
14763
14764    /// Sets or clears the value of [update_mask][crate::model::UpdateModelRequest::update_mask].
14765    ///
14766    /// # Example
14767    /// ```ignore,no_run
14768    /// # use google_cloud_retail_v2::model::UpdateModelRequest;
14769    /// use wkt::FieldMask;
14770    /// let x = UpdateModelRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
14771    /// let x = UpdateModelRequest::new().set_or_clear_update_mask(None::<FieldMask>);
14772    /// ```
14773    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
14774    where
14775        T: std::convert::Into<wkt::FieldMask>,
14776    {
14777        self.update_mask = v.map(|x| x.into());
14778        self
14779    }
14780}
14781
14782impl wkt::message::Message for UpdateModelRequest {
14783    fn typename() -> &'static str {
14784        "type.googleapis.com/google.cloud.retail.v2.UpdateModelRequest"
14785    }
14786}
14787
14788/// Request for getting a model.
14789#[derive(Clone, Default, PartialEq)]
14790#[non_exhaustive]
14791pub struct GetModelRequest {
14792    /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14793    /// get. Format:
14794    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog}/models/{model_id}`
14795    ///
14796    /// [google.cloud.retail.v2.Model]: crate::model::Model
14797    pub name: std::string::String,
14798
14799    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14800}
14801
14802impl GetModelRequest {
14803    /// Creates a new default instance.
14804    pub fn new() -> Self {
14805        std::default::Default::default()
14806    }
14807
14808    /// Sets the value of [name][crate::model::GetModelRequest::name].
14809    ///
14810    /// # Example
14811    /// ```ignore,no_run
14812    /// # use google_cloud_retail_v2::model::GetModelRequest;
14813    /// # let project_id = "project_id";
14814    /// # let location_id = "location_id";
14815    /// # let catalog_id = "catalog_id";
14816    /// # let model_id = "model_id";
14817    /// let x = GetModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
14818    /// ```
14819    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14820        self.name = v.into();
14821        self
14822    }
14823}
14824
14825impl wkt::message::Message for GetModelRequest {
14826    fn typename() -> &'static str {
14827        "type.googleapis.com/google.cloud.retail.v2.GetModelRequest"
14828    }
14829}
14830
14831/// Request for pausing training of a model.
14832#[derive(Clone, Default, PartialEq)]
14833#[non_exhaustive]
14834pub struct PauseModelRequest {
14835    /// Required. The name of the model to pause.
14836    /// Format:
14837    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14838    pub name: std::string::String,
14839
14840    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14841}
14842
14843impl PauseModelRequest {
14844    /// Creates a new default instance.
14845    pub fn new() -> Self {
14846        std::default::Default::default()
14847    }
14848
14849    /// Sets the value of [name][crate::model::PauseModelRequest::name].
14850    ///
14851    /// # Example
14852    /// ```ignore,no_run
14853    /// # use google_cloud_retail_v2::model::PauseModelRequest;
14854    /// # let project_id = "project_id";
14855    /// # let location_id = "location_id";
14856    /// # let catalog_id = "catalog_id";
14857    /// # let model_id = "model_id";
14858    /// let x = PauseModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
14859    /// ```
14860    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14861        self.name = v.into();
14862        self
14863    }
14864}
14865
14866impl wkt::message::Message for PauseModelRequest {
14867    fn typename() -> &'static str {
14868        "type.googleapis.com/google.cloud.retail.v2.PauseModelRequest"
14869    }
14870}
14871
14872/// Request for resuming training of a model.
14873#[derive(Clone, Default, PartialEq)]
14874#[non_exhaustive]
14875pub struct ResumeModelRequest {
14876    /// Required. The name of the model to resume.
14877    /// Format:
14878    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14879    pub name: std::string::String,
14880
14881    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14882}
14883
14884impl ResumeModelRequest {
14885    /// Creates a new default instance.
14886    pub fn new() -> Self {
14887        std::default::Default::default()
14888    }
14889
14890    /// Sets the value of [name][crate::model::ResumeModelRequest::name].
14891    ///
14892    /// # Example
14893    /// ```ignore,no_run
14894    /// # use google_cloud_retail_v2::model::ResumeModelRequest;
14895    /// let x = ResumeModelRequest::new().set_name("example");
14896    /// ```
14897    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14898        self.name = v.into();
14899        self
14900    }
14901}
14902
14903impl wkt::message::Message for ResumeModelRequest {
14904    fn typename() -> &'static str {
14905        "type.googleapis.com/google.cloud.retail.v2.ResumeModelRequest"
14906    }
14907}
14908
14909/// Request for listing models associated with a resource.
14910#[derive(Clone, Default, PartialEq)]
14911#[non_exhaustive]
14912pub struct ListModelsRequest {
14913    /// Required. The parent for which to list models.
14914    /// Format:
14915    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
14916    pub parent: std::string::String,
14917
14918    /// Optional. Maximum number of results to return. If unspecified, defaults
14919    /// to 50. Max allowed value is 1000.
14920    pub page_size: i32,
14921
14922    /// Optional. A page token, received from a previous `ListModels`
14923    /// call. Provide this to retrieve the subsequent page.
14924    pub page_token: std::string::String,
14925
14926    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14927}
14928
14929impl ListModelsRequest {
14930    /// Creates a new default instance.
14931    pub fn new() -> Self {
14932        std::default::Default::default()
14933    }
14934
14935    /// Sets the value of [parent][crate::model::ListModelsRequest::parent].
14936    ///
14937    /// # Example
14938    /// ```ignore,no_run
14939    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14940    /// # let project_id = "project_id";
14941    /// # let location_id = "location_id";
14942    /// # let catalog_id = "catalog_id";
14943    /// let x = ListModelsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
14944    /// ```
14945    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14946        self.parent = v.into();
14947        self
14948    }
14949
14950    /// Sets the value of [page_size][crate::model::ListModelsRequest::page_size].
14951    ///
14952    /// # Example
14953    /// ```ignore,no_run
14954    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14955    /// let x = ListModelsRequest::new().set_page_size(42);
14956    /// ```
14957    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14958        self.page_size = v.into();
14959        self
14960    }
14961
14962    /// Sets the value of [page_token][crate::model::ListModelsRequest::page_token].
14963    ///
14964    /// # Example
14965    /// ```ignore,no_run
14966    /// # use google_cloud_retail_v2::model::ListModelsRequest;
14967    /// let x = ListModelsRequest::new().set_page_token("example");
14968    /// ```
14969    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14970        self.page_token = v.into();
14971        self
14972    }
14973}
14974
14975impl wkt::message::Message for ListModelsRequest {
14976    fn typename() -> &'static str {
14977        "type.googleapis.com/google.cloud.retail.v2.ListModelsRequest"
14978    }
14979}
14980
14981/// Request for deleting a model.
14982#[derive(Clone, Default, PartialEq)]
14983#[non_exhaustive]
14984pub struct DeleteModelRequest {
14985    /// Required. The resource name of the [Model][google.cloud.retail.v2.Model] to
14986    /// delete. Format:
14987    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
14988    ///
14989    /// [google.cloud.retail.v2.Model]: crate::model::Model
14990    pub name: std::string::String,
14991
14992    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14993}
14994
14995impl DeleteModelRequest {
14996    /// Creates a new default instance.
14997    pub fn new() -> Self {
14998        std::default::Default::default()
14999    }
15000
15001    /// Sets the value of [name][crate::model::DeleteModelRequest::name].
15002    ///
15003    /// # Example
15004    /// ```ignore,no_run
15005    /// # use google_cloud_retail_v2::model::DeleteModelRequest;
15006    /// # let project_id = "project_id";
15007    /// # let location_id = "location_id";
15008    /// # let catalog_id = "catalog_id";
15009    /// # let model_id = "model_id";
15010    /// let x = DeleteModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
15011    /// ```
15012    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15013        self.name = v.into();
15014        self
15015    }
15016}
15017
15018impl wkt::message::Message for DeleteModelRequest {
15019    fn typename() -> &'static str {
15020        "type.googleapis.com/google.cloud.retail.v2.DeleteModelRequest"
15021    }
15022}
15023
15024/// Response to a ListModelRequest.
15025#[derive(Clone, Default, PartialEq)]
15026#[non_exhaustive]
15027pub struct ListModelsResponse {
15028    /// List of Models.
15029    pub models: std::vec::Vec<crate::model::Model>,
15030
15031    /// Pagination token, if not returned indicates the last page.
15032    pub next_page_token: std::string::String,
15033
15034    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15035}
15036
15037impl ListModelsResponse {
15038    /// Creates a new default instance.
15039    pub fn new() -> Self {
15040        std::default::Default::default()
15041    }
15042
15043    /// Sets the value of [models][crate::model::ListModelsResponse::models].
15044    ///
15045    /// # Example
15046    /// ```ignore,no_run
15047    /// # use google_cloud_retail_v2::model::ListModelsResponse;
15048    /// use google_cloud_retail_v2::model::Model;
15049    /// let x = ListModelsResponse::new()
15050    ///     .set_models([
15051    ///         Model::default()/* use setters */,
15052    ///         Model::default()/* use (different) setters */,
15053    ///     ]);
15054    /// ```
15055    pub fn set_models<T, V>(mut self, v: T) -> Self
15056    where
15057        T: std::iter::IntoIterator<Item = V>,
15058        V: std::convert::Into<crate::model::Model>,
15059    {
15060        use std::iter::Iterator;
15061        self.models = v.into_iter().map(|i| i.into()).collect();
15062        self
15063    }
15064
15065    /// Sets the value of [next_page_token][crate::model::ListModelsResponse::next_page_token].
15066    ///
15067    /// # Example
15068    /// ```ignore,no_run
15069    /// # use google_cloud_retail_v2::model::ListModelsResponse;
15070    /// let x = ListModelsResponse::new().set_next_page_token("example");
15071    /// ```
15072    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15073        self.next_page_token = v.into();
15074        self
15075    }
15076}
15077
15078impl wkt::message::Message for ListModelsResponse {
15079    fn typename() -> &'static str {
15080        "type.googleapis.com/google.cloud.retail.v2.ListModelsResponse"
15081    }
15082}
15083
15084#[doc(hidden)]
15085impl google_cloud_gax::paginator::internal::PageableResponse for ListModelsResponse {
15086    type PageItem = crate::model::Model;
15087
15088    fn items(self) -> std::vec::Vec<Self::PageItem> {
15089        self.models
15090    }
15091
15092    fn next_page_token(&self) -> std::string::String {
15093        use std::clone::Clone;
15094        self.next_page_token.clone()
15095    }
15096}
15097
15098/// Request to manually start a tuning process now (instead of waiting for
15099/// the periodically scheduled tuning to happen).
15100#[derive(Clone, Default, PartialEq)]
15101#[non_exhaustive]
15102pub struct TuneModelRequest {
15103    /// Required. The resource name of the model to tune.
15104    /// Format:
15105    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15106    pub name: std::string::String,
15107
15108    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15109}
15110
15111impl TuneModelRequest {
15112    /// Creates a new default instance.
15113    pub fn new() -> Self {
15114        std::default::Default::default()
15115    }
15116
15117    /// Sets the value of [name][crate::model::TuneModelRequest::name].
15118    ///
15119    /// # Example
15120    /// ```ignore,no_run
15121    /// # use google_cloud_retail_v2::model::TuneModelRequest;
15122    /// # let project_id = "project_id";
15123    /// # let location_id = "location_id";
15124    /// # let catalog_id = "catalog_id";
15125    /// # let model_id = "model_id";
15126    /// let x = TuneModelRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}"));
15127    /// ```
15128    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15129        self.name = v.into();
15130        self
15131    }
15132}
15133
15134impl wkt::message::Message for TuneModelRequest {
15135    fn typename() -> &'static str {
15136        "type.googleapis.com/google.cloud.retail.v2.TuneModelRequest"
15137    }
15138}
15139
15140/// Metadata associated with a create operation.
15141#[derive(Clone, Default, PartialEq)]
15142#[non_exhaustive]
15143pub struct CreateModelMetadata {
15144    /// The resource name of the model that this create applies to.
15145    /// Format:
15146    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15147    pub model: std::string::String,
15148
15149    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15150}
15151
15152impl CreateModelMetadata {
15153    /// Creates a new default instance.
15154    pub fn new() -> Self {
15155        std::default::Default::default()
15156    }
15157
15158    /// Sets the value of [model][crate::model::CreateModelMetadata::model].
15159    ///
15160    /// # Example
15161    /// ```ignore,no_run
15162    /// # use google_cloud_retail_v2::model::CreateModelMetadata;
15163    /// let x = CreateModelMetadata::new().set_model("example");
15164    /// ```
15165    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15166        self.model = v.into();
15167        self
15168    }
15169}
15170
15171impl wkt::message::Message for CreateModelMetadata {
15172    fn typename() -> &'static str {
15173        "type.googleapis.com/google.cloud.retail.v2.CreateModelMetadata"
15174    }
15175}
15176
15177/// Metadata associated with a tune operation.
15178#[derive(Clone, Default, PartialEq)]
15179#[non_exhaustive]
15180pub struct TuneModelMetadata {
15181    /// The resource name of the model that this tune applies to.
15182    /// Format:
15183    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/models/{model_id}`
15184    pub model: std::string::String,
15185
15186    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15187}
15188
15189impl TuneModelMetadata {
15190    /// Creates a new default instance.
15191    pub fn new() -> Self {
15192        std::default::Default::default()
15193    }
15194
15195    /// Sets the value of [model][crate::model::TuneModelMetadata::model].
15196    ///
15197    /// # Example
15198    /// ```ignore,no_run
15199    /// # use google_cloud_retail_v2::model::TuneModelMetadata;
15200    /// let x = TuneModelMetadata::new().set_model("example");
15201    /// ```
15202    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15203        self.model = v.into();
15204        self
15205    }
15206}
15207
15208impl wkt::message::Message for TuneModelMetadata {
15209    fn typename() -> &'static str {
15210        "type.googleapis.com/google.cloud.retail.v2.TuneModelMetadata"
15211    }
15212}
15213
15214/// Response associated with a tune operation.
15215#[derive(Clone, Default, PartialEq)]
15216#[non_exhaustive]
15217pub struct TuneModelResponse {
15218    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15219}
15220
15221impl TuneModelResponse {
15222    /// Creates a new default instance.
15223    pub fn new() -> Self {
15224        std::default::Default::default()
15225    }
15226}
15227
15228impl wkt::message::Message for TuneModelResponse {
15229    fn typename() -> &'static str {
15230        "type.googleapis.com/google.cloud.retail.v2.TuneModelResponse"
15231    }
15232}
15233
15234/// Request message for Predict method.
15235#[derive(Clone, Default, PartialEq)]
15236#[non_exhaustive]
15237pub struct PredictRequest {
15238    /// Required. Full resource name of the format:
15239    /// `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}`
15240    /// or
15241    /// `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`.
15242    /// We recommend using the `servingConfigs` resource. `placements` is a legacy
15243    /// resource.
15244    /// The ID of the Recommendations AI serving config or placement.
15245    /// Before you can request predictions from your model, you must create at
15246    /// least one serving config or placement for it. For more information, see
15247    /// [Manage serving configs]
15248    /// (<https://cloud.google.com/retail/docs/manage-configs>).
15249    ///
15250    /// The full list of available serving configs can be seen at
15251    /// <https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs>
15252    pub placement: std::string::String,
15253
15254    /// Required. Context about the user, what they are looking at and what action
15255    /// they took to trigger the predict request. Note that this user event detail
15256    /// won't be ingested to userEvent logs. Thus, a separate userEvent write
15257    /// request is required for event logging.
15258    ///
15259    /// Don't set
15260    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or
15261    /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same
15262    /// fixed ID for different users. If you are trying to receive non-personalized
15263    /// recommendations (not recommended; this can negatively impact model
15264    /// performance), instead set
15265    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a
15266    /// random unique ID and leave
15267    /// [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset.
15268    ///
15269    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
15270    /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
15271    pub user_event: std::option::Option<crate::model::UserEvent>,
15272
15273    /// Maximum number of results to return. Set this property to the number of
15274    /// prediction results needed. If zero, the service will choose a reasonable
15275    /// default. The maximum allowed value is 100. Values above 100 will be coerced
15276    /// to 100.
15277    pub page_size: i32,
15278
15279    /// This field is not used; leave it unset.
15280    #[deprecated]
15281    pub page_token: std::string::String,
15282
15283    /// Filter for restricting prediction results with a length limit of 5,000
15284    /// characters. Accepts values for tags and the `filterOutOfStockItems` flag.
15285    ///
15286    /// * Tag expressions. Restricts predictions to products that match all of the
15287    ///   specified tags. Boolean operators `OR` and `NOT` are supported if the
15288    ///   expression is enclosed in parentheses, and must be separated from the
15289    ///   tag values by a space. `-"tagA"` is also supported and is equivalent to
15290    ///   `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
15291    ///   with a size limit of 1,000 characters.
15292    ///
15293    ///   Note: "Recently viewed" models don't support tag filtering at the
15294    ///   moment.
15295    ///
15296    /// * filterOutOfStockItems. Restricts predictions to products that do not
15297    ///   have a
15298    ///   stockState value of OUT_OF_STOCK.
15299    ///
15300    ///
15301    /// Examples:
15302    ///
15303    /// * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
15304    /// * filterOutOfStockItems  tag=(-"promotional")
15305    /// * filterOutOfStockItems
15306    ///
15307    /// If your filter blocks all prediction results, the API will return *no*
15308    /// results. If instead you want empty result sets to return generic
15309    /// (unfiltered) popular products, set `strictFiltering` to False in
15310    /// `PredictRequest.params`. Note that the API will never return items with
15311    /// storageStatus of "EXPIRED" or "DELETED" regardless of filter choices.
15312    ///
15313    /// If `filterSyntaxV2` is set to true under the `params` field, then
15314    /// attribute-based expressions are expected instead of the above described
15315    /// tag-based syntax. Examples:
15316    ///
15317    /// * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones"))
15318    /// * (availability: ANY("IN_STOCK")) AND
15319    ///   (colors: ANY("Red") OR categories: ANY("Phones"))
15320    ///
15321    /// For more information, see
15322    /// [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs).
15323    pub filter: std::string::String,
15324
15325    /// Use validate only mode for this prediction query. If set to true, a
15326    /// dummy model will be used that returns arbitrary products.
15327    /// Note that the validate only mode should only be used for testing the API,
15328    /// or if the model is not ready.
15329    pub validate_only: bool,
15330
15331    /// Additional domain specific parameters for the predictions.
15332    ///
15333    /// Allowed values:
15334    ///
15335    /// * `returnProduct`: Boolean. If set to true, the associated product
15336    ///   object will be returned in the `results.metadata` field in the
15337    ///   prediction response.
15338    /// * `returnScore`: Boolean. If set to true, the prediction 'score'
15339    ///   corresponding to each returned product will be set in the
15340    ///   `results.metadata` field in the prediction response. The given
15341    ///   'score' indicates the probability of a product being clicked/purchased
15342    ///   given the user's context and history.
15343    /// * `strictFiltering`: Boolean. True by default. If set to false, the service
15344    ///   will return generic (unfiltered) popular products instead of empty if
15345    ///   your filter blocks all prediction results.
15346    /// * `priceRerankLevel`: String. Default empty. If set to be non-empty, then
15347    ///   it needs to be one of {'no-price-reranking', 'low-price-reranking',
15348    ///   'medium-price-reranking', 'high-price-reranking'}. This gives
15349    ///   request-level control and adjusts prediction results based on product
15350    ///   price.
15351    /// * `diversityLevel`: String. Default empty. If set to be non-empty, then
15352    ///   it needs to be one of {'no-diversity', 'low-diversity',
15353    ///   'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives
15354    ///   request-level control and adjusts prediction results based on product
15355    ///   category.
15356    /// * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter`
15357    ///   field is interpreteted according to the new, attribute-based syntax.
15358    pub params: std::collections::HashMap<std::string::String, wkt::Value>,
15359
15360    /// The labels applied to a resource must meet the following requirements:
15361    ///
15362    /// * Each resource can have multiple labels, up to a maximum of 64.
15363    /// * Each label must be a key-value pair.
15364    /// * Keys have a minimum length of 1 character and a maximum length of 63
15365    ///   characters and cannot be empty. Values can be empty and have a maximum
15366    ///   length of 63 characters.
15367    /// * Keys and values can contain only lowercase letters, numeric characters,
15368    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
15369    ///   international characters are allowed.
15370    /// * The key portion of a label must be unique. However, you can use the same
15371    ///   key with multiple resources.
15372    /// * Keys must start with a lowercase letter or international character.
15373    ///
15374    /// See [Google Cloud
15375    /// Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
15376    /// for more details.
15377    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
15378
15379    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15380}
15381
15382impl PredictRequest {
15383    /// Creates a new default instance.
15384    pub fn new() -> Self {
15385        std::default::Default::default()
15386    }
15387
15388    /// Sets the value of [placement][crate::model::PredictRequest::placement].
15389    ///
15390    /// # Example
15391    /// ```ignore,no_run
15392    /// # use google_cloud_retail_v2::model::PredictRequest;
15393    /// let x = PredictRequest::new().set_placement("example");
15394    /// ```
15395    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15396        self.placement = v.into();
15397        self
15398    }
15399
15400    /// Sets the value of [user_event][crate::model::PredictRequest::user_event].
15401    ///
15402    /// # Example
15403    /// ```ignore,no_run
15404    /// # use google_cloud_retail_v2::model::PredictRequest;
15405    /// use google_cloud_retail_v2::model::UserEvent;
15406    /// let x = PredictRequest::new().set_user_event(UserEvent::default()/* use setters */);
15407    /// ```
15408    pub fn set_user_event<T>(mut self, v: T) -> Self
15409    where
15410        T: std::convert::Into<crate::model::UserEvent>,
15411    {
15412        self.user_event = std::option::Option::Some(v.into());
15413        self
15414    }
15415
15416    /// Sets or clears the value of [user_event][crate::model::PredictRequest::user_event].
15417    ///
15418    /// # Example
15419    /// ```ignore,no_run
15420    /// # use google_cloud_retail_v2::model::PredictRequest;
15421    /// use google_cloud_retail_v2::model::UserEvent;
15422    /// let x = PredictRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
15423    /// let x = PredictRequest::new().set_or_clear_user_event(None::<UserEvent>);
15424    /// ```
15425    pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
15426    where
15427        T: std::convert::Into<crate::model::UserEvent>,
15428    {
15429        self.user_event = v.map(|x| x.into());
15430        self
15431    }
15432
15433    /// Sets the value of [page_size][crate::model::PredictRequest::page_size].
15434    ///
15435    /// # Example
15436    /// ```ignore,no_run
15437    /// # use google_cloud_retail_v2::model::PredictRequest;
15438    /// let x = PredictRequest::new().set_page_size(42);
15439    /// ```
15440    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15441        self.page_size = v.into();
15442        self
15443    }
15444
15445    /// Sets the value of [page_token][crate::model::PredictRequest::page_token].
15446    ///
15447    /// # Example
15448    /// ```ignore,no_run
15449    /// # use google_cloud_retail_v2::model::PredictRequest;
15450    /// let x = PredictRequest::new().set_page_token("example");
15451    /// ```
15452    #[deprecated]
15453    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15454        self.page_token = v.into();
15455        self
15456    }
15457
15458    /// Sets the value of [filter][crate::model::PredictRequest::filter].
15459    ///
15460    /// # Example
15461    /// ```ignore,no_run
15462    /// # use google_cloud_retail_v2::model::PredictRequest;
15463    /// let x = PredictRequest::new().set_filter("example");
15464    /// ```
15465    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15466        self.filter = v.into();
15467        self
15468    }
15469
15470    /// Sets the value of [validate_only][crate::model::PredictRequest::validate_only].
15471    ///
15472    /// # Example
15473    /// ```ignore,no_run
15474    /// # use google_cloud_retail_v2::model::PredictRequest;
15475    /// let x = PredictRequest::new().set_validate_only(true);
15476    /// ```
15477    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15478        self.validate_only = v.into();
15479        self
15480    }
15481
15482    /// Sets the value of [params][crate::model::PredictRequest::params].
15483    ///
15484    /// # Example
15485    /// ```ignore,no_run
15486    /// # use google_cloud_retail_v2::model::PredictRequest;
15487    /// use wkt::Value;
15488    /// let x = PredictRequest::new().set_params([
15489    ///     ("key0", Value::default()/* use setters */),
15490    ///     ("key1", Value::default()/* use (different) setters */),
15491    /// ]);
15492    /// ```
15493    pub fn set_params<T, K, V>(mut self, v: T) -> Self
15494    where
15495        T: std::iter::IntoIterator<Item = (K, V)>,
15496        K: std::convert::Into<std::string::String>,
15497        V: std::convert::Into<wkt::Value>,
15498    {
15499        use std::iter::Iterator;
15500        self.params = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15501        self
15502    }
15503
15504    /// Sets the value of [labels][crate::model::PredictRequest::labels].
15505    ///
15506    /// # Example
15507    /// ```ignore,no_run
15508    /// # use google_cloud_retail_v2::model::PredictRequest;
15509    /// let x = PredictRequest::new().set_labels([
15510    ///     ("key0", "abc"),
15511    ///     ("key1", "xyz"),
15512    /// ]);
15513    /// ```
15514    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
15515    where
15516        T: std::iter::IntoIterator<Item = (K, V)>,
15517        K: std::convert::Into<std::string::String>,
15518        V: std::convert::Into<std::string::String>,
15519    {
15520        use std::iter::Iterator;
15521        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15522        self
15523    }
15524}
15525
15526impl wkt::message::Message for PredictRequest {
15527    fn typename() -> &'static str {
15528        "type.googleapis.com/google.cloud.retail.v2.PredictRequest"
15529    }
15530}
15531
15532/// Response message for predict method.
15533#[derive(Clone, Default, PartialEq)]
15534#[non_exhaustive]
15535pub struct PredictResponse {
15536    /// A list of recommended products. The order represents the ranking (from the
15537    /// most relevant product to the least).
15538    pub results: std::vec::Vec<crate::model::predict_response::PredictionResult>,
15539
15540    /// A unique attribution token. This should be included in the
15541    /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
15542    /// recommendation, which enables accurate attribution of recommendation model
15543    /// performance.
15544    ///
15545    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
15546    pub attribution_token: std::string::String,
15547
15548    /// IDs of products in the request that were missing from the inventory.
15549    pub missing_ids: std::vec::Vec<std::string::String>,
15550
15551    /// True if the validateOnly property was set in the request.
15552    pub validate_only: bool,
15553
15554    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15555}
15556
15557impl PredictResponse {
15558    /// Creates a new default instance.
15559    pub fn new() -> Self {
15560        std::default::Default::default()
15561    }
15562
15563    /// Sets the value of [results][crate::model::PredictResponse::results].
15564    ///
15565    /// # Example
15566    /// ```ignore,no_run
15567    /// # use google_cloud_retail_v2::model::PredictResponse;
15568    /// use google_cloud_retail_v2::model::predict_response::PredictionResult;
15569    /// let x = PredictResponse::new()
15570    ///     .set_results([
15571    ///         PredictionResult::default()/* use setters */,
15572    ///         PredictionResult::default()/* use (different) setters */,
15573    ///     ]);
15574    /// ```
15575    pub fn set_results<T, V>(mut self, v: T) -> Self
15576    where
15577        T: std::iter::IntoIterator<Item = V>,
15578        V: std::convert::Into<crate::model::predict_response::PredictionResult>,
15579    {
15580        use std::iter::Iterator;
15581        self.results = v.into_iter().map(|i| i.into()).collect();
15582        self
15583    }
15584
15585    /// Sets the value of [attribution_token][crate::model::PredictResponse::attribution_token].
15586    ///
15587    /// # Example
15588    /// ```ignore,no_run
15589    /// # use google_cloud_retail_v2::model::PredictResponse;
15590    /// let x = PredictResponse::new().set_attribution_token("example");
15591    /// ```
15592    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
15593        mut self,
15594        v: T,
15595    ) -> Self {
15596        self.attribution_token = v.into();
15597        self
15598    }
15599
15600    /// Sets the value of [missing_ids][crate::model::PredictResponse::missing_ids].
15601    ///
15602    /// # Example
15603    /// ```ignore,no_run
15604    /// # use google_cloud_retail_v2::model::PredictResponse;
15605    /// let x = PredictResponse::new().set_missing_ids(["a", "b", "c"]);
15606    /// ```
15607    pub fn set_missing_ids<T, V>(mut self, v: T) -> Self
15608    where
15609        T: std::iter::IntoIterator<Item = V>,
15610        V: std::convert::Into<std::string::String>,
15611    {
15612        use std::iter::Iterator;
15613        self.missing_ids = v.into_iter().map(|i| i.into()).collect();
15614        self
15615    }
15616
15617    /// Sets the value of [validate_only][crate::model::PredictResponse::validate_only].
15618    ///
15619    /// # Example
15620    /// ```ignore,no_run
15621    /// # use google_cloud_retail_v2::model::PredictResponse;
15622    /// let x = PredictResponse::new().set_validate_only(true);
15623    /// ```
15624    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15625        self.validate_only = v.into();
15626        self
15627    }
15628}
15629
15630impl wkt::message::Message for PredictResponse {
15631    fn typename() -> &'static str {
15632        "type.googleapis.com/google.cloud.retail.v2.PredictResponse"
15633    }
15634}
15635
15636/// Defines additional types related to [PredictResponse].
15637pub mod predict_response {
15638    #[allow(unused_imports)]
15639    use super::*;
15640
15641    /// PredictionResult represents the recommendation prediction results.
15642    #[derive(Clone, Default, PartialEq)]
15643    #[non_exhaustive]
15644    pub struct PredictionResult {
15645        /// ID of the recommended product
15646        pub id: std::string::String,
15647
15648        /// Additional product metadata / annotations.
15649        ///
15650        /// Possible values:
15651        ///
15652        /// * `product`: JSON representation of the product. Is set if
15653        ///   `returnProduct` is set to true in `PredictRequest.params`.
15654        /// * `score`: Prediction score in double value. Is set if
15655        ///   `returnScore` is set to true in `PredictRequest.params`.
15656        pub metadata: std::collections::HashMap<std::string::String, wkt::Value>,
15657
15658        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15659    }
15660
15661    impl PredictionResult {
15662        /// Creates a new default instance.
15663        pub fn new() -> Self {
15664            std::default::Default::default()
15665        }
15666
15667        /// Sets the value of [id][crate::model::predict_response::PredictionResult::id].
15668        ///
15669        /// # Example
15670        /// ```ignore,no_run
15671        /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15672        /// let x = PredictionResult::new().set_id("example");
15673        /// ```
15674        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15675            self.id = v.into();
15676            self
15677        }
15678
15679        /// Sets the value of [metadata][crate::model::predict_response::PredictionResult::metadata].
15680        ///
15681        /// # Example
15682        /// ```ignore,no_run
15683        /// # use google_cloud_retail_v2::model::predict_response::PredictionResult;
15684        /// use wkt::Value;
15685        /// let x = PredictionResult::new().set_metadata([
15686        ///     ("key0", Value::default()/* use setters */),
15687        ///     ("key1", Value::default()/* use (different) setters */),
15688        /// ]);
15689        /// ```
15690        pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
15691        where
15692            T: std::iter::IntoIterator<Item = (K, V)>,
15693            K: std::convert::Into<std::string::String>,
15694            V: std::convert::Into<wkt::Value>,
15695        {
15696            use std::iter::Iterator;
15697            self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15698            self
15699        }
15700    }
15701
15702    impl wkt::message::Message for PredictionResult {
15703        fn typename() -> &'static str {
15704            "type.googleapis.com/google.cloud.retail.v2.PredictResponse.PredictionResult"
15705        }
15706    }
15707}
15708
15709/// Product captures all metadata information of items to be recommended or
15710/// searched.
15711#[derive(Clone, Default, PartialEq)]
15712#[non_exhaustive]
15713pub struct Product {
15714    /// Immutable. Full resource name of the product, such as
15715    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/product_id`.
15716    pub name: std::string::String,
15717
15718    /// Immutable. [Product][google.cloud.retail.v2.Product] identifier, which is
15719    /// the final component of [name][google.cloud.retail.v2.Product.name]. For
15720    /// example, this field is "id_1", if
15721    /// [name][google.cloud.retail.v2.Product.name] is
15722    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/id_1`.
15723    ///
15724    /// This field must be a UTF-8 encoded string with a length limit of 128
15725    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15726    ///
15727    /// Corresponding properties: Google Merchant Center property
15728    /// [id](https://support.google.com/merchants/answer/6324405). Schema.org
15729    /// property [Product.sku](https://schema.org/sku).
15730    ///
15731    /// [google.cloud.retail.v2.Product]: crate::model::Product
15732    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
15733    pub id: std::string::String,
15734
15735    /// Immutable. The type of the product. Default to
15736    /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
15737    /// if unset.
15738    ///
15739    /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
15740    pub r#type: crate::model::product::Type,
15741
15742    /// Variant group identifier. Must be an
15743    /// [id][google.cloud.retail.v2.Product.id], with the same parent branch with
15744    /// this product. Otherwise, an error is thrown.
15745    ///
15746    /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15747    /// [Product][google.cloud.retail.v2.Product]s, this field can only be empty or
15748    /// set to the same value as [id][google.cloud.retail.v2.Product.id].
15749    ///
15750    /// For VARIANT [Product][google.cloud.retail.v2.Product]s, this field cannot
15751    /// be empty. A maximum of 2,000 products are allowed to share the same
15752    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15753    /// [Product][google.cloud.retail.v2.Product]. Otherwise, an INVALID_ARGUMENT
15754    /// error is returned.
15755    ///
15756    /// Corresponding properties: Google Merchant Center property
15757    /// [item_group_id](https://support.google.com/merchants/answer/6324507).
15758    /// Schema.org property
15759    /// [Product.inProductGroupWithID](https://schema.org/inProductGroupWithID).
15760    ///
15761    /// [google.cloud.retail.v2.Product]: crate::model::Product
15762    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15763    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15764    pub primary_product_id: std::string::String,
15765
15766    /// The [id][google.cloud.retail.v2.Product.id] of the collection members when
15767    /// [type][google.cloud.retail.v2.Product.type] is
15768    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION].
15769    ///
15770    /// Non-existent product ids are allowed.
15771    /// The [type][google.cloud.retail.v2.Product.type] of the members must be
15772    /// either [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] or
15773    /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT] otherwise an
15774    /// INVALID_ARGUMENT error is thrown. Should not set it for other types. A
15775    /// maximum of 1000 values are allowed. Otherwise, an INVALID_ARGUMENT error is
15776    /// return.
15777    ///
15778    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15779    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15780    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15781    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
15782    /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
15783    pub collection_member_ids: std::vec::Vec<std::string::String>,
15784
15785    /// The Global Trade Item Number (GTIN) of the product.
15786    ///
15787    /// This field must be a UTF-8 encoded string with a length limit of 128
15788    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15789    ///
15790    /// This field must be a Unigram. Otherwise, an INVALID_ARGUMENT error is
15791    /// returned.
15792    ///
15793    /// Corresponding properties: Google Merchant Center property
15794    /// [gtin](https://support.google.com/merchants/answer/6324461).
15795    /// Schema.org property
15796    /// [Product.isbn](https://schema.org/isbn),
15797    /// [Product.gtin8](https://schema.org/gtin8),
15798    /// [Product.gtin12](https://schema.org/gtin12),
15799    /// [Product.gtin13](https://schema.org/gtin13), or
15800    /// [Product.gtin14](https://schema.org/gtin14).
15801    ///
15802    /// If the value is not a valid GTIN, an INVALID_ARGUMENT error is returned.
15803    pub gtin: std::string::String,
15804
15805    /// Product categories. This field is repeated for supporting one product
15806    /// belonging to several parallel categories. Strongly recommended using the
15807    /// full path for better search / recommendation quality.
15808    ///
15809    /// To represent full path of category, use '>' sign to separate different
15810    /// hierarchies. If '>' is part of the category name, replace it with
15811    /// other character(s).
15812    ///
15813    /// For example, if a shoes product belongs to both
15814    /// ["Shoes & Accessories" -> "Shoes"] and
15815    /// ["Sports & Fitness" -> "Athletic Clothing" -> "Shoes"], it could be
15816    /// represented as:
15817    ///
15818    /// ```norust
15819    ///  "categories": [
15820    ///    "Shoes & Accessories > Shoes",
15821    ///    "Sports & Fitness > Athletic Clothing > Shoes"
15822    ///  ]
15823    /// ```
15824    ///
15825    /// Must be set for [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
15826    /// [Product][google.cloud.retail.v2.Product] otherwise an INVALID_ARGUMENT
15827    /// error is returned.
15828    ///
15829    /// At most 250 values are allowed per
15830    /// [Product][google.cloud.retail.v2.Product] unless overridden through the
15831    /// Google Cloud console. Empty values are not allowed. Each value must be a
15832    /// UTF-8 encoded string with a length limit of 5,000 characters. Otherwise, an
15833    /// INVALID_ARGUMENT error is returned.
15834    ///
15835    /// Corresponding properties: Google Merchant Center property
15836    /// [google_product_category][mc_google_product_category]. Schema.org property
15837    /// [Product.category] (<https://schema.org/category>).
15838    ///
15839    /// [google.cloud.retail.v2.Product]: crate::model::Product
15840    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15841    pub categories: std::vec::Vec<std::string::String>,
15842
15843    /// Required. Product title.
15844    ///
15845    /// This field must be a UTF-8 encoded string with a length limit of 1,000
15846    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15847    ///
15848    /// Corresponding properties: Google Merchant Center property
15849    /// [title](https://support.google.com/merchants/answer/6324415). Schema.org
15850    /// property [Product.name](https://schema.org/name).
15851    pub title: std::string::String,
15852
15853    /// The brands of the product.
15854    ///
15855    /// A maximum of 30 brands are allowed unless overridden through the Google
15856    /// Cloud console. Each
15857    /// brand must be a UTF-8 encoded string with a length limit of 1,000
15858    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15859    ///
15860    /// Corresponding properties: Google Merchant Center property
15861    /// [brand](https://support.google.com/merchants/answer/6324351). Schema.org
15862    /// property [Product.brand](https://schema.org/brand).
15863    pub brands: std::vec::Vec<std::string::String>,
15864
15865    /// Product description.
15866    ///
15867    /// This field must be a UTF-8 encoded string with a length limit of 5,000
15868    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
15869    ///
15870    /// Corresponding properties: Google Merchant Center property
15871    /// [description](https://support.google.com/merchants/answer/6324468).
15872    /// Schema.org property [Product.description](https://schema.org/description).
15873    pub description: std::string::String,
15874
15875    /// Language of the title/description and other string attributes. Use language
15876    /// tags defined by [BCP 47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt).
15877    ///
15878    /// For product prediction, this field is ignored and the model automatically
15879    /// detects the text language. The [Product][google.cloud.retail.v2.Product]
15880    /// can include text in different languages, but duplicating
15881    /// [Product][google.cloud.retail.v2.Product]s to provide text in multiple
15882    /// languages can result in degraded model performance.
15883    ///
15884    /// For product search this field is in use. It defaults to "en-US" if unset.
15885    ///
15886    /// [google.cloud.retail.v2.Product]: crate::model::Product
15887    pub language_code: std::string::String,
15888
15889    /// Highly encouraged. Extra product attributes to be included. For example,
15890    /// for products, this could include the store name, vendor, style, color, etc.
15891    /// These are very strong signals for recommendation model, thus we highly
15892    /// recommend providing the attributes here.
15893    ///
15894    /// Features that can take on one of a limited number of possible values. Two
15895    /// types of features can be set are:
15896    ///
15897    /// Textual features. some examples would be the brand/maker of a product, or
15898    /// country of a customer. Numerical features. Some examples would be the
15899    /// height/weight of a product, or age of a customer.
15900    ///
15901    /// For example: `{ "vendor": {"text": ["vendor123", "vendor456"]},
15902    /// "lengths_cm": {"numbers":[2.3, 15.4]}, "heights_cm": {"numbers":[8.1, 6.4]}
15903    /// }`.
15904    ///
15905    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
15906    /// error is returned:
15907    ///
15908    /// * Max entries count: 200.
15909    /// * The key must be a UTF-8 encoded string with a length limit of 128
15910    ///   characters.
15911    /// * For indexable attribute, the key must match the pattern:
15912    ///   `[a-zA-Z0-9][a-zA-Z0-9_]*`. For example, `key0LikeThis` or
15913    ///   `KEY_1_LIKE_THIS`.
15914    /// * For text attributes, at most 400 values are allowed. Empty values are not
15915    ///   allowed. Each value must be a non-empty UTF-8 encoded string with a
15916    ///   length limit of 256 characters.
15917    /// * For number attributes, at most 400 values are allowed.
15918    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
15919
15920    /// Custom tags associated with the product.
15921    ///
15922    /// At most 250 values are allowed per
15923    /// [Product][google.cloud.retail.v2.Product]. This value must be a UTF-8
15924    /// encoded string with a length limit of 1,000 characters. Otherwise, an
15925    /// INVALID_ARGUMENT error is returned.
15926    ///
15927    /// This tag can be used for filtering recommendation results by passing the
15928    /// tag as part of the
15929    /// [PredictRequest.filter][google.cloud.retail.v2.PredictRequest.filter].
15930    ///
15931    /// Corresponding properties: Google Merchant Center property
15932    /// [custom_label_0–4](https://support.google.com/merchants/answer/6324473).
15933    ///
15934    /// [google.cloud.retail.v2.PredictRequest.filter]: crate::model::PredictRequest::filter
15935    /// [google.cloud.retail.v2.Product]: crate::model::Product
15936    pub tags: std::vec::Vec<std::string::String>,
15937
15938    /// Product price and cost information.
15939    ///
15940    /// Corresponding properties: Google Merchant Center property
15941    /// [price](https://support.google.com/merchants/answer/6324371).
15942    pub price_info: std::option::Option<crate::model::PriceInfo>,
15943
15944    /// The rating of this product.
15945    pub rating: std::option::Option<crate::model::Rating>,
15946
15947    /// The timestamp when this [Product][google.cloud.retail.v2.Product] becomes
15948    /// available for
15949    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search]. Note
15950    /// that this is only applicable to
15951    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
15952    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], and
15953    /// ignored for [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT].
15954    ///
15955    /// [google.cloud.retail.v2.Product]: crate::model::Product
15956    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
15957    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
15958    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
15959    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
15960    pub available_time: std::option::Option<wkt::Timestamp>,
15961
15962    /// The online availability of the [Product][google.cloud.retail.v2.Product].
15963    /// Default to
15964    /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK].
15965    ///
15966    /// For primary products with variants set the availability of the primary as
15967    /// [Availability.OUT_OF_STOCK][google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]
15968    /// and set the true availability at the variant level. This way the primary
15969    /// product will be considered "in stock" as long as it has at least one
15970    /// variant in stock.
15971    ///
15972    /// For primary products with no variants set the true availability at the
15973    /// primary level.
15974    ///
15975    /// Corresponding properties: Google Merchant Center property
15976    /// [availability](https://support.google.com/merchants/answer/6324448).
15977    /// Schema.org property [Offer.availability](https://schema.org/availability).
15978    ///
15979    /// [google.cloud.retail.v2.Product]: crate::model::Product
15980    /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
15981    /// [google.cloud.retail.v2.Product.Availability.OUT_OF_STOCK]: crate::model::product::Availability::OutOfStock
15982    pub availability: crate::model::product::Availability,
15983
15984    /// The available quantity of the item.
15985    pub available_quantity: std::option::Option<wkt::Int32Value>,
15986
15987    /// Fulfillment information, such as the store IDs for in-store pickup or
15988    /// region IDs for different shipping methods.
15989    ///
15990    /// All the elements must have distinct
15991    /// [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type].
15992    /// Otherwise, an INVALID_ARGUMENT error is returned.
15993    ///
15994    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
15995    pub fulfillment_info: std::vec::Vec<crate::model::FulfillmentInfo>,
15996
15997    /// Canonical URL directly linking to the product detail page.
15998    ///
15999    /// It is strongly recommended to provide a valid uri for the product,
16000    /// otherwise the service performance could be significantly degraded.
16001    ///
16002    /// This field must be a UTF-8 encoded string with a length limit of 5,000
16003    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
16004    ///
16005    /// Corresponding properties: Google Merchant Center property
16006    /// [link](https://support.google.com/merchants/answer/6324416). Schema.org
16007    /// property [Offer.url](https://schema.org/url).
16008    pub uri: std::string::String,
16009
16010    /// Product images for the product. We highly recommend putting the main
16011    /// image first.
16012    ///
16013    /// A maximum of 300 images are allowed.
16014    ///
16015    /// Corresponding properties: Google Merchant Center property
16016    /// [image_link](https://support.google.com/merchants/answer/6324350).
16017    /// Schema.org property [Product.image](https://schema.org/image).
16018    pub images: std::vec::Vec<crate::model::Image>,
16019
16020    /// The target group associated with a given audience (e.g. male, veterans,
16021    /// car owners, musicians, etc.) of the product.
16022    pub audience: std::option::Option<crate::model::Audience>,
16023
16024    /// The color of the product.
16025    ///
16026    /// Corresponding properties: Google Merchant Center property
16027    /// [color](https://support.google.com/merchants/answer/6324487). Schema.org
16028    /// property [Product.color](https://schema.org/color).
16029    pub color_info: std::option::Option<crate::model::ColorInfo>,
16030
16031    /// The size of the product. To represent different size systems or size types,
16032    /// consider using this format: [[[size_system:]size_type:]size_value].
16033    ///
16034    /// For example, in "US:MENS:M", "US" represents size system; "MENS" represents
16035    /// size type; "M" represents size value. In "GIRLS:27", size system is empty;
16036    /// "GIRLS" represents size type; "27" represents size value. In "32 inches",
16037    /// both size system and size type are empty, while size value is "32 inches".
16038    ///
16039    /// A maximum of 20 values are allowed per
16040    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
16041    /// encoded string with a length limit of 128 characters. Otherwise, an
16042    /// INVALID_ARGUMENT error is returned.
16043    ///
16044    /// Corresponding properties: Google Merchant Center property
16045    /// [size](https://support.google.com/merchants/answer/6324492),
16046    /// [size_type](https://support.google.com/merchants/answer/6324497), and
16047    /// [size_system](https://support.google.com/merchants/answer/6324502).
16048    /// Schema.org property [Product.size](https://schema.org/size).
16049    ///
16050    /// [google.cloud.retail.v2.Product]: crate::model::Product
16051    pub sizes: std::vec::Vec<std::string::String>,
16052
16053    /// The material of the product. For example, "leather", "wooden".
16054    ///
16055    /// A maximum of 20 values are allowed. Each value must be a UTF-8 encoded
16056    /// string with a length limit of 200 characters. Otherwise, an
16057    /// INVALID_ARGUMENT error is returned.
16058    ///
16059    /// Corresponding properties: Google Merchant Center property
16060    /// [material](https://support.google.com/merchants/answer/6324410). Schema.org
16061    /// property [Product.material](https://schema.org/material).
16062    pub materials: std::vec::Vec<std::string::String>,
16063
16064    /// The pattern or graphic print of the product. For example, "striped", "polka
16065    /// dot", "paisley".
16066    ///
16067    /// A maximum of 20 values are allowed per
16068    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
16069    /// encoded string with a length limit of 128 characters. Otherwise, an
16070    /// INVALID_ARGUMENT error is returned.
16071    ///
16072    /// Corresponding properties: Google Merchant Center property
16073    /// [pattern](https://support.google.com/merchants/answer/6324483). Schema.org
16074    /// property [Product.pattern](https://schema.org/pattern).
16075    ///
16076    /// [google.cloud.retail.v2.Product]: crate::model::Product
16077    pub patterns: std::vec::Vec<std::string::String>,
16078
16079    /// The condition of the product. Strongly encouraged to use the standard
16080    /// values: "new", "refurbished", "used".
16081    ///
16082    /// A maximum of 1 value is allowed per
16083    /// [Product][google.cloud.retail.v2.Product]. Each value must be a UTF-8
16084    /// encoded string with a length limit of 128 characters. Otherwise, an
16085    /// INVALID_ARGUMENT error is returned.
16086    ///
16087    /// Corresponding properties: Google Merchant Center property
16088    /// [condition](https://support.google.com/merchants/answer/6324469).
16089    /// Schema.org property
16090    /// [Offer.itemCondition](https://schema.org/itemCondition).
16091    ///
16092    /// [google.cloud.retail.v2.Product]: crate::model::Product
16093    pub conditions: std::vec::Vec<std::string::String>,
16094
16095    /// The promotions applied to the product. A maximum of 10 values are allowed
16096    /// per [Product][google.cloud.retail.v2.Product]. Only
16097    /// [Promotion.promotion_id][google.cloud.retail.v2.Promotion.promotion_id]
16098    /// will be used, other fields will be ignored if set.
16099    ///
16100    /// [google.cloud.retail.v2.Product]: crate::model::Product
16101    /// [google.cloud.retail.v2.Promotion.promotion_id]: crate::model::Promotion::promotion_id
16102    pub promotions: std::vec::Vec<crate::model::Promotion>,
16103
16104    /// The timestamp when the product is published by the retailer for the first
16105    /// time, which indicates the freshness of the products. Note that this field
16106    /// is different from
16107    /// [available_time][google.cloud.retail.v2.Product.available_time], given it
16108    /// purely describes product freshness regardless of when it is available on
16109    /// search and recommendation.
16110    ///
16111    /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
16112    pub publish_time: std::option::Option<wkt::Timestamp>,
16113
16114    /// Indicates which fields in the [Product][google.cloud.retail.v2.Product]s
16115    /// are returned in [SearchResponse][google.cloud.retail.v2.SearchResponse].
16116    ///
16117    /// Supported fields for all [type][google.cloud.retail.v2.Product.type]s:
16118    ///
16119    /// * [audience][google.cloud.retail.v2.Product.audience]
16120    /// * [availability][google.cloud.retail.v2.Product.availability]
16121    /// * [brands][google.cloud.retail.v2.Product.brands]
16122    /// * [color_info][google.cloud.retail.v2.Product.color_info]
16123    /// * [conditions][google.cloud.retail.v2.Product.conditions]
16124    /// * [gtin][google.cloud.retail.v2.Product.gtin]
16125    /// * [materials][google.cloud.retail.v2.Product.materials]
16126    /// * [name][google.cloud.retail.v2.Product.name]
16127    /// * [patterns][google.cloud.retail.v2.Product.patterns]
16128    /// * [price_info][google.cloud.retail.v2.Product.price_info]
16129    /// * [rating][google.cloud.retail.v2.Product.rating]
16130    /// * [sizes][google.cloud.retail.v2.Product.sizes]
16131    /// * [title][google.cloud.retail.v2.Product.title]
16132    /// * [uri][google.cloud.retail.v2.Product.uri]
16133    ///
16134    /// Supported fields only for
16135    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
16136    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]:
16137    ///
16138    /// * [categories][google.cloud.retail.v2.Product.categories]
16139    /// * [description][google.cloud.retail.v2.Product.description]
16140    /// * [images][google.cloud.retail.v2.Product.images]
16141    ///
16142    /// Supported fields only for
16143    /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]:
16144    ///
16145    /// * Only the first image in [images][google.cloud.retail.v2.Product.images]
16146    ///
16147    /// To mark [attributes][google.cloud.retail.v2.Product.attributes] as
16148    /// retrievable, include paths of the form "attributes.key" where "key" is the
16149    /// key of a custom attribute, as specified in
16150    /// [attributes][google.cloud.retail.v2.Product.attributes].
16151    ///
16152    /// For [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY] and
16153    /// [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION], the
16154    /// following fields are always returned in
16155    /// [SearchResponse][google.cloud.retail.v2.SearchResponse] by default:
16156    ///
16157    /// * [name][google.cloud.retail.v2.Product.name]
16158    ///
16159    /// For [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT], the
16160    /// following fields are always returned in by default:
16161    ///
16162    /// * [name][google.cloud.retail.v2.Product.name]
16163    /// * [color_info][google.cloud.retail.v2.Product.color_info]
16164    ///
16165    /// Note: Returning more fields in
16166    /// [SearchResponse][google.cloud.retail.v2.SearchResponse] can increase
16167    /// response payload size and serving latency.
16168    ///
16169    /// This field is deprecated. Use the retrievable site-wide control instead.
16170    ///
16171    /// [google.cloud.retail.v2.Product]: crate::model::Product
16172    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
16173    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16174    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
16175    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
16176    /// [google.cloud.retail.v2.Product.audience]: crate::model::Product::audience
16177    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
16178    /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
16179    /// [google.cloud.retail.v2.Product.categories]: crate::model::Product::categories
16180    /// [google.cloud.retail.v2.Product.color_info]: crate::model::Product::color_info
16181    /// [google.cloud.retail.v2.Product.conditions]: crate::model::Product::conditions
16182    /// [google.cloud.retail.v2.Product.description]: crate::model::Product::description
16183    /// [google.cloud.retail.v2.Product.gtin]: crate::model::Product::gtin
16184    /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
16185    /// [google.cloud.retail.v2.Product.materials]: crate::model::Product::materials
16186    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
16187    /// [google.cloud.retail.v2.Product.patterns]: crate::model::Product::patterns
16188    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
16189    /// [google.cloud.retail.v2.Product.rating]: crate::model::Product::rating
16190    /// [google.cloud.retail.v2.Product.sizes]: crate::model::Product::sizes
16191    /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
16192    /// [google.cloud.retail.v2.Product.type]: crate::model::Product::type
16193    /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
16194    /// [google.cloud.retail.v2.SearchResponse]: crate::model::SearchResponse
16195    #[deprecated]
16196    pub retrievable_fields: std::option::Option<wkt::FieldMask>,
16197
16198    /// Output only. Product variants grouped together on primary product which
16199    /// share similar product attributes. It's automatically grouped by
16200    /// [primary_product_id][google.cloud.retail.v2.Product.primary_product_id] for
16201    /// all the product variants. Only populated for
16202    /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
16203    /// [Product][google.cloud.retail.v2.Product]s.
16204    ///
16205    /// Note: This field is OUTPUT_ONLY for
16206    /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct].
16207    /// Do not set this field in API requests.
16208    ///
16209    /// [google.cloud.retail.v2.Product]: crate::model::Product
16210    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
16211    /// [google.cloud.retail.v2.Product.primary_product_id]: crate::model::Product::primary_product_id
16212    /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
16213    pub variants: std::vec::Vec<crate::model::Product>,
16214
16215    /// Output only. A list of local inventories specific to different places.
16216    ///
16217    /// This field can be managed by
16218    /// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
16219    /// and
16220    /// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
16221    /// APIs if fine-grained, high-volume updates are necessary.
16222    ///
16223    /// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
16224    /// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
16225    pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
16226
16227    #[allow(missing_docs)]
16228    pub expiration: std::option::Option<crate::model::product::Expiration>,
16229
16230    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16231}
16232
16233impl Product {
16234    /// Creates a new default instance.
16235    pub fn new() -> Self {
16236        std::default::Default::default()
16237    }
16238
16239    /// Sets the value of [name][crate::model::Product::name].
16240    ///
16241    /// # Example
16242    /// ```ignore,no_run
16243    /// # use google_cloud_retail_v2::model::Product;
16244    /// # let project_id = "project_id";
16245    /// # let location_id = "location_id";
16246    /// # let catalog_id = "catalog_id";
16247    /// # let branch_id = "branch_id";
16248    /// # let product_id = "product_id";
16249    /// let x = Product::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
16250    /// ```
16251    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16252        self.name = v.into();
16253        self
16254    }
16255
16256    /// Sets the value of [id][crate::model::Product::id].
16257    ///
16258    /// # Example
16259    /// ```ignore,no_run
16260    /// # use google_cloud_retail_v2::model::Product;
16261    /// let x = Product::new().set_id("example");
16262    /// ```
16263    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16264        self.id = v.into();
16265        self
16266    }
16267
16268    /// Sets the value of [r#type][crate::model::Product::type].
16269    ///
16270    /// # Example
16271    /// ```ignore,no_run
16272    /// # use google_cloud_retail_v2::model::Product;
16273    /// use google_cloud_retail_v2::model::product::Type;
16274    /// let x0 = Product::new().set_type(Type::Primary);
16275    /// let x1 = Product::new().set_type(Type::Variant);
16276    /// let x2 = Product::new().set_type(Type::Collection);
16277    /// ```
16278    pub fn set_type<T: std::convert::Into<crate::model::product::Type>>(mut self, v: T) -> Self {
16279        self.r#type = v.into();
16280        self
16281    }
16282
16283    /// Sets the value of [primary_product_id][crate::model::Product::primary_product_id].
16284    ///
16285    /// # Example
16286    /// ```ignore,no_run
16287    /// # use google_cloud_retail_v2::model::Product;
16288    /// let x = Product::new().set_primary_product_id("example");
16289    /// ```
16290    pub fn set_primary_product_id<T: std::convert::Into<std::string::String>>(
16291        mut self,
16292        v: T,
16293    ) -> Self {
16294        self.primary_product_id = v.into();
16295        self
16296    }
16297
16298    /// Sets the value of [collection_member_ids][crate::model::Product::collection_member_ids].
16299    ///
16300    /// # Example
16301    /// ```ignore,no_run
16302    /// # use google_cloud_retail_v2::model::Product;
16303    /// let x = Product::new().set_collection_member_ids(["a", "b", "c"]);
16304    /// ```
16305    pub fn set_collection_member_ids<T, V>(mut self, v: T) -> Self
16306    where
16307        T: std::iter::IntoIterator<Item = V>,
16308        V: std::convert::Into<std::string::String>,
16309    {
16310        use std::iter::Iterator;
16311        self.collection_member_ids = v.into_iter().map(|i| i.into()).collect();
16312        self
16313    }
16314
16315    /// Sets the value of [gtin][crate::model::Product::gtin].
16316    ///
16317    /// # Example
16318    /// ```ignore,no_run
16319    /// # use google_cloud_retail_v2::model::Product;
16320    /// let x = Product::new().set_gtin("example");
16321    /// ```
16322    pub fn set_gtin<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16323        self.gtin = v.into();
16324        self
16325    }
16326
16327    /// Sets the value of [categories][crate::model::Product::categories].
16328    ///
16329    /// # Example
16330    /// ```ignore,no_run
16331    /// # use google_cloud_retail_v2::model::Product;
16332    /// let x = Product::new().set_categories(["a", "b", "c"]);
16333    /// ```
16334    pub fn set_categories<T, V>(mut self, v: T) -> Self
16335    where
16336        T: std::iter::IntoIterator<Item = V>,
16337        V: std::convert::Into<std::string::String>,
16338    {
16339        use std::iter::Iterator;
16340        self.categories = v.into_iter().map(|i| i.into()).collect();
16341        self
16342    }
16343
16344    /// Sets the value of [title][crate::model::Product::title].
16345    ///
16346    /// # Example
16347    /// ```ignore,no_run
16348    /// # use google_cloud_retail_v2::model::Product;
16349    /// let x = Product::new().set_title("example");
16350    /// ```
16351    pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16352        self.title = v.into();
16353        self
16354    }
16355
16356    /// Sets the value of [brands][crate::model::Product::brands].
16357    ///
16358    /// # Example
16359    /// ```ignore,no_run
16360    /// # use google_cloud_retail_v2::model::Product;
16361    /// let x = Product::new().set_brands(["a", "b", "c"]);
16362    /// ```
16363    pub fn set_brands<T, V>(mut self, v: T) -> Self
16364    where
16365        T: std::iter::IntoIterator<Item = V>,
16366        V: std::convert::Into<std::string::String>,
16367    {
16368        use std::iter::Iterator;
16369        self.brands = v.into_iter().map(|i| i.into()).collect();
16370        self
16371    }
16372
16373    /// Sets the value of [description][crate::model::Product::description].
16374    ///
16375    /// # Example
16376    /// ```ignore,no_run
16377    /// # use google_cloud_retail_v2::model::Product;
16378    /// let x = Product::new().set_description("example");
16379    /// ```
16380    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16381        self.description = v.into();
16382        self
16383    }
16384
16385    /// Sets the value of [language_code][crate::model::Product::language_code].
16386    ///
16387    /// # Example
16388    /// ```ignore,no_run
16389    /// # use google_cloud_retail_v2::model::Product;
16390    /// let x = Product::new().set_language_code("example");
16391    /// ```
16392    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16393        self.language_code = v.into();
16394        self
16395    }
16396
16397    /// Sets the value of [attributes][crate::model::Product::attributes].
16398    ///
16399    /// # Example
16400    /// ```ignore,no_run
16401    /// # use google_cloud_retail_v2::model::Product;
16402    /// use google_cloud_retail_v2::model::CustomAttribute;
16403    /// let x = Product::new().set_attributes([
16404    ///     ("key0", CustomAttribute::default()/* use setters */),
16405    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
16406    /// ]);
16407    /// ```
16408    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
16409    where
16410        T: std::iter::IntoIterator<Item = (K, V)>,
16411        K: std::convert::Into<std::string::String>,
16412        V: std::convert::Into<crate::model::CustomAttribute>,
16413    {
16414        use std::iter::Iterator;
16415        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16416        self
16417    }
16418
16419    /// Sets the value of [tags][crate::model::Product::tags].
16420    ///
16421    /// # Example
16422    /// ```ignore,no_run
16423    /// # use google_cloud_retail_v2::model::Product;
16424    /// let x = Product::new().set_tags(["a", "b", "c"]);
16425    /// ```
16426    pub fn set_tags<T, V>(mut self, v: T) -> Self
16427    where
16428        T: std::iter::IntoIterator<Item = V>,
16429        V: std::convert::Into<std::string::String>,
16430    {
16431        use std::iter::Iterator;
16432        self.tags = v.into_iter().map(|i| i.into()).collect();
16433        self
16434    }
16435
16436    /// Sets the value of [price_info][crate::model::Product::price_info].
16437    ///
16438    /// # Example
16439    /// ```ignore,no_run
16440    /// # use google_cloud_retail_v2::model::Product;
16441    /// use google_cloud_retail_v2::model::PriceInfo;
16442    /// let x = Product::new().set_price_info(PriceInfo::default()/* use setters */);
16443    /// ```
16444    pub fn set_price_info<T>(mut self, v: T) -> Self
16445    where
16446        T: std::convert::Into<crate::model::PriceInfo>,
16447    {
16448        self.price_info = std::option::Option::Some(v.into());
16449        self
16450    }
16451
16452    /// Sets or clears the value of [price_info][crate::model::Product::price_info].
16453    ///
16454    /// # Example
16455    /// ```ignore,no_run
16456    /// # use google_cloud_retail_v2::model::Product;
16457    /// use google_cloud_retail_v2::model::PriceInfo;
16458    /// let x = Product::new().set_or_clear_price_info(Some(PriceInfo::default()/* use setters */));
16459    /// let x = Product::new().set_or_clear_price_info(None::<PriceInfo>);
16460    /// ```
16461    pub fn set_or_clear_price_info<T>(mut self, v: std::option::Option<T>) -> Self
16462    where
16463        T: std::convert::Into<crate::model::PriceInfo>,
16464    {
16465        self.price_info = v.map(|x| x.into());
16466        self
16467    }
16468
16469    /// Sets the value of [rating][crate::model::Product::rating].
16470    ///
16471    /// # Example
16472    /// ```ignore,no_run
16473    /// # use google_cloud_retail_v2::model::Product;
16474    /// use google_cloud_retail_v2::model::Rating;
16475    /// let x = Product::new().set_rating(Rating::default()/* use setters */);
16476    /// ```
16477    pub fn set_rating<T>(mut self, v: T) -> Self
16478    where
16479        T: std::convert::Into<crate::model::Rating>,
16480    {
16481        self.rating = std::option::Option::Some(v.into());
16482        self
16483    }
16484
16485    /// Sets or clears the value of [rating][crate::model::Product::rating].
16486    ///
16487    /// # Example
16488    /// ```ignore,no_run
16489    /// # use google_cloud_retail_v2::model::Product;
16490    /// use google_cloud_retail_v2::model::Rating;
16491    /// let x = Product::new().set_or_clear_rating(Some(Rating::default()/* use setters */));
16492    /// let x = Product::new().set_or_clear_rating(None::<Rating>);
16493    /// ```
16494    pub fn set_or_clear_rating<T>(mut self, v: std::option::Option<T>) -> Self
16495    where
16496        T: std::convert::Into<crate::model::Rating>,
16497    {
16498        self.rating = v.map(|x| x.into());
16499        self
16500    }
16501
16502    /// Sets the value of [available_time][crate::model::Product::available_time].
16503    ///
16504    /// # Example
16505    /// ```ignore,no_run
16506    /// # use google_cloud_retail_v2::model::Product;
16507    /// use wkt::Timestamp;
16508    /// let x = Product::new().set_available_time(Timestamp::default()/* use setters */);
16509    /// ```
16510    pub fn set_available_time<T>(mut self, v: T) -> Self
16511    where
16512        T: std::convert::Into<wkt::Timestamp>,
16513    {
16514        self.available_time = std::option::Option::Some(v.into());
16515        self
16516    }
16517
16518    /// Sets or clears the value of [available_time][crate::model::Product::available_time].
16519    ///
16520    /// # Example
16521    /// ```ignore,no_run
16522    /// # use google_cloud_retail_v2::model::Product;
16523    /// use wkt::Timestamp;
16524    /// let x = Product::new().set_or_clear_available_time(Some(Timestamp::default()/* use setters */));
16525    /// let x = Product::new().set_or_clear_available_time(None::<Timestamp>);
16526    /// ```
16527    pub fn set_or_clear_available_time<T>(mut self, v: std::option::Option<T>) -> Self
16528    where
16529        T: std::convert::Into<wkt::Timestamp>,
16530    {
16531        self.available_time = v.map(|x| x.into());
16532        self
16533    }
16534
16535    /// Sets the value of [availability][crate::model::Product::availability].
16536    ///
16537    /// # Example
16538    /// ```ignore,no_run
16539    /// # use google_cloud_retail_v2::model::Product;
16540    /// use google_cloud_retail_v2::model::product::Availability;
16541    /// let x0 = Product::new().set_availability(Availability::InStock);
16542    /// let x1 = Product::new().set_availability(Availability::OutOfStock);
16543    /// let x2 = Product::new().set_availability(Availability::Preorder);
16544    /// ```
16545    pub fn set_availability<T: std::convert::Into<crate::model::product::Availability>>(
16546        mut self,
16547        v: T,
16548    ) -> Self {
16549        self.availability = v.into();
16550        self
16551    }
16552
16553    /// Sets the value of [available_quantity][crate::model::Product::available_quantity].
16554    ///
16555    /// # Example
16556    /// ```ignore,no_run
16557    /// # use google_cloud_retail_v2::model::Product;
16558    /// use wkt::Int32Value;
16559    /// let x = Product::new().set_available_quantity(Int32Value::default()/* use setters */);
16560    /// ```
16561    pub fn set_available_quantity<T>(mut self, v: T) -> Self
16562    where
16563        T: std::convert::Into<wkt::Int32Value>,
16564    {
16565        self.available_quantity = std::option::Option::Some(v.into());
16566        self
16567    }
16568
16569    /// Sets or clears the value of [available_quantity][crate::model::Product::available_quantity].
16570    ///
16571    /// # Example
16572    /// ```ignore,no_run
16573    /// # use google_cloud_retail_v2::model::Product;
16574    /// use wkt::Int32Value;
16575    /// let x = Product::new().set_or_clear_available_quantity(Some(Int32Value::default()/* use setters */));
16576    /// let x = Product::new().set_or_clear_available_quantity(None::<Int32Value>);
16577    /// ```
16578    pub fn set_or_clear_available_quantity<T>(mut self, v: std::option::Option<T>) -> Self
16579    where
16580        T: std::convert::Into<wkt::Int32Value>,
16581    {
16582        self.available_quantity = v.map(|x| x.into());
16583        self
16584    }
16585
16586    /// Sets the value of [fulfillment_info][crate::model::Product::fulfillment_info].
16587    ///
16588    /// # Example
16589    /// ```ignore,no_run
16590    /// # use google_cloud_retail_v2::model::Product;
16591    /// use google_cloud_retail_v2::model::FulfillmentInfo;
16592    /// let x = Product::new()
16593    ///     .set_fulfillment_info([
16594    ///         FulfillmentInfo::default()/* use setters */,
16595    ///         FulfillmentInfo::default()/* use (different) setters */,
16596    ///     ]);
16597    /// ```
16598    pub fn set_fulfillment_info<T, V>(mut self, v: T) -> Self
16599    where
16600        T: std::iter::IntoIterator<Item = V>,
16601        V: std::convert::Into<crate::model::FulfillmentInfo>,
16602    {
16603        use std::iter::Iterator;
16604        self.fulfillment_info = v.into_iter().map(|i| i.into()).collect();
16605        self
16606    }
16607
16608    /// Sets the value of [uri][crate::model::Product::uri].
16609    ///
16610    /// # Example
16611    /// ```ignore,no_run
16612    /// # use google_cloud_retail_v2::model::Product;
16613    /// let x = Product::new().set_uri("example");
16614    /// ```
16615    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16616        self.uri = v.into();
16617        self
16618    }
16619
16620    /// Sets the value of [images][crate::model::Product::images].
16621    ///
16622    /// # Example
16623    /// ```ignore,no_run
16624    /// # use google_cloud_retail_v2::model::Product;
16625    /// use google_cloud_retail_v2::model::Image;
16626    /// let x = Product::new()
16627    ///     .set_images([
16628    ///         Image::default()/* use setters */,
16629    ///         Image::default()/* use (different) setters */,
16630    ///     ]);
16631    /// ```
16632    pub fn set_images<T, V>(mut self, v: T) -> Self
16633    where
16634        T: std::iter::IntoIterator<Item = V>,
16635        V: std::convert::Into<crate::model::Image>,
16636    {
16637        use std::iter::Iterator;
16638        self.images = v.into_iter().map(|i| i.into()).collect();
16639        self
16640    }
16641
16642    /// Sets the value of [audience][crate::model::Product::audience].
16643    ///
16644    /// # Example
16645    /// ```ignore,no_run
16646    /// # use google_cloud_retail_v2::model::Product;
16647    /// use google_cloud_retail_v2::model::Audience;
16648    /// let x = Product::new().set_audience(Audience::default()/* use setters */);
16649    /// ```
16650    pub fn set_audience<T>(mut self, v: T) -> Self
16651    where
16652        T: std::convert::Into<crate::model::Audience>,
16653    {
16654        self.audience = std::option::Option::Some(v.into());
16655        self
16656    }
16657
16658    /// Sets or clears the value of [audience][crate::model::Product::audience].
16659    ///
16660    /// # Example
16661    /// ```ignore,no_run
16662    /// # use google_cloud_retail_v2::model::Product;
16663    /// use google_cloud_retail_v2::model::Audience;
16664    /// let x = Product::new().set_or_clear_audience(Some(Audience::default()/* use setters */));
16665    /// let x = Product::new().set_or_clear_audience(None::<Audience>);
16666    /// ```
16667    pub fn set_or_clear_audience<T>(mut self, v: std::option::Option<T>) -> Self
16668    where
16669        T: std::convert::Into<crate::model::Audience>,
16670    {
16671        self.audience = v.map(|x| x.into());
16672        self
16673    }
16674
16675    /// Sets the value of [color_info][crate::model::Product::color_info].
16676    ///
16677    /// # Example
16678    /// ```ignore,no_run
16679    /// # use google_cloud_retail_v2::model::Product;
16680    /// use google_cloud_retail_v2::model::ColorInfo;
16681    /// let x = Product::new().set_color_info(ColorInfo::default()/* use setters */);
16682    /// ```
16683    pub fn set_color_info<T>(mut self, v: T) -> Self
16684    where
16685        T: std::convert::Into<crate::model::ColorInfo>,
16686    {
16687        self.color_info = std::option::Option::Some(v.into());
16688        self
16689    }
16690
16691    /// Sets or clears the value of [color_info][crate::model::Product::color_info].
16692    ///
16693    /// # Example
16694    /// ```ignore,no_run
16695    /// # use google_cloud_retail_v2::model::Product;
16696    /// use google_cloud_retail_v2::model::ColorInfo;
16697    /// let x = Product::new().set_or_clear_color_info(Some(ColorInfo::default()/* use setters */));
16698    /// let x = Product::new().set_or_clear_color_info(None::<ColorInfo>);
16699    /// ```
16700    pub fn set_or_clear_color_info<T>(mut self, v: std::option::Option<T>) -> Self
16701    where
16702        T: std::convert::Into<crate::model::ColorInfo>,
16703    {
16704        self.color_info = v.map(|x| x.into());
16705        self
16706    }
16707
16708    /// Sets the value of [sizes][crate::model::Product::sizes].
16709    ///
16710    /// # Example
16711    /// ```ignore,no_run
16712    /// # use google_cloud_retail_v2::model::Product;
16713    /// let x = Product::new().set_sizes(["a", "b", "c"]);
16714    /// ```
16715    pub fn set_sizes<T, V>(mut self, v: T) -> Self
16716    where
16717        T: std::iter::IntoIterator<Item = V>,
16718        V: std::convert::Into<std::string::String>,
16719    {
16720        use std::iter::Iterator;
16721        self.sizes = v.into_iter().map(|i| i.into()).collect();
16722        self
16723    }
16724
16725    /// Sets the value of [materials][crate::model::Product::materials].
16726    ///
16727    /// # Example
16728    /// ```ignore,no_run
16729    /// # use google_cloud_retail_v2::model::Product;
16730    /// let x = Product::new().set_materials(["a", "b", "c"]);
16731    /// ```
16732    pub fn set_materials<T, V>(mut self, v: T) -> Self
16733    where
16734        T: std::iter::IntoIterator<Item = V>,
16735        V: std::convert::Into<std::string::String>,
16736    {
16737        use std::iter::Iterator;
16738        self.materials = v.into_iter().map(|i| i.into()).collect();
16739        self
16740    }
16741
16742    /// Sets the value of [patterns][crate::model::Product::patterns].
16743    ///
16744    /// # Example
16745    /// ```ignore,no_run
16746    /// # use google_cloud_retail_v2::model::Product;
16747    /// let x = Product::new().set_patterns(["a", "b", "c"]);
16748    /// ```
16749    pub fn set_patterns<T, V>(mut self, v: T) -> Self
16750    where
16751        T: std::iter::IntoIterator<Item = V>,
16752        V: std::convert::Into<std::string::String>,
16753    {
16754        use std::iter::Iterator;
16755        self.patterns = v.into_iter().map(|i| i.into()).collect();
16756        self
16757    }
16758
16759    /// Sets the value of [conditions][crate::model::Product::conditions].
16760    ///
16761    /// # Example
16762    /// ```ignore,no_run
16763    /// # use google_cloud_retail_v2::model::Product;
16764    /// let x = Product::new().set_conditions(["a", "b", "c"]);
16765    /// ```
16766    pub fn set_conditions<T, V>(mut self, v: T) -> Self
16767    where
16768        T: std::iter::IntoIterator<Item = V>,
16769        V: std::convert::Into<std::string::String>,
16770    {
16771        use std::iter::Iterator;
16772        self.conditions = v.into_iter().map(|i| i.into()).collect();
16773        self
16774    }
16775
16776    /// Sets the value of [promotions][crate::model::Product::promotions].
16777    ///
16778    /// # Example
16779    /// ```ignore,no_run
16780    /// # use google_cloud_retail_v2::model::Product;
16781    /// use google_cloud_retail_v2::model::Promotion;
16782    /// let x = Product::new()
16783    ///     .set_promotions([
16784    ///         Promotion::default()/* use setters */,
16785    ///         Promotion::default()/* use (different) setters */,
16786    ///     ]);
16787    /// ```
16788    pub fn set_promotions<T, V>(mut self, v: T) -> Self
16789    where
16790        T: std::iter::IntoIterator<Item = V>,
16791        V: std::convert::Into<crate::model::Promotion>,
16792    {
16793        use std::iter::Iterator;
16794        self.promotions = v.into_iter().map(|i| i.into()).collect();
16795        self
16796    }
16797
16798    /// Sets the value of [publish_time][crate::model::Product::publish_time].
16799    ///
16800    /// # Example
16801    /// ```ignore,no_run
16802    /// # use google_cloud_retail_v2::model::Product;
16803    /// use wkt::Timestamp;
16804    /// let x = Product::new().set_publish_time(Timestamp::default()/* use setters */);
16805    /// ```
16806    pub fn set_publish_time<T>(mut self, v: T) -> Self
16807    where
16808        T: std::convert::Into<wkt::Timestamp>,
16809    {
16810        self.publish_time = std::option::Option::Some(v.into());
16811        self
16812    }
16813
16814    /// Sets or clears the value of [publish_time][crate::model::Product::publish_time].
16815    ///
16816    /// # Example
16817    /// ```ignore,no_run
16818    /// # use google_cloud_retail_v2::model::Product;
16819    /// use wkt::Timestamp;
16820    /// let x = Product::new().set_or_clear_publish_time(Some(Timestamp::default()/* use setters */));
16821    /// let x = Product::new().set_or_clear_publish_time(None::<Timestamp>);
16822    /// ```
16823    pub fn set_or_clear_publish_time<T>(mut self, v: std::option::Option<T>) -> Self
16824    where
16825        T: std::convert::Into<wkt::Timestamp>,
16826    {
16827        self.publish_time = v.map(|x| x.into());
16828        self
16829    }
16830
16831    /// Sets the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16832    ///
16833    /// # Example
16834    /// ```ignore,no_run
16835    /// # use google_cloud_retail_v2::model::Product;
16836    /// use wkt::FieldMask;
16837    /// let x = Product::new().set_retrievable_fields(FieldMask::default()/* use setters */);
16838    /// ```
16839    #[deprecated]
16840    pub fn set_retrievable_fields<T>(mut self, v: T) -> Self
16841    where
16842        T: std::convert::Into<wkt::FieldMask>,
16843    {
16844        self.retrievable_fields = std::option::Option::Some(v.into());
16845        self
16846    }
16847
16848    /// Sets or clears the value of [retrievable_fields][crate::model::Product::retrievable_fields].
16849    ///
16850    /// # Example
16851    /// ```ignore,no_run
16852    /// # use google_cloud_retail_v2::model::Product;
16853    /// use wkt::FieldMask;
16854    /// let x = Product::new().set_or_clear_retrievable_fields(Some(FieldMask::default()/* use setters */));
16855    /// let x = Product::new().set_or_clear_retrievable_fields(None::<FieldMask>);
16856    /// ```
16857    #[deprecated]
16858    pub fn set_or_clear_retrievable_fields<T>(mut self, v: std::option::Option<T>) -> Self
16859    where
16860        T: std::convert::Into<wkt::FieldMask>,
16861    {
16862        self.retrievable_fields = v.map(|x| x.into());
16863        self
16864    }
16865
16866    /// Sets the value of [variants][crate::model::Product::variants].
16867    ///
16868    /// # Example
16869    /// ```ignore,no_run
16870    /// # use google_cloud_retail_v2::model::Product;
16871    /// let x = Product::new()
16872    ///     .set_variants([
16873    ///         Product::default()/* use setters */,
16874    ///         Product::default()/* use (different) setters */,
16875    ///     ]);
16876    /// ```
16877    pub fn set_variants<T, V>(mut self, v: T) -> Self
16878    where
16879        T: std::iter::IntoIterator<Item = V>,
16880        V: std::convert::Into<crate::model::Product>,
16881    {
16882        use std::iter::Iterator;
16883        self.variants = v.into_iter().map(|i| i.into()).collect();
16884        self
16885    }
16886
16887    /// Sets the value of [local_inventories][crate::model::Product::local_inventories].
16888    ///
16889    /// # Example
16890    /// ```ignore,no_run
16891    /// # use google_cloud_retail_v2::model::Product;
16892    /// use google_cloud_retail_v2::model::LocalInventory;
16893    /// let x = Product::new()
16894    ///     .set_local_inventories([
16895    ///         LocalInventory::default()/* use setters */,
16896    ///         LocalInventory::default()/* use (different) setters */,
16897    ///     ]);
16898    /// ```
16899    pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
16900    where
16901        T: std::iter::IntoIterator<Item = V>,
16902        V: std::convert::Into<crate::model::LocalInventory>,
16903    {
16904        use std::iter::Iterator;
16905        self.local_inventories = v.into_iter().map(|i| i.into()).collect();
16906        self
16907    }
16908
16909    /// Sets the value of [expiration][crate::model::Product::expiration].
16910    ///
16911    /// Note that all the setters affecting `expiration` are mutually
16912    /// exclusive.
16913    ///
16914    /// # Example
16915    /// ```ignore,no_run
16916    /// # use google_cloud_retail_v2::model::Product;
16917    /// use wkt::Timestamp;
16918    /// let x = Product::new().set_expiration(Some(
16919    ///     google_cloud_retail_v2::model::product::Expiration::ExpireTime(Timestamp::default().into())));
16920    /// ```
16921    pub fn set_expiration<
16922        T: std::convert::Into<std::option::Option<crate::model::product::Expiration>>,
16923    >(
16924        mut self,
16925        v: T,
16926    ) -> Self {
16927        self.expiration = v.into();
16928        self
16929    }
16930
16931    /// The value of [expiration][crate::model::Product::expiration]
16932    /// if it holds a `ExpireTime`, `None` if the field is not set or
16933    /// holds a different branch.
16934    pub fn expire_time(&self) -> std::option::Option<&std::boxed::Box<wkt::Timestamp>> {
16935        #[allow(unreachable_patterns)]
16936        self.expiration.as_ref().and_then(|v| match v {
16937            crate::model::product::Expiration::ExpireTime(v) => std::option::Option::Some(v),
16938            _ => std::option::Option::None,
16939        })
16940    }
16941
16942    /// Sets the value of [expiration][crate::model::Product::expiration]
16943    /// to hold a `ExpireTime`.
16944    ///
16945    /// Note that all the setters affecting `expiration` are
16946    /// mutually exclusive.
16947    ///
16948    /// # Example
16949    /// ```ignore,no_run
16950    /// # use google_cloud_retail_v2::model::Product;
16951    /// use wkt::Timestamp;
16952    /// let x = Product::new().set_expire_time(Timestamp::default()/* use setters */);
16953    /// assert!(x.expire_time().is_some());
16954    /// assert!(x.ttl().is_none());
16955    /// ```
16956    pub fn set_expire_time<T: std::convert::Into<std::boxed::Box<wkt::Timestamp>>>(
16957        mut self,
16958        v: T,
16959    ) -> Self {
16960        self.expiration =
16961            std::option::Option::Some(crate::model::product::Expiration::ExpireTime(v.into()));
16962        self
16963    }
16964
16965    /// The value of [expiration][crate::model::Product::expiration]
16966    /// if it holds a `Ttl`, `None` if the field is not set or
16967    /// holds a different branch.
16968    pub fn ttl(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
16969        #[allow(unreachable_patterns)]
16970        self.expiration.as_ref().and_then(|v| match v {
16971            crate::model::product::Expiration::Ttl(v) => std::option::Option::Some(v),
16972            _ => std::option::Option::None,
16973        })
16974    }
16975
16976    /// Sets the value of [expiration][crate::model::Product::expiration]
16977    /// to hold a `Ttl`.
16978    ///
16979    /// Note that all the setters affecting `expiration` are
16980    /// mutually exclusive.
16981    ///
16982    /// # Example
16983    /// ```ignore,no_run
16984    /// # use google_cloud_retail_v2::model::Product;
16985    /// use wkt::Duration;
16986    /// let x = Product::new().set_ttl(Duration::default()/* use setters */);
16987    /// assert!(x.ttl().is_some());
16988    /// assert!(x.expire_time().is_none());
16989    /// ```
16990    pub fn set_ttl<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(mut self, v: T) -> Self {
16991        self.expiration =
16992            std::option::Option::Some(crate::model::product::Expiration::Ttl(v.into()));
16993        self
16994    }
16995}
16996
16997impl wkt::message::Message for Product {
16998    fn typename() -> &'static str {
16999        "type.googleapis.com/google.cloud.retail.v2.Product"
17000    }
17001}
17002
17003/// Defines additional types related to [Product].
17004pub mod product {
17005    #[allow(unused_imports)]
17006    use super::*;
17007
17008    /// The type of this product.
17009    ///
17010    /// # Working with unknown values
17011    ///
17012    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17013    /// additional enum variants at any time. Adding new variants is not considered
17014    /// a breaking change. Applications should write their code in anticipation of:
17015    ///
17016    /// - New values appearing in future releases of the client library, **and**
17017    /// - New values received dynamically, without application changes.
17018    ///
17019    /// Please consult the [Working with enums] section in the user guide for some
17020    /// guidelines.
17021    ///
17022    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17023    #[derive(Clone, Debug, PartialEq)]
17024    #[non_exhaustive]
17025    pub enum Type {
17026        /// Default value. Default to
17027        /// [Catalog.product_level_config.ingestion_product_type][google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]
17028        /// if unset.
17029        ///
17030        /// [google.cloud.retail.v2.ProductLevelConfig.ingestion_product_type]: crate::model::ProductLevelConfig::ingestion_product_type
17031        Unspecified,
17032        /// The primary type.
17033        ///
17034        /// As the primary unit for predicting, indexing and search serving, a
17035        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17036        /// [Product][google.cloud.retail.v2.Product] is grouped with multiple
17037        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17038        /// [Product][google.cloud.retail.v2.Product]s.
17039        ///
17040        /// [google.cloud.retail.v2.Product]: crate::model::Product
17041        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17042        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17043        Primary,
17044        /// The variant type.
17045        ///
17046        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17047        /// [Product][google.cloud.retail.v2.Product]s usually share some common
17048        /// attributes on the same
17049        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17050        /// [Product][google.cloud.retail.v2.Product]s, but they have variant
17051        /// attributes like different colors, sizes and prices, etc.
17052        ///
17053        /// [google.cloud.retail.v2.Product]: crate::model::Product
17054        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17055        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17056        Variant,
17057        /// The collection type. Collection products are bundled
17058        /// [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17059        /// [Product][google.cloud.retail.v2.Product]s or
17060        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17061        /// [Product][google.cloud.retail.v2.Product]s that are sold together, such
17062        /// as a jewelry set with necklaces, earrings and rings, etc.
17063        ///
17064        /// [google.cloud.retail.v2.Product]: crate::model::Product
17065        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17066        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17067        Collection,
17068        /// If set, the enum was initialized with an unknown value.
17069        ///
17070        /// Applications can examine the value using [Type::value] or
17071        /// [Type::name].
17072        UnknownValue(r#type::UnknownValue),
17073    }
17074
17075    #[doc(hidden)]
17076    pub mod r#type {
17077        #[allow(unused_imports)]
17078        use super::*;
17079        #[derive(Clone, Debug, PartialEq)]
17080        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17081    }
17082
17083    impl Type {
17084        /// Gets the enum value.
17085        ///
17086        /// Returns `None` if the enum contains an unknown value deserialized from
17087        /// the string representation of enums.
17088        pub fn value(&self) -> std::option::Option<i32> {
17089            match self {
17090                Self::Unspecified => std::option::Option::Some(0),
17091                Self::Primary => std::option::Option::Some(1),
17092                Self::Variant => std::option::Option::Some(2),
17093                Self::Collection => std::option::Option::Some(3),
17094                Self::UnknownValue(u) => u.0.value(),
17095            }
17096        }
17097
17098        /// Gets the enum value as a string.
17099        ///
17100        /// Returns `None` if the enum contains an unknown value deserialized from
17101        /// the integer representation of enums.
17102        pub fn name(&self) -> std::option::Option<&str> {
17103            match self {
17104                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
17105                Self::Primary => std::option::Option::Some("PRIMARY"),
17106                Self::Variant => std::option::Option::Some("VARIANT"),
17107                Self::Collection => std::option::Option::Some("COLLECTION"),
17108                Self::UnknownValue(u) => u.0.name(),
17109            }
17110        }
17111    }
17112
17113    impl std::default::Default for Type {
17114        fn default() -> Self {
17115            use std::convert::From;
17116            Self::from(0)
17117        }
17118    }
17119
17120    impl std::fmt::Display for Type {
17121        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17122            wkt::internal::display_enum(f, self.name(), self.value())
17123        }
17124    }
17125
17126    impl std::convert::From<i32> for Type {
17127        fn from(value: i32) -> Self {
17128            match value {
17129                0 => Self::Unspecified,
17130                1 => Self::Primary,
17131                2 => Self::Variant,
17132                3 => Self::Collection,
17133                _ => Self::UnknownValue(r#type::UnknownValue(
17134                    wkt::internal::UnknownEnumValue::Integer(value),
17135                )),
17136            }
17137        }
17138    }
17139
17140    impl std::convert::From<&str> for Type {
17141        fn from(value: &str) -> Self {
17142            use std::string::ToString;
17143            match value {
17144                "TYPE_UNSPECIFIED" => Self::Unspecified,
17145                "PRIMARY" => Self::Primary,
17146                "VARIANT" => Self::Variant,
17147                "COLLECTION" => Self::Collection,
17148                _ => Self::UnknownValue(r#type::UnknownValue(
17149                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17150                )),
17151            }
17152        }
17153    }
17154
17155    impl serde::ser::Serialize for Type {
17156        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17157        where
17158            S: serde::Serializer,
17159        {
17160            match self {
17161                Self::Unspecified => serializer.serialize_i32(0),
17162                Self::Primary => serializer.serialize_i32(1),
17163                Self::Variant => serializer.serialize_i32(2),
17164                Self::Collection => serializer.serialize_i32(3),
17165                Self::UnknownValue(u) => u.0.serialize(serializer),
17166            }
17167        }
17168    }
17169
17170    impl<'de> serde::de::Deserialize<'de> for Type {
17171        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17172        where
17173            D: serde::Deserializer<'de>,
17174        {
17175            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
17176                ".google.cloud.retail.v2.Product.Type",
17177            ))
17178        }
17179    }
17180
17181    /// Product availability. If this field is unspecified, the product is
17182    /// assumed to be in stock.
17183    ///
17184    /// # Working with unknown values
17185    ///
17186    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17187    /// additional enum variants at any time. Adding new variants is not considered
17188    /// a breaking change. Applications should write their code in anticipation of:
17189    ///
17190    /// - New values appearing in future releases of the client library, **and**
17191    /// - New values received dynamically, without application changes.
17192    ///
17193    /// Please consult the [Working with enums] section in the user guide for some
17194    /// guidelines.
17195    ///
17196    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17197    #[derive(Clone, Debug, PartialEq)]
17198    #[non_exhaustive]
17199    pub enum Availability {
17200        /// Default product availability. Default to
17201        /// [Availability.IN_STOCK][google.cloud.retail.v2.Product.Availability.IN_STOCK]
17202        /// if unset.
17203        ///
17204        /// [google.cloud.retail.v2.Product.Availability.IN_STOCK]: crate::model::product::Availability::InStock
17205        Unspecified,
17206        /// Product in stock.
17207        InStock,
17208        /// Product out of stock.
17209        OutOfStock,
17210        /// Product that is in pre-order state.
17211        Preorder,
17212        /// Product that is back-ordered (i.e. temporarily out of stock).
17213        Backorder,
17214        /// If set, the enum was initialized with an unknown value.
17215        ///
17216        /// Applications can examine the value using [Availability::value] or
17217        /// [Availability::name].
17218        UnknownValue(availability::UnknownValue),
17219    }
17220
17221    #[doc(hidden)]
17222    pub mod availability {
17223        #[allow(unused_imports)]
17224        use super::*;
17225        #[derive(Clone, Debug, PartialEq)]
17226        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17227    }
17228
17229    impl Availability {
17230        /// Gets the enum value.
17231        ///
17232        /// Returns `None` if the enum contains an unknown value deserialized from
17233        /// the string representation of enums.
17234        pub fn value(&self) -> std::option::Option<i32> {
17235            match self {
17236                Self::Unspecified => std::option::Option::Some(0),
17237                Self::InStock => std::option::Option::Some(1),
17238                Self::OutOfStock => std::option::Option::Some(2),
17239                Self::Preorder => std::option::Option::Some(3),
17240                Self::Backorder => std::option::Option::Some(4),
17241                Self::UnknownValue(u) => u.0.value(),
17242            }
17243        }
17244
17245        /// Gets the enum value as a string.
17246        ///
17247        /// Returns `None` if the enum contains an unknown value deserialized from
17248        /// the integer representation of enums.
17249        pub fn name(&self) -> std::option::Option<&str> {
17250            match self {
17251                Self::Unspecified => std::option::Option::Some("AVAILABILITY_UNSPECIFIED"),
17252                Self::InStock => std::option::Option::Some("IN_STOCK"),
17253                Self::OutOfStock => std::option::Option::Some("OUT_OF_STOCK"),
17254                Self::Preorder => std::option::Option::Some("PREORDER"),
17255                Self::Backorder => std::option::Option::Some("BACKORDER"),
17256                Self::UnknownValue(u) => u.0.name(),
17257            }
17258        }
17259    }
17260
17261    impl std::default::Default for Availability {
17262        fn default() -> Self {
17263            use std::convert::From;
17264            Self::from(0)
17265        }
17266    }
17267
17268    impl std::fmt::Display for Availability {
17269        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17270            wkt::internal::display_enum(f, self.name(), self.value())
17271        }
17272    }
17273
17274    impl std::convert::From<i32> for Availability {
17275        fn from(value: i32) -> Self {
17276            match value {
17277                0 => Self::Unspecified,
17278                1 => Self::InStock,
17279                2 => Self::OutOfStock,
17280                3 => Self::Preorder,
17281                4 => Self::Backorder,
17282                _ => Self::UnknownValue(availability::UnknownValue(
17283                    wkt::internal::UnknownEnumValue::Integer(value),
17284                )),
17285            }
17286        }
17287    }
17288
17289    impl std::convert::From<&str> for Availability {
17290        fn from(value: &str) -> Self {
17291            use std::string::ToString;
17292            match value {
17293                "AVAILABILITY_UNSPECIFIED" => Self::Unspecified,
17294                "IN_STOCK" => Self::InStock,
17295                "OUT_OF_STOCK" => Self::OutOfStock,
17296                "PREORDER" => Self::Preorder,
17297                "BACKORDER" => Self::Backorder,
17298                _ => Self::UnknownValue(availability::UnknownValue(
17299                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17300                )),
17301            }
17302        }
17303    }
17304
17305    impl serde::ser::Serialize for Availability {
17306        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17307        where
17308            S: serde::Serializer,
17309        {
17310            match self {
17311                Self::Unspecified => serializer.serialize_i32(0),
17312                Self::InStock => serializer.serialize_i32(1),
17313                Self::OutOfStock => serializer.serialize_i32(2),
17314                Self::Preorder => serializer.serialize_i32(3),
17315                Self::Backorder => serializer.serialize_i32(4),
17316                Self::UnknownValue(u) => u.0.serialize(serializer),
17317            }
17318        }
17319    }
17320
17321    impl<'de> serde::de::Deserialize<'de> for Availability {
17322        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17323        where
17324            D: serde::Deserializer<'de>,
17325        {
17326            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Availability>::new(
17327                ".google.cloud.retail.v2.Product.Availability",
17328            ))
17329        }
17330    }
17331
17332    #[allow(missing_docs)]
17333    #[derive(Clone, Debug, PartialEq)]
17334    #[non_exhaustive]
17335    pub enum Expiration {
17336        /// Note that this field is applied in the following ways:
17337        ///
17338        /// * If the [Product][google.cloud.retail.v2.Product] is already expired
17339        ///   when it is uploaded, this product
17340        ///   is not indexed for search.
17341        ///
17342        /// * If the [Product][google.cloud.retail.v2.Product] is not expired when it
17343        ///   is uploaded, only the
17344        ///   [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]'s and
17345        ///   [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]'s
17346        ///   expireTime is respected, and
17347        ///   [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]'s
17348        ///   expireTime is not used.
17349        ///
17350        ///
17351        /// In general, we suggest the users to delete the stale
17352        /// products explicitly, instead of using this field to determine staleness.
17353        ///
17354        /// [expire_time][google.cloud.retail.v2.Product.expire_time] must be later
17355        /// than [available_time][google.cloud.retail.v2.Product.available_time] and
17356        /// [publish_time][google.cloud.retail.v2.Product.publish_time], otherwise an
17357        /// INVALID_ARGUMENT error is thrown.
17358        ///
17359        /// Corresponding properties: Google Merchant Center property
17360        /// [expiration_date](https://support.google.com/merchants/answer/6324499).
17361        ///
17362        /// [google.cloud.retail.v2.Product]: crate::model::Product
17363        /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17364        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17365        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17366        /// [google.cloud.retail.v2.Product.available_time]: crate::model::Product::available_time
17367        /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17368        /// [google.cloud.retail.v2.Product.publish_time]: crate::model::Product::publish_time
17369        ExpireTime(std::boxed::Box<wkt::Timestamp>),
17370        /// Input only. The TTL (time to live) of the product. Note that this is only
17371        /// applicable to [Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17372        /// and [Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION],
17373        /// and ignored for
17374        /// [Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]. In general,
17375        /// we suggest the users to delete the stale products explicitly, instead of
17376        /// using this field to determine staleness.
17377        ///
17378        /// If it is set, it must be a non-negative value, and
17379        /// [expire_time][google.cloud.retail.v2.Product.expire_time] is set as
17380        /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl]. The
17381        /// derived [expire_time][google.cloud.retail.v2.Product.expire_time] is
17382        /// returned in the output and [ttl][google.cloud.retail.v2.Product.ttl] is
17383        /// left blank when retrieving the [Product][google.cloud.retail.v2.Product].
17384        ///
17385        /// If it is set, the product is not available for
17386        /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] after
17387        /// current timestamp plus [ttl][google.cloud.retail.v2.Product.ttl].
17388        /// However, the product can still be retrieved by
17389        /// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17390        /// and
17391        /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts].
17392        ///
17393        /// [google.cloud.retail.v2.Product]: crate::model::Product
17394        /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17395        /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17396        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17397        /// [google.cloud.retail.v2.Product.expire_time]: crate::model::Product::expiration
17398        /// [google.cloud.retail.v2.Product.ttl]: crate::model::Product::expiration
17399        /// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17400        /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17401        /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
17402        Ttl(std::boxed::Box<wkt::Duration>),
17403    }
17404}
17405
17406/// Request message for
17407/// [ProductService.CreateProduct][google.cloud.retail.v2.ProductService.CreateProduct]
17408/// method.
17409///
17410/// [google.cloud.retail.v2.ProductService.CreateProduct]: crate::client::ProductService::create_product
17411#[derive(Clone, Default, PartialEq)]
17412#[non_exhaustive]
17413pub struct CreateProductRequest {
17414    /// Required. The parent catalog resource name, such as
17415    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch`.
17416    pub parent: std::string::String,
17417
17418    /// Required. The [Product][google.cloud.retail.v2.Product] to create.
17419    ///
17420    /// [google.cloud.retail.v2.Product]: crate::model::Product
17421    pub product: std::option::Option<crate::model::Product>,
17422
17423    /// Required. The ID to use for the [Product][google.cloud.retail.v2.Product],
17424    /// which will become the final component of the
17425    /// [Product.name][google.cloud.retail.v2.Product.name].
17426    ///
17427    /// If the caller does not have permission to create the
17428    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17429    /// exists, a PERMISSION_DENIED error is returned.
17430    ///
17431    /// This field must be unique among all
17432    /// [Product][google.cloud.retail.v2.Product]s with the same
17433    /// [parent][google.cloud.retail.v2.CreateProductRequest.parent]. Otherwise, an
17434    /// ALREADY_EXISTS error is returned.
17435    ///
17436    /// This field must be a UTF-8 encoded string with a length limit of 128
17437    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
17438    ///
17439    /// [google.cloud.retail.v2.CreateProductRequest.parent]: crate::model::CreateProductRequest::parent
17440    /// [google.cloud.retail.v2.Product]: crate::model::Product
17441    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17442    pub product_id: std::string::String,
17443
17444    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17445}
17446
17447impl CreateProductRequest {
17448    /// Creates a new default instance.
17449    pub fn new() -> Self {
17450        std::default::Default::default()
17451    }
17452
17453    /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
17454    ///
17455    /// # Example
17456    /// ```ignore,no_run
17457    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17458    /// let x = CreateProductRequest::new().set_parent("example");
17459    /// ```
17460    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17461        self.parent = v.into();
17462        self
17463    }
17464
17465    /// Sets the value of [product][crate::model::CreateProductRequest::product].
17466    ///
17467    /// # Example
17468    /// ```ignore,no_run
17469    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17470    /// use google_cloud_retail_v2::model::Product;
17471    /// let x = CreateProductRequest::new().set_product(Product::default()/* use setters */);
17472    /// ```
17473    pub fn set_product<T>(mut self, v: T) -> Self
17474    where
17475        T: std::convert::Into<crate::model::Product>,
17476    {
17477        self.product = std::option::Option::Some(v.into());
17478        self
17479    }
17480
17481    /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
17482    ///
17483    /// # Example
17484    /// ```ignore,no_run
17485    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17486    /// use google_cloud_retail_v2::model::Product;
17487    /// let x = CreateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17488    /// let x = CreateProductRequest::new().set_or_clear_product(None::<Product>);
17489    /// ```
17490    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17491    where
17492        T: std::convert::Into<crate::model::Product>,
17493    {
17494        self.product = v.map(|x| x.into());
17495        self
17496    }
17497
17498    /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
17499    ///
17500    /// # Example
17501    /// ```ignore,no_run
17502    /// # use google_cloud_retail_v2::model::CreateProductRequest;
17503    /// let x = CreateProductRequest::new().set_product_id("example");
17504    /// ```
17505    pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17506        self.product_id = v.into();
17507        self
17508    }
17509}
17510
17511impl wkt::message::Message for CreateProductRequest {
17512    fn typename() -> &'static str {
17513        "type.googleapis.com/google.cloud.retail.v2.CreateProductRequest"
17514    }
17515}
17516
17517/// Request message for
17518/// [ProductService.GetProduct][google.cloud.retail.v2.ProductService.GetProduct]
17519/// method.
17520///
17521/// [google.cloud.retail.v2.ProductService.GetProduct]: crate::client::ProductService::get_product
17522#[derive(Clone, Default, PartialEq)]
17523#[non_exhaustive]
17524pub struct GetProductRequest {
17525    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17526    /// such as
17527    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17528    ///
17529    /// If the caller does not have permission to access the
17530    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17531    /// exists, a PERMISSION_DENIED error is returned.
17532    ///
17533    /// If the requested [Product][google.cloud.retail.v2.Product] does not exist,
17534    /// a NOT_FOUND error is returned.
17535    ///
17536    /// [google.cloud.retail.v2.Product]: crate::model::Product
17537    pub name: std::string::String,
17538
17539    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17540}
17541
17542impl GetProductRequest {
17543    /// Creates a new default instance.
17544    pub fn new() -> Self {
17545        std::default::Default::default()
17546    }
17547
17548    /// Sets the value of [name][crate::model::GetProductRequest::name].
17549    ///
17550    /// # Example
17551    /// ```ignore,no_run
17552    /// # use google_cloud_retail_v2::model::GetProductRequest;
17553    /// # let project_id = "project_id";
17554    /// # let location_id = "location_id";
17555    /// # let catalog_id = "catalog_id";
17556    /// # let branch_id = "branch_id";
17557    /// # let product_id = "product_id";
17558    /// let x = GetProductRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
17559    /// ```
17560    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17561        self.name = v.into();
17562        self
17563    }
17564}
17565
17566impl wkt::message::Message for GetProductRequest {
17567    fn typename() -> &'static str {
17568        "type.googleapis.com/google.cloud.retail.v2.GetProductRequest"
17569    }
17570}
17571
17572/// Request message for
17573/// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
17574/// method.
17575///
17576/// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
17577#[derive(Clone, Default, PartialEq)]
17578#[non_exhaustive]
17579pub struct UpdateProductRequest {
17580    /// Required. The product to update/create.
17581    ///
17582    /// If the caller does not have permission to update the
17583    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17584    /// exists, a PERMISSION_DENIED error is returned.
17585    ///
17586    /// If the [Product][google.cloud.retail.v2.Product] to update does not exist
17587    /// and
17588    /// [allow_missing][google.cloud.retail.v2.UpdateProductRequest.allow_missing]
17589    /// is not set, a NOT_FOUND error is returned.
17590    ///
17591    /// [google.cloud.retail.v2.Product]: crate::model::Product
17592    /// [google.cloud.retail.v2.UpdateProductRequest.allow_missing]: crate::model::UpdateProductRequest::allow_missing
17593    pub product: std::option::Option<crate::model::Product>,
17594
17595    /// Indicates which fields in the provided
17596    /// [Product][google.cloud.retail.v2.Product] to update. The immutable and
17597    /// output only fields are NOT supported. If not set, all supported fields (the
17598    /// fields that are neither immutable nor output only) are updated.
17599    ///
17600    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17601    /// is returned.
17602    ///
17603    /// The attribute key can be updated by setting the mask path as
17604    /// "attributes.${key_name}". If a key name is present in the mask but not in
17605    /// the patching product from the request, this key will be deleted after the
17606    /// update.
17607    ///
17608    /// [google.cloud.retail.v2.Product]: crate::model::Product
17609    pub update_mask: std::option::Option<wkt::FieldMask>,
17610
17611    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
17612    /// found, a new [Product][google.cloud.retail.v2.Product] will be created. In
17613    /// this situation, `update_mask` is ignored.
17614    ///
17615    /// [google.cloud.retail.v2.Product]: crate::model::Product
17616    pub allow_missing: bool,
17617
17618    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17619}
17620
17621impl UpdateProductRequest {
17622    /// Creates a new default instance.
17623    pub fn new() -> Self {
17624        std::default::Default::default()
17625    }
17626
17627    /// Sets the value of [product][crate::model::UpdateProductRequest::product].
17628    ///
17629    /// # Example
17630    /// ```ignore,no_run
17631    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17632    /// use google_cloud_retail_v2::model::Product;
17633    /// let x = UpdateProductRequest::new().set_product(Product::default()/* use setters */);
17634    /// ```
17635    pub fn set_product<T>(mut self, v: T) -> Self
17636    where
17637        T: std::convert::Into<crate::model::Product>,
17638    {
17639        self.product = std::option::Option::Some(v.into());
17640        self
17641    }
17642
17643    /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
17644    ///
17645    /// # Example
17646    /// ```ignore,no_run
17647    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17648    /// use google_cloud_retail_v2::model::Product;
17649    /// let x = UpdateProductRequest::new().set_or_clear_product(Some(Product::default()/* use setters */));
17650    /// let x = UpdateProductRequest::new().set_or_clear_product(None::<Product>);
17651    /// ```
17652    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
17653    where
17654        T: std::convert::Into<crate::model::Product>,
17655    {
17656        self.product = v.map(|x| x.into());
17657        self
17658    }
17659
17660    /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17661    ///
17662    /// # Example
17663    /// ```ignore,no_run
17664    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17665    /// use wkt::FieldMask;
17666    /// let x = UpdateProductRequest::new().set_update_mask(FieldMask::default()/* use setters */);
17667    /// ```
17668    pub fn set_update_mask<T>(mut self, v: T) -> Self
17669    where
17670        T: std::convert::Into<wkt::FieldMask>,
17671    {
17672        self.update_mask = std::option::Option::Some(v.into());
17673        self
17674    }
17675
17676    /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
17677    ///
17678    /// # Example
17679    /// ```ignore,no_run
17680    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17681    /// use wkt::FieldMask;
17682    /// let x = UpdateProductRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
17683    /// let x = UpdateProductRequest::new().set_or_clear_update_mask(None::<FieldMask>);
17684    /// ```
17685    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
17686    where
17687        T: std::convert::Into<wkt::FieldMask>,
17688    {
17689        self.update_mask = v.map(|x| x.into());
17690        self
17691    }
17692
17693    /// Sets the value of [allow_missing][crate::model::UpdateProductRequest::allow_missing].
17694    ///
17695    /// # Example
17696    /// ```ignore,no_run
17697    /// # use google_cloud_retail_v2::model::UpdateProductRequest;
17698    /// let x = UpdateProductRequest::new().set_allow_missing(true);
17699    /// ```
17700    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17701        self.allow_missing = v.into();
17702        self
17703    }
17704}
17705
17706impl wkt::message::Message for UpdateProductRequest {
17707    fn typename() -> &'static str {
17708        "type.googleapis.com/google.cloud.retail.v2.UpdateProductRequest"
17709    }
17710}
17711
17712/// Request message for
17713/// [ProductService.DeleteProduct][google.cloud.retail.v2.ProductService.DeleteProduct]
17714/// method.
17715///
17716/// [google.cloud.retail.v2.ProductService.DeleteProduct]: crate::client::ProductService::delete_product
17717#[derive(Clone, Default, PartialEq)]
17718#[non_exhaustive]
17719pub struct DeleteProductRequest {
17720    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
17721    /// such as
17722    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
17723    ///
17724    /// If the caller does not have permission to delete the
17725    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
17726    /// exists, a PERMISSION_DENIED error is returned.
17727    ///
17728    /// If the [Product][google.cloud.retail.v2.Product] to delete does not exist,
17729    /// a NOT_FOUND error is returned.
17730    ///
17731    /// The [Product][google.cloud.retail.v2.Product] to delete can neither be a
17732    /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17733    /// [Product][google.cloud.retail.v2.Product] member nor a
17734    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17735    /// [Product][google.cloud.retail.v2.Product] with more than one
17736    /// [variants][google.cloud.retail.v2.Product.Type.VARIANT]. Otherwise, an
17737    /// INVALID_ARGUMENT error is returned.
17738    ///
17739    /// All inventory information for the named
17740    /// [Product][google.cloud.retail.v2.Product] will be deleted.
17741    ///
17742    /// [google.cloud.retail.v2.Product]: crate::model::Product
17743    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17744    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17745    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17746    pub name: std::string::String,
17747
17748    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17749}
17750
17751impl DeleteProductRequest {
17752    /// Creates a new default instance.
17753    pub fn new() -> Self {
17754        std::default::Default::default()
17755    }
17756
17757    /// Sets the value of [name][crate::model::DeleteProductRequest::name].
17758    ///
17759    /// # Example
17760    /// ```ignore,no_run
17761    /// # use google_cloud_retail_v2::model::DeleteProductRequest;
17762    /// # let project_id = "project_id";
17763    /// # let location_id = "location_id";
17764    /// # let catalog_id = "catalog_id";
17765    /// # let branch_id = "branch_id";
17766    /// # let product_id = "product_id";
17767    /// let x = DeleteProductRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
17768    /// ```
17769    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17770        self.name = v.into();
17771        self
17772    }
17773}
17774
17775impl wkt::message::Message for DeleteProductRequest {
17776    fn typename() -> &'static str {
17777        "type.googleapis.com/google.cloud.retail.v2.DeleteProductRequest"
17778    }
17779}
17780
17781/// Request message for
17782/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17783/// method.
17784///
17785/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17786#[derive(Clone, Default, PartialEq)]
17787#[non_exhaustive]
17788pub struct ListProductsRequest {
17789    /// Required. The parent branch resource name, such as
17790    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`. Use
17791    /// `default_branch` as the branch ID, to list products under the default
17792    /// branch.
17793    ///
17794    /// If the caller does not have permission to list
17795    /// [Product][google.cloud.retail.v2.Product]s under this branch, regardless of
17796    /// whether or not this branch exists, a PERMISSION_DENIED error is returned.
17797    ///
17798    /// [google.cloud.retail.v2.Product]: crate::model::Product
17799    pub parent: std::string::String,
17800
17801    /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
17802    /// unspecified, defaults to 100. The maximum allowed value is 1000. Values
17803    /// above 1000 will be coerced to 1000.
17804    ///
17805    /// If this field is negative, an INVALID_ARGUMENT error is returned.
17806    ///
17807    /// [google.cloud.retail.v2.Product]: crate::model::Product
17808    pub page_size: i32,
17809
17810    /// A page token
17811    /// [ListProductsResponse.next_page_token][google.cloud.retail.v2.ListProductsResponse.next_page_token],
17812    /// received from a previous
17813    /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17814    /// call. Provide this to retrieve the subsequent page.
17815    ///
17816    /// When paginating, all other parameters provided to
17817    /// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17818    /// must match the call that provided the page token. Otherwise, an
17819    /// INVALID_ARGUMENT error is returned.
17820    ///
17821    /// [google.cloud.retail.v2.ListProductsResponse.next_page_token]: crate::model::ListProductsResponse::next_page_token
17822    /// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17823    pub page_token: std::string::String,
17824
17825    /// A filter to apply on the list results. Supported features:
17826    ///
17827    /// * List all the products under the parent branch if
17828    ///   [filter][google.cloud.retail.v2.ListProductsRequest.filter] is unset.
17829    /// * List [Product.Type.VARIANT][google.cloud.retail.v2.Product.Type.VARIANT]
17830    ///   [Product][google.cloud.retail.v2.Product]s sharing the same
17831    ///   [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17832    ///   [Product][google.cloud.retail.v2.Product]. For example:
17833    ///   `primary_product_id = "some_product_id"`
17834    /// * List [Product][google.cloud.retail.v2.Product]s bundled in a
17835    ///   [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17836    ///   [Product][google.cloud.retail.v2.Product].
17837    ///   For example:
17838    ///   `collection_product_id = "some_product_id"`
17839    /// * List [Product][google.cloud.retail.v2.Product]s with a partibular type.
17840    ///   For example:
17841    ///   `type = "PRIMARY"`
17842    ///   `type = "VARIANT"`
17843    ///   `type = "COLLECTION"`
17844    ///
17845    /// If the field is unrecognizable, an INVALID_ARGUMENT error is returned.
17846    ///
17847    /// If the specified
17848    /// [Product.Type.PRIMARY][google.cloud.retail.v2.Product.Type.PRIMARY]
17849    /// [Product][google.cloud.retail.v2.Product] or
17850    /// [Product.Type.COLLECTION][google.cloud.retail.v2.Product.Type.COLLECTION]
17851    /// [Product][google.cloud.retail.v2.Product] does not exist, a NOT_FOUND error
17852    /// is returned.
17853    ///
17854    /// [google.cloud.retail.v2.ListProductsRequest.filter]: crate::model::ListProductsRequest::filter
17855    /// [google.cloud.retail.v2.Product]: crate::model::Product
17856    /// [google.cloud.retail.v2.Product.Type.COLLECTION]: crate::model::product::Type::Collection
17857    /// [google.cloud.retail.v2.Product.Type.PRIMARY]: crate::model::product::Type::Primary
17858    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
17859    pub filter: std::string::String,
17860
17861    /// The fields of [Product][google.cloud.retail.v2.Product] to return in the
17862    /// responses. If not set or empty, the following fields are returned:
17863    ///
17864    /// * [Product.name][google.cloud.retail.v2.Product.name]
17865    /// * [Product.id][google.cloud.retail.v2.Product.id]
17866    /// * [Product.title][google.cloud.retail.v2.Product.title]
17867    /// * [Product.uri][google.cloud.retail.v2.Product.uri]
17868    /// * [Product.images][google.cloud.retail.v2.Product.images]
17869    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
17870    /// * [Product.brands][google.cloud.retail.v2.Product.brands]
17871    ///
17872    /// If "*" is provided, all fields are returned.
17873    /// [Product.name][google.cloud.retail.v2.Product.name] is always returned no
17874    /// matter what mask is set.
17875    ///
17876    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
17877    /// is returned.
17878    ///
17879    /// [google.cloud.retail.v2.Product]: crate::model::Product
17880    /// [google.cloud.retail.v2.Product.brands]: crate::model::Product::brands
17881    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
17882    /// [google.cloud.retail.v2.Product.images]: crate::model::Product::images
17883    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
17884    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
17885    /// [google.cloud.retail.v2.Product.title]: crate::model::Product::title
17886    /// [google.cloud.retail.v2.Product.uri]: crate::model::Product::uri
17887    pub read_mask: std::option::Option<wkt::FieldMask>,
17888
17889    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17890}
17891
17892impl ListProductsRequest {
17893    /// Creates a new default instance.
17894    pub fn new() -> Self {
17895        std::default::Default::default()
17896    }
17897
17898    /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
17899    ///
17900    /// # Example
17901    /// ```ignore,no_run
17902    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17903    /// let x = ListProductsRequest::new().set_parent("example");
17904    /// ```
17905    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17906        self.parent = v.into();
17907        self
17908    }
17909
17910    /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
17911    ///
17912    /// # Example
17913    /// ```ignore,no_run
17914    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17915    /// let x = ListProductsRequest::new().set_page_size(42);
17916    /// ```
17917    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17918        self.page_size = v.into();
17919        self
17920    }
17921
17922    /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
17923    ///
17924    /// # Example
17925    /// ```ignore,no_run
17926    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17927    /// let x = ListProductsRequest::new().set_page_token("example");
17928    /// ```
17929    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17930        self.page_token = v.into();
17931        self
17932    }
17933
17934    /// Sets the value of [filter][crate::model::ListProductsRequest::filter].
17935    ///
17936    /// # Example
17937    /// ```ignore,no_run
17938    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17939    /// let x = ListProductsRequest::new().set_filter("example");
17940    /// ```
17941    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17942        self.filter = v.into();
17943        self
17944    }
17945
17946    /// Sets the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17947    ///
17948    /// # Example
17949    /// ```ignore,no_run
17950    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17951    /// use wkt::FieldMask;
17952    /// let x = ListProductsRequest::new().set_read_mask(FieldMask::default()/* use setters */);
17953    /// ```
17954    pub fn set_read_mask<T>(mut self, v: T) -> Self
17955    where
17956        T: std::convert::Into<wkt::FieldMask>,
17957    {
17958        self.read_mask = std::option::Option::Some(v.into());
17959        self
17960    }
17961
17962    /// Sets or clears the value of [read_mask][crate::model::ListProductsRequest::read_mask].
17963    ///
17964    /// # Example
17965    /// ```ignore,no_run
17966    /// # use google_cloud_retail_v2::model::ListProductsRequest;
17967    /// use wkt::FieldMask;
17968    /// let x = ListProductsRequest::new().set_or_clear_read_mask(Some(FieldMask::default()/* use setters */));
17969    /// let x = ListProductsRequest::new().set_or_clear_read_mask(None::<FieldMask>);
17970    /// ```
17971    pub fn set_or_clear_read_mask<T>(mut self, v: std::option::Option<T>) -> Self
17972    where
17973        T: std::convert::Into<wkt::FieldMask>,
17974    {
17975        self.read_mask = v.map(|x| x.into());
17976        self
17977    }
17978}
17979
17980impl wkt::message::Message for ListProductsRequest {
17981    fn typename() -> &'static str {
17982        "type.googleapis.com/google.cloud.retail.v2.ListProductsRequest"
17983    }
17984}
17985
17986/// Response message for
17987/// [ProductService.ListProducts][google.cloud.retail.v2.ProductService.ListProducts]
17988/// method.
17989///
17990/// [google.cloud.retail.v2.ProductService.ListProducts]: crate::client::ProductService::list_products
17991#[derive(Clone, Default, PartialEq)]
17992#[non_exhaustive]
17993pub struct ListProductsResponse {
17994    /// The [Product][google.cloud.retail.v2.Product]s.
17995    ///
17996    /// [google.cloud.retail.v2.Product]: crate::model::Product
17997    pub products: std::vec::Vec<crate::model::Product>,
17998
17999    /// A token that can be sent as
18000    /// [ListProductsRequest.page_token][google.cloud.retail.v2.ListProductsRequest.page_token]
18001    /// to retrieve the next page. If this field is omitted, there are no
18002    /// subsequent pages.
18003    ///
18004    /// [google.cloud.retail.v2.ListProductsRequest.page_token]: crate::model::ListProductsRequest::page_token
18005    pub next_page_token: std::string::String,
18006
18007    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18008}
18009
18010impl ListProductsResponse {
18011    /// Creates a new default instance.
18012    pub fn new() -> Self {
18013        std::default::Default::default()
18014    }
18015
18016    /// Sets the value of [products][crate::model::ListProductsResponse::products].
18017    ///
18018    /// # Example
18019    /// ```ignore,no_run
18020    /// # use google_cloud_retail_v2::model::ListProductsResponse;
18021    /// use google_cloud_retail_v2::model::Product;
18022    /// let x = ListProductsResponse::new()
18023    ///     .set_products([
18024    ///         Product::default()/* use setters */,
18025    ///         Product::default()/* use (different) setters */,
18026    ///     ]);
18027    /// ```
18028    pub fn set_products<T, V>(mut self, v: T) -> Self
18029    where
18030        T: std::iter::IntoIterator<Item = V>,
18031        V: std::convert::Into<crate::model::Product>,
18032    {
18033        use std::iter::Iterator;
18034        self.products = v.into_iter().map(|i| i.into()).collect();
18035        self
18036    }
18037
18038    /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
18039    ///
18040    /// # Example
18041    /// ```ignore,no_run
18042    /// # use google_cloud_retail_v2::model::ListProductsResponse;
18043    /// let x = ListProductsResponse::new().set_next_page_token("example");
18044    /// ```
18045    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18046        self.next_page_token = v.into();
18047        self
18048    }
18049}
18050
18051impl wkt::message::Message for ListProductsResponse {
18052    fn typename() -> &'static str {
18053        "type.googleapis.com/google.cloud.retail.v2.ListProductsResponse"
18054    }
18055}
18056
18057#[doc(hidden)]
18058impl google_cloud_gax::paginator::internal::PageableResponse for ListProductsResponse {
18059    type PageItem = crate::model::Product;
18060
18061    fn items(self) -> std::vec::Vec<Self::PageItem> {
18062        self.products
18063    }
18064
18065    fn next_page_token(&self) -> std::string::String {
18066        use std::clone::Clone;
18067        self.next_page_token.clone()
18068    }
18069}
18070
18071/// Request message for
18072/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18073/// method.
18074///
18075/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18076#[derive(Clone, Default, PartialEq)]
18077#[non_exhaustive]
18078pub struct SetInventoryRequest {
18079    /// Required. The inventory information to update. The allowable fields to
18080    /// update are:
18081    ///
18082    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
18083    /// * [Product.availability][google.cloud.retail.v2.Product.availability]
18084    /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
18085    /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18086    ///   The updated inventory fields must be specified in
18087    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask].
18088    ///
18089    /// If
18090    /// [SetInventoryRequest.inventory.name][google.cloud.retail.v2.Product.name]
18091    /// is empty or invalid, an INVALID_ARGUMENT error is returned.
18092    ///
18093    /// If the caller does not have permission to update the
18094    /// [Product][google.cloud.retail.v2.Product] named in
18095    /// [Product.name][google.cloud.retail.v2.Product.name], regardless of whether
18096    /// or not it exists, a PERMISSION_DENIED error is returned.
18097    ///
18098    /// If the [Product][google.cloud.retail.v2.Product] to update does not have
18099    /// existing inventory information, the provided inventory information will be
18100    /// inserted.
18101    ///
18102    /// If the [Product][google.cloud.retail.v2.Product] to update has existing
18103    /// inventory information, the provided inventory information will be merged
18104    /// while respecting the last update time for each inventory field, using the
18105    /// provided or default value for
18106    /// [SetInventoryRequest.set_time][google.cloud.retail.v2.SetInventoryRequest.set_time].
18107    ///
18108    /// The caller can replace place IDs for a subset of fulfillment types in the
18109    /// following ways:
18110    ///
18111    /// * Adds "fulfillment_info" in
18112    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
18113    /// * Specifies only the desired fulfillment types and corresponding place IDs
18114    ///   to update in
18115    ///   [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18116    ///
18117    /// The caller can clear all place IDs from a subset of fulfillment types in
18118    /// the following ways:
18119    ///
18120    /// * Adds "fulfillment_info" in
18121    ///   [SetInventoryRequest.set_mask][google.cloud.retail.v2.SetInventoryRequest.set_mask]
18122    /// * Specifies only the desired fulfillment types to clear in
18123    ///   [SetInventoryRequest.inventory.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18124    /// * Checks that only the desired fulfillment info types have empty
18125    ///   [SetInventoryRequest.inventory.fulfillment_info.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
18126    ///
18127    /// The last update time is recorded for the following inventory fields:
18128    ///
18129    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
18130    /// * [Product.availability][google.cloud.retail.v2.Product.availability]
18131    /// * [Product.available_quantity][google.cloud.retail.v2.Product.available_quantity]
18132    /// * [Product.fulfillment_info][google.cloud.retail.v2.Product.fulfillment_info]
18133    ///
18134    /// If a full overwrite of inventory information while ignoring timestamps is
18135    /// needed,
18136    /// [ProductService.UpdateProduct][google.cloud.retail.v2.ProductService.UpdateProduct]
18137    /// should be invoked instead.
18138    ///
18139    /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
18140    /// [google.cloud.retail.v2.Product]: crate::model::Product
18141    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
18142    /// [google.cloud.retail.v2.Product.available_quantity]: crate::model::Product::available_quantity
18143    /// [google.cloud.retail.v2.Product.fulfillment_info]: crate::model::Product::fulfillment_info
18144    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
18145    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
18146    /// [google.cloud.retail.v2.ProductService.UpdateProduct]: crate::client::ProductService::update_product
18147    /// [google.cloud.retail.v2.SetInventoryRequest.set_mask]: crate::model::SetInventoryRequest::set_mask
18148    /// [google.cloud.retail.v2.SetInventoryRequest.set_time]: crate::model::SetInventoryRequest::set_time
18149    pub inventory: std::option::Option<crate::model::Product>,
18150
18151    /// Indicates which inventory fields in the provided
18152    /// [Product][google.cloud.retail.v2.Product] to update.
18153    ///
18154    /// At least one field must be provided.
18155    ///
18156    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18157    /// is returned and the entire update will be ignored.
18158    ///
18159    /// [google.cloud.retail.v2.Product]: crate::model::Product
18160    pub set_mask: std::option::Option<wkt::FieldMask>,
18161
18162    /// The time when the request is issued, used to prevent
18163    /// out-of-order updates on inventory fields with the last update time
18164    /// recorded. If not provided, the internal system time will be used.
18165    pub set_time: std::option::Option<wkt::Timestamp>,
18166
18167    /// If set to true, and the [Product][google.cloud.retail.v2.Product] with name
18168    /// [Product.name][google.cloud.retail.v2.Product.name] is not found, the
18169    /// inventory update will still be processed and retained for at most 1 day
18170    /// until the [Product][google.cloud.retail.v2.Product] is created. If set to
18171    /// false, a NOT_FOUND error is returned if the
18172    /// [Product][google.cloud.retail.v2.Product] is not found.
18173    ///
18174    /// [google.cloud.retail.v2.Product]: crate::model::Product
18175    /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
18176    pub allow_missing: bool,
18177
18178    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18179}
18180
18181impl SetInventoryRequest {
18182    /// Creates a new default instance.
18183    pub fn new() -> Self {
18184        std::default::Default::default()
18185    }
18186
18187    /// Sets the value of [inventory][crate::model::SetInventoryRequest::inventory].
18188    ///
18189    /// # Example
18190    /// ```ignore,no_run
18191    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18192    /// use google_cloud_retail_v2::model::Product;
18193    /// let x = SetInventoryRequest::new().set_inventory(Product::default()/* use setters */);
18194    /// ```
18195    pub fn set_inventory<T>(mut self, v: T) -> Self
18196    where
18197        T: std::convert::Into<crate::model::Product>,
18198    {
18199        self.inventory = std::option::Option::Some(v.into());
18200        self
18201    }
18202
18203    /// Sets or clears the value of [inventory][crate::model::SetInventoryRequest::inventory].
18204    ///
18205    /// # Example
18206    /// ```ignore,no_run
18207    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18208    /// use google_cloud_retail_v2::model::Product;
18209    /// let x = SetInventoryRequest::new().set_or_clear_inventory(Some(Product::default()/* use setters */));
18210    /// let x = SetInventoryRequest::new().set_or_clear_inventory(None::<Product>);
18211    /// ```
18212    pub fn set_or_clear_inventory<T>(mut self, v: std::option::Option<T>) -> Self
18213    where
18214        T: std::convert::Into<crate::model::Product>,
18215    {
18216        self.inventory = v.map(|x| x.into());
18217        self
18218    }
18219
18220    /// Sets the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
18221    ///
18222    /// # Example
18223    /// ```ignore,no_run
18224    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18225    /// use wkt::FieldMask;
18226    /// let x = SetInventoryRequest::new().set_set_mask(FieldMask::default()/* use setters */);
18227    /// ```
18228    pub fn set_set_mask<T>(mut self, v: T) -> Self
18229    where
18230        T: std::convert::Into<wkt::FieldMask>,
18231    {
18232        self.set_mask = std::option::Option::Some(v.into());
18233        self
18234    }
18235
18236    /// Sets or clears the value of [set_mask][crate::model::SetInventoryRequest::set_mask].
18237    ///
18238    /// # Example
18239    /// ```ignore,no_run
18240    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18241    /// use wkt::FieldMask;
18242    /// let x = SetInventoryRequest::new().set_or_clear_set_mask(Some(FieldMask::default()/* use setters */));
18243    /// let x = SetInventoryRequest::new().set_or_clear_set_mask(None::<FieldMask>);
18244    /// ```
18245    pub fn set_or_clear_set_mask<T>(mut self, v: std::option::Option<T>) -> Self
18246    where
18247        T: std::convert::Into<wkt::FieldMask>,
18248    {
18249        self.set_mask = v.map(|x| x.into());
18250        self
18251    }
18252
18253    /// Sets the value of [set_time][crate::model::SetInventoryRequest::set_time].
18254    ///
18255    /// # Example
18256    /// ```ignore,no_run
18257    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18258    /// use wkt::Timestamp;
18259    /// let x = SetInventoryRequest::new().set_set_time(Timestamp::default()/* use setters */);
18260    /// ```
18261    pub fn set_set_time<T>(mut self, v: T) -> Self
18262    where
18263        T: std::convert::Into<wkt::Timestamp>,
18264    {
18265        self.set_time = std::option::Option::Some(v.into());
18266        self
18267    }
18268
18269    /// Sets or clears the value of [set_time][crate::model::SetInventoryRequest::set_time].
18270    ///
18271    /// # Example
18272    /// ```ignore,no_run
18273    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18274    /// use wkt::Timestamp;
18275    /// let x = SetInventoryRequest::new().set_or_clear_set_time(Some(Timestamp::default()/* use setters */));
18276    /// let x = SetInventoryRequest::new().set_or_clear_set_time(None::<Timestamp>);
18277    /// ```
18278    pub fn set_or_clear_set_time<T>(mut self, v: std::option::Option<T>) -> Self
18279    where
18280        T: std::convert::Into<wkt::Timestamp>,
18281    {
18282        self.set_time = v.map(|x| x.into());
18283        self
18284    }
18285
18286    /// Sets the value of [allow_missing][crate::model::SetInventoryRequest::allow_missing].
18287    ///
18288    /// # Example
18289    /// ```ignore,no_run
18290    /// # use google_cloud_retail_v2::model::SetInventoryRequest;
18291    /// let x = SetInventoryRequest::new().set_allow_missing(true);
18292    /// ```
18293    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18294        self.allow_missing = v.into();
18295        self
18296    }
18297}
18298
18299impl wkt::message::Message for SetInventoryRequest {
18300    fn typename() -> &'static str {
18301        "type.googleapis.com/google.cloud.retail.v2.SetInventoryRequest"
18302    }
18303}
18304
18305/// Metadata related to the progress of the SetInventory operation.
18306/// Currently empty because there is no meaningful metadata populated from the
18307/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18308/// method.
18309///
18310/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18311#[derive(Clone, Default, PartialEq)]
18312#[non_exhaustive]
18313pub struct SetInventoryMetadata {
18314    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18315}
18316
18317impl SetInventoryMetadata {
18318    /// Creates a new default instance.
18319    pub fn new() -> Self {
18320        std::default::Default::default()
18321    }
18322}
18323
18324impl wkt::message::Message for SetInventoryMetadata {
18325    fn typename() -> &'static str {
18326        "type.googleapis.com/google.cloud.retail.v2.SetInventoryMetadata"
18327    }
18328}
18329
18330/// Response of the SetInventoryRequest.  Currently empty because
18331/// there is no meaningful response populated from the
18332/// [ProductService.SetInventory][google.cloud.retail.v2.ProductService.SetInventory]
18333/// method.
18334///
18335/// [google.cloud.retail.v2.ProductService.SetInventory]: crate::client::ProductService::set_inventory
18336#[derive(Clone, Default, PartialEq)]
18337#[non_exhaustive]
18338pub struct SetInventoryResponse {
18339    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18340}
18341
18342impl SetInventoryResponse {
18343    /// Creates a new default instance.
18344    pub fn new() -> Self {
18345        std::default::Default::default()
18346    }
18347}
18348
18349impl wkt::message::Message for SetInventoryResponse {
18350    fn typename() -> &'static str {
18351        "type.googleapis.com/google.cloud.retail.v2.SetInventoryResponse"
18352    }
18353}
18354
18355/// Request message for
18356/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18357/// method.
18358///
18359/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18360#[derive(Clone, Default, PartialEq)]
18361#[non_exhaustive]
18362pub struct AddFulfillmentPlacesRequest {
18363    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18364    /// such as
18365    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18366    ///
18367    /// If the caller does not have permission to access the
18368    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18369    /// exists, a PERMISSION_DENIED error is returned.
18370    ///
18371    /// [google.cloud.retail.v2.Product]: crate::model::Product
18372    pub product: std::string::String,
18373
18374    /// Required. The fulfillment type, including commonly used types (such as
18375    /// pickup in store and same day delivery), and custom types.
18376    ///
18377    /// Supported values:
18378    ///
18379    /// * "pickup-in-store"
18380    /// * "ship-to-store"
18381    /// * "same-day-delivery"
18382    /// * "next-day-delivery"
18383    /// * "custom-type-1"
18384    /// * "custom-type-2"
18385    /// * "custom-type-3"
18386    /// * "custom-type-4"
18387    /// * "custom-type-5"
18388    ///
18389    /// If this field is set to an invalid value other than these, an
18390    /// INVALID_ARGUMENT error is returned.
18391    ///
18392    /// This field directly corresponds to
18393    /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
18394    ///
18395    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
18396    pub r#type: std::string::String,
18397
18398    /// Required. The IDs for this
18399    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type], such as
18400    /// the store IDs for "pickup-in-store" or the region IDs for
18401    /// "same-day-delivery" to be added for this
18402    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]. Duplicate
18403    /// IDs will be automatically ignored.
18404    ///
18405    /// At least 1 value is required, and a maximum of 2000 values are allowed.
18406    /// Each value must be a string with a length limit of 10 characters, matching
18407    /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
18408    /// INVALID_ARGUMENT error is returned.
18409    ///
18410    /// If the total number of place IDs exceeds 2000 for this
18411    /// [type][google.cloud.retail.v2.AddFulfillmentPlacesRequest.type] after
18412    /// adding, then the update will be rejected.
18413    ///
18414    /// [google.cloud.retail.v2.AddFulfillmentPlacesRequest.type]: crate::model::AddFulfillmentPlacesRequest::type
18415    pub place_ids: std::vec::Vec<std::string::String>,
18416
18417    /// The time when the fulfillment updates are issued, used to prevent
18418    /// out-of-order updates on fulfillment information. If not provided, the
18419    /// internal system time will be used.
18420    pub add_time: std::option::Option<wkt::Timestamp>,
18421
18422    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18423    /// found, the fulfillment information will still be processed and retained for
18424    /// at most 1 day and processed once the
18425    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18426    /// NOT_FOUND error is returned if the
18427    /// [Product][google.cloud.retail.v2.Product] is not found.
18428    ///
18429    /// [google.cloud.retail.v2.Product]: crate::model::Product
18430    pub allow_missing: bool,
18431
18432    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18433}
18434
18435impl AddFulfillmentPlacesRequest {
18436    /// Creates a new default instance.
18437    pub fn new() -> Self {
18438        std::default::Default::default()
18439    }
18440
18441    /// Sets the value of [product][crate::model::AddFulfillmentPlacesRequest::product].
18442    ///
18443    /// # Example
18444    /// ```ignore,no_run
18445    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18446    /// # let project_id = "project_id";
18447    /// # let location_id = "location_id";
18448    /// # let catalog_id = "catalog_id";
18449    /// # let branch_id = "branch_id";
18450    /// # let product_id = "product_id";
18451    /// let x = AddFulfillmentPlacesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
18452    /// ```
18453    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18454        self.product = v.into();
18455        self
18456    }
18457
18458    /// Sets the value of [r#type][crate::model::AddFulfillmentPlacesRequest::type].
18459    ///
18460    /// # Example
18461    /// ```ignore,no_run
18462    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18463    /// let x = AddFulfillmentPlacesRequest::new().set_type("example");
18464    /// ```
18465    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18466        self.r#type = v.into();
18467        self
18468    }
18469
18470    /// Sets the value of [place_ids][crate::model::AddFulfillmentPlacesRequest::place_ids].
18471    ///
18472    /// # Example
18473    /// ```ignore,no_run
18474    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18475    /// let x = AddFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
18476    /// ```
18477    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18478    where
18479        T: std::iter::IntoIterator<Item = V>,
18480        V: std::convert::Into<std::string::String>,
18481    {
18482        use std::iter::Iterator;
18483        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18484        self
18485    }
18486
18487    /// Sets the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18488    ///
18489    /// # Example
18490    /// ```ignore,no_run
18491    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18492    /// use wkt::Timestamp;
18493    /// let x = AddFulfillmentPlacesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18494    /// ```
18495    pub fn set_add_time<T>(mut self, v: T) -> Self
18496    where
18497        T: std::convert::Into<wkt::Timestamp>,
18498    {
18499        self.add_time = std::option::Option::Some(v.into());
18500        self
18501    }
18502
18503    /// Sets or clears the value of [add_time][crate::model::AddFulfillmentPlacesRequest::add_time].
18504    ///
18505    /// # Example
18506    /// ```ignore,no_run
18507    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18508    /// use wkt::Timestamp;
18509    /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18510    /// let x = AddFulfillmentPlacesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18511    /// ```
18512    pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18513    where
18514        T: std::convert::Into<wkt::Timestamp>,
18515    {
18516        self.add_time = v.map(|x| x.into());
18517        self
18518    }
18519
18520    /// Sets the value of [allow_missing][crate::model::AddFulfillmentPlacesRequest::allow_missing].
18521    ///
18522    /// # Example
18523    /// ```ignore,no_run
18524    /// # use google_cloud_retail_v2::model::AddFulfillmentPlacesRequest;
18525    /// let x = AddFulfillmentPlacesRequest::new().set_allow_missing(true);
18526    /// ```
18527    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18528        self.allow_missing = v.into();
18529        self
18530    }
18531}
18532
18533impl wkt::message::Message for AddFulfillmentPlacesRequest {
18534    fn typename() -> &'static str {
18535        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesRequest"
18536    }
18537}
18538
18539/// Metadata related to the progress of the AddFulfillmentPlaces operation.
18540/// Currently empty because there is no meaningful metadata populated from the
18541/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18542/// method.
18543///
18544/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18545#[derive(Clone, Default, PartialEq)]
18546#[non_exhaustive]
18547pub struct AddFulfillmentPlacesMetadata {
18548    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18549}
18550
18551impl AddFulfillmentPlacesMetadata {
18552    /// Creates a new default instance.
18553    pub fn new() -> Self {
18554        std::default::Default::default()
18555    }
18556}
18557
18558impl wkt::message::Message for AddFulfillmentPlacesMetadata {
18559    fn typename() -> &'static str {
18560        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesMetadata"
18561    }
18562}
18563
18564/// Response of the AddFulfillmentPlacesRequest.  Currently empty because
18565/// there is no meaningful response populated from the
18566/// [ProductService.AddFulfillmentPlaces][google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]
18567/// method.
18568///
18569/// [google.cloud.retail.v2.ProductService.AddFulfillmentPlaces]: crate::client::ProductService::add_fulfillment_places
18570#[derive(Clone, Default, PartialEq)]
18571#[non_exhaustive]
18572pub struct AddFulfillmentPlacesResponse {
18573    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18574}
18575
18576impl AddFulfillmentPlacesResponse {
18577    /// Creates a new default instance.
18578    pub fn new() -> Self {
18579        std::default::Default::default()
18580    }
18581}
18582
18583impl wkt::message::Message for AddFulfillmentPlacesResponse {
18584    fn typename() -> &'static str {
18585        "type.googleapis.com/google.cloud.retail.v2.AddFulfillmentPlacesResponse"
18586    }
18587}
18588
18589/// Request message for
18590/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18591/// method.
18592///
18593/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18594#[derive(Clone, Default, PartialEq)]
18595#[non_exhaustive]
18596pub struct AddLocalInventoriesRequest {
18597    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18598    /// such as
18599    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18600    ///
18601    /// If the caller does not have permission to access the
18602    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18603    /// exists, a PERMISSION_DENIED error is returned.
18604    ///
18605    /// [google.cloud.retail.v2.Product]: crate::model::Product
18606    pub product: std::string::String,
18607
18608    /// Required. A list of inventory information at difference places. Each place
18609    /// is identified by its place ID. At most 3000 inventories are allowed per
18610    /// request.
18611    pub local_inventories: std::vec::Vec<crate::model::LocalInventory>,
18612
18613    /// Indicates which inventory fields in the provided list of
18614    /// [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The
18615    /// field is updated to the provided value.
18616    ///
18617    /// If a field is set while the place does not have a previous local inventory,
18618    /// the local inventory at that store is created.
18619    ///
18620    /// If a field is set while the value of that field is not provided, the
18621    /// original field value, if it exists, is deleted.
18622    ///
18623    /// If the mask is not set or set with empty paths, all inventory fields will
18624    /// be updated.
18625    ///
18626    /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
18627    /// is returned and the entire update will be ignored.
18628    ///
18629    /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
18630    pub add_mask: std::option::Option<wkt::FieldMask>,
18631
18632    /// The time when the inventory updates are issued. Used to prevent
18633    /// out-of-order updates on local inventory fields. If not provided, the
18634    /// internal system time will be used.
18635    pub add_time: std::option::Option<wkt::Timestamp>,
18636
18637    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18638    /// found, the local inventory will still be processed and retained for at most
18639    /// 1 day and processed once the [Product][google.cloud.retail.v2.Product] is
18640    /// created. If set to false, a NOT_FOUND error is returned if the
18641    /// [Product][google.cloud.retail.v2.Product] is not found.
18642    ///
18643    /// [google.cloud.retail.v2.Product]: crate::model::Product
18644    pub allow_missing: bool,
18645
18646    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18647}
18648
18649impl AddLocalInventoriesRequest {
18650    /// Creates a new default instance.
18651    pub fn new() -> Self {
18652        std::default::Default::default()
18653    }
18654
18655    /// Sets the value of [product][crate::model::AddLocalInventoriesRequest::product].
18656    ///
18657    /// # Example
18658    /// ```ignore,no_run
18659    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18660    /// # let project_id = "project_id";
18661    /// # let location_id = "location_id";
18662    /// # let catalog_id = "catalog_id";
18663    /// # let branch_id = "branch_id";
18664    /// # let product_id = "product_id";
18665    /// let x = AddLocalInventoriesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
18666    /// ```
18667    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18668        self.product = v.into();
18669        self
18670    }
18671
18672    /// Sets the value of [local_inventories][crate::model::AddLocalInventoriesRequest::local_inventories].
18673    ///
18674    /// # Example
18675    /// ```ignore,no_run
18676    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18677    /// use google_cloud_retail_v2::model::LocalInventory;
18678    /// let x = AddLocalInventoriesRequest::new()
18679    ///     .set_local_inventories([
18680    ///         LocalInventory::default()/* use setters */,
18681    ///         LocalInventory::default()/* use (different) setters */,
18682    ///     ]);
18683    /// ```
18684    pub fn set_local_inventories<T, V>(mut self, v: T) -> Self
18685    where
18686        T: std::iter::IntoIterator<Item = V>,
18687        V: std::convert::Into<crate::model::LocalInventory>,
18688    {
18689        use std::iter::Iterator;
18690        self.local_inventories = v.into_iter().map(|i| i.into()).collect();
18691        self
18692    }
18693
18694    /// Sets the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18695    ///
18696    /// # Example
18697    /// ```ignore,no_run
18698    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18699    /// use wkt::FieldMask;
18700    /// let x = AddLocalInventoriesRequest::new().set_add_mask(FieldMask::default()/* use setters */);
18701    /// ```
18702    pub fn set_add_mask<T>(mut self, v: T) -> Self
18703    where
18704        T: std::convert::Into<wkt::FieldMask>,
18705    {
18706        self.add_mask = std::option::Option::Some(v.into());
18707        self
18708    }
18709
18710    /// Sets or clears the value of [add_mask][crate::model::AddLocalInventoriesRequest::add_mask].
18711    ///
18712    /// # Example
18713    /// ```ignore,no_run
18714    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18715    /// use wkt::FieldMask;
18716    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(Some(FieldMask::default()/* use setters */));
18717    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_mask(None::<FieldMask>);
18718    /// ```
18719    pub fn set_or_clear_add_mask<T>(mut self, v: std::option::Option<T>) -> Self
18720    where
18721        T: std::convert::Into<wkt::FieldMask>,
18722    {
18723        self.add_mask = v.map(|x| x.into());
18724        self
18725    }
18726
18727    /// Sets the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18728    ///
18729    /// # Example
18730    /// ```ignore,no_run
18731    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18732    /// use wkt::Timestamp;
18733    /// let x = AddLocalInventoriesRequest::new().set_add_time(Timestamp::default()/* use setters */);
18734    /// ```
18735    pub fn set_add_time<T>(mut self, v: T) -> Self
18736    where
18737        T: std::convert::Into<wkt::Timestamp>,
18738    {
18739        self.add_time = std::option::Option::Some(v.into());
18740        self
18741    }
18742
18743    /// Sets or clears the value of [add_time][crate::model::AddLocalInventoriesRequest::add_time].
18744    ///
18745    /// # Example
18746    /// ```ignore,no_run
18747    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18748    /// use wkt::Timestamp;
18749    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(Some(Timestamp::default()/* use setters */));
18750    /// let x = AddLocalInventoriesRequest::new().set_or_clear_add_time(None::<Timestamp>);
18751    /// ```
18752    pub fn set_or_clear_add_time<T>(mut self, v: std::option::Option<T>) -> Self
18753    where
18754        T: std::convert::Into<wkt::Timestamp>,
18755    {
18756        self.add_time = v.map(|x| x.into());
18757        self
18758    }
18759
18760    /// Sets the value of [allow_missing][crate::model::AddLocalInventoriesRequest::allow_missing].
18761    ///
18762    /// # Example
18763    /// ```ignore,no_run
18764    /// # use google_cloud_retail_v2::model::AddLocalInventoriesRequest;
18765    /// let x = AddLocalInventoriesRequest::new().set_allow_missing(true);
18766    /// ```
18767    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18768        self.allow_missing = v.into();
18769        self
18770    }
18771}
18772
18773impl wkt::message::Message for AddLocalInventoriesRequest {
18774    fn typename() -> &'static str {
18775        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
18776    }
18777}
18778
18779/// Metadata related to the progress of the AddLocalInventories operation.
18780/// Currently empty because there is no meaningful metadata populated from the
18781/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18782/// method.
18783///
18784/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18785#[derive(Clone, Default, PartialEq)]
18786#[non_exhaustive]
18787pub struct AddLocalInventoriesMetadata {
18788    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18789}
18790
18791impl AddLocalInventoriesMetadata {
18792    /// Creates a new default instance.
18793    pub fn new() -> Self {
18794        std::default::Default::default()
18795    }
18796}
18797
18798impl wkt::message::Message for AddLocalInventoriesMetadata {
18799    fn typename() -> &'static str {
18800        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesMetadata"
18801    }
18802}
18803
18804/// Response of the
18805/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18806/// API.  Currently empty because there is no meaningful response populated from
18807/// the
18808/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
18809/// method.
18810///
18811/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: crate::client::ProductService::add_local_inventories
18812#[derive(Clone, Default, PartialEq)]
18813#[non_exhaustive]
18814pub struct AddLocalInventoriesResponse {
18815    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18816}
18817
18818impl AddLocalInventoriesResponse {
18819    /// Creates a new default instance.
18820    pub fn new() -> Self {
18821        std::default::Default::default()
18822    }
18823}
18824
18825impl wkt::message::Message for AddLocalInventoriesResponse {
18826    fn typename() -> &'static str {
18827        "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesResponse"
18828    }
18829}
18830
18831/// Request message for
18832/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18833/// method.
18834///
18835/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18836#[derive(Clone, Default, PartialEq)]
18837#[non_exhaustive]
18838pub struct RemoveLocalInventoriesRequest {
18839    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
18840    /// such as
18841    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
18842    ///
18843    /// If the caller does not have permission to access the
18844    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
18845    /// exists, a PERMISSION_DENIED error is returned.
18846    ///
18847    /// [google.cloud.retail.v2.Product]: crate::model::Product
18848    pub product: std::string::String,
18849
18850    /// Required. A list of place IDs to have their inventory deleted.
18851    /// At most 3000 place IDs are allowed per request.
18852    pub place_ids: std::vec::Vec<std::string::String>,
18853
18854    /// The time when the inventory deletions are issued. Used to prevent
18855    /// out-of-order updates and deletions on local inventory fields. If not
18856    /// provided, the internal system time will be used.
18857    pub remove_time: std::option::Option<wkt::Timestamp>,
18858
18859    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
18860    /// found, the local inventory removal request will still be processed and
18861    /// retained for at most 1 day and processed once the
18862    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
18863    /// NOT_FOUND error is returned if the
18864    /// [Product][google.cloud.retail.v2.Product] is not found.
18865    ///
18866    /// [google.cloud.retail.v2.Product]: crate::model::Product
18867    pub allow_missing: bool,
18868
18869    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18870}
18871
18872impl RemoveLocalInventoriesRequest {
18873    /// Creates a new default instance.
18874    pub fn new() -> Self {
18875        std::default::Default::default()
18876    }
18877
18878    /// Sets the value of [product][crate::model::RemoveLocalInventoriesRequest::product].
18879    ///
18880    /// # Example
18881    /// ```ignore,no_run
18882    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18883    /// # let project_id = "project_id";
18884    /// # let location_id = "location_id";
18885    /// # let catalog_id = "catalog_id";
18886    /// # let branch_id = "branch_id";
18887    /// # let product_id = "product_id";
18888    /// let x = RemoveLocalInventoriesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
18889    /// ```
18890    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18891        self.product = v.into();
18892        self
18893    }
18894
18895    /// Sets the value of [place_ids][crate::model::RemoveLocalInventoriesRequest::place_ids].
18896    ///
18897    /// # Example
18898    /// ```ignore,no_run
18899    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18900    /// let x = RemoveLocalInventoriesRequest::new().set_place_ids(["a", "b", "c"]);
18901    /// ```
18902    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
18903    where
18904        T: std::iter::IntoIterator<Item = V>,
18905        V: std::convert::Into<std::string::String>,
18906    {
18907        use std::iter::Iterator;
18908        self.place_ids = v.into_iter().map(|i| i.into()).collect();
18909        self
18910    }
18911
18912    /// Sets the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18913    ///
18914    /// # Example
18915    /// ```ignore,no_run
18916    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18917    /// use wkt::Timestamp;
18918    /// let x = RemoveLocalInventoriesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
18919    /// ```
18920    pub fn set_remove_time<T>(mut self, v: T) -> Self
18921    where
18922        T: std::convert::Into<wkt::Timestamp>,
18923    {
18924        self.remove_time = std::option::Option::Some(v.into());
18925        self
18926    }
18927
18928    /// Sets or clears the value of [remove_time][crate::model::RemoveLocalInventoriesRequest::remove_time].
18929    ///
18930    /// # Example
18931    /// ```ignore,no_run
18932    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18933    /// use wkt::Timestamp;
18934    /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
18935    /// let x = RemoveLocalInventoriesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
18936    /// ```
18937    pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
18938    where
18939        T: std::convert::Into<wkt::Timestamp>,
18940    {
18941        self.remove_time = v.map(|x| x.into());
18942        self
18943    }
18944
18945    /// Sets the value of [allow_missing][crate::model::RemoveLocalInventoriesRequest::allow_missing].
18946    ///
18947    /// # Example
18948    /// ```ignore,no_run
18949    /// # use google_cloud_retail_v2::model::RemoveLocalInventoriesRequest;
18950    /// let x = RemoveLocalInventoriesRequest::new().set_allow_missing(true);
18951    /// ```
18952    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18953        self.allow_missing = v.into();
18954        self
18955    }
18956}
18957
18958impl wkt::message::Message for RemoveLocalInventoriesRequest {
18959    fn typename() -> &'static str {
18960        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesRequest"
18961    }
18962}
18963
18964/// Metadata related to the progress of the RemoveLocalInventories operation.
18965/// Currently empty because there is no meaningful metadata populated from the
18966/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18967/// method.
18968///
18969/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18970#[derive(Clone, Default, PartialEq)]
18971#[non_exhaustive]
18972pub struct RemoveLocalInventoriesMetadata {
18973    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18974}
18975
18976impl RemoveLocalInventoriesMetadata {
18977    /// Creates a new default instance.
18978    pub fn new() -> Self {
18979        std::default::Default::default()
18980    }
18981}
18982
18983impl wkt::message::Message for RemoveLocalInventoriesMetadata {
18984    fn typename() -> &'static str {
18985        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesMetadata"
18986    }
18987}
18988
18989/// Response of the
18990/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18991/// API.  Currently empty because there is no meaningful response populated from
18992/// the
18993/// [ProductService.RemoveLocalInventories][google.cloud.retail.v2.ProductService.RemoveLocalInventories]
18994/// method.
18995///
18996/// [google.cloud.retail.v2.ProductService.RemoveLocalInventories]: crate::client::ProductService::remove_local_inventories
18997#[derive(Clone, Default, PartialEq)]
18998#[non_exhaustive]
18999pub struct RemoveLocalInventoriesResponse {
19000    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19001}
19002
19003impl RemoveLocalInventoriesResponse {
19004    /// Creates a new default instance.
19005    pub fn new() -> Self {
19006        std::default::Default::default()
19007    }
19008}
19009
19010impl wkt::message::Message for RemoveLocalInventoriesResponse {
19011    fn typename() -> &'static str {
19012        "type.googleapis.com/google.cloud.retail.v2.RemoveLocalInventoriesResponse"
19013    }
19014}
19015
19016/// Request message for
19017/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19018/// method.
19019///
19020/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19021#[derive(Clone, Default, PartialEq)]
19022#[non_exhaustive]
19023pub struct RemoveFulfillmentPlacesRequest {
19024    /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
19025    /// such as
19026    /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
19027    ///
19028    /// If the caller does not have permission to access the
19029    /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
19030    /// exists, a PERMISSION_DENIED error is returned.
19031    ///
19032    /// [google.cloud.retail.v2.Product]: crate::model::Product
19033    pub product: std::string::String,
19034
19035    /// Required. The fulfillment type, including commonly used types (such as
19036    /// pickup in store and same day delivery), and custom types.
19037    ///
19038    /// Supported values:
19039    ///
19040    /// * "pickup-in-store"
19041    /// * "ship-to-store"
19042    /// * "same-day-delivery"
19043    /// * "next-day-delivery"
19044    /// * "custom-type-1"
19045    /// * "custom-type-2"
19046    /// * "custom-type-3"
19047    /// * "custom-type-4"
19048    /// * "custom-type-5"
19049    ///
19050    /// If this field is set to an invalid value other than these, an
19051    /// INVALID_ARGUMENT error is returned.
19052    ///
19053    /// This field directly corresponds to
19054    /// [Product.fulfillment_info.type][google.cloud.retail.v2.FulfillmentInfo.type].
19055    ///
19056    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
19057    pub r#type: std::string::String,
19058
19059    /// Required. The IDs for this
19060    /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type], such as
19061    /// the store IDs for "pickup-in-store" or the region IDs for
19062    /// "same-day-delivery", to be removed for this
19063    /// [type][google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type].
19064    ///
19065    /// At least 1 value is required, and a maximum of 2000 values are allowed.
19066    /// Each value must be a string with a length limit of 10 characters, matching
19067    /// the pattern `[a-zA-Z0-9_-]+`, such as "store1" or "REGION-2". Otherwise, an
19068    /// INVALID_ARGUMENT error is returned.
19069    ///
19070    /// [google.cloud.retail.v2.RemoveFulfillmentPlacesRequest.type]: crate::model::RemoveFulfillmentPlacesRequest::type
19071    pub place_ids: std::vec::Vec<std::string::String>,
19072
19073    /// The time when the fulfillment updates are issued, used to prevent
19074    /// out-of-order updates on fulfillment information. If not provided, the
19075    /// internal system time will be used.
19076    pub remove_time: std::option::Option<wkt::Timestamp>,
19077
19078    /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
19079    /// found, the fulfillment information will still be processed and retained for
19080    /// at most 1 day and processed once the
19081    /// [Product][google.cloud.retail.v2.Product] is created. If set to false, a
19082    /// NOT_FOUND error is returned if the
19083    /// [Product][google.cloud.retail.v2.Product] is not found.
19084    ///
19085    /// [google.cloud.retail.v2.Product]: crate::model::Product
19086    pub allow_missing: bool,
19087
19088    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19089}
19090
19091impl RemoveFulfillmentPlacesRequest {
19092    /// Creates a new default instance.
19093    pub fn new() -> Self {
19094        std::default::Default::default()
19095    }
19096
19097    /// Sets the value of [product][crate::model::RemoveFulfillmentPlacesRequest::product].
19098    ///
19099    /// # Example
19100    /// ```ignore,no_run
19101    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19102    /// # let project_id = "project_id";
19103    /// # let location_id = "location_id";
19104    /// # let catalog_id = "catalog_id";
19105    /// # let branch_id = "branch_id";
19106    /// # let product_id = "product_id";
19107    /// let x = RemoveFulfillmentPlacesRequest::new().set_product(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/branches/{branch_id}/products/{product_id}"));
19108    /// ```
19109    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19110        self.product = v.into();
19111        self
19112    }
19113
19114    /// Sets the value of [r#type][crate::model::RemoveFulfillmentPlacesRequest::type].
19115    ///
19116    /// # Example
19117    /// ```ignore,no_run
19118    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19119    /// let x = RemoveFulfillmentPlacesRequest::new().set_type("example");
19120    /// ```
19121    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19122        self.r#type = v.into();
19123        self
19124    }
19125
19126    /// Sets the value of [place_ids][crate::model::RemoveFulfillmentPlacesRequest::place_ids].
19127    ///
19128    /// # Example
19129    /// ```ignore,no_run
19130    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19131    /// let x = RemoveFulfillmentPlacesRequest::new().set_place_ids(["a", "b", "c"]);
19132    /// ```
19133    pub fn set_place_ids<T, V>(mut self, v: T) -> Self
19134    where
19135        T: std::iter::IntoIterator<Item = V>,
19136        V: std::convert::Into<std::string::String>,
19137    {
19138        use std::iter::Iterator;
19139        self.place_ids = v.into_iter().map(|i| i.into()).collect();
19140        self
19141    }
19142
19143    /// Sets the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
19144    ///
19145    /// # Example
19146    /// ```ignore,no_run
19147    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19148    /// use wkt::Timestamp;
19149    /// let x = RemoveFulfillmentPlacesRequest::new().set_remove_time(Timestamp::default()/* use setters */);
19150    /// ```
19151    pub fn set_remove_time<T>(mut self, v: T) -> Self
19152    where
19153        T: std::convert::Into<wkt::Timestamp>,
19154    {
19155        self.remove_time = std::option::Option::Some(v.into());
19156        self
19157    }
19158
19159    /// Sets or clears the value of [remove_time][crate::model::RemoveFulfillmentPlacesRequest::remove_time].
19160    ///
19161    /// # Example
19162    /// ```ignore,no_run
19163    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19164    /// use wkt::Timestamp;
19165    /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(Some(Timestamp::default()/* use setters */));
19166    /// let x = RemoveFulfillmentPlacesRequest::new().set_or_clear_remove_time(None::<Timestamp>);
19167    /// ```
19168    pub fn set_or_clear_remove_time<T>(mut self, v: std::option::Option<T>) -> Self
19169    where
19170        T: std::convert::Into<wkt::Timestamp>,
19171    {
19172        self.remove_time = v.map(|x| x.into());
19173        self
19174    }
19175
19176    /// Sets the value of [allow_missing][crate::model::RemoveFulfillmentPlacesRequest::allow_missing].
19177    ///
19178    /// # Example
19179    /// ```ignore,no_run
19180    /// # use google_cloud_retail_v2::model::RemoveFulfillmentPlacesRequest;
19181    /// let x = RemoveFulfillmentPlacesRequest::new().set_allow_missing(true);
19182    /// ```
19183    pub fn set_allow_missing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19184        self.allow_missing = v.into();
19185        self
19186    }
19187}
19188
19189impl wkt::message::Message for RemoveFulfillmentPlacesRequest {
19190    fn typename() -> &'static str {
19191        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesRequest"
19192    }
19193}
19194
19195/// Metadata related to the progress of the RemoveFulfillmentPlaces operation.
19196/// Currently empty because there is no meaningful metadata populated from the
19197/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19198/// method.
19199///
19200/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19201#[derive(Clone, Default, PartialEq)]
19202#[non_exhaustive]
19203pub struct RemoveFulfillmentPlacesMetadata {
19204    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19205}
19206
19207impl RemoveFulfillmentPlacesMetadata {
19208    /// Creates a new default instance.
19209    pub fn new() -> Self {
19210        std::default::Default::default()
19211    }
19212}
19213
19214impl wkt::message::Message for RemoveFulfillmentPlacesMetadata {
19215    fn typename() -> &'static str {
19216        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesMetadata"
19217    }
19218}
19219
19220/// Response of the RemoveFulfillmentPlacesRequest. Currently empty because there
19221/// is no meaningful response populated from the
19222/// [ProductService.RemoveFulfillmentPlaces][google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]
19223/// method.
19224///
19225/// [google.cloud.retail.v2.ProductService.RemoveFulfillmentPlaces]: crate::client::ProductService::remove_fulfillment_places
19226#[derive(Clone, Default, PartialEq)]
19227#[non_exhaustive]
19228pub struct RemoveFulfillmentPlacesResponse {
19229    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19230}
19231
19232impl RemoveFulfillmentPlacesResponse {
19233    /// Creates a new default instance.
19234    pub fn new() -> Self {
19235        std::default::Default::default()
19236    }
19237}
19238
19239impl wkt::message::Message for RemoveFulfillmentPlacesResponse {
19240    fn typename() -> &'static str {
19241        "type.googleapis.com/google.cloud.retail.v2.RemoveFulfillmentPlacesResponse"
19242    }
19243}
19244
19245/// Promotion information.
19246#[derive(Clone, Default, PartialEq)]
19247#[non_exhaustive]
19248pub struct Promotion {
19249    /// ID of the promotion. For example, "free gift".
19250    ///
19251    /// The value must be a UTF-8 encoded string with a length limit of 128
19252    /// characters, and match the pattern: `[a-zA-Z][a-zA-Z0-9_]*`. For example,
19253    /// id0LikeThis or ID_1_LIKE_THIS. Otherwise, an INVALID_ARGUMENT error is
19254    /// returned.
19255    ///
19256    /// Corresponds to Google Merchant Center property
19257    /// [promotion_id](https://support.google.com/merchants/answer/7050148).
19258    pub promotion_id: std::string::String,
19259
19260    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19261}
19262
19263impl Promotion {
19264    /// Creates a new default instance.
19265    pub fn new() -> Self {
19266        std::default::Default::default()
19267    }
19268
19269    /// Sets the value of [promotion_id][crate::model::Promotion::promotion_id].
19270    ///
19271    /// # Example
19272    /// ```ignore,no_run
19273    /// # use google_cloud_retail_v2::model::Promotion;
19274    /// let x = Promotion::new().set_promotion_id("example");
19275    /// ```
19276    pub fn set_promotion_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19277        self.promotion_id = v.into();
19278        self
19279    }
19280}
19281
19282impl wkt::message::Message for Promotion {
19283    fn typename() -> &'static str {
19284        "type.googleapis.com/google.cloud.retail.v2.Promotion"
19285    }
19286}
19287
19288/// Metadata related to the progress of the Purge operation.
19289/// This will be returned by the google.longrunning.Operation.metadata field.
19290#[derive(Clone, Default, PartialEq)]
19291#[non_exhaustive]
19292pub struct PurgeMetadata {
19293    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19294}
19295
19296impl PurgeMetadata {
19297    /// Creates a new default instance.
19298    pub fn new() -> Self {
19299        std::default::Default::default()
19300    }
19301}
19302
19303impl wkt::message::Message for PurgeMetadata {
19304    fn typename() -> &'static str {
19305        "type.googleapis.com/google.cloud.retail.v2.PurgeMetadata"
19306    }
19307}
19308
19309/// Metadata related to the progress of the PurgeProducts operation.
19310/// This will be returned by the google.longrunning.Operation.metadata field.
19311#[derive(Clone, Default, PartialEq)]
19312#[non_exhaustive]
19313pub struct PurgeProductsMetadata {
19314    /// Operation create time.
19315    pub create_time: std::option::Option<wkt::Timestamp>,
19316
19317    /// Operation last update time. If the operation is done, this is also the
19318    /// finish time.
19319    pub update_time: std::option::Option<wkt::Timestamp>,
19320
19321    /// Count of entries that were deleted successfully.
19322    pub success_count: i64,
19323
19324    /// Count of entries that encountered errors while processing.
19325    pub failure_count: i64,
19326
19327    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19328}
19329
19330impl PurgeProductsMetadata {
19331    /// Creates a new default instance.
19332    pub fn new() -> Self {
19333        std::default::Default::default()
19334    }
19335
19336    /// Sets the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19337    ///
19338    /// # Example
19339    /// ```ignore,no_run
19340    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19341    /// use wkt::Timestamp;
19342    /// let x = PurgeProductsMetadata::new().set_create_time(Timestamp::default()/* use setters */);
19343    /// ```
19344    pub fn set_create_time<T>(mut self, v: T) -> Self
19345    where
19346        T: std::convert::Into<wkt::Timestamp>,
19347    {
19348        self.create_time = std::option::Option::Some(v.into());
19349        self
19350    }
19351
19352    /// Sets or clears the value of [create_time][crate::model::PurgeProductsMetadata::create_time].
19353    ///
19354    /// # Example
19355    /// ```ignore,no_run
19356    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19357    /// use wkt::Timestamp;
19358    /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19359    /// let x = PurgeProductsMetadata::new().set_or_clear_create_time(None::<Timestamp>);
19360    /// ```
19361    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19362    where
19363        T: std::convert::Into<wkt::Timestamp>,
19364    {
19365        self.create_time = v.map(|x| x.into());
19366        self
19367    }
19368
19369    /// Sets the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19370    ///
19371    /// # Example
19372    /// ```ignore,no_run
19373    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19374    /// use wkt::Timestamp;
19375    /// let x = PurgeProductsMetadata::new().set_update_time(Timestamp::default()/* use setters */);
19376    /// ```
19377    pub fn set_update_time<T>(mut self, v: T) -> Self
19378    where
19379        T: std::convert::Into<wkt::Timestamp>,
19380    {
19381        self.update_time = std::option::Option::Some(v.into());
19382        self
19383    }
19384
19385    /// Sets or clears the value of [update_time][crate::model::PurgeProductsMetadata::update_time].
19386    ///
19387    /// # Example
19388    /// ```ignore,no_run
19389    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19390    /// use wkt::Timestamp;
19391    /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
19392    /// let x = PurgeProductsMetadata::new().set_or_clear_update_time(None::<Timestamp>);
19393    /// ```
19394    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
19395    where
19396        T: std::convert::Into<wkt::Timestamp>,
19397    {
19398        self.update_time = v.map(|x| x.into());
19399        self
19400    }
19401
19402    /// Sets the value of [success_count][crate::model::PurgeProductsMetadata::success_count].
19403    ///
19404    /// # Example
19405    /// ```ignore,no_run
19406    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19407    /// let x = PurgeProductsMetadata::new().set_success_count(42);
19408    /// ```
19409    pub fn set_success_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19410        self.success_count = v.into();
19411        self
19412    }
19413
19414    /// Sets the value of [failure_count][crate::model::PurgeProductsMetadata::failure_count].
19415    ///
19416    /// # Example
19417    /// ```ignore,no_run
19418    /// # use google_cloud_retail_v2::model::PurgeProductsMetadata;
19419    /// let x = PurgeProductsMetadata::new().set_failure_count(42);
19420    /// ```
19421    pub fn set_failure_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19422        self.failure_count = v.into();
19423        self
19424    }
19425}
19426
19427impl wkt::message::Message for PurgeProductsMetadata {
19428    fn typename() -> &'static str {
19429        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsMetadata"
19430    }
19431}
19432
19433/// Request message for PurgeProducts method.
19434#[derive(Clone, Default, PartialEq)]
19435#[non_exhaustive]
19436pub struct PurgeProductsRequest {
19437    /// Required. The resource name of the branch under which the products are
19438    /// created. The format is
19439    /// `projects/${projectId}/locations/global/catalogs/${catalogId}/branches/${branchId}`
19440    pub parent: std::string::String,
19441
19442    /// Required. The filter string to specify the products to be deleted with a
19443    /// length limit of 5,000 characters.
19444    ///
19445    /// Empty string filter is not allowed. "*" implies delete all items in a
19446    /// branch.
19447    ///
19448    /// The eligible fields for filtering are:
19449    ///
19450    /// * `availability`: Double quoted
19451    ///   [Product.availability][google.cloud.retail.v2.Product.availability] string.
19452    /// * `create_time` : in ISO 8601 "zulu" format.
19453    ///
19454    /// Supported syntax:
19455    ///
19456    /// * Comparators (">", "<", ">=", "<=", "=").
19457    ///   Examples:
19458    ///
19459    ///   * create_time <= "2015-02-13T17:05:46Z"
19460    ///   * availability = "IN_STOCK"
19461    /// * Conjunctions ("AND")
19462    ///   Examples:
19463    ///
19464    ///   * create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER"
19465    /// * Disjunctions ("OR")
19466    ///   Examples:
19467    ///
19468    ///   * create_time <= "2015-02-13T17:05:46Z" OR availability = "IN_STOCK"
19469    /// * Can support nested queries.
19470    ///   Examples:
19471    ///
19472    ///   * (create_time <= "2015-02-13T17:05:46Z" AND availability = "PREORDER")
19473    ///     OR (create_time >= "2015-02-14T13:03:32Z" AND availability = "IN_STOCK")
19474    /// * Filter Limits:
19475    ///
19476    ///   * Filter should not contain more than 6 conditions.
19477    ///   * Max nesting depth should not exceed 2 levels.
19478    ///
19479    /// Examples queries:
19480    ///
19481    /// * Delete back order products created before a timestamp.
19482    ///   create_time <= "2015-02-13T17:05:46Z" OR availability = "BACKORDER"
19483    ///
19484    /// [google.cloud.retail.v2.Product.availability]: crate::model::Product::availability
19485    pub filter: std::string::String,
19486
19487    /// Actually perform the purge.
19488    /// If `force` is set to false, the method will return the expected purge count
19489    /// without deleting any products.
19490    pub force: bool,
19491
19492    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19493}
19494
19495impl PurgeProductsRequest {
19496    /// Creates a new default instance.
19497    pub fn new() -> Self {
19498        std::default::Default::default()
19499    }
19500
19501    /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
19502    ///
19503    /// # Example
19504    /// ```ignore,no_run
19505    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19506    /// let x = PurgeProductsRequest::new().set_parent("example");
19507    /// ```
19508    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19509        self.parent = v.into();
19510        self
19511    }
19512
19513    /// Sets the value of [filter][crate::model::PurgeProductsRequest::filter].
19514    ///
19515    /// # Example
19516    /// ```ignore,no_run
19517    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19518    /// let x = PurgeProductsRequest::new().set_filter("example");
19519    /// ```
19520    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19521        self.filter = v.into();
19522        self
19523    }
19524
19525    /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
19526    ///
19527    /// # Example
19528    /// ```ignore,no_run
19529    /// # use google_cloud_retail_v2::model::PurgeProductsRequest;
19530    /// let x = PurgeProductsRequest::new().set_force(true);
19531    /// ```
19532    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19533        self.force = v.into();
19534        self
19535    }
19536}
19537
19538impl wkt::message::Message for PurgeProductsRequest {
19539    fn typename() -> &'static str {
19540        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsRequest"
19541    }
19542}
19543
19544/// Response of the PurgeProductsRequest. If the long running operation is
19545/// successfully done, then this message is returned by the
19546/// google.longrunning.Operations.response field.
19547#[derive(Clone, Default, PartialEq)]
19548#[non_exhaustive]
19549pub struct PurgeProductsResponse {
19550    /// The total count of products purged as a result of the operation.
19551    pub purge_count: i64,
19552
19553    /// A sample of the product names that will be deleted.
19554    /// Only populated if `force` is set to false. A max of 100 names will be
19555    /// returned and the names are chosen at random.
19556    pub purge_sample: std::vec::Vec<std::string::String>,
19557
19558    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19559}
19560
19561impl PurgeProductsResponse {
19562    /// Creates a new default instance.
19563    pub fn new() -> Self {
19564        std::default::Default::default()
19565    }
19566
19567    /// Sets the value of [purge_count][crate::model::PurgeProductsResponse::purge_count].
19568    ///
19569    /// # Example
19570    /// ```ignore,no_run
19571    /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19572    /// let x = PurgeProductsResponse::new().set_purge_count(42);
19573    /// ```
19574    pub fn set_purge_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19575        self.purge_count = v.into();
19576        self
19577    }
19578
19579    /// Sets the value of [purge_sample][crate::model::PurgeProductsResponse::purge_sample].
19580    ///
19581    /// # Example
19582    /// ```ignore,no_run
19583    /// # use google_cloud_retail_v2::model::PurgeProductsResponse;
19584    /// let x = PurgeProductsResponse::new().set_purge_sample(["a", "b", "c"]);
19585    /// ```
19586    pub fn set_purge_sample<T, V>(mut self, v: T) -> Self
19587    where
19588        T: std::iter::IntoIterator<Item = V>,
19589        V: std::convert::Into<std::string::String>,
19590    {
19591        use std::iter::Iterator;
19592        self.purge_sample = v.into_iter().map(|i| i.into()).collect();
19593        self
19594    }
19595}
19596
19597impl wkt::message::Message for PurgeProductsResponse {
19598    fn typename() -> &'static str {
19599        "type.googleapis.com/google.cloud.retail.v2.PurgeProductsResponse"
19600    }
19601}
19602
19603/// Request message for PurgeUserEvents method.
19604#[derive(Clone, Default, PartialEq)]
19605#[non_exhaustive]
19606pub struct PurgeUserEventsRequest {
19607    /// Required. The resource name of the catalog under which the events are
19608    /// created. The format is
19609    /// `projects/${projectId}/locations/global/catalogs/${catalogId}`
19610    pub parent: std::string::String,
19611
19612    /// Required. The filter string to specify the events to be deleted with a
19613    /// length limit of 5,000 characters. Empty string filter is not allowed. The
19614    /// eligible fields for filtering are:
19615    ///
19616    /// * `eventType`: Double quoted
19617    ///   [UserEvent.event_type][google.cloud.retail.v2.UserEvent.event_type] string.
19618    /// * `eventTime`: in ISO 8601 "zulu" format.
19619    /// * `visitorId`: Double quoted string. Specifying this will delete all
19620    ///   events associated with a visitor.
19621    /// * `userId`: Double quoted string. Specifying this will delete all events
19622    ///   associated with a user.
19623    ///
19624    /// Examples:
19625    ///
19626    /// * Deleting all events in a time range:
19627    ///   `eventTime > "2012-04-23T18:25:43.511Z"
19628    ///   eventTime < "2012-04-23T18:30:43.511Z"`
19629    /// * Deleting specific eventType in time range:
19630    ///   `eventTime > "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
19631    /// * Deleting all events for a specific visitor:
19632    ///   `visitorId = "visitor1024"`
19633    ///
19634    /// The filtering fields are assumed to have an implicit AND.
19635    ///
19636    /// [google.cloud.retail.v2.UserEvent.event_type]: crate::model::UserEvent::event_type
19637    pub filter: std::string::String,
19638
19639    /// Actually perform the purge.
19640    /// If `force` is set to false, the method will return the expected purge count
19641    /// without deleting any user events.
19642    pub force: bool,
19643
19644    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19645}
19646
19647impl PurgeUserEventsRequest {
19648    /// Creates a new default instance.
19649    pub fn new() -> Self {
19650        std::default::Default::default()
19651    }
19652
19653    /// Sets the value of [parent][crate::model::PurgeUserEventsRequest::parent].
19654    ///
19655    /// # Example
19656    /// ```ignore,no_run
19657    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19658    /// # let project_id = "project_id";
19659    /// # let location_id = "location_id";
19660    /// # let catalog_id = "catalog_id";
19661    /// let x = PurgeUserEventsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
19662    /// ```
19663    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19664        self.parent = v.into();
19665        self
19666    }
19667
19668    /// Sets the value of [filter][crate::model::PurgeUserEventsRequest::filter].
19669    ///
19670    /// # Example
19671    /// ```ignore,no_run
19672    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19673    /// let x = PurgeUserEventsRequest::new().set_filter("example");
19674    /// ```
19675    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19676        self.filter = v.into();
19677        self
19678    }
19679
19680    /// Sets the value of [force][crate::model::PurgeUserEventsRequest::force].
19681    ///
19682    /// # Example
19683    /// ```ignore,no_run
19684    /// # use google_cloud_retail_v2::model::PurgeUserEventsRequest;
19685    /// let x = PurgeUserEventsRequest::new().set_force(true);
19686    /// ```
19687    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19688        self.force = v.into();
19689        self
19690    }
19691}
19692
19693impl wkt::message::Message for PurgeUserEventsRequest {
19694    fn typename() -> &'static str {
19695        "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsRequest"
19696    }
19697}
19698
19699/// Response of the PurgeUserEventsRequest. If the long running operation is
19700/// successfully done, then this message is returned by the
19701/// google.longrunning.Operations.response field.
19702#[derive(Clone, Default, PartialEq)]
19703#[non_exhaustive]
19704pub struct PurgeUserEventsResponse {
19705    /// The total count of events purged as a result of the operation.
19706    pub purged_events_count: i64,
19707
19708    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19709}
19710
19711impl PurgeUserEventsResponse {
19712    /// Creates a new default instance.
19713    pub fn new() -> Self {
19714        std::default::Default::default()
19715    }
19716
19717    /// Sets the value of [purged_events_count][crate::model::PurgeUserEventsResponse::purged_events_count].
19718    ///
19719    /// # Example
19720    /// ```ignore,no_run
19721    /// # use google_cloud_retail_v2::model::PurgeUserEventsResponse;
19722    /// let x = PurgeUserEventsResponse::new().set_purged_events_count(42);
19723    /// ```
19724    pub fn set_purged_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
19725        self.purged_events_count = v.into();
19726        self
19727    }
19728}
19729
19730impl wkt::message::Message for PurgeUserEventsResponse {
19731    fn typename() -> &'static str {
19732        "type.googleapis.com/google.cloud.retail.v2.PurgeUserEventsResponse"
19733    }
19734}
19735
19736/// Safety settings.
19737#[derive(Clone, Default, PartialEq)]
19738#[non_exhaustive]
19739pub struct SafetySetting {
19740    /// Harm category.
19741    pub category: crate::model::HarmCategory,
19742
19743    /// The harm block threshold.
19744    pub threshold: crate::model::safety_setting::HarmBlockThreshold,
19745
19746    /// Optional. Specify if the threshold is used for probability or severity
19747    /// score. If not specified, the threshold is used for probability score.
19748    pub method: crate::model::safety_setting::HarmBlockMethod,
19749
19750    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19751}
19752
19753impl SafetySetting {
19754    /// Creates a new default instance.
19755    pub fn new() -> Self {
19756        std::default::Default::default()
19757    }
19758
19759    /// Sets the value of [category][crate::model::SafetySetting::category].
19760    ///
19761    /// # Example
19762    /// ```ignore,no_run
19763    /// # use google_cloud_retail_v2::model::SafetySetting;
19764    /// use google_cloud_retail_v2::model::HarmCategory;
19765    /// let x0 = SafetySetting::new().set_category(HarmCategory::HateSpeech);
19766    /// let x1 = SafetySetting::new().set_category(HarmCategory::DangerousContent);
19767    /// let x2 = SafetySetting::new().set_category(HarmCategory::Harassment);
19768    /// ```
19769    pub fn set_category<T: std::convert::Into<crate::model::HarmCategory>>(mut self, v: T) -> Self {
19770        self.category = v.into();
19771        self
19772    }
19773
19774    /// Sets the value of [threshold][crate::model::SafetySetting::threshold].
19775    ///
19776    /// # Example
19777    /// ```ignore,no_run
19778    /// # use google_cloud_retail_v2::model::SafetySetting;
19779    /// use google_cloud_retail_v2::model::safety_setting::HarmBlockThreshold;
19780    /// let x0 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockLowAndAbove);
19781    /// let x1 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockMediumAndAbove);
19782    /// let x2 = SafetySetting::new().set_threshold(HarmBlockThreshold::BlockOnlyHigh);
19783    /// ```
19784    pub fn set_threshold<
19785        T: std::convert::Into<crate::model::safety_setting::HarmBlockThreshold>,
19786    >(
19787        mut self,
19788        v: T,
19789    ) -> Self {
19790        self.threshold = v.into();
19791        self
19792    }
19793
19794    /// Sets the value of [method][crate::model::SafetySetting::method].
19795    ///
19796    /// # Example
19797    /// ```ignore,no_run
19798    /// # use google_cloud_retail_v2::model::SafetySetting;
19799    /// use google_cloud_retail_v2::model::safety_setting::HarmBlockMethod;
19800    /// let x0 = SafetySetting::new().set_method(HarmBlockMethod::Severity);
19801    /// let x1 = SafetySetting::new().set_method(HarmBlockMethod::Probability);
19802    /// ```
19803    pub fn set_method<T: std::convert::Into<crate::model::safety_setting::HarmBlockMethod>>(
19804        mut self,
19805        v: T,
19806    ) -> Self {
19807        self.method = v.into();
19808        self
19809    }
19810}
19811
19812impl wkt::message::Message for SafetySetting {
19813    fn typename() -> &'static str {
19814        "type.googleapis.com/google.cloud.retail.v2.SafetySetting"
19815    }
19816}
19817
19818/// Defines additional types related to [SafetySetting].
19819pub mod safety_setting {
19820    #[allow(unused_imports)]
19821    use super::*;
19822
19823    /// Probability based thresholds levels for blocking.
19824    ///
19825    /// # Working with unknown values
19826    ///
19827    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19828    /// additional enum variants at any time. Adding new variants is not considered
19829    /// a breaking change. Applications should write their code in anticipation of:
19830    ///
19831    /// - New values appearing in future releases of the client library, **and**
19832    /// - New values received dynamically, without application changes.
19833    ///
19834    /// Please consult the [Working with enums] section in the user guide for some
19835    /// guidelines.
19836    ///
19837    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19838    #[derive(Clone, Debug, PartialEq)]
19839    #[non_exhaustive]
19840    pub enum HarmBlockThreshold {
19841        /// Unspecified harm block threshold.
19842        Unspecified,
19843        /// Block low threshold and above (i.e. block more).
19844        BlockLowAndAbove,
19845        /// Block medium threshold and above.
19846        BlockMediumAndAbove,
19847        /// Block only high threshold (i.e. block less).
19848        BlockOnlyHigh,
19849        /// Block none.
19850        BlockNone,
19851        /// Turn off the safety filter.
19852        Off,
19853        /// If set, the enum was initialized with an unknown value.
19854        ///
19855        /// Applications can examine the value using [HarmBlockThreshold::value] or
19856        /// [HarmBlockThreshold::name].
19857        UnknownValue(harm_block_threshold::UnknownValue),
19858    }
19859
19860    #[doc(hidden)]
19861    pub mod harm_block_threshold {
19862        #[allow(unused_imports)]
19863        use super::*;
19864        #[derive(Clone, Debug, PartialEq)]
19865        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19866    }
19867
19868    impl HarmBlockThreshold {
19869        /// Gets the enum value.
19870        ///
19871        /// Returns `None` if the enum contains an unknown value deserialized from
19872        /// the string representation of enums.
19873        pub fn value(&self) -> std::option::Option<i32> {
19874            match self {
19875                Self::Unspecified => std::option::Option::Some(0),
19876                Self::BlockLowAndAbove => std::option::Option::Some(1),
19877                Self::BlockMediumAndAbove => std::option::Option::Some(2),
19878                Self::BlockOnlyHigh => std::option::Option::Some(3),
19879                Self::BlockNone => std::option::Option::Some(4),
19880                Self::Off => std::option::Option::Some(5),
19881                Self::UnknownValue(u) => u.0.value(),
19882            }
19883        }
19884
19885        /// Gets the enum value as a string.
19886        ///
19887        /// Returns `None` if the enum contains an unknown value deserialized from
19888        /// the integer representation of enums.
19889        pub fn name(&self) -> std::option::Option<&str> {
19890            match self {
19891                Self::Unspecified => std::option::Option::Some("HARM_BLOCK_THRESHOLD_UNSPECIFIED"),
19892                Self::BlockLowAndAbove => std::option::Option::Some("BLOCK_LOW_AND_ABOVE"),
19893                Self::BlockMediumAndAbove => std::option::Option::Some("BLOCK_MEDIUM_AND_ABOVE"),
19894                Self::BlockOnlyHigh => std::option::Option::Some("BLOCK_ONLY_HIGH"),
19895                Self::BlockNone => std::option::Option::Some("BLOCK_NONE"),
19896                Self::Off => std::option::Option::Some("OFF"),
19897                Self::UnknownValue(u) => u.0.name(),
19898            }
19899        }
19900    }
19901
19902    impl std::default::Default for HarmBlockThreshold {
19903        fn default() -> Self {
19904            use std::convert::From;
19905            Self::from(0)
19906        }
19907    }
19908
19909    impl std::fmt::Display for HarmBlockThreshold {
19910        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19911            wkt::internal::display_enum(f, self.name(), self.value())
19912        }
19913    }
19914
19915    impl std::convert::From<i32> for HarmBlockThreshold {
19916        fn from(value: i32) -> Self {
19917            match value {
19918                0 => Self::Unspecified,
19919                1 => Self::BlockLowAndAbove,
19920                2 => Self::BlockMediumAndAbove,
19921                3 => Self::BlockOnlyHigh,
19922                4 => Self::BlockNone,
19923                5 => Self::Off,
19924                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19925                    wkt::internal::UnknownEnumValue::Integer(value),
19926                )),
19927            }
19928        }
19929    }
19930
19931    impl std::convert::From<&str> for HarmBlockThreshold {
19932        fn from(value: &str) -> Self {
19933            use std::string::ToString;
19934            match value {
19935                "HARM_BLOCK_THRESHOLD_UNSPECIFIED" => Self::Unspecified,
19936                "BLOCK_LOW_AND_ABOVE" => Self::BlockLowAndAbove,
19937                "BLOCK_MEDIUM_AND_ABOVE" => Self::BlockMediumAndAbove,
19938                "BLOCK_ONLY_HIGH" => Self::BlockOnlyHigh,
19939                "BLOCK_NONE" => Self::BlockNone,
19940                "OFF" => Self::Off,
19941                _ => Self::UnknownValue(harm_block_threshold::UnknownValue(
19942                    wkt::internal::UnknownEnumValue::String(value.to_string()),
19943                )),
19944            }
19945        }
19946    }
19947
19948    impl serde::ser::Serialize for HarmBlockThreshold {
19949        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19950        where
19951            S: serde::Serializer,
19952        {
19953            match self {
19954                Self::Unspecified => serializer.serialize_i32(0),
19955                Self::BlockLowAndAbove => serializer.serialize_i32(1),
19956                Self::BlockMediumAndAbove => serializer.serialize_i32(2),
19957                Self::BlockOnlyHigh => serializer.serialize_i32(3),
19958                Self::BlockNone => serializer.serialize_i32(4),
19959                Self::Off => serializer.serialize_i32(5),
19960                Self::UnknownValue(u) => u.0.serialize(serializer),
19961            }
19962        }
19963    }
19964
19965    impl<'de> serde::de::Deserialize<'de> for HarmBlockThreshold {
19966        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19967        where
19968            D: serde::Deserializer<'de>,
19969        {
19970            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockThreshold>::new(
19971                ".google.cloud.retail.v2.SafetySetting.HarmBlockThreshold",
19972            ))
19973        }
19974    }
19975
19976    /// Probability vs severity.
19977    ///
19978    /// # Working with unknown values
19979    ///
19980    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19981    /// additional enum variants at any time. Adding new variants is not considered
19982    /// a breaking change. Applications should write their code in anticipation of:
19983    ///
19984    /// - New values appearing in future releases of the client library, **and**
19985    /// - New values received dynamically, without application changes.
19986    ///
19987    /// Please consult the [Working with enums] section in the user guide for some
19988    /// guidelines.
19989    ///
19990    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19991    #[derive(Clone, Debug, PartialEq)]
19992    #[non_exhaustive]
19993    pub enum HarmBlockMethod {
19994        /// The harm block method is unspecified.
19995        Unspecified,
19996        /// The harm block method uses both probability and severity scores.
19997        Severity,
19998        /// The harm block method uses the probability score.
19999        Probability,
20000        /// If set, the enum was initialized with an unknown value.
20001        ///
20002        /// Applications can examine the value using [HarmBlockMethod::value] or
20003        /// [HarmBlockMethod::name].
20004        UnknownValue(harm_block_method::UnknownValue),
20005    }
20006
20007    #[doc(hidden)]
20008    pub mod harm_block_method {
20009        #[allow(unused_imports)]
20010        use super::*;
20011        #[derive(Clone, Debug, PartialEq)]
20012        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
20013    }
20014
20015    impl HarmBlockMethod {
20016        /// Gets the enum value.
20017        ///
20018        /// Returns `None` if the enum contains an unknown value deserialized from
20019        /// the string representation of enums.
20020        pub fn value(&self) -> std::option::Option<i32> {
20021            match self {
20022                Self::Unspecified => std::option::Option::Some(0),
20023                Self::Severity => std::option::Option::Some(1),
20024                Self::Probability => std::option::Option::Some(2),
20025                Self::UnknownValue(u) => u.0.value(),
20026            }
20027        }
20028
20029        /// Gets the enum value as a string.
20030        ///
20031        /// Returns `None` if the enum contains an unknown value deserialized from
20032        /// the integer representation of enums.
20033        pub fn name(&self) -> std::option::Option<&str> {
20034            match self {
20035                Self::Unspecified => std::option::Option::Some("HARM_BLOCK_METHOD_UNSPECIFIED"),
20036                Self::Severity => std::option::Option::Some("SEVERITY"),
20037                Self::Probability => std::option::Option::Some("PROBABILITY"),
20038                Self::UnknownValue(u) => u.0.name(),
20039            }
20040        }
20041    }
20042
20043    impl std::default::Default for HarmBlockMethod {
20044        fn default() -> Self {
20045            use std::convert::From;
20046            Self::from(0)
20047        }
20048    }
20049
20050    impl std::fmt::Display for HarmBlockMethod {
20051        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
20052            wkt::internal::display_enum(f, self.name(), self.value())
20053        }
20054    }
20055
20056    impl std::convert::From<i32> for HarmBlockMethod {
20057        fn from(value: i32) -> Self {
20058            match value {
20059                0 => Self::Unspecified,
20060                1 => Self::Severity,
20061                2 => Self::Probability,
20062                _ => Self::UnknownValue(harm_block_method::UnknownValue(
20063                    wkt::internal::UnknownEnumValue::Integer(value),
20064                )),
20065            }
20066        }
20067    }
20068
20069    impl std::convert::From<&str> for HarmBlockMethod {
20070        fn from(value: &str) -> Self {
20071            use std::string::ToString;
20072            match value {
20073                "HARM_BLOCK_METHOD_UNSPECIFIED" => Self::Unspecified,
20074                "SEVERITY" => Self::Severity,
20075                "PROBABILITY" => Self::Probability,
20076                _ => Self::UnknownValue(harm_block_method::UnknownValue(
20077                    wkt::internal::UnknownEnumValue::String(value.to_string()),
20078                )),
20079            }
20080        }
20081    }
20082
20083    impl serde::ser::Serialize for HarmBlockMethod {
20084        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
20085        where
20086            S: serde::Serializer,
20087        {
20088            match self {
20089                Self::Unspecified => serializer.serialize_i32(0),
20090                Self::Severity => serializer.serialize_i32(1),
20091                Self::Probability => serializer.serialize_i32(2),
20092                Self::UnknownValue(u) => u.0.serialize(serializer),
20093            }
20094        }
20095    }
20096
20097    impl<'de> serde::de::Deserialize<'de> for HarmBlockMethod {
20098        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
20099        where
20100            D: serde::Deserializer<'de>,
20101        {
20102            deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmBlockMethod>::new(
20103                ".google.cloud.retail.v2.SafetySetting.HarmBlockMethod",
20104            ))
20105        }
20106    }
20107}
20108
20109/// Product attribute which structured by an attribute name and value. This
20110/// structure is used in conversational search filters and answers. For example,
20111/// if we have `name=color` and `value=red`, this means that the color is `red`.
20112#[derive(Clone, Default, PartialEq)]
20113#[non_exhaustive]
20114pub struct ProductAttributeValue {
20115    /// The attribute name.
20116    pub name: std::string::String,
20117
20118    /// The attribute value.
20119    pub value: std::string::String,
20120
20121    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20122}
20123
20124impl ProductAttributeValue {
20125    /// Creates a new default instance.
20126    pub fn new() -> Self {
20127        std::default::Default::default()
20128    }
20129
20130    /// Sets the value of [name][crate::model::ProductAttributeValue::name].
20131    ///
20132    /// # Example
20133    /// ```ignore,no_run
20134    /// # use google_cloud_retail_v2::model::ProductAttributeValue;
20135    /// let x = ProductAttributeValue::new().set_name("example");
20136    /// ```
20137    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20138        self.name = v.into();
20139        self
20140    }
20141
20142    /// Sets the value of [value][crate::model::ProductAttributeValue::value].
20143    ///
20144    /// # Example
20145    /// ```ignore,no_run
20146    /// # use google_cloud_retail_v2::model::ProductAttributeValue;
20147    /// let x = ProductAttributeValue::new().set_value("example");
20148    /// ```
20149    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20150        self.value = v.into();
20151        self
20152    }
20153}
20154
20155impl wkt::message::Message for ProductAttributeValue {
20156    fn typename() -> &'static str {
20157        "type.googleapis.com/google.cloud.retail.v2.ProductAttributeValue"
20158    }
20159}
20160
20161/// Product attribute name and numeric interval.
20162#[derive(Clone, Default, PartialEq)]
20163#[non_exhaustive]
20164pub struct ProductAttributeInterval {
20165    /// The attribute name (e.g. "length")
20166    pub name: std::string::String,
20167
20168    /// The numeric interval (e.g. [10, 20))
20169    pub interval: std::option::Option<crate::model::Interval>,
20170
20171    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20172}
20173
20174impl ProductAttributeInterval {
20175    /// Creates a new default instance.
20176    pub fn new() -> Self {
20177        std::default::Default::default()
20178    }
20179
20180    /// Sets the value of [name][crate::model::ProductAttributeInterval::name].
20181    ///
20182    /// # Example
20183    /// ```ignore,no_run
20184    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20185    /// let x = ProductAttributeInterval::new().set_name("example");
20186    /// ```
20187    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20188        self.name = v.into();
20189        self
20190    }
20191
20192    /// Sets the value of [interval][crate::model::ProductAttributeInterval::interval].
20193    ///
20194    /// # Example
20195    /// ```ignore,no_run
20196    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20197    /// use google_cloud_retail_v2::model::Interval;
20198    /// let x = ProductAttributeInterval::new().set_interval(Interval::default()/* use setters */);
20199    /// ```
20200    pub fn set_interval<T>(mut self, v: T) -> Self
20201    where
20202        T: std::convert::Into<crate::model::Interval>,
20203    {
20204        self.interval = std::option::Option::Some(v.into());
20205        self
20206    }
20207
20208    /// Sets or clears the value of [interval][crate::model::ProductAttributeInterval::interval].
20209    ///
20210    /// # Example
20211    /// ```ignore,no_run
20212    /// # use google_cloud_retail_v2::model::ProductAttributeInterval;
20213    /// use google_cloud_retail_v2::model::Interval;
20214    /// let x = ProductAttributeInterval::new().set_or_clear_interval(Some(Interval::default()/* use setters */));
20215    /// let x = ProductAttributeInterval::new().set_or_clear_interval(None::<Interval>);
20216    /// ```
20217    pub fn set_or_clear_interval<T>(mut self, v: std::option::Option<T>) -> Self
20218    where
20219        T: std::convert::Into<crate::model::Interval>,
20220    {
20221        self.interval = v.map(|x| x.into());
20222        self
20223    }
20224}
20225
20226impl wkt::message::Message for ProductAttributeInterval {
20227    fn typename() -> &'static str {
20228        "type.googleapis.com/google.cloud.retail.v2.ProductAttributeInterval"
20229    }
20230}
20231
20232/// This field specifies the tile information including an attribute key,
20233/// attribute value. More fields will be added in the future, eg: product id
20234/// or product counts, etc.
20235#[derive(Clone, Default, PartialEq)]
20236#[non_exhaustive]
20237pub struct Tile {
20238    /// The representative product id for this tile.
20239    pub representative_product_id: std::string::String,
20240
20241    /// The attribute key and value for the tile.
20242    pub product_attribute: std::option::Option<crate::model::tile::ProductAttribute>,
20243
20244    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20245}
20246
20247impl Tile {
20248    /// Creates a new default instance.
20249    pub fn new() -> Self {
20250        std::default::Default::default()
20251    }
20252
20253    /// Sets the value of [representative_product_id][crate::model::Tile::representative_product_id].
20254    ///
20255    /// # Example
20256    /// ```ignore,no_run
20257    /// # use google_cloud_retail_v2::model::Tile;
20258    /// let x = Tile::new().set_representative_product_id("example");
20259    /// ```
20260    pub fn set_representative_product_id<T: std::convert::Into<std::string::String>>(
20261        mut self,
20262        v: T,
20263    ) -> Self {
20264        self.representative_product_id = v.into();
20265        self
20266    }
20267
20268    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute].
20269    ///
20270    /// Note that all the setters affecting `product_attribute` are mutually
20271    /// exclusive.
20272    ///
20273    /// # Example
20274    /// ```ignore,no_run
20275    /// # use google_cloud_retail_v2::model::Tile;
20276    /// use google_cloud_retail_v2::model::ProductAttributeValue;
20277    /// let x = Tile::new().set_product_attribute(Some(
20278    ///     google_cloud_retail_v2::model::tile::ProductAttribute::ProductAttributeValue(ProductAttributeValue::default().into())));
20279    /// ```
20280    pub fn set_product_attribute<
20281        T: std::convert::Into<std::option::Option<crate::model::tile::ProductAttribute>>,
20282    >(
20283        mut self,
20284        v: T,
20285    ) -> Self {
20286        self.product_attribute = v.into();
20287        self
20288    }
20289
20290    /// The value of [product_attribute][crate::model::Tile::product_attribute]
20291    /// if it holds a `ProductAttributeValue`, `None` if the field is not set or
20292    /// holds a different branch.
20293    pub fn product_attribute_value(
20294        &self,
20295    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeValue>> {
20296        #[allow(unreachable_patterns)]
20297        self.product_attribute.as_ref().and_then(|v| match v {
20298            crate::model::tile::ProductAttribute::ProductAttributeValue(v) => {
20299                std::option::Option::Some(v)
20300            }
20301            _ => std::option::Option::None,
20302        })
20303    }
20304
20305    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20306    /// to hold a `ProductAttributeValue`.
20307    ///
20308    /// Note that all the setters affecting `product_attribute` are
20309    /// mutually exclusive.
20310    ///
20311    /// # Example
20312    /// ```ignore,no_run
20313    /// # use google_cloud_retail_v2::model::Tile;
20314    /// use google_cloud_retail_v2::model::ProductAttributeValue;
20315    /// let x = Tile::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
20316    /// assert!(x.product_attribute_value().is_some());
20317    /// assert!(x.product_attribute_interval().is_none());
20318    /// ```
20319    pub fn set_product_attribute_value<
20320        T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeValue>>,
20321    >(
20322        mut self,
20323        v: T,
20324    ) -> Self {
20325        self.product_attribute = std::option::Option::Some(
20326            crate::model::tile::ProductAttribute::ProductAttributeValue(v.into()),
20327        );
20328        self
20329    }
20330
20331    /// The value of [product_attribute][crate::model::Tile::product_attribute]
20332    /// if it holds a `ProductAttributeInterval`, `None` if the field is not set or
20333    /// holds a different branch.
20334    pub fn product_attribute_interval(
20335        &self,
20336    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductAttributeInterval>> {
20337        #[allow(unreachable_patterns)]
20338        self.product_attribute.as_ref().and_then(|v| match v {
20339            crate::model::tile::ProductAttribute::ProductAttributeInterval(v) => {
20340                std::option::Option::Some(v)
20341            }
20342            _ => std::option::Option::None,
20343        })
20344    }
20345
20346    /// Sets the value of [product_attribute][crate::model::Tile::product_attribute]
20347    /// to hold a `ProductAttributeInterval`.
20348    ///
20349    /// Note that all the setters affecting `product_attribute` are
20350    /// mutually exclusive.
20351    ///
20352    /// # Example
20353    /// ```ignore,no_run
20354    /// # use google_cloud_retail_v2::model::Tile;
20355    /// use google_cloud_retail_v2::model::ProductAttributeInterval;
20356    /// let x = Tile::new().set_product_attribute_interval(ProductAttributeInterval::default()/* use setters */);
20357    /// assert!(x.product_attribute_interval().is_some());
20358    /// assert!(x.product_attribute_value().is_none());
20359    /// ```
20360    pub fn set_product_attribute_interval<
20361        T: std::convert::Into<std::boxed::Box<crate::model::ProductAttributeInterval>>,
20362    >(
20363        mut self,
20364        v: T,
20365    ) -> Self {
20366        self.product_attribute = std::option::Option::Some(
20367            crate::model::tile::ProductAttribute::ProductAttributeInterval(v.into()),
20368        );
20369        self
20370    }
20371}
20372
20373impl wkt::message::Message for Tile {
20374    fn typename() -> &'static str {
20375        "type.googleapis.com/google.cloud.retail.v2.Tile"
20376    }
20377}
20378
20379/// Defines additional types related to [Tile].
20380pub mod tile {
20381    #[allow(unused_imports)]
20382    use super::*;
20383
20384    /// The attribute key and value for the tile.
20385    #[derive(Clone, Debug, PartialEq)]
20386    #[non_exhaustive]
20387    pub enum ProductAttribute {
20388        /// The product attribute key-value.
20389        ProductAttributeValue(std::boxed::Box<crate::model::ProductAttributeValue>),
20390        /// The product attribute key-numeric interval.
20391        ProductAttributeInterval(std::boxed::Box<crate::model::ProductAttributeInterval>),
20392    }
20393}
20394
20395/// Request message for
20396/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
20397///
20398/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20399#[derive(Clone, Default, PartialEq)]
20400#[non_exhaustive]
20401pub struct SearchRequest {
20402    /// Required. The resource name of the Retail Search serving config, such as
20403    /// `projects/*/locations/global/catalogs/default_catalog/servingConfigs/default_serving_config`
20404    /// or the name of the legacy placement resource, such as
20405    /// `projects/*/locations/global/catalogs/default_catalog/placements/default_search`.
20406    /// This field is used to identify the serving config name and the set
20407    /// of models that are used to make the search.
20408    pub placement: std::string::String,
20409
20410    /// The branch resource name, such as
20411    /// `projects/*/locations/global/catalogs/default_catalog/branches/0`.
20412    ///
20413    /// Use "default_branch" as the branch ID or leave this field empty, to search
20414    /// products under the default branch.
20415    pub branch: std::string::String,
20416
20417    /// Raw search query.
20418    ///
20419    /// If this field is empty, the request is considered a category browsing
20420    /// request and returned results are based on
20421    /// [filter][google.cloud.retail.v2.SearchRequest.filter] and
20422    /// [page_categories][google.cloud.retail.v2.SearchRequest.page_categories].
20423    ///
20424    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20425    /// [google.cloud.retail.v2.SearchRequest.page_categories]: crate::model::SearchRequest::page_categories
20426    pub query: std::string::String,
20427
20428    /// Required. A unique identifier for tracking visitors. For example, this
20429    /// could be implemented with an HTTP cookie, which should be able to uniquely
20430    /// identify a visitor on a single device. This unique identifier should not
20431    /// change if the visitor logs in or out of the website.
20432    ///
20433    /// This should be the same identifier as
20434    /// [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id].
20435    ///
20436    /// The field must be a UTF-8 encoded string with a length limit of 128
20437    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
20438    ///
20439    /// [google.cloud.retail.v2.UserEvent.visitor_id]: crate::model::UserEvent::visitor_id
20440    pub visitor_id: std::string::String,
20441
20442    /// User information.
20443    pub user_info: std::option::Option<crate::model::UserInfo>,
20444
20445    /// Maximum number of [Product][google.cloud.retail.v2.Product]s to return. If
20446    /// unspecified, defaults to a reasonable value. The maximum allowed value is
20447    /// 120. Values above 120 will be coerced to 120.
20448    ///
20449    /// If this field is negative, an INVALID_ARGUMENT is returned.
20450    ///
20451    /// [google.cloud.retail.v2.Product]: crate::model::Product
20452    pub page_size: i32,
20453
20454    /// A page token
20455    /// [SearchResponse.next_page_token][google.cloud.retail.v2.SearchResponse.next_page_token],
20456    /// received from a previous
20457    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] call.
20458    /// Provide this to retrieve the subsequent page.
20459    ///
20460    /// When paginating, all other parameters provided to
20461    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] must
20462    /// match the call that provided the page token. Otherwise, an INVALID_ARGUMENT
20463    /// error is returned.
20464    ///
20465    /// [google.cloud.retail.v2.SearchResponse.next_page_token]: crate::model::SearchResponse::next_page_token
20466    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
20467    pub page_token: std::string::String,
20468
20469    /// A 0-indexed integer that specifies the current offset (that is, starting
20470    /// result location, amongst the [Product][google.cloud.retail.v2.Product]s
20471    /// deemed by the API as relevant) in search results. This field is only
20472    /// considered if [page_token][google.cloud.retail.v2.SearchRequest.page_token]
20473    /// is unset.
20474    ///
20475    /// If this field is negative, an INVALID_ARGUMENT is returned.
20476    ///
20477    /// [google.cloud.retail.v2.Product]: crate::model::Product
20478    /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
20479    pub offset: i32,
20480
20481    /// The filter syntax consists of an expression language for constructing a
20482    /// predicate from one or more fields of the products being filtered. Filter
20483    /// expression is case-sensitive. For more information, see
20484    /// [Filter](https://cloud.google.com/retail/docs/filter-and-order#filter).
20485    ///
20486    /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20487    pub filter: std::string::String,
20488
20489    /// The default filter that is applied when a user performs a search without
20490    /// checking any filters on the search page.
20491    ///
20492    /// The filter applied to every search request when quality improvement such as
20493    /// query expansion is needed. In the case a query does not have a sufficient
20494    /// amount of results this filter will be used to determine whether or not to
20495    /// enable the query expansion flow. The original filter will still be used for
20496    /// the query expanded search.
20497    /// This field is strongly recommended to achieve high search quality.
20498    ///
20499    /// For more information about filter syntax, see
20500    /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
20501    ///
20502    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
20503    pub canonical_filter: std::string::String,
20504
20505    /// The order in which products are returned. Products can be ordered by
20506    /// a field in an [Product][google.cloud.retail.v2.Product] object. Leave it
20507    /// unset if ordered by relevance. OrderBy expression is case-sensitive. For
20508    /// more information, see
20509    /// [Order](https://cloud.google.com/retail/docs/filter-and-order#order).
20510    ///
20511    /// If this field is unrecognizable, an INVALID_ARGUMENT is returned.
20512    ///
20513    /// [google.cloud.retail.v2.Product]: crate::model::Product
20514    pub order_by: std::string::String,
20515
20516    /// Facet specifications for faceted search. If empty, no facets are returned.
20517    ///
20518    /// A maximum of 200 values are allowed. Otherwise, an INVALID_ARGUMENT error
20519    /// is returned.
20520    pub facet_specs: std::vec::Vec<crate::model::search_request::FacetSpec>,
20521
20522    /// Deprecated. Refer to <https://cloud.google.com/retail/docs/configs#dynamic>
20523    /// to enable dynamic facets. Do not set this field.
20524    ///
20525    /// The specification for dynamically generated facets. Notice that only
20526    /// textual facets can be dynamically generated.
20527    #[deprecated]
20528    pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
20529
20530    /// Boost specification to boost certain products. For more information, see
20531    /// [Boost results](https://cloud.google.com/retail/docs/boosting).
20532    ///
20533    /// Notice that if both
20534    /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
20535    /// and
20536    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
20537    /// are set, the boost conditions from both places are evaluated. If a search
20538    /// request matches multiple boost conditions, the final boost score is equal
20539    /// to the sum of the boost scores from all matched boost conditions.
20540    ///
20541    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
20542    /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
20543    pub boost_spec: std::option::Option<crate::model::search_request::BoostSpec>,
20544
20545    /// The query expansion specification that specifies the conditions under which
20546    /// query expansion occurs. For more information, see [Query
20547    /// expansion](https://cloud.google.com/retail/docs/result-size#query_expansion).
20548    pub query_expansion_spec: std::option::Option<crate::model::search_request::QueryExpansionSpec>,
20549
20550    /// The keys to fetch and rollup the matching
20551    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20552    /// [Product][google.cloud.retail.v2.Product]s attributes,
20553    /// [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo] or
20554    /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s attributes. The
20555    /// attributes from all the matching
20556    /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
20557    /// [Product][google.cloud.retail.v2.Product]s or
20558    /// [LocalInventory][google.cloud.retail.v2.LocalInventory]s are merged and
20559    /// de-duplicated. Notice that rollup attributes will lead to extra query
20560    /// latency. Maximum number of keys is 30.
20561    ///
20562    /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], a
20563    /// fulfillment type and a fulfillment ID must be provided in the format of
20564    /// "fulfillmentType.fulfillmentId". E.g., in "pickupInStore.store123",
20565    /// "pickupInStore" is fulfillment type and "store123" is the store ID.
20566    ///
20567    /// Supported keys are:
20568    ///
20569    /// * colorFamilies
20570    /// * price
20571    /// * originalPrice
20572    /// * discount
20573    /// * variantId
20574    /// * inventory(place_id,price)
20575    /// * inventory(place_id,original_price)
20576    /// * inventory(place_id,attributes.key), where key is any key in the
20577    ///   [Product.local_inventories.attributes][google.cloud.retail.v2.LocalInventory.attributes]
20578    ///   map.
20579    /// * attributes.key, where key is any key in the
20580    ///   [Product.attributes][google.cloud.retail.v2.Product.attributes] map.
20581    /// * pickupInStore.id, where id is any
20582    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20583    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20584    ///   "pickup-in-store".
20585    /// * shipToStore.id, where id is any
20586    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20587    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20588    ///   "ship-to-store".
20589    /// * sameDayDelivery.id, where id is any
20590    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20591    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20592    ///   "same-day-delivery".
20593    /// * nextDayDelivery.id, where id is any
20594    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20595    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20596    ///   "next-day-delivery".
20597    /// * customFulfillment1.id, where id is any
20598    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20599    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20600    ///   "custom-type-1".
20601    /// * customFulfillment2.id, where id is any
20602    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20603    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20604    ///   "custom-type-2".
20605    /// * customFulfillment3.id, where id is any
20606    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20607    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20608    ///   "custom-type-3".
20609    /// * customFulfillment4.id, where id is any
20610    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20611    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20612    ///   "custom-type-4".
20613    /// * customFulfillment5.id, where id is any
20614    ///   [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
20615    ///   for [FulfillmentInfo.type][google.cloud.retail.v2.FulfillmentInfo.type]
20616    ///   "custom-type-5".
20617    ///
20618    /// If this field is set to an invalid value other than these, an
20619    /// INVALID_ARGUMENT error is returned.
20620    ///
20621    /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
20622    /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
20623    /// [google.cloud.retail.v2.FulfillmentInfo.type]: crate::model::FulfillmentInfo::type
20624    /// [google.cloud.retail.v2.LocalInventory]: crate::model::LocalInventory
20625    /// [google.cloud.retail.v2.LocalInventory.attributes]: crate::model::LocalInventory::attributes
20626    /// [google.cloud.retail.v2.Product]: crate::model::Product
20627    /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
20628    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
20629    pub variant_rollup_keys: std::vec::Vec<std::string::String>,
20630
20631    /// The categories associated with a category page. Must be set for category
20632    /// navigation queries to achieve good search quality. The format should be
20633    /// the same as
20634    /// [UserEvent.page_categories][google.cloud.retail.v2.UserEvent.page_categories];
20635    ///
20636    /// To represent full path of category, use '>' sign to separate different
20637    /// hierarchies. If '>' is part of the category name, replace it with
20638    /// other character(s).
20639    ///
20640    /// Category pages include special pages such as sales or promotions. For
20641    /// instance, a special sale page may have the category hierarchy:
20642    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
20643    ///
20644    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
20645    pub page_categories: std::vec::Vec<std::string::String>,
20646
20647    /// The search mode of the search request. If not specified, a single search
20648    /// request triggers both product search and faceted search.
20649    pub search_mode: crate::model::search_request::SearchMode,
20650
20651    /// The specification for personalization.
20652    ///
20653    /// Notice that if both
20654    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
20655    /// and
20656    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20657    /// are set.
20658    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
20659    /// will override
20660    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
20661    ///
20662    /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
20663    /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
20664    pub personalization_spec:
20665        std::option::Option<crate::model::search_request::PersonalizationSpec>,
20666
20667    /// The labels applied to a resource must meet the following requirements:
20668    ///
20669    /// * Each resource can have multiple labels, up to a maximum of 64.
20670    /// * Each label must be a key-value pair.
20671    /// * Keys have a minimum length of 1 character and a maximum length of 63
20672    ///   characters and cannot be empty. Values can be empty and have a maximum
20673    ///   length of 63 characters.
20674    /// * Keys and values can contain only lowercase letters, numeric characters,
20675    ///   underscores, and dashes. All characters must use UTF-8 encoding, and
20676    ///   international characters are allowed.
20677    /// * The key portion of a label must be unique. However, you can use the same
20678    ///   key with multiple resources.
20679    /// * Keys must start with a lowercase letter or international character.
20680    ///
20681    /// For more information, see [Requirements for
20682    /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
20683    /// in the Resource Manager documentation.
20684    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
20685
20686    /// The spell correction specification that specifies the mode under
20687    /// which spell correction will take effect.
20688    pub spell_correction_spec:
20689        std::option::Option<crate::model::search_request::SpellCorrectionSpec>,
20690
20691    /// The entity for customers that may run multiple different entities, domains,
20692    /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
20693    /// `google.com`, `youtube.com`, etc.
20694    /// If this is set, it should be exactly matched with
20695    /// [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get search
20696    /// results boosted by entity.
20697    ///
20698    /// [google.cloud.retail.v2.UserEvent.entity]: crate::model::UserEvent::entity
20699    pub entity: std::string::String,
20700
20701    /// Optional. This field specifies all conversational related parameters
20702    /// addition to traditional retail search.
20703    pub conversational_search_spec:
20704        std::option::Option<crate::model::search_request::ConversationalSearchSpec>,
20705
20706    /// Optional. This field specifies tile navigation related parameters.
20707    pub tile_navigation_spec: std::option::Option<crate::model::search_request::TileNavigationSpec>,
20708
20709    /// Optional. The BCP-47 language code, such as "en-US" or "sr-Latn"
20710    /// [list](https://www.unicode.org/cldr/charts/46/summary/root.html). For more
20711    /// information, see [Standardized codes](https://google.aip.dev/143). This
20712    /// field helps to better interpret the query. If a value isn't specified, the
20713    /// query language code is automatically detected, which may not be accurate.
20714    pub language_code: std::string::String,
20715
20716    /// Optional. The Unicode country/region code (CLDR) of a location, such as
20717    /// "US" and "419"
20718    /// [list](https://www.unicode.org/cldr/charts/46/supplemental/territory_information.html).
20719    /// For more information, see [Standardized codes](https://google.aip.dev/143).
20720    /// If set, then results will be boosted based on the region_code provided.
20721    pub region_code: std::string::String,
20722
20723    /// Optional. An id corresponding to a place, such as a store id or region id.
20724    /// When specified, we use the price from the local inventory with the matching
20725    /// product's
20726    /// [LocalInventory.place_id][google.cloud.retail.v2.LocalInventory.place_id]
20727    /// for revenue optimization.
20728    ///
20729    /// [google.cloud.retail.v2.LocalInventory.place_id]: crate::model::LocalInventory::place_id
20730    pub place_id: std::string::String,
20731
20732    /// Optional. The user attributes that could be used for personalization of
20733    /// search results.
20734    ///
20735    /// * Populate at most 100 key-value pairs per query.
20736    /// * Only supports string keys and repeated string values.
20737    /// * Duplicate keys are not allowed within a single query.
20738    ///
20739    /// Example:
20740    /// user_attributes: [
20741    /// { key: "pets"
20742    /// value {
20743    /// values: "dog"
20744    /// values: "cat"
20745    /// }
20746    /// },
20747    /// { key: "state"
20748    /// value {
20749    /// values: "CA"
20750    /// }
20751    /// }
20752    /// ]
20753    pub user_attributes: std::collections::HashMap<std::string::String, crate::model::StringList>,
20754
20755    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
20756}
20757
20758impl SearchRequest {
20759    /// Creates a new default instance.
20760    pub fn new() -> Self {
20761        std::default::Default::default()
20762    }
20763
20764    /// Sets the value of [placement][crate::model::SearchRequest::placement].
20765    ///
20766    /// # Example
20767    /// ```ignore,no_run
20768    /// # use google_cloud_retail_v2::model::SearchRequest;
20769    /// let x = SearchRequest::new().set_placement("example");
20770    /// ```
20771    pub fn set_placement<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20772        self.placement = v.into();
20773        self
20774    }
20775
20776    /// Sets the value of [branch][crate::model::SearchRequest::branch].
20777    ///
20778    /// # Example
20779    /// ```ignore,no_run
20780    /// # use google_cloud_retail_v2::model::SearchRequest;
20781    /// let x = SearchRequest::new().set_branch("example");
20782    /// ```
20783    pub fn set_branch<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20784        self.branch = v.into();
20785        self
20786    }
20787
20788    /// Sets the value of [query][crate::model::SearchRequest::query].
20789    ///
20790    /// # Example
20791    /// ```ignore,no_run
20792    /// # use google_cloud_retail_v2::model::SearchRequest;
20793    /// let x = SearchRequest::new().set_query("example");
20794    /// ```
20795    pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20796        self.query = v.into();
20797        self
20798    }
20799
20800    /// Sets the value of [visitor_id][crate::model::SearchRequest::visitor_id].
20801    ///
20802    /// # Example
20803    /// ```ignore,no_run
20804    /// # use google_cloud_retail_v2::model::SearchRequest;
20805    /// let x = SearchRequest::new().set_visitor_id("example");
20806    /// ```
20807    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20808        self.visitor_id = v.into();
20809        self
20810    }
20811
20812    /// Sets the value of [user_info][crate::model::SearchRequest::user_info].
20813    ///
20814    /// # Example
20815    /// ```ignore,no_run
20816    /// # use google_cloud_retail_v2::model::SearchRequest;
20817    /// use google_cloud_retail_v2::model::UserInfo;
20818    /// let x = SearchRequest::new().set_user_info(UserInfo::default()/* use setters */);
20819    /// ```
20820    pub fn set_user_info<T>(mut self, v: T) -> Self
20821    where
20822        T: std::convert::Into<crate::model::UserInfo>,
20823    {
20824        self.user_info = std::option::Option::Some(v.into());
20825        self
20826    }
20827
20828    /// Sets or clears the value of [user_info][crate::model::SearchRequest::user_info].
20829    ///
20830    /// # Example
20831    /// ```ignore,no_run
20832    /// # use google_cloud_retail_v2::model::SearchRequest;
20833    /// use google_cloud_retail_v2::model::UserInfo;
20834    /// let x = SearchRequest::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
20835    /// let x = SearchRequest::new().set_or_clear_user_info(None::<UserInfo>);
20836    /// ```
20837    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
20838    where
20839        T: std::convert::Into<crate::model::UserInfo>,
20840    {
20841        self.user_info = v.map(|x| x.into());
20842        self
20843    }
20844
20845    /// Sets the value of [page_size][crate::model::SearchRequest::page_size].
20846    ///
20847    /// # Example
20848    /// ```ignore,no_run
20849    /// # use google_cloud_retail_v2::model::SearchRequest;
20850    /// let x = SearchRequest::new().set_page_size(42);
20851    /// ```
20852    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20853        self.page_size = v.into();
20854        self
20855    }
20856
20857    /// Sets the value of [page_token][crate::model::SearchRequest::page_token].
20858    ///
20859    /// # Example
20860    /// ```ignore,no_run
20861    /// # use google_cloud_retail_v2::model::SearchRequest;
20862    /// let x = SearchRequest::new().set_page_token("example");
20863    /// ```
20864    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20865        self.page_token = v.into();
20866        self
20867    }
20868
20869    /// Sets the value of [offset][crate::model::SearchRequest::offset].
20870    ///
20871    /// # Example
20872    /// ```ignore,no_run
20873    /// # use google_cloud_retail_v2::model::SearchRequest;
20874    /// let x = SearchRequest::new().set_offset(42);
20875    /// ```
20876    pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
20877        self.offset = v.into();
20878        self
20879    }
20880
20881    /// Sets the value of [filter][crate::model::SearchRequest::filter].
20882    ///
20883    /// # Example
20884    /// ```ignore,no_run
20885    /// # use google_cloud_retail_v2::model::SearchRequest;
20886    /// let x = SearchRequest::new().set_filter("example");
20887    /// ```
20888    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20889        self.filter = v.into();
20890        self
20891    }
20892
20893    /// Sets the value of [canonical_filter][crate::model::SearchRequest::canonical_filter].
20894    ///
20895    /// # Example
20896    /// ```ignore,no_run
20897    /// # use google_cloud_retail_v2::model::SearchRequest;
20898    /// let x = SearchRequest::new().set_canonical_filter("example");
20899    /// ```
20900    pub fn set_canonical_filter<T: std::convert::Into<std::string::String>>(
20901        mut self,
20902        v: T,
20903    ) -> Self {
20904        self.canonical_filter = v.into();
20905        self
20906    }
20907
20908    /// Sets the value of [order_by][crate::model::SearchRequest::order_by].
20909    ///
20910    /// # Example
20911    /// ```ignore,no_run
20912    /// # use google_cloud_retail_v2::model::SearchRequest;
20913    /// let x = SearchRequest::new().set_order_by("example");
20914    /// ```
20915    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
20916        self.order_by = v.into();
20917        self
20918    }
20919
20920    /// Sets the value of [facet_specs][crate::model::SearchRequest::facet_specs].
20921    ///
20922    /// # Example
20923    /// ```ignore,no_run
20924    /// # use google_cloud_retail_v2::model::SearchRequest;
20925    /// use google_cloud_retail_v2::model::search_request::FacetSpec;
20926    /// let x = SearchRequest::new()
20927    ///     .set_facet_specs([
20928    ///         FacetSpec::default()/* use setters */,
20929    ///         FacetSpec::default()/* use (different) setters */,
20930    ///     ]);
20931    /// ```
20932    pub fn set_facet_specs<T, V>(mut self, v: T) -> Self
20933    where
20934        T: std::iter::IntoIterator<Item = V>,
20935        V: std::convert::Into<crate::model::search_request::FacetSpec>,
20936    {
20937        use std::iter::Iterator;
20938        self.facet_specs = v.into_iter().map(|i| i.into()).collect();
20939        self
20940    }
20941
20942    /// Sets the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20943    ///
20944    /// # Example
20945    /// ```ignore,no_run
20946    /// # use google_cloud_retail_v2::model::SearchRequest;
20947    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20948    /// let x = SearchRequest::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
20949    /// ```
20950    #[deprecated]
20951    pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
20952    where
20953        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20954    {
20955        self.dynamic_facet_spec = std::option::Option::Some(v.into());
20956        self
20957    }
20958
20959    /// Sets or clears the value of [dynamic_facet_spec][crate::model::SearchRequest::dynamic_facet_spec].
20960    ///
20961    /// # Example
20962    /// ```ignore,no_run
20963    /// # use google_cloud_retail_v2::model::SearchRequest;
20964    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
20965    /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
20966    /// let x = SearchRequest::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
20967    /// ```
20968    #[deprecated]
20969    pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
20970    where
20971        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
20972    {
20973        self.dynamic_facet_spec = v.map(|x| x.into());
20974        self
20975    }
20976
20977    /// Sets the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20978    ///
20979    /// # Example
20980    /// ```ignore,no_run
20981    /// # use google_cloud_retail_v2::model::SearchRequest;
20982    /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20983    /// let x = SearchRequest::new().set_boost_spec(BoostSpec::default()/* use setters */);
20984    /// ```
20985    pub fn set_boost_spec<T>(mut self, v: T) -> Self
20986    where
20987        T: std::convert::Into<crate::model::search_request::BoostSpec>,
20988    {
20989        self.boost_spec = std::option::Option::Some(v.into());
20990        self
20991    }
20992
20993    /// Sets or clears the value of [boost_spec][crate::model::SearchRequest::boost_spec].
20994    ///
20995    /// # Example
20996    /// ```ignore,no_run
20997    /// # use google_cloud_retail_v2::model::SearchRequest;
20998    /// use google_cloud_retail_v2::model::search_request::BoostSpec;
20999    /// let x = SearchRequest::new().set_or_clear_boost_spec(Some(BoostSpec::default()/* use setters */));
21000    /// let x = SearchRequest::new().set_or_clear_boost_spec(None::<BoostSpec>);
21001    /// ```
21002    pub fn set_or_clear_boost_spec<T>(mut self, v: std::option::Option<T>) -> Self
21003    where
21004        T: std::convert::Into<crate::model::search_request::BoostSpec>,
21005    {
21006        self.boost_spec = v.map(|x| x.into());
21007        self
21008    }
21009
21010    /// Sets the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
21011    ///
21012    /// # Example
21013    /// ```ignore,no_run
21014    /// # use google_cloud_retail_v2::model::SearchRequest;
21015    /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21016    /// let x = SearchRequest::new().set_query_expansion_spec(QueryExpansionSpec::default()/* use setters */);
21017    /// ```
21018    pub fn set_query_expansion_spec<T>(mut self, v: T) -> Self
21019    where
21020        T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
21021    {
21022        self.query_expansion_spec = std::option::Option::Some(v.into());
21023        self
21024    }
21025
21026    /// Sets or clears the value of [query_expansion_spec][crate::model::SearchRequest::query_expansion_spec].
21027    ///
21028    /// # Example
21029    /// ```ignore,no_run
21030    /// # use google_cloud_retail_v2::model::SearchRequest;
21031    /// use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
21032    /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(Some(QueryExpansionSpec::default()/* use setters */));
21033    /// let x = SearchRequest::new().set_or_clear_query_expansion_spec(None::<QueryExpansionSpec>);
21034    /// ```
21035    pub fn set_or_clear_query_expansion_spec<T>(mut self, v: std::option::Option<T>) -> Self
21036    where
21037        T: std::convert::Into<crate::model::search_request::QueryExpansionSpec>,
21038    {
21039        self.query_expansion_spec = v.map(|x| x.into());
21040        self
21041    }
21042
21043    /// Sets the value of [variant_rollup_keys][crate::model::SearchRequest::variant_rollup_keys].
21044    ///
21045    /// # Example
21046    /// ```ignore,no_run
21047    /// # use google_cloud_retail_v2::model::SearchRequest;
21048    /// let x = SearchRequest::new().set_variant_rollup_keys(["a", "b", "c"]);
21049    /// ```
21050    pub fn set_variant_rollup_keys<T, V>(mut self, v: T) -> Self
21051    where
21052        T: std::iter::IntoIterator<Item = V>,
21053        V: std::convert::Into<std::string::String>,
21054    {
21055        use std::iter::Iterator;
21056        self.variant_rollup_keys = v.into_iter().map(|i| i.into()).collect();
21057        self
21058    }
21059
21060    /// Sets the value of [page_categories][crate::model::SearchRequest::page_categories].
21061    ///
21062    /// # Example
21063    /// ```ignore,no_run
21064    /// # use google_cloud_retail_v2::model::SearchRequest;
21065    /// let x = SearchRequest::new().set_page_categories(["a", "b", "c"]);
21066    /// ```
21067    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
21068    where
21069        T: std::iter::IntoIterator<Item = V>,
21070        V: std::convert::Into<std::string::String>,
21071    {
21072        use std::iter::Iterator;
21073        self.page_categories = v.into_iter().map(|i| i.into()).collect();
21074        self
21075    }
21076
21077    /// Sets the value of [search_mode][crate::model::SearchRequest::search_mode].
21078    ///
21079    /// # Example
21080    /// ```ignore,no_run
21081    /// # use google_cloud_retail_v2::model::SearchRequest;
21082    /// use google_cloud_retail_v2::model::search_request::SearchMode;
21083    /// let x0 = SearchRequest::new().set_search_mode(SearchMode::ProductSearchOnly);
21084    /// let x1 = SearchRequest::new().set_search_mode(SearchMode::FacetedSearchOnly);
21085    /// ```
21086    pub fn set_search_mode<T: std::convert::Into<crate::model::search_request::SearchMode>>(
21087        mut self,
21088        v: T,
21089    ) -> Self {
21090        self.search_mode = v.into();
21091        self
21092    }
21093
21094    /// Sets the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
21095    ///
21096    /// # Example
21097    /// ```ignore,no_run
21098    /// # use google_cloud_retail_v2::model::SearchRequest;
21099    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
21100    /// let x = SearchRequest::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
21101    /// ```
21102    pub fn set_personalization_spec<T>(mut self, v: T) -> Self
21103    where
21104        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
21105    {
21106        self.personalization_spec = std::option::Option::Some(v.into());
21107        self
21108    }
21109
21110    /// Sets or clears the value of [personalization_spec][crate::model::SearchRequest::personalization_spec].
21111    ///
21112    /// # Example
21113    /// ```ignore,no_run
21114    /// # use google_cloud_retail_v2::model::SearchRequest;
21115    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
21116    /// let x = SearchRequest::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
21117    /// let x = SearchRequest::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
21118    /// ```
21119    pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
21120    where
21121        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
21122    {
21123        self.personalization_spec = v.map(|x| x.into());
21124        self
21125    }
21126
21127    /// Sets the value of [labels][crate::model::SearchRequest::labels].
21128    ///
21129    /// # Example
21130    /// ```ignore,no_run
21131    /// # use google_cloud_retail_v2::model::SearchRequest;
21132    /// let x = SearchRequest::new().set_labels([
21133    ///     ("key0", "abc"),
21134    ///     ("key1", "xyz"),
21135    /// ]);
21136    /// ```
21137    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
21138    where
21139        T: std::iter::IntoIterator<Item = (K, V)>,
21140        K: std::convert::Into<std::string::String>,
21141        V: std::convert::Into<std::string::String>,
21142    {
21143        use std::iter::Iterator;
21144        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21145        self
21146    }
21147
21148    /// Sets the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
21149    ///
21150    /// # Example
21151    /// ```ignore,no_run
21152    /// # use google_cloud_retail_v2::model::SearchRequest;
21153    /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
21154    /// let x = SearchRequest::new().set_spell_correction_spec(SpellCorrectionSpec::default()/* use setters */);
21155    /// ```
21156    pub fn set_spell_correction_spec<T>(mut self, v: T) -> Self
21157    where
21158        T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
21159    {
21160        self.spell_correction_spec = std::option::Option::Some(v.into());
21161        self
21162    }
21163
21164    /// Sets or clears the value of [spell_correction_spec][crate::model::SearchRequest::spell_correction_spec].
21165    ///
21166    /// # Example
21167    /// ```ignore,no_run
21168    /// # use google_cloud_retail_v2::model::SearchRequest;
21169    /// use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
21170    /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(Some(SpellCorrectionSpec::default()/* use setters */));
21171    /// let x = SearchRequest::new().set_or_clear_spell_correction_spec(None::<SpellCorrectionSpec>);
21172    /// ```
21173    pub fn set_or_clear_spell_correction_spec<T>(mut self, v: std::option::Option<T>) -> Self
21174    where
21175        T: std::convert::Into<crate::model::search_request::SpellCorrectionSpec>,
21176    {
21177        self.spell_correction_spec = v.map(|x| x.into());
21178        self
21179    }
21180
21181    /// Sets the value of [entity][crate::model::SearchRequest::entity].
21182    ///
21183    /// # Example
21184    /// ```ignore,no_run
21185    /// # use google_cloud_retail_v2::model::SearchRequest;
21186    /// let x = SearchRequest::new().set_entity("example");
21187    /// ```
21188    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21189        self.entity = v.into();
21190        self
21191    }
21192
21193    /// Sets the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
21194    ///
21195    /// # Example
21196    /// ```ignore,no_run
21197    /// # use google_cloud_retail_v2::model::SearchRequest;
21198    /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
21199    /// let x = SearchRequest::new().set_conversational_search_spec(ConversationalSearchSpec::default()/* use setters */);
21200    /// ```
21201    pub fn set_conversational_search_spec<T>(mut self, v: T) -> Self
21202    where
21203        T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
21204    {
21205        self.conversational_search_spec = std::option::Option::Some(v.into());
21206        self
21207    }
21208
21209    /// Sets or clears the value of [conversational_search_spec][crate::model::SearchRequest::conversational_search_spec].
21210    ///
21211    /// # Example
21212    /// ```ignore,no_run
21213    /// # use google_cloud_retail_v2::model::SearchRequest;
21214    /// use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
21215    /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(Some(ConversationalSearchSpec::default()/* use setters */));
21216    /// let x = SearchRequest::new().set_or_clear_conversational_search_spec(None::<ConversationalSearchSpec>);
21217    /// ```
21218    pub fn set_or_clear_conversational_search_spec<T>(mut self, v: std::option::Option<T>) -> Self
21219    where
21220        T: std::convert::Into<crate::model::search_request::ConversationalSearchSpec>,
21221    {
21222        self.conversational_search_spec = v.map(|x| x.into());
21223        self
21224    }
21225
21226    /// Sets the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
21227    ///
21228    /// # Example
21229    /// ```ignore,no_run
21230    /// # use google_cloud_retail_v2::model::SearchRequest;
21231    /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
21232    /// let x = SearchRequest::new().set_tile_navigation_spec(TileNavigationSpec::default()/* use setters */);
21233    /// ```
21234    pub fn set_tile_navigation_spec<T>(mut self, v: T) -> Self
21235    where
21236        T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
21237    {
21238        self.tile_navigation_spec = std::option::Option::Some(v.into());
21239        self
21240    }
21241
21242    /// Sets or clears the value of [tile_navigation_spec][crate::model::SearchRequest::tile_navigation_spec].
21243    ///
21244    /// # Example
21245    /// ```ignore,no_run
21246    /// # use google_cloud_retail_v2::model::SearchRequest;
21247    /// use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
21248    /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(Some(TileNavigationSpec::default()/* use setters */));
21249    /// let x = SearchRequest::new().set_or_clear_tile_navigation_spec(None::<TileNavigationSpec>);
21250    /// ```
21251    pub fn set_or_clear_tile_navigation_spec<T>(mut self, v: std::option::Option<T>) -> Self
21252    where
21253        T: std::convert::Into<crate::model::search_request::TileNavigationSpec>,
21254    {
21255        self.tile_navigation_spec = v.map(|x| x.into());
21256        self
21257    }
21258
21259    /// Sets the value of [language_code][crate::model::SearchRequest::language_code].
21260    ///
21261    /// # Example
21262    /// ```ignore,no_run
21263    /// # use google_cloud_retail_v2::model::SearchRequest;
21264    /// let x = SearchRequest::new().set_language_code("example");
21265    /// ```
21266    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21267        self.language_code = v.into();
21268        self
21269    }
21270
21271    /// Sets the value of [region_code][crate::model::SearchRequest::region_code].
21272    ///
21273    /// # Example
21274    /// ```ignore,no_run
21275    /// # use google_cloud_retail_v2::model::SearchRequest;
21276    /// let x = SearchRequest::new().set_region_code("example");
21277    /// ```
21278    pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21279        self.region_code = v.into();
21280        self
21281    }
21282
21283    /// Sets the value of [place_id][crate::model::SearchRequest::place_id].
21284    ///
21285    /// # Example
21286    /// ```ignore,no_run
21287    /// # use google_cloud_retail_v2::model::SearchRequest;
21288    /// let x = SearchRequest::new().set_place_id("example");
21289    /// ```
21290    pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21291        self.place_id = v.into();
21292        self
21293    }
21294
21295    /// Sets the value of [user_attributes][crate::model::SearchRequest::user_attributes].
21296    ///
21297    /// # Example
21298    /// ```ignore,no_run
21299    /// # use google_cloud_retail_v2::model::SearchRequest;
21300    /// use google_cloud_retail_v2::model::StringList;
21301    /// let x = SearchRequest::new().set_user_attributes([
21302    ///     ("key0", StringList::default()/* use setters */),
21303    ///     ("key1", StringList::default()/* use (different) setters */),
21304    /// ]);
21305    /// ```
21306    pub fn set_user_attributes<T, K, V>(mut self, v: T) -> Self
21307    where
21308        T: std::iter::IntoIterator<Item = (K, V)>,
21309        K: std::convert::Into<std::string::String>,
21310        V: std::convert::Into<crate::model::StringList>,
21311    {
21312        use std::iter::Iterator;
21313        self.user_attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
21314        self
21315    }
21316}
21317
21318impl wkt::message::Message for SearchRequest {
21319    fn typename() -> &'static str {
21320        "type.googleapis.com/google.cloud.retail.v2.SearchRequest"
21321    }
21322}
21323
21324/// Defines additional types related to [SearchRequest].
21325pub mod search_request {
21326    #[allow(unused_imports)]
21327    use super::*;
21328
21329    /// A facet specification to perform faceted search.
21330    #[derive(Clone, Default, PartialEq)]
21331    #[non_exhaustive]
21332    pub struct FacetSpec {
21333        /// Required. The facet key specification.
21334        pub facet_key: std::option::Option<crate::model::search_request::facet_spec::FacetKey>,
21335
21336        /// Maximum of facet values that should be returned for this facet. If
21337        /// unspecified, defaults to 50. The maximum allowed value is 300. Values
21338        /// above 300 will be coerced to 300.
21339        ///
21340        /// If this field is negative, an INVALID_ARGUMENT is returned.
21341        pub limit: i32,
21342
21343        /// List of keys to exclude when faceting.
21344        ///
21345        /// By default,
21346        /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21347        /// is not excluded from the filter unless it is listed in this field.
21348        ///
21349        /// Listing a facet key in this field allows its values to appear as facet
21350        /// results, even when they are filtered out of search results. Using this
21351        /// field does not affect what search results are returned.
21352        ///
21353        /// For example, suppose there are 100 products with the color facet "Red"
21354        /// and 200 products with the color facet "Blue". A query containing the
21355        /// filter "colorFamilies:ANY("Red")" and having "colorFamilies" as
21356        /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21357        /// would by default return only "Red" products in the search results, and
21358        /// also return "Red" with count 100 as the only color facet. Although there
21359        /// are also blue products available, "Blue" would not be shown as an
21360        /// available facet value.
21361        ///
21362        /// If "colorFamilies" is listed in "excludedFilterKeys", then the query
21363        /// returns the facet values "Red" with count 100 and "Blue" with count
21364        /// 200, because the "colorFamilies" key is now excluded from the filter.
21365        /// Because this field doesn't affect search results, the search results
21366        /// are still correctly filtered to return only "Red" products.
21367        ///
21368        /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
21369        /// is returned.
21370        ///
21371        /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21372        pub excluded_filter_keys: std::vec::Vec<std::string::String>,
21373
21374        /// Enables dynamic position for this facet. If set to true, the position of
21375        /// this facet among all facets in the response is determined by Google
21376        /// Retail Search. It is ordered together with dynamic facets if dynamic
21377        /// facets is enabled. If set to false, the position of this facet in the
21378        /// response is the same as in the request, and it is ranked before
21379        /// the facets with dynamic position enable and all dynamic facets.
21380        ///
21381        /// For example, you may always want to have rating facet returned in
21382        /// the response, but it's not necessarily to always display the rating facet
21383        /// at the top. In that case, you can set enable_dynamic_position to true so
21384        /// that the position of rating facet in response is determined by
21385        /// Google Retail Search.
21386        ///
21387        /// Another example, assuming you have the following facets in the request:
21388        ///
21389        /// * "rating", enable_dynamic_position = true
21390        ///
21391        /// * "price", enable_dynamic_position = false
21392        ///
21393        /// * "brands", enable_dynamic_position = false
21394        ///
21395        ///
21396        /// And also you have a dynamic facets enable, which generates a facet
21397        /// "gender". Then, the final order of the facets in the response can be
21398        /// ("price", "brands", "rating", "gender") or ("price", "brands", "gender",
21399        /// "rating") depends on how Google Retail Search orders "gender" and
21400        /// "rating" facets. However, notice that "price" and "brands" are always
21401        /// ranked at first and second position because their enable_dynamic_position
21402        /// values are false.
21403        pub enable_dynamic_position: bool,
21404
21405        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21406    }
21407
21408    impl FacetSpec {
21409        /// Creates a new default instance.
21410        pub fn new() -> Self {
21411            std::default::Default::default()
21412        }
21413
21414        /// Sets the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21415        ///
21416        /// # Example
21417        /// ```ignore,no_run
21418        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21419        /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21420        /// let x = FacetSpec::new().set_facet_key(FacetKey::default()/* use setters */);
21421        /// ```
21422        pub fn set_facet_key<T>(mut self, v: T) -> Self
21423        where
21424            T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21425        {
21426            self.facet_key = std::option::Option::Some(v.into());
21427            self
21428        }
21429
21430        /// Sets or clears the value of [facet_key][crate::model::search_request::FacetSpec::facet_key].
21431        ///
21432        /// # Example
21433        /// ```ignore,no_run
21434        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21435        /// use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21436        /// let x = FacetSpec::new().set_or_clear_facet_key(Some(FacetKey::default()/* use setters */));
21437        /// let x = FacetSpec::new().set_or_clear_facet_key(None::<FacetKey>);
21438        /// ```
21439        pub fn set_or_clear_facet_key<T>(mut self, v: std::option::Option<T>) -> Self
21440        where
21441            T: std::convert::Into<crate::model::search_request::facet_spec::FacetKey>,
21442        {
21443            self.facet_key = v.map(|x| x.into());
21444            self
21445        }
21446
21447        /// Sets the value of [limit][crate::model::search_request::FacetSpec::limit].
21448        ///
21449        /// # Example
21450        /// ```ignore,no_run
21451        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21452        /// let x = FacetSpec::new().set_limit(42);
21453        /// ```
21454        pub fn set_limit<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
21455            self.limit = v.into();
21456            self
21457        }
21458
21459        /// Sets the value of [excluded_filter_keys][crate::model::search_request::FacetSpec::excluded_filter_keys].
21460        ///
21461        /// # Example
21462        /// ```ignore,no_run
21463        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21464        /// let x = FacetSpec::new().set_excluded_filter_keys(["a", "b", "c"]);
21465        /// ```
21466        pub fn set_excluded_filter_keys<T, V>(mut self, v: T) -> Self
21467        where
21468            T: std::iter::IntoIterator<Item = V>,
21469            V: std::convert::Into<std::string::String>,
21470        {
21471            use std::iter::Iterator;
21472            self.excluded_filter_keys = v.into_iter().map(|i| i.into()).collect();
21473            self
21474        }
21475
21476        /// Sets the value of [enable_dynamic_position][crate::model::search_request::FacetSpec::enable_dynamic_position].
21477        ///
21478        /// # Example
21479        /// ```ignore,no_run
21480        /// # use google_cloud_retail_v2::model::search_request::FacetSpec;
21481        /// let x = FacetSpec::new().set_enable_dynamic_position(true);
21482        /// ```
21483        pub fn set_enable_dynamic_position<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21484            self.enable_dynamic_position = v.into();
21485            self
21486        }
21487    }
21488
21489    impl wkt::message::Message for FacetSpec {
21490        fn typename() -> &'static str {
21491            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec"
21492        }
21493    }
21494
21495    /// Defines additional types related to [FacetSpec].
21496    pub mod facet_spec {
21497        #[allow(unused_imports)]
21498        use super::*;
21499
21500        /// Specifies how a facet is computed.
21501        #[derive(Clone, Default, PartialEq)]
21502        #[non_exhaustive]
21503        pub struct FacetKey {
21504            /// Required. Supported textual and numerical facet keys in
21505            /// [Product][google.cloud.retail.v2.Product] object, over which the facet
21506            /// values are computed. Facet key is case-sensitive.
21507            ///
21508            /// Allowed facet keys when
21509            /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21510            /// is not specified:
21511            ///
21512            /// * textual_field =
21513            ///
21514            ///   * "brands"
21515            ///   * "categories"
21516            ///   * "genders"
21517            ///   * "ageGroups"
21518            ///   * "availability"
21519            ///   * "colorFamilies"
21520            ///   * "colors"
21521            ///   * "sizes"
21522            ///   * "materials"
21523            ///   * "patterns"
21524            ///   * "conditions"
21525            ///   * "attributes.key"
21526            ///   * "pickupInStore"
21527            ///   * "shipToStore"
21528            ///   * "sameDayDelivery"
21529            ///   * "nextDayDelivery"
21530            ///   * "customFulfillment1"
21531            ///   * "customFulfillment2"
21532            ///   * "customFulfillment3"
21533            ///   * "customFulfillment4"
21534            ///   * "customFulfillment5"
21535            ///   * "inventory(place_id,attributes.key)"
21536            /// * numerical_field =
21537            ///
21538            ///   * "price"
21539            ///   * "discount"
21540            ///   * "rating"
21541            ///   * "ratingCount"
21542            ///   * "attributes.key"
21543            ///   * "inventory(place_id,price)"
21544            ///   * "inventory(place_id,original_price)"
21545            ///   * "inventory(place_id,attributes.key)"
21546            ///
21547            /// [google.cloud.retail.v2.Product]: crate::model::Product
21548            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21549            pub key: std::string::String,
21550
21551            /// Set only if values should be bucketized into intervals. Must be set
21552            /// for facets with numerical values. Must not be set for facet with text
21553            /// values. Maximum number of intervals is 40.
21554            ///
21555            /// For all numerical facet keys that appear in the list of products from
21556            /// the catalog, the percentiles 0, 10, 30, 50, 70, 90, and 100 are
21557            /// computed from their distribution weekly. If the model assigns a high
21558            /// score to a numerical facet key and its intervals are not specified in
21559            /// the search request, these percentiles become the bounds
21560            /// for its intervals and are returned in the response. If the
21561            /// facet key intervals are specified in the request, then the specified
21562            /// intervals are returned instead.
21563            pub intervals: std::vec::Vec<crate::model::Interval>,
21564
21565            /// Only get facet for the given restricted values. For example, when using
21566            /// "pickupInStore" as key and set restricted values to
21567            /// ["store123", "store456"], only facets for "store123" and "store456" are
21568            /// returned. Only supported on predefined textual fields, custom textual
21569            /// attributes and fulfillments. Maximum is 20.
21570            ///
21571            /// Must be set for the fulfillment facet keys:
21572            ///
21573            /// * pickupInStore
21574            ///
21575            /// * shipToStore
21576            ///
21577            /// * sameDayDelivery
21578            ///
21579            /// * nextDayDelivery
21580            ///
21581            /// * customFulfillment1
21582            ///
21583            /// * customFulfillment2
21584            ///
21585            /// * customFulfillment3
21586            ///
21587            /// * customFulfillment4
21588            ///
21589            /// * customFulfillment5
21590            ///
21591            pub restricted_values: std::vec::Vec<std::string::String>,
21592
21593            /// Only get facet values that start with the given string prefix. For
21594            /// example, suppose "categories" has three values "Women > Shoe",
21595            /// "Women > Dress" and "Men > Shoe". If set "prefixes" to "Women", the
21596            /// "categories" facet gives only "Women > Shoe" and "Women > Dress".
21597            /// Only supported on textual fields. Maximum is 10.
21598            pub prefixes: std::vec::Vec<std::string::String>,
21599
21600            /// Only get facet values that contains the given strings. For example,
21601            /// suppose "categories" has three values "Women > Shoe",
21602            /// "Women > Dress" and "Men > Shoe". If set "contains" to "Shoe", the
21603            /// "categories" facet gives only "Women > Shoe" and "Men > Shoe".
21604            /// Only supported on textual fields. Maximum is 10.
21605            pub contains: std::vec::Vec<std::string::String>,
21606
21607            /// True to make facet keys case insensitive when getting faceting
21608            /// values with prefixes or contains; false otherwise.
21609            pub case_insensitive: bool,
21610
21611            /// The order in which
21612            /// [SearchResponse.Facet.values][google.cloud.retail.v2.SearchResponse.Facet.values]
21613            /// are returned.
21614            ///
21615            /// Allowed values are:
21616            ///
21617            /// * "count desc", which means order by
21618            ///   [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21619            ///   descending.
21620            ///
21621            /// * "value desc", which means order by
21622            ///   [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21623            ///   descending.
21624            ///   Only applies to textual facets.
21625            ///
21626            ///
21627            /// If not set, textual values are sorted in [natural
21628            /// order](https://en.wikipedia.org/wiki/Natural_sort_order); numerical
21629            /// intervals are sorted in the order given by
21630            /// [FacetSpec.FacetKey.intervals][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals];
21631            /// [FulfillmentInfo.place_ids][google.cloud.retail.v2.FulfillmentInfo.place_ids]
21632            /// are sorted in the order given by
21633            /// [FacetSpec.FacetKey.restricted_values][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values].
21634            ///
21635            /// [google.cloud.retail.v2.FulfillmentInfo.place_ids]: crate::model::FulfillmentInfo::place_ids
21636            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.intervals]: crate::model::search_request::facet_spec::FacetKey::intervals
21637            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.restricted_values]: crate::model::search_request::facet_spec::FacetKey::restricted_values
21638            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21639            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21640            /// [google.cloud.retail.v2.SearchResponse.Facet.values]: crate::model::search_response::Facet::values
21641            pub order_by: std::string::String,
21642
21643            /// The query that is used to compute facet for the given facet key.
21644            /// When provided, it overrides the default behavior of facet
21645            /// computation. The query syntax is the same as a filter expression. See
21646            /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
21647            /// detail syntax and limitations. Notice that there is no limitation on
21648            /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21649            /// when query is specified.
21650            ///
21651            /// In the response,
21652            /// [SearchResponse.Facet.values.value][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]
21653            /// is always "1" and
21654            /// [SearchResponse.Facet.values.count][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]
21655            /// is the number of results that match the query.
21656            ///
21657            /// For example, you can set a customized facet for "shipToStore",
21658            /// where
21659            /// [FacetKey.key][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]
21660            /// is "customizedShipToStore", and
21661            /// [FacetKey.query][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]
21662            /// is "availability: ANY(\"IN_STOCK\") AND shipToStore: ANY(\"123\")".
21663            /// Then the facet counts the products that are both in stock and ship
21664            /// to store "123".
21665            ///
21666            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.key]: crate::model::search_request::facet_spec::FacetKey::key
21667            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.query]: crate::model::search_request::facet_spec::FacetKey::query
21668            /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
21669            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.count]: crate::model::search_response::facet::FacetValue::count
21670            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.value]: crate::model::search_response::facet::FacetValue::facet_value
21671            pub query: std::string::String,
21672
21673            /// Returns the min and max value for each numerical facet intervals.
21674            /// Ignored for textual facets.
21675            pub return_min_max: bool,
21676
21677            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21678        }
21679
21680        impl FacetKey {
21681            /// Creates a new default instance.
21682            pub fn new() -> Self {
21683                std::default::Default::default()
21684            }
21685
21686            /// Sets the value of [key][crate::model::search_request::facet_spec::FacetKey::key].
21687            ///
21688            /// # Example
21689            /// ```ignore,no_run
21690            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21691            /// let x = FacetKey::new().set_key("example");
21692            /// ```
21693            pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21694                self.key = v.into();
21695                self
21696            }
21697
21698            /// Sets the value of [intervals][crate::model::search_request::facet_spec::FacetKey::intervals].
21699            ///
21700            /// # Example
21701            /// ```ignore,no_run
21702            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21703            /// use google_cloud_retail_v2::model::Interval;
21704            /// let x = FacetKey::new()
21705            ///     .set_intervals([
21706            ///         Interval::default()/* use setters */,
21707            ///         Interval::default()/* use (different) setters */,
21708            ///     ]);
21709            /// ```
21710            pub fn set_intervals<T, V>(mut self, v: T) -> Self
21711            where
21712                T: std::iter::IntoIterator<Item = V>,
21713                V: std::convert::Into<crate::model::Interval>,
21714            {
21715                use std::iter::Iterator;
21716                self.intervals = v.into_iter().map(|i| i.into()).collect();
21717                self
21718            }
21719
21720            /// Sets the value of [restricted_values][crate::model::search_request::facet_spec::FacetKey::restricted_values].
21721            ///
21722            /// # Example
21723            /// ```ignore,no_run
21724            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21725            /// let x = FacetKey::new().set_restricted_values(["a", "b", "c"]);
21726            /// ```
21727            pub fn set_restricted_values<T, V>(mut self, v: T) -> Self
21728            where
21729                T: std::iter::IntoIterator<Item = V>,
21730                V: std::convert::Into<std::string::String>,
21731            {
21732                use std::iter::Iterator;
21733                self.restricted_values = v.into_iter().map(|i| i.into()).collect();
21734                self
21735            }
21736
21737            /// Sets the value of [prefixes][crate::model::search_request::facet_spec::FacetKey::prefixes].
21738            ///
21739            /// # Example
21740            /// ```ignore,no_run
21741            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21742            /// let x = FacetKey::new().set_prefixes(["a", "b", "c"]);
21743            /// ```
21744            pub fn set_prefixes<T, V>(mut self, v: T) -> Self
21745            where
21746                T: std::iter::IntoIterator<Item = V>,
21747                V: std::convert::Into<std::string::String>,
21748            {
21749                use std::iter::Iterator;
21750                self.prefixes = v.into_iter().map(|i| i.into()).collect();
21751                self
21752            }
21753
21754            /// Sets the value of [contains][crate::model::search_request::facet_spec::FacetKey::contains].
21755            ///
21756            /// # Example
21757            /// ```ignore,no_run
21758            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21759            /// let x = FacetKey::new().set_contains(["a", "b", "c"]);
21760            /// ```
21761            pub fn set_contains<T, V>(mut self, v: T) -> Self
21762            where
21763                T: std::iter::IntoIterator<Item = V>,
21764                V: std::convert::Into<std::string::String>,
21765            {
21766                use std::iter::Iterator;
21767                self.contains = v.into_iter().map(|i| i.into()).collect();
21768                self
21769            }
21770
21771            /// Sets the value of [case_insensitive][crate::model::search_request::facet_spec::FacetKey::case_insensitive].
21772            ///
21773            /// # Example
21774            /// ```ignore,no_run
21775            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21776            /// let x = FacetKey::new().set_case_insensitive(true);
21777            /// ```
21778            pub fn set_case_insensitive<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21779                self.case_insensitive = v.into();
21780                self
21781            }
21782
21783            /// Sets the value of [order_by][crate::model::search_request::facet_spec::FacetKey::order_by].
21784            ///
21785            /// # Example
21786            /// ```ignore,no_run
21787            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21788            /// let x = FacetKey::new().set_order_by("example");
21789            /// ```
21790            pub fn set_order_by<T: std::convert::Into<std::string::String>>(
21791                mut self,
21792                v: T,
21793            ) -> Self {
21794                self.order_by = v.into();
21795                self
21796            }
21797
21798            /// Sets the value of [query][crate::model::search_request::facet_spec::FacetKey::query].
21799            ///
21800            /// # Example
21801            /// ```ignore,no_run
21802            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21803            /// let x = FacetKey::new().set_query("example");
21804            /// ```
21805            pub fn set_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
21806                self.query = v.into();
21807                self
21808            }
21809
21810            /// Sets the value of [return_min_max][crate::model::search_request::facet_spec::FacetKey::return_min_max].
21811            ///
21812            /// # Example
21813            /// ```ignore,no_run
21814            /// # use google_cloud_retail_v2::model::search_request::facet_spec::FacetKey;
21815            /// let x = FacetKey::new().set_return_min_max(true);
21816            /// ```
21817            pub fn set_return_min_max<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
21818                self.return_min_max = v.into();
21819                self
21820            }
21821        }
21822
21823        impl wkt::message::Message for FacetKey {
21824            fn typename() -> &'static str {
21825                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey"
21826            }
21827        }
21828    }
21829
21830    /// The specifications of dynamically generated facets.
21831    #[derive(Clone, Default, PartialEq)]
21832    #[non_exhaustive]
21833    pub struct DynamicFacetSpec {
21834        /// Mode of the DynamicFacet feature.
21835        /// Defaults to
21836        /// [Mode.DISABLED][google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]
21837        /// if it's unset.
21838        ///
21839        /// [google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode.DISABLED]: crate::model::search_request::dynamic_facet_spec::Mode::Disabled
21840        pub mode: crate::model::search_request::dynamic_facet_spec::Mode,
21841
21842        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
21843    }
21844
21845    impl DynamicFacetSpec {
21846        /// Creates a new default instance.
21847        pub fn new() -> Self {
21848            std::default::Default::default()
21849        }
21850
21851        /// Sets the value of [mode][crate::model::search_request::DynamicFacetSpec::mode].
21852        ///
21853        /// # Example
21854        /// ```ignore,no_run
21855        /// # use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
21856        /// use google_cloud_retail_v2::model::search_request::dynamic_facet_spec::Mode;
21857        /// let x0 = DynamicFacetSpec::new().set_mode(Mode::Disabled);
21858        /// let x1 = DynamicFacetSpec::new().set_mode(Mode::Enabled);
21859        /// ```
21860        pub fn set_mode<
21861            T: std::convert::Into<crate::model::search_request::dynamic_facet_spec::Mode>,
21862        >(
21863            mut self,
21864            v: T,
21865        ) -> Self {
21866            self.mode = v.into();
21867            self
21868        }
21869    }
21870
21871    impl wkt::message::Message for DynamicFacetSpec {
21872        fn typename() -> &'static str {
21873            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.DynamicFacetSpec"
21874        }
21875    }
21876
21877    /// Defines additional types related to [DynamicFacetSpec].
21878    pub mod dynamic_facet_spec {
21879        #[allow(unused_imports)]
21880        use super::*;
21881
21882        /// Enum to control DynamicFacet mode
21883        ///
21884        /// # Working with unknown values
21885        ///
21886        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
21887        /// additional enum variants at any time. Adding new variants is not considered
21888        /// a breaking change. Applications should write their code in anticipation of:
21889        ///
21890        /// - New values appearing in future releases of the client library, **and**
21891        /// - New values received dynamically, without application changes.
21892        ///
21893        /// Please consult the [Working with enums] section in the user guide for some
21894        /// guidelines.
21895        ///
21896        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
21897        #[derive(Clone, Debug, PartialEq)]
21898        #[non_exhaustive]
21899        pub enum Mode {
21900            /// Default value.
21901            Unspecified,
21902            /// Disable Dynamic Facet.
21903            Disabled,
21904            /// Automatic mode built by Google Retail Search.
21905            Enabled,
21906            /// If set, the enum was initialized with an unknown value.
21907            ///
21908            /// Applications can examine the value using [Mode::value] or
21909            /// [Mode::name].
21910            UnknownValue(mode::UnknownValue),
21911        }
21912
21913        #[doc(hidden)]
21914        pub mod mode {
21915            #[allow(unused_imports)]
21916            use super::*;
21917            #[derive(Clone, Debug, PartialEq)]
21918            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
21919        }
21920
21921        impl Mode {
21922            /// Gets the enum value.
21923            ///
21924            /// Returns `None` if the enum contains an unknown value deserialized from
21925            /// the string representation of enums.
21926            pub fn value(&self) -> std::option::Option<i32> {
21927                match self {
21928                    Self::Unspecified => std::option::Option::Some(0),
21929                    Self::Disabled => std::option::Option::Some(1),
21930                    Self::Enabled => std::option::Option::Some(2),
21931                    Self::UnknownValue(u) => u.0.value(),
21932                }
21933            }
21934
21935            /// Gets the enum value as a string.
21936            ///
21937            /// Returns `None` if the enum contains an unknown value deserialized from
21938            /// the integer representation of enums.
21939            pub fn name(&self) -> std::option::Option<&str> {
21940                match self {
21941                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
21942                    Self::Disabled => std::option::Option::Some("DISABLED"),
21943                    Self::Enabled => std::option::Option::Some("ENABLED"),
21944                    Self::UnknownValue(u) => u.0.name(),
21945                }
21946            }
21947        }
21948
21949        impl std::default::Default for Mode {
21950            fn default() -> Self {
21951                use std::convert::From;
21952                Self::from(0)
21953            }
21954        }
21955
21956        impl std::fmt::Display for Mode {
21957            fn fmt(
21958                &self,
21959                f: &mut std::fmt::Formatter<'_>,
21960            ) -> std::result::Result<(), std::fmt::Error> {
21961                wkt::internal::display_enum(f, self.name(), self.value())
21962            }
21963        }
21964
21965        impl std::convert::From<i32> for Mode {
21966            fn from(value: i32) -> Self {
21967                match value {
21968                    0 => Self::Unspecified,
21969                    1 => Self::Disabled,
21970                    2 => Self::Enabled,
21971                    _ => Self::UnknownValue(mode::UnknownValue(
21972                        wkt::internal::UnknownEnumValue::Integer(value),
21973                    )),
21974                }
21975            }
21976        }
21977
21978        impl std::convert::From<&str> for Mode {
21979            fn from(value: &str) -> Self {
21980                use std::string::ToString;
21981                match value {
21982                    "MODE_UNSPECIFIED" => Self::Unspecified,
21983                    "DISABLED" => Self::Disabled,
21984                    "ENABLED" => Self::Enabled,
21985                    _ => Self::UnknownValue(mode::UnknownValue(
21986                        wkt::internal::UnknownEnumValue::String(value.to_string()),
21987                    )),
21988                }
21989            }
21990        }
21991
21992        impl serde::ser::Serialize for Mode {
21993            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
21994            where
21995                S: serde::Serializer,
21996            {
21997                match self {
21998                    Self::Unspecified => serializer.serialize_i32(0),
21999                    Self::Disabled => serializer.serialize_i32(1),
22000                    Self::Enabled => serializer.serialize_i32(2),
22001                    Self::UnknownValue(u) => u.0.serialize(serializer),
22002                }
22003            }
22004        }
22005
22006        impl<'de> serde::de::Deserialize<'de> for Mode {
22007            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22008            where
22009                D: serde::Deserializer<'de>,
22010            {
22011                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22012                    ".google.cloud.retail.v2.SearchRequest.DynamicFacetSpec.Mode",
22013                ))
22014            }
22015        }
22016    }
22017
22018    /// Boost specification to boost certain items.
22019    #[derive(Clone, Default, PartialEq)]
22020    #[non_exhaustive]
22021    pub struct BoostSpec {
22022        /// Condition boost specifications. If a product matches multiple conditions
22023        /// in the specifications, boost scores from these specifications are all
22024        /// applied and combined in a non-linear way. Maximum number of
22025        /// specifications is 20.
22026        pub condition_boost_specs:
22027            std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
22028
22029        /// Whether to skip boostspec validation. If this field is set to true,
22030        /// invalid
22031        /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
22032        /// will be ignored and valid
22033        /// [BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
22034        /// will still be applied.
22035        ///
22036        /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
22037        pub skip_boost_spec_validation: std::option::Option<bool>,
22038
22039        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22040    }
22041
22042    impl BoostSpec {
22043        /// Creates a new default instance.
22044        pub fn new() -> Self {
22045            std::default::Default::default()
22046        }
22047
22048        /// Sets the value of [condition_boost_specs][crate::model::search_request::BoostSpec::condition_boost_specs].
22049        ///
22050        /// # Example
22051        /// ```ignore,no_run
22052        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
22053        /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22054        /// let x = BoostSpec::new()
22055        ///     .set_condition_boost_specs([
22056        ///         ConditionBoostSpec::default()/* use setters */,
22057        ///         ConditionBoostSpec::default()/* use (different) setters */,
22058        ///     ]);
22059        /// ```
22060        pub fn set_condition_boost_specs<T, V>(mut self, v: T) -> Self
22061        where
22062            T: std::iter::IntoIterator<Item = V>,
22063            V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
22064        {
22065            use std::iter::Iterator;
22066            self.condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
22067            self
22068        }
22069
22070        /// Sets the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
22071        ///
22072        /// # Example
22073        /// ```ignore,no_run
22074        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
22075        /// let x = BoostSpec::new().set_skip_boost_spec_validation(true);
22076        /// ```
22077        pub fn set_skip_boost_spec_validation<T>(mut self, v: T) -> Self
22078        where
22079            T: std::convert::Into<bool>,
22080        {
22081            self.skip_boost_spec_validation = std::option::Option::Some(v.into());
22082            self
22083        }
22084
22085        /// Sets or clears the value of [skip_boost_spec_validation][crate::model::search_request::BoostSpec::skip_boost_spec_validation].
22086        ///
22087        /// # Example
22088        /// ```ignore,no_run
22089        /// # use google_cloud_retail_v2::model::search_request::BoostSpec;
22090        /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(Some(false));
22091        /// let x = BoostSpec::new().set_or_clear_skip_boost_spec_validation(None::<bool>);
22092        /// ```
22093        pub fn set_or_clear_skip_boost_spec_validation<T>(
22094            mut self,
22095            v: std::option::Option<T>,
22096        ) -> Self
22097        where
22098            T: std::convert::Into<bool>,
22099        {
22100            self.skip_boost_spec_validation = v.map(|x| x.into());
22101            self
22102        }
22103    }
22104
22105    impl wkt::message::Message for BoostSpec {
22106        fn typename() -> &'static str {
22107            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec"
22108        }
22109    }
22110
22111    /// Defines additional types related to [BoostSpec].
22112    pub mod boost_spec {
22113        #[allow(unused_imports)]
22114        use super::*;
22115
22116        /// Boost applies to products which match a condition.
22117        #[derive(Clone, Default, PartialEq)]
22118        #[non_exhaustive]
22119        pub struct ConditionBoostSpec {
22120            /// An expression which specifies a boost condition. The syntax and
22121            /// supported fields are the same as a filter expression. See
22122            /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
22123            /// detail syntax and limitations.
22124            ///
22125            /// Examples:
22126            ///
22127            /// * To boost products with product ID "product_1" or "product_2", and
22128            ///   color
22129            ///   "Red" or "Blue":
22130            ///   * (id: ANY("product_1", "product_2")) AND (colorFamilies:
22131            ///     ANY("Red","Blue"))
22132            ///
22133            /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
22134            pub condition: std::string::String,
22135
22136            /// Strength of the condition boost, which should be in [-1, 1]. Negative
22137            /// boost means demotion. Default is 0.0.
22138            ///
22139            /// Setting to 1.0 gives the item a big promotion. However, it does not
22140            /// necessarily mean that the boosted item will be the top result at all
22141            /// times, nor that other items will be excluded. Results could still be
22142            /// shown even when none of them matches the condition. And results that
22143            /// are significantly more relevant to the search query can still trump
22144            /// your heavily favored but irrelevant items.
22145            ///
22146            /// Setting to -1.0 gives the item a big demotion. However, results that
22147            /// are deeply relevant might still be shown. The item will have an
22148            /// upstream battle to get a fairly high ranking, but it is not blocked out
22149            /// completely.
22150            ///
22151            /// Setting to 0.0 means no boost applied. The boosting condition is
22152            /// ignored.
22153            pub boost: f32,
22154
22155            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22156        }
22157
22158        impl ConditionBoostSpec {
22159            /// Creates a new default instance.
22160            pub fn new() -> Self {
22161                std::default::Default::default()
22162            }
22163
22164            /// Sets the value of [condition][crate::model::search_request::boost_spec::ConditionBoostSpec::condition].
22165            ///
22166            /// # Example
22167            /// ```ignore,no_run
22168            /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22169            /// let x = ConditionBoostSpec::new().set_condition("example");
22170            /// ```
22171            pub fn set_condition<T: std::convert::Into<std::string::String>>(
22172                mut self,
22173                v: T,
22174            ) -> Self {
22175                self.condition = v.into();
22176                self
22177            }
22178
22179            /// Sets the value of [boost][crate::model::search_request::boost_spec::ConditionBoostSpec::boost].
22180            ///
22181            /// # Example
22182            /// ```ignore,no_run
22183            /// # use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
22184            /// let x = ConditionBoostSpec::new().set_boost(42.0);
22185            /// ```
22186            pub fn set_boost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
22187                self.boost = v.into();
22188                self
22189            }
22190        }
22191
22192        impl wkt::message::Message for ConditionBoostSpec {
22193            fn typename() -> &'static str {
22194                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.BoostSpec.ConditionBoostSpec"
22195            }
22196        }
22197    }
22198
22199    /// Specification to determine under which conditions query expansion should
22200    /// occur.
22201    #[derive(Clone, Default, PartialEq)]
22202    #[non_exhaustive]
22203    pub struct QueryExpansionSpec {
22204        /// The condition under which query expansion should occur. Default to
22205        /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
22206        ///
22207        /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
22208        pub condition: crate::model::search_request::query_expansion_spec::Condition,
22209
22210        /// Whether to pin unexpanded results. The default value is false. If this
22211        /// field is set to true,
22212        /// unexpanded products are always at the top of the search results, followed
22213        /// by the expanded results.
22214        pub pin_unexpanded_results: bool,
22215
22216        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22217    }
22218
22219    impl QueryExpansionSpec {
22220        /// Creates a new default instance.
22221        pub fn new() -> Self {
22222            std::default::Default::default()
22223        }
22224
22225        /// Sets the value of [condition][crate::model::search_request::QueryExpansionSpec::condition].
22226        ///
22227        /// # Example
22228        /// ```ignore,no_run
22229        /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
22230        /// use google_cloud_retail_v2::model::search_request::query_expansion_spec::Condition;
22231        /// let x0 = QueryExpansionSpec::new().set_condition(Condition::Disabled);
22232        /// let x1 = QueryExpansionSpec::new().set_condition(Condition::Auto);
22233        /// ```
22234        pub fn set_condition<
22235            T: std::convert::Into<crate::model::search_request::query_expansion_spec::Condition>,
22236        >(
22237            mut self,
22238            v: T,
22239        ) -> Self {
22240            self.condition = v.into();
22241            self
22242        }
22243
22244        /// Sets the value of [pin_unexpanded_results][crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results].
22245        ///
22246        /// # Example
22247        /// ```ignore,no_run
22248        /// # use google_cloud_retail_v2::model::search_request::QueryExpansionSpec;
22249        /// let x = QueryExpansionSpec::new().set_pin_unexpanded_results(true);
22250        /// ```
22251        pub fn set_pin_unexpanded_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
22252            self.pin_unexpanded_results = v.into();
22253            self
22254        }
22255    }
22256
22257    impl wkt::message::Message for QueryExpansionSpec {
22258        fn typename() -> &'static str {
22259            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.QueryExpansionSpec"
22260        }
22261    }
22262
22263    /// Defines additional types related to [QueryExpansionSpec].
22264    pub mod query_expansion_spec {
22265        #[allow(unused_imports)]
22266        use super::*;
22267
22268        /// Enum describing under which condition query expansion should occur.
22269        ///
22270        /// # Working with unknown values
22271        ///
22272        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22273        /// additional enum variants at any time. Adding new variants is not considered
22274        /// a breaking change. Applications should write their code in anticipation of:
22275        ///
22276        /// - New values appearing in future releases of the client library, **and**
22277        /// - New values received dynamically, without application changes.
22278        ///
22279        /// Please consult the [Working with enums] section in the user guide for some
22280        /// guidelines.
22281        ///
22282        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22283        #[derive(Clone, Debug, PartialEq)]
22284        #[non_exhaustive]
22285        pub enum Condition {
22286            /// Unspecified query expansion condition. In this case, server behavior
22287            /// defaults to
22288            /// [Condition.DISABLED][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED].
22289            ///
22290            /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition.DISABLED]: crate::model::search_request::query_expansion_spec::Condition::Disabled
22291            Unspecified,
22292            /// Disabled query expansion. Only the exact search query is used, even if
22293            /// [SearchResponse.total_size][google.cloud.retail.v2.SearchResponse.total_size]
22294            /// is zero.
22295            ///
22296            /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
22297            Disabled,
22298            /// Automatic query expansion built by Google Retail Search.
22299            Auto,
22300            /// If set, the enum was initialized with an unknown value.
22301            ///
22302            /// Applications can examine the value using [Condition::value] or
22303            /// [Condition::name].
22304            UnknownValue(condition::UnknownValue),
22305        }
22306
22307        #[doc(hidden)]
22308        pub mod condition {
22309            #[allow(unused_imports)]
22310            use super::*;
22311            #[derive(Clone, Debug, PartialEq)]
22312            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22313        }
22314
22315        impl Condition {
22316            /// Gets the enum value.
22317            ///
22318            /// Returns `None` if the enum contains an unknown value deserialized from
22319            /// the string representation of enums.
22320            pub fn value(&self) -> std::option::Option<i32> {
22321                match self {
22322                    Self::Unspecified => std::option::Option::Some(0),
22323                    Self::Disabled => std::option::Option::Some(1),
22324                    Self::Auto => std::option::Option::Some(3),
22325                    Self::UnknownValue(u) => u.0.value(),
22326                }
22327            }
22328
22329            /// Gets the enum value as a string.
22330            ///
22331            /// Returns `None` if the enum contains an unknown value deserialized from
22332            /// the integer representation of enums.
22333            pub fn name(&self) -> std::option::Option<&str> {
22334                match self {
22335                    Self::Unspecified => std::option::Option::Some("CONDITION_UNSPECIFIED"),
22336                    Self::Disabled => std::option::Option::Some("DISABLED"),
22337                    Self::Auto => std::option::Option::Some("AUTO"),
22338                    Self::UnknownValue(u) => u.0.name(),
22339                }
22340            }
22341        }
22342
22343        impl std::default::Default for Condition {
22344            fn default() -> Self {
22345                use std::convert::From;
22346                Self::from(0)
22347            }
22348        }
22349
22350        impl std::fmt::Display for Condition {
22351            fn fmt(
22352                &self,
22353                f: &mut std::fmt::Formatter<'_>,
22354            ) -> std::result::Result<(), std::fmt::Error> {
22355                wkt::internal::display_enum(f, self.name(), self.value())
22356            }
22357        }
22358
22359        impl std::convert::From<i32> for Condition {
22360            fn from(value: i32) -> Self {
22361                match value {
22362                    0 => Self::Unspecified,
22363                    1 => Self::Disabled,
22364                    3 => Self::Auto,
22365                    _ => Self::UnknownValue(condition::UnknownValue(
22366                        wkt::internal::UnknownEnumValue::Integer(value),
22367                    )),
22368                }
22369            }
22370        }
22371
22372        impl std::convert::From<&str> for Condition {
22373            fn from(value: &str) -> Self {
22374                use std::string::ToString;
22375                match value {
22376                    "CONDITION_UNSPECIFIED" => Self::Unspecified,
22377                    "DISABLED" => Self::Disabled,
22378                    "AUTO" => Self::Auto,
22379                    _ => Self::UnknownValue(condition::UnknownValue(
22380                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22381                    )),
22382                }
22383            }
22384        }
22385
22386        impl serde::ser::Serialize for Condition {
22387            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22388            where
22389                S: serde::Serializer,
22390            {
22391                match self {
22392                    Self::Unspecified => serializer.serialize_i32(0),
22393                    Self::Disabled => serializer.serialize_i32(1),
22394                    Self::Auto => serializer.serialize_i32(3),
22395                    Self::UnknownValue(u) => u.0.serialize(serializer),
22396                }
22397            }
22398        }
22399
22400        impl<'de> serde::de::Deserialize<'de> for Condition {
22401            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22402            where
22403                D: serde::Deserializer<'de>,
22404            {
22405                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Condition>::new(
22406                    ".google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.Condition",
22407                ))
22408            }
22409        }
22410    }
22411
22412    /// The specification for personalization.
22413    #[derive(Clone, Default, PartialEq)]
22414    #[non_exhaustive]
22415    pub struct PersonalizationSpec {
22416        /// Defaults to
22417        /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22418        ///
22419        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22420        pub mode: crate::model::search_request::personalization_spec::Mode,
22421
22422        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22423    }
22424
22425    impl PersonalizationSpec {
22426        /// Creates a new default instance.
22427        pub fn new() -> Self {
22428            std::default::Default::default()
22429        }
22430
22431        /// Sets the value of [mode][crate::model::search_request::PersonalizationSpec::mode].
22432        ///
22433        /// # Example
22434        /// ```ignore,no_run
22435        /// # use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
22436        /// use google_cloud_retail_v2::model::search_request::personalization_spec::Mode;
22437        /// let x0 = PersonalizationSpec::new().set_mode(Mode::Auto);
22438        /// let x1 = PersonalizationSpec::new().set_mode(Mode::Disabled);
22439        /// ```
22440        pub fn set_mode<
22441            T: std::convert::Into<crate::model::search_request::personalization_spec::Mode>,
22442        >(
22443            mut self,
22444            v: T,
22445        ) -> Self {
22446            self.mode = v.into();
22447            self
22448        }
22449    }
22450
22451    impl wkt::message::Message for PersonalizationSpec {
22452        fn typename() -> &'static str {
22453            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.PersonalizationSpec"
22454        }
22455    }
22456
22457    /// Defines additional types related to [PersonalizationSpec].
22458    pub mod personalization_spec {
22459        #[allow(unused_imports)]
22460        use super::*;
22461
22462        /// The personalization mode of each search request.
22463        ///
22464        /// # Working with unknown values
22465        ///
22466        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22467        /// additional enum variants at any time. Adding new variants is not considered
22468        /// a breaking change. Applications should write their code in anticipation of:
22469        ///
22470        /// - New values appearing in future releases of the client library, **and**
22471        /// - New values received dynamically, without application changes.
22472        ///
22473        /// Please consult the [Working with enums] section in the user guide for some
22474        /// guidelines.
22475        ///
22476        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22477        #[derive(Clone, Debug, PartialEq)]
22478        #[non_exhaustive]
22479        pub enum Mode {
22480            /// Default value. In this case, server behavior defaults to
22481            /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
22482            ///
22483            /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
22484            Unspecified,
22485            /// Let CRS decide whether to use personalization based on quality of user
22486            /// event data.
22487            Auto,
22488            /// Disable personalization.
22489            Disabled,
22490            /// If set, the enum was initialized with an unknown value.
22491            ///
22492            /// Applications can examine the value using [Mode::value] or
22493            /// [Mode::name].
22494            UnknownValue(mode::UnknownValue),
22495        }
22496
22497        #[doc(hidden)]
22498        pub mod mode {
22499            #[allow(unused_imports)]
22500            use super::*;
22501            #[derive(Clone, Debug, PartialEq)]
22502            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22503        }
22504
22505        impl Mode {
22506            /// Gets the enum value.
22507            ///
22508            /// Returns `None` if the enum contains an unknown value deserialized from
22509            /// the string representation of enums.
22510            pub fn value(&self) -> std::option::Option<i32> {
22511                match self {
22512                    Self::Unspecified => std::option::Option::Some(0),
22513                    Self::Auto => std::option::Option::Some(1),
22514                    Self::Disabled => std::option::Option::Some(2),
22515                    Self::UnknownValue(u) => u.0.value(),
22516                }
22517            }
22518
22519            /// Gets the enum value as a string.
22520            ///
22521            /// Returns `None` if the enum contains an unknown value deserialized from
22522            /// the integer representation of enums.
22523            pub fn name(&self) -> std::option::Option<&str> {
22524                match self {
22525                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22526                    Self::Auto => std::option::Option::Some("AUTO"),
22527                    Self::Disabled => std::option::Option::Some("DISABLED"),
22528                    Self::UnknownValue(u) => u.0.name(),
22529                }
22530            }
22531        }
22532
22533        impl std::default::Default for Mode {
22534            fn default() -> Self {
22535                use std::convert::From;
22536                Self::from(0)
22537            }
22538        }
22539
22540        impl std::fmt::Display for Mode {
22541            fn fmt(
22542                &self,
22543                f: &mut std::fmt::Formatter<'_>,
22544            ) -> std::result::Result<(), std::fmt::Error> {
22545                wkt::internal::display_enum(f, self.name(), self.value())
22546            }
22547        }
22548
22549        impl std::convert::From<i32> for Mode {
22550            fn from(value: i32) -> Self {
22551                match value {
22552                    0 => Self::Unspecified,
22553                    1 => Self::Auto,
22554                    2 => Self::Disabled,
22555                    _ => Self::UnknownValue(mode::UnknownValue(
22556                        wkt::internal::UnknownEnumValue::Integer(value),
22557                    )),
22558                }
22559            }
22560        }
22561
22562        impl std::convert::From<&str> for Mode {
22563            fn from(value: &str) -> Self {
22564                use std::string::ToString;
22565                match value {
22566                    "MODE_UNSPECIFIED" => Self::Unspecified,
22567                    "AUTO" => Self::Auto,
22568                    "DISABLED" => Self::Disabled,
22569                    _ => Self::UnknownValue(mode::UnknownValue(
22570                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22571                    )),
22572                }
22573            }
22574        }
22575
22576        impl serde::ser::Serialize for Mode {
22577            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22578            where
22579                S: serde::Serializer,
22580            {
22581                match self {
22582                    Self::Unspecified => serializer.serialize_i32(0),
22583                    Self::Auto => serializer.serialize_i32(1),
22584                    Self::Disabled => serializer.serialize_i32(2),
22585                    Self::UnknownValue(u) => u.0.serialize(serializer),
22586                }
22587            }
22588        }
22589
22590        impl<'de> serde::de::Deserialize<'de> for Mode {
22591            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22592            where
22593                D: serde::Deserializer<'de>,
22594            {
22595                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22596                    ".google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode",
22597                ))
22598            }
22599        }
22600    }
22601
22602    /// The specification for query spell correction.
22603    #[derive(Clone, Default, PartialEq)]
22604    #[non_exhaustive]
22605    pub struct SpellCorrectionSpec {
22606        /// The mode under which spell correction should take effect to
22607        /// replace the original search query. Default to
22608        /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22609        ///
22610        /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22611        pub mode: crate::model::search_request::spell_correction_spec::Mode,
22612
22613        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22614    }
22615
22616    impl SpellCorrectionSpec {
22617        /// Creates a new default instance.
22618        pub fn new() -> Self {
22619            std::default::Default::default()
22620        }
22621
22622        /// Sets the value of [mode][crate::model::search_request::SpellCorrectionSpec::mode].
22623        ///
22624        /// # Example
22625        /// ```ignore,no_run
22626        /// # use google_cloud_retail_v2::model::search_request::SpellCorrectionSpec;
22627        /// use google_cloud_retail_v2::model::search_request::spell_correction_spec::Mode;
22628        /// let x0 = SpellCorrectionSpec::new().set_mode(Mode::SuggestionOnly);
22629        /// let x1 = SpellCorrectionSpec::new().set_mode(Mode::Auto);
22630        /// ```
22631        pub fn set_mode<
22632            T: std::convert::Into<crate::model::search_request::spell_correction_spec::Mode>,
22633        >(
22634            mut self,
22635            v: T,
22636        ) -> Self {
22637            self.mode = v.into();
22638            self
22639        }
22640    }
22641
22642    impl wkt::message::Message for SpellCorrectionSpec {
22643        fn typename() -> &'static str {
22644            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec"
22645        }
22646    }
22647
22648    /// Defines additional types related to [SpellCorrectionSpec].
22649    pub mod spell_correction_spec {
22650        #[allow(unused_imports)]
22651        use super::*;
22652
22653        /// Enum describing under which mode spell correction should occur.
22654        ///
22655        /// # Working with unknown values
22656        ///
22657        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
22658        /// additional enum variants at any time. Adding new variants is not considered
22659        /// a breaking change. Applications should write their code in anticipation of:
22660        ///
22661        /// - New values appearing in future releases of the client library, **and**
22662        /// - New values received dynamically, without application changes.
22663        ///
22664        /// Please consult the [Working with enums] section in the user guide for some
22665        /// guidelines.
22666        ///
22667        /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
22668        #[derive(Clone, Debug, PartialEq)]
22669        #[non_exhaustive]
22670        pub enum Mode {
22671            /// Unspecified spell correction mode. In this case, server behavior
22672            /// defaults to
22673            /// [Mode.AUTO][google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO].
22674            ///
22675            /// [google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode.AUTO]: crate::model::search_request::spell_correction_spec::Mode::Auto
22676            Unspecified,
22677            /// Google Retail Search will try to find a spell suggestion if there
22678            /// is any and put in the
22679            /// [SearchResponse.corrected_query][google.cloud.retail.v2.SearchResponse.corrected_query].
22680            /// The spell suggestion will not be used as the search query.
22681            ///
22682            /// [google.cloud.retail.v2.SearchResponse.corrected_query]: crate::model::SearchResponse::corrected_query
22683            SuggestionOnly,
22684            /// Automatic spell correction built by Google Retail Search. Search will
22685            /// be based on the corrected query if found.
22686            Auto,
22687            /// If set, the enum was initialized with an unknown value.
22688            ///
22689            /// Applications can examine the value using [Mode::value] or
22690            /// [Mode::name].
22691            UnknownValue(mode::UnknownValue),
22692        }
22693
22694        #[doc(hidden)]
22695        pub mod mode {
22696            #[allow(unused_imports)]
22697            use super::*;
22698            #[derive(Clone, Debug, PartialEq)]
22699            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
22700        }
22701
22702        impl Mode {
22703            /// Gets the enum value.
22704            ///
22705            /// Returns `None` if the enum contains an unknown value deserialized from
22706            /// the string representation of enums.
22707            pub fn value(&self) -> std::option::Option<i32> {
22708                match self {
22709                    Self::Unspecified => std::option::Option::Some(0),
22710                    Self::SuggestionOnly => std::option::Option::Some(1),
22711                    Self::Auto => std::option::Option::Some(2),
22712                    Self::UnknownValue(u) => u.0.value(),
22713                }
22714            }
22715
22716            /// Gets the enum value as a string.
22717            ///
22718            /// Returns `None` if the enum contains an unknown value deserialized from
22719            /// the integer representation of enums.
22720            pub fn name(&self) -> std::option::Option<&str> {
22721                match self {
22722                    Self::Unspecified => std::option::Option::Some("MODE_UNSPECIFIED"),
22723                    Self::SuggestionOnly => std::option::Option::Some("SUGGESTION_ONLY"),
22724                    Self::Auto => std::option::Option::Some("AUTO"),
22725                    Self::UnknownValue(u) => u.0.name(),
22726                }
22727            }
22728        }
22729
22730        impl std::default::Default for Mode {
22731            fn default() -> Self {
22732                use std::convert::From;
22733                Self::from(0)
22734            }
22735        }
22736
22737        impl std::fmt::Display for Mode {
22738            fn fmt(
22739                &self,
22740                f: &mut std::fmt::Formatter<'_>,
22741            ) -> std::result::Result<(), std::fmt::Error> {
22742                wkt::internal::display_enum(f, self.name(), self.value())
22743            }
22744        }
22745
22746        impl std::convert::From<i32> for Mode {
22747            fn from(value: i32) -> Self {
22748                match value {
22749                    0 => Self::Unspecified,
22750                    1 => Self::SuggestionOnly,
22751                    2 => Self::Auto,
22752                    _ => Self::UnknownValue(mode::UnknownValue(
22753                        wkt::internal::UnknownEnumValue::Integer(value),
22754                    )),
22755                }
22756            }
22757        }
22758
22759        impl std::convert::From<&str> for Mode {
22760            fn from(value: &str) -> Self {
22761                use std::string::ToString;
22762                match value {
22763                    "MODE_UNSPECIFIED" => Self::Unspecified,
22764                    "SUGGESTION_ONLY" => Self::SuggestionOnly,
22765                    "AUTO" => Self::Auto,
22766                    _ => Self::UnknownValue(mode::UnknownValue(
22767                        wkt::internal::UnknownEnumValue::String(value.to_string()),
22768                    )),
22769                }
22770            }
22771        }
22772
22773        impl serde::ser::Serialize for Mode {
22774            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
22775            where
22776                S: serde::Serializer,
22777            {
22778                match self {
22779                    Self::Unspecified => serializer.serialize_i32(0),
22780                    Self::SuggestionOnly => serializer.serialize_i32(1),
22781                    Self::Auto => serializer.serialize_i32(2),
22782                    Self::UnknownValue(u) => u.0.serialize(serializer),
22783                }
22784            }
22785        }
22786
22787        impl<'de> serde::de::Deserialize<'de> for Mode {
22788            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
22789            where
22790                D: serde::Deserializer<'de>,
22791            {
22792                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Mode>::new(
22793                    ".google.cloud.retail.v2.SearchRequest.SpellCorrectionSpec.Mode",
22794                ))
22795            }
22796        }
22797    }
22798
22799    /// This field specifies all conversational related parameters addition to
22800    /// traditional retail search.
22801    #[derive(Clone, Default, PartialEq)]
22802    #[non_exhaustive]
22803    pub struct ConversationalSearchSpec {
22804        /// This field specifies whether the customer would like to do conversational
22805        /// search. If this field is set to true, conversational related extra
22806        /// information will be returned from server side, including follow-up
22807        /// question, answer options, etc.
22808        pub followup_conversation_requested: bool,
22809
22810        /// This field specifies the conversation id, which maintains the state of
22811        /// the conversation between client side and server side. Use the value from
22812        /// the previous [ConversationalSearchResult.conversation_id][]. For the
22813        /// initial request, this should be empty.
22814        pub conversation_id: std::string::String,
22815
22816        /// This field specifies the current user answer during the conversational
22817        /// search. This can be either user selected from suggested answers or user
22818        /// input plain text.
22819        pub user_answer: std::option::Option<
22820            crate::model::search_request::conversational_search_spec::UserAnswer,
22821        >,
22822
22823        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22824    }
22825
22826    impl ConversationalSearchSpec {
22827        /// Creates a new default instance.
22828        pub fn new() -> Self {
22829            std::default::Default::default()
22830        }
22831
22832        /// Sets the value of [followup_conversation_requested][crate::model::search_request::ConversationalSearchSpec::followup_conversation_requested].
22833        ///
22834        /// # Example
22835        /// ```ignore,no_run
22836        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22837        /// let x = ConversationalSearchSpec::new().set_followup_conversation_requested(true);
22838        /// ```
22839        pub fn set_followup_conversation_requested<T: std::convert::Into<bool>>(
22840            mut self,
22841            v: T,
22842        ) -> Self {
22843            self.followup_conversation_requested = v.into();
22844            self
22845        }
22846
22847        /// Sets the value of [conversation_id][crate::model::search_request::ConversationalSearchSpec::conversation_id].
22848        ///
22849        /// # Example
22850        /// ```ignore,no_run
22851        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22852        /// let x = ConversationalSearchSpec::new().set_conversation_id("example");
22853        /// ```
22854        pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
22855            mut self,
22856            v: T,
22857        ) -> Self {
22858            self.conversation_id = v.into();
22859            self
22860        }
22861
22862        /// Sets the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22863        ///
22864        /// # Example
22865        /// ```ignore,no_run
22866        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22867        /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22868        /// let x = ConversationalSearchSpec::new().set_user_answer(UserAnswer::default()/* use setters */);
22869        /// ```
22870        pub fn set_user_answer<T>(mut self, v: T) -> Self
22871        where
22872            T: std::convert::Into<
22873                    crate::model::search_request::conversational_search_spec::UserAnswer,
22874                >,
22875        {
22876            self.user_answer = std::option::Option::Some(v.into());
22877            self
22878        }
22879
22880        /// Sets or clears the value of [user_answer][crate::model::search_request::ConversationalSearchSpec::user_answer].
22881        ///
22882        /// # Example
22883        /// ```ignore,no_run
22884        /// # use google_cloud_retail_v2::model::search_request::ConversationalSearchSpec;
22885        /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22886        /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(Some(UserAnswer::default()/* use setters */));
22887        /// let x = ConversationalSearchSpec::new().set_or_clear_user_answer(None::<UserAnswer>);
22888        /// ```
22889        pub fn set_or_clear_user_answer<T>(mut self, v: std::option::Option<T>) -> Self
22890        where
22891            T: std::convert::Into<
22892                    crate::model::search_request::conversational_search_spec::UserAnswer,
22893                >,
22894        {
22895            self.user_answer = v.map(|x| x.into());
22896            self
22897        }
22898    }
22899
22900    impl wkt::message::Message for ConversationalSearchSpec {
22901        fn typename() -> &'static str {
22902            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec"
22903        }
22904    }
22905
22906    /// Defines additional types related to [ConversationalSearchSpec].
22907    pub mod conversational_search_spec {
22908        #[allow(unused_imports)]
22909        use super::*;
22910
22911        /// This field specifies the current user answer during the conversational
22912        /// search. This can be either user selected from suggested answers or user
22913        /// input plain text.
22914        #[derive(Clone, Default, PartialEq)]
22915        #[non_exhaustive]
22916        pub struct UserAnswer {
22917            /// This field specifies the type of user answer.
22918            pub r#type: std::option::Option<
22919                crate::model::search_request::conversational_search_spec::user_answer::Type,
22920            >,
22921
22922            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
22923        }
22924
22925        impl UserAnswer {
22926            /// Creates a new default instance.
22927            pub fn new() -> Self {
22928                std::default::Default::default()
22929            }
22930
22931            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::type].
22932            ///
22933            /// Note that all the setters affecting `r#type` are mutually
22934            /// exclusive.
22935            ///
22936            /// # Example
22937            /// ```ignore,no_run
22938            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22939            /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::Type;
22940            /// let x = UserAnswer::new().set_type(Some(Type::TextAnswer("example".to_string())));
22941            /// ```
22942            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
22943            {
22944                self.r#type = v.into();
22945                self
22946            }
22947
22948            /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22949            /// if it holds a `TextAnswer`, `None` if the field is not set or
22950            /// holds a different branch.
22951            pub fn text_answer(&self) -> std::option::Option<&std::string::String> {
22952                #[allow(unreachable_patterns)]
22953                self.r#type.as_ref().and_then(|v| match v {
22954                    crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(v) => std::option::Option::Some(v),
22955                    _ => std::option::Option::None,
22956                })
22957            }
22958
22959            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22960            /// to hold a `TextAnswer`.
22961            ///
22962            /// Note that all the setters affecting `r#type` are
22963            /// mutually exclusive.
22964            ///
22965            /// # Example
22966            /// ```ignore,no_run
22967            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
22968            /// let x = UserAnswer::new().set_text_answer("example");
22969            /// assert!(x.text_answer().is_some());
22970            /// assert!(x.selected_answer().is_none());
22971            /// ```
22972            pub fn set_text_answer<T: std::convert::Into<std::string::String>>(
22973                mut self,
22974                v: T,
22975            ) -> Self {
22976                self.r#type = std::option::Option::Some(
22977                    crate::model::search_request::conversational_search_spec::user_answer::Type::TextAnswer(
22978                        v.into()
22979                    )
22980                );
22981                self
22982            }
22983
22984            /// The value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22985            /// if it holds a `SelectedAnswer`, `None` if the field is not set or
22986            /// holds a different branch.
22987            pub fn selected_answer(&self) -> std::option::Option<&std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>>{
22988                #[allow(unreachable_patterns)]
22989                self.r#type.as_ref().and_then(|v| match v {
22990                    crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(v) => std::option::Option::Some(v),
22991                    _ => std::option::Option::None,
22992                })
22993            }
22994
22995            /// Sets the value of [r#type][crate::model::search_request::conversational_search_spec::UserAnswer::r#type]
22996            /// to hold a `SelectedAnswer`.
22997            ///
22998            /// Note that all the setters affecting `r#type` are
22999            /// mutually exclusive.
23000            ///
23001            /// # Example
23002            /// ```ignore,no_run
23003            /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::UserAnswer;
23004            /// use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23005            /// let x = UserAnswer::new().set_selected_answer(SelectedAnswer::default()/* use setters */);
23006            /// assert!(x.selected_answer().is_some());
23007            /// assert!(x.text_answer().is_none());
23008            /// ```
23009            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{
23010                self.r#type = std::option::Option::Some(
23011                    crate::model::search_request::conversational_search_spec::user_answer::Type::SelectedAnswer(
23012                        v.into()
23013                    )
23014                );
23015                self
23016            }
23017        }
23018
23019        impl wkt::message::Message for UserAnswer {
23020            fn typename() -> &'static str {
23021                "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer"
23022            }
23023        }
23024
23025        /// Defines additional types related to [UserAnswer].
23026        pub mod user_answer {
23027            #[allow(unused_imports)]
23028            use super::*;
23029
23030            /// This field specifies the selected answers during the conversational
23031            /// search.
23032            #[derive(Clone, Default, PartialEq)]
23033            #[non_exhaustive]
23034            pub struct SelectedAnswer {
23035                /// This field is deprecated and should not be set.
23036                #[deprecated]
23037                pub product_attribute_values: std::vec::Vec<crate::model::ProductAttributeValue>,
23038
23039                /// This field specifies the selected answer which is a attribute
23040                /// key-value.
23041                pub product_attribute_value:
23042                    std::option::Option<crate::model::ProductAttributeValue>,
23043
23044                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23045            }
23046
23047            impl SelectedAnswer {
23048                /// Creates a new default instance.
23049                pub fn new() -> Self {
23050                    std::default::Default::default()
23051                }
23052
23053                /// Sets the value of [product_attribute_values][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_values].
23054                ///
23055                /// # Example
23056                /// ```ignore,no_run
23057                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23058                /// use google_cloud_retail_v2::model::ProductAttributeValue;
23059                /// let x = SelectedAnswer::new()
23060                ///     .set_product_attribute_values([
23061                ///         ProductAttributeValue::default()/* use setters */,
23062                ///         ProductAttributeValue::default()/* use (different) setters */,
23063                ///     ]);
23064                /// ```
23065                #[deprecated]
23066                pub fn set_product_attribute_values<T, V>(mut self, v: T) -> Self
23067                where
23068                    T: std::iter::IntoIterator<Item = V>,
23069                    V: std::convert::Into<crate::model::ProductAttributeValue>,
23070                {
23071                    use std::iter::Iterator;
23072                    self.product_attribute_values = v.into_iter().map(|i| i.into()).collect();
23073                    self
23074                }
23075
23076                /// Sets the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
23077                ///
23078                /// # Example
23079                /// ```ignore,no_run
23080                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23081                /// use google_cloud_retail_v2::model::ProductAttributeValue;
23082                /// let x = SelectedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
23083                /// ```
23084                pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
23085                where
23086                    T: std::convert::Into<crate::model::ProductAttributeValue>,
23087                {
23088                    self.product_attribute_value = std::option::Option::Some(v.into());
23089                    self
23090                }
23091
23092                /// Sets or clears the value of [product_attribute_value][crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer::product_attribute_value].
23093                ///
23094                /// # Example
23095                /// ```ignore,no_run
23096                /// # use google_cloud_retail_v2::model::search_request::conversational_search_spec::user_answer::SelectedAnswer;
23097                /// use google_cloud_retail_v2::model::ProductAttributeValue;
23098                /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
23099                /// let x = SelectedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
23100                /// ```
23101                pub fn set_or_clear_product_attribute_value<T>(
23102                    mut self,
23103                    v: std::option::Option<T>,
23104                ) -> Self
23105                where
23106                    T: std::convert::Into<crate::model::ProductAttributeValue>,
23107                {
23108                    self.product_attribute_value = v.map(|x| x.into());
23109                    self
23110                }
23111            }
23112
23113            impl wkt::message::Message for SelectedAnswer {
23114                fn typename() -> &'static str {
23115                    "type.googleapis.com/google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.SelectedAnswer"
23116                }
23117            }
23118
23119            /// This field specifies the type of user answer.
23120            #[derive(Clone, Debug, PartialEq)]
23121            #[non_exhaustive]
23122            pub enum Type {
23123                /// This field specifies the incremental input text from the user during
23124                /// the conversational search.
23125                TextAnswer(std::string::String),
23126                /// This field specifies the selected attributes during the
23127                /// conversational search. This should be a subset of
23128                /// [ConversationalSearchResult.suggested_answers][].
23129                SelectedAnswer(std::boxed::Box<crate::model::search_request::conversational_search_spec::user_answer::SelectedAnswer>),
23130            }
23131        }
23132    }
23133
23134    /// This field specifies tile navigation related parameters.
23135    #[derive(Clone, Default, PartialEq)]
23136    #[non_exhaustive]
23137    pub struct TileNavigationSpec {
23138        /// This field specifies whether the customer would like to request tile
23139        /// navigation.
23140        pub tile_navigation_requested: bool,
23141
23142        /// This optional field specifies the tiles which are already clicked in
23143        /// client side. While the feature works without this field set, particularly
23144        /// for an initial query, it is highly recommended to set this field because
23145        /// it can improve the quality of the search response and removes possible
23146        /// duplicate tiles.
23147        ///
23148        /// NOTE: This field is not being used for filtering search
23149        /// products. Client side should also put all the applied tiles in
23150        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter].
23151        ///
23152        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
23153        pub applied_tiles: std::vec::Vec<crate::model::Tile>,
23154
23155        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23156    }
23157
23158    impl TileNavigationSpec {
23159        /// Creates a new default instance.
23160        pub fn new() -> Self {
23161            std::default::Default::default()
23162        }
23163
23164        /// Sets the value of [tile_navigation_requested][crate::model::search_request::TileNavigationSpec::tile_navigation_requested].
23165        ///
23166        /// # Example
23167        /// ```ignore,no_run
23168        /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
23169        /// let x = TileNavigationSpec::new().set_tile_navigation_requested(true);
23170        /// ```
23171        pub fn set_tile_navigation_requested<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
23172            self.tile_navigation_requested = v.into();
23173            self
23174        }
23175
23176        /// Sets the value of [applied_tiles][crate::model::search_request::TileNavigationSpec::applied_tiles].
23177        ///
23178        /// # Example
23179        /// ```ignore,no_run
23180        /// # use google_cloud_retail_v2::model::search_request::TileNavigationSpec;
23181        /// use google_cloud_retail_v2::model::Tile;
23182        /// let x = TileNavigationSpec::new()
23183        ///     .set_applied_tiles([
23184        ///         Tile::default()/* use setters */,
23185        ///         Tile::default()/* use (different) setters */,
23186        ///     ]);
23187        /// ```
23188        pub fn set_applied_tiles<T, V>(mut self, v: T) -> Self
23189        where
23190            T: std::iter::IntoIterator<Item = V>,
23191            V: std::convert::Into<crate::model::Tile>,
23192        {
23193            use std::iter::Iterator;
23194            self.applied_tiles = v.into_iter().map(|i| i.into()).collect();
23195            self
23196        }
23197    }
23198
23199    impl wkt::message::Message for TileNavigationSpec {
23200        fn typename() -> &'static str {
23201            "type.googleapis.com/google.cloud.retail.v2.SearchRequest.TileNavigationSpec"
23202        }
23203    }
23204
23205    /// The search mode of each search request.
23206    ///
23207    /// # Working with unknown values
23208    ///
23209    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
23210    /// additional enum variants at any time. Adding new variants is not considered
23211    /// a breaking change. Applications should write their code in anticipation of:
23212    ///
23213    /// - New values appearing in future releases of the client library, **and**
23214    /// - New values received dynamically, without application changes.
23215    ///
23216    /// Please consult the [Working with enums] section in the user guide for some
23217    /// guidelines.
23218    ///
23219    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
23220    #[derive(Clone, Debug, PartialEq)]
23221    #[non_exhaustive]
23222    pub enum SearchMode {
23223        /// Default value. In this case both product search and faceted search will
23224        /// be performed. Both
23225        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23226        /// and [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet]
23227        /// will be returned.
23228        ///
23229        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23230        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23231        Unspecified,
23232        /// Only product search will be performed. The faceted search will be
23233        /// disabled.
23234        ///
23235        /// Only
23236        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23237        /// will be returned.
23238        /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
23239        /// not be returned, even if
23240        /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
23241        /// or
23242        /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
23243        /// is set.
23244        ///
23245        /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
23246        /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
23247        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23248        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23249        ProductSearchOnly,
23250        /// Only faceted search will be performed. The product search will be
23251        /// disabled.
23252        ///
23253        /// When in this mode, one or both of
23254        /// [SearchRequest.facet_specs][google.cloud.retail.v2.SearchRequest.facet_specs]
23255        /// and
23256        /// [SearchRequest.dynamic_facet_spec][google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]
23257        /// should be set. Otherwise, an INVALID_ARGUMENT error is returned. Only
23258        /// [SearchResponse.Facet][google.cloud.retail.v2.SearchResponse.Facet] will
23259        /// be returned.
23260        /// [SearchResponse.SearchResult][google.cloud.retail.v2.SearchResponse.SearchResult]
23261        /// will not be returned.
23262        ///
23263        /// [google.cloud.retail.v2.SearchRequest.dynamic_facet_spec]: crate::model::SearchRequest::dynamic_facet_spec
23264        /// [google.cloud.retail.v2.SearchRequest.facet_specs]: crate::model::SearchRequest::facet_specs
23265        /// [google.cloud.retail.v2.SearchResponse.Facet]: crate::model::search_response::Facet
23266        /// [google.cloud.retail.v2.SearchResponse.SearchResult]: crate::model::search_response::SearchResult
23267        FacetedSearchOnly,
23268        /// If set, the enum was initialized with an unknown value.
23269        ///
23270        /// Applications can examine the value using [SearchMode::value] or
23271        /// [SearchMode::name].
23272        UnknownValue(search_mode::UnknownValue),
23273    }
23274
23275    #[doc(hidden)]
23276    pub mod search_mode {
23277        #[allow(unused_imports)]
23278        use super::*;
23279        #[derive(Clone, Debug, PartialEq)]
23280        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
23281    }
23282
23283    impl SearchMode {
23284        /// Gets the enum value.
23285        ///
23286        /// Returns `None` if the enum contains an unknown value deserialized from
23287        /// the string representation of enums.
23288        pub fn value(&self) -> std::option::Option<i32> {
23289            match self {
23290                Self::Unspecified => std::option::Option::Some(0),
23291                Self::ProductSearchOnly => std::option::Option::Some(1),
23292                Self::FacetedSearchOnly => std::option::Option::Some(2),
23293                Self::UnknownValue(u) => u.0.value(),
23294            }
23295        }
23296
23297        /// Gets the enum value as a string.
23298        ///
23299        /// Returns `None` if the enum contains an unknown value deserialized from
23300        /// the integer representation of enums.
23301        pub fn name(&self) -> std::option::Option<&str> {
23302            match self {
23303                Self::Unspecified => std::option::Option::Some("SEARCH_MODE_UNSPECIFIED"),
23304                Self::ProductSearchOnly => std::option::Option::Some("PRODUCT_SEARCH_ONLY"),
23305                Self::FacetedSearchOnly => std::option::Option::Some("FACETED_SEARCH_ONLY"),
23306                Self::UnknownValue(u) => u.0.name(),
23307            }
23308        }
23309    }
23310
23311    impl std::default::Default for SearchMode {
23312        fn default() -> Self {
23313            use std::convert::From;
23314            Self::from(0)
23315        }
23316    }
23317
23318    impl std::fmt::Display for SearchMode {
23319        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
23320            wkt::internal::display_enum(f, self.name(), self.value())
23321        }
23322    }
23323
23324    impl std::convert::From<i32> for SearchMode {
23325        fn from(value: i32) -> Self {
23326            match value {
23327                0 => Self::Unspecified,
23328                1 => Self::ProductSearchOnly,
23329                2 => Self::FacetedSearchOnly,
23330                _ => Self::UnknownValue(search_mode::UnknownValue(
23331                    wkt::internal::UnknownEnumValue::Integer(value),
23332                )),
23333            }
23334        }
23335    }
23336
23337    impl std::convert::From<&str> for SearchMode {
23338        fn from(value: &str) -> Self {
23339            use std::string::ToString;
23340            match value {
23341                "SEARCH_MODE_UNSPECIFIED" => Self::Unspecified,
23342                "PRODUCT_SEARCH_ONLY" => Self::ProductSearchOnly,
23343                "FACETED_SEARCH_ONLY" => Self::FacetedSearchOnly,
23344                _ => Self::UnknownValue(search_mode::UnknownValue(
23345                    wkt::internal::UnknownEnumValue::String(value.to_string()),
23346                )),
23347            }
23348        }
23349    }
23350
23351    impl serde::ser::Serialize for SearchMode {
23352        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
23353        where
23354            S: serde::Serializer,
23355        {
23356            match self {
23357                Self::Unspecified => serializer.serialize_i32(0),
23358                Self::ProductSearchOnly => serializer.serialize_i32(1),
23359                Self::FacetedSearchOnly => serializer.serialize_i32(2),
23360                Self::UnknownValue(u) => u.0.serialize(serializer),
23361            }
23362        }
23363    }
23364
23365    impl<'de> serde::de::Deserialize<'de> for SearchMode {
23366        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
23367        where
23368            D: serde::Deserializer<'de>,
23369        {
23370            deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchMode>::new(
23371                ".google.cloud.retail.v2.SearchRequest.SearchMode",
23372            ))
23373        }
23374    }
23375}
23376
23377/// Response message for
23378/// [SearchService.Search][google.cloud.retail.v2.SearchService.Search] method.
23379///
23380/// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
23381#[derive(Clone, Default, PartialEq)]
23382#[non_exhaustive]
23383pub struct SearchResponse {
23384    /// A list of matched items. The order represents the ranking.
23385    pub results: std::vec::Vec<crate::model::search_response::SearchResult>,
23386
23387    /// Results of facets requested by user.
23388    pub facets: std::vec::Vec<crate::model::search_response::Facet>,
23389
23390    /// The estimated total count of matched items irrespective of pagination. The
23391    /// count of [results][google.cloud.retail.v2.SearchResponse.results] returned
23392    /// by pagination may be less than the
23393    /// [total_size][google.cloud.retail.v2.SearchResponse.total_size] that
23394    /// matches.
23395    ///
23396    /// [google.cloud.retail.v2.SearchResponse.results]: crate::model::SearchResponse::results
23397    /// [google.cloud.retail.v2.SearchResponse.total_size]: crate::model::SearchResponse::total_size
23398    pub total_size: i32,
23399
23400    /// Contains the spell corrected query, if found. If the spell correction type
23401    /// is AUTOMATIC, then the search results are based on corrected_query.
23402    /// Otherwise the original query is used for search.
23403    pub corrected_query: std::string::String,
23404
23405    /// A unique search token. This should be included in the
23406    /// [UserEvent][google.cloud.retail.v2.UserEvent] logs resulting from this
23407    /// search, which enables accurate attribution of search model performance.
23408    ///
23409    /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23410    pub attribution_token: std::string::String,
23411
23412    /// A token that can be sent as
23413    /// [SearchRequest.page_token][google.cloud.retail.v2.SearchRequest.page_token]
23414    /// to retrieve the next page. If this field is omitted, there are no
23415    /// subsequent pages.
23416    ///
23417    /// [google.cloud.retail.v2.SearchRequest.page_token]: crate::model::SearchRequest::page_token
23418    pub next_page_token: std::string::String,
23419
23420    /// Query expansion information for the returned results.
23421    pub query_expansion_info:
23422        std::option::Option<crate::model::search_response::QueryExpansionInfo>,
23423
23424    /// The URI of a customer-defined redirect page. If redirect action is
23425    /// triggered, no search is performed, and only
23426    /// [redirect_uri][google.cloud.retail.v2.SearchResponse.redirect_uri] and
23427    /// [attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
23428    /// are set in the response.
23429    ///
23430    /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
23431    /// [google.cloud.retail.v2.SearchResponse.redirect_uri]: crate::model::SearchResponse::redirect_uri
23432    pub redirect_uri: std::string::String,
23433
23434    /// The fully qualified resource name of applied
23435    /// [controls](https://cloud.google.com/retail/docs/serving-control-rules).
23436    pub applied_controls: std::vec::Vec<std::string::String>,
23437
23438    /// Metadata for pin controls which were applicable to the request.
23439    /// This contains two map fields, one for all matched pins and one for pins
23440    /// which were matched but not applied.
23441    ///
23442    /// The two maps are keyed by pin position, and the values are the product ids
23443    /// which were matched to that pin.
23444    pub pin_control_metadata: std::option::Option<crate::model::PinControlMetadata>,
23445
23446    /// The invalid
23447    /// [SearchRequest.BoostSpec.condition_boost_specs][google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]
23448    /// that are not applied during serving.
23449    ///
23450    /// [google.cloud.retail.v2.SearchRequest.BoostSpec.condition_boost_specs]: crate::model::search_request::BoostSpec::condition_boost_specs
23451    pub invalid_condition_boost_specs:
23452        std::vec::Vec<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23453
23454    /// Metadata related to A/B testing experiment associated with this
23455    /// response. Only exists when an experiment is triggered.
23456    pub experiment_info: std::vec::Vec<crate::model::ExperimentInfo>,
23457
23458    /// This field specifies all related information that is needed on client
23459    /// side for UI rendering of conversational retail search.
23460    pub conversational_search_result:
23461        std::option::Option<crate::model::search_response::ConversationalSearchResult>,
23462
23463    /// This field specifies all related information for tile navigation that will
23464    /// be used in client side.
23465    pub tile_navigation_result:
23466        std::option::Option<crate::model::search_response::TileNavigationResult>,
23467
23468    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23469}
23470
23471impl SearchResponse {
23472    /// Creates a new default instance.
23473    pub fn new() -> Self {
23474        std::default::Default::default()
23475    }
23476
23477    /// Sets the value of [results][crate::model::SearchResponse::results].
23478    ///
23479    /// # Example
23480    /// ```ignore,no_run
23481    /// # use google_cloud_retail_v2::model::SearchResponse;
23482    /// use google_cloud_retail_v2::model::search_response::SearchResult;
23483    /// let x = SearchResponse::new()
23484    ///     .set_results([
23485    ///         SearchResult::default()/* use setters */,
23486    ///         SearchResult::default()/* use (different) setters */,
23487    ///     ]);
23488    /// ```
23489    pub fn set_results<T, V>(mut self, v: T) -> Self
23490    where
23491        T: std::iter::IntoIterator<Item = V>,
23492        V: std::convert::Into<crate::model::search_response::SearchResult>,
23493    {
23494        use std::iter::Iterator;
23495        self.results = v.into_iter().map(|i| i.into()).collect();
23496        self
23497    }
23498
23499    /// Sets the value of [facets][crate::model::SearchResponse::facets].
23500    ///
23501    /// # Example
23502    /// ```ignore,no_run
23503    /// # use google_cloud_retail_v2::model::SearchResponse;
23504    /// use google_cloud_retail_v2::model::search_response::Facet;
23505    /// let x = SearchResponse::new()
23506    ///     .set_facets([
23507    ///         Facet::default()/* use setters */,
23508    ///         Facet::default()/* use (different) setters */,
23509    ///     ]);
23510    /// ```
23511    pub fn set_facets<T, V>(mut self, v: T) -> Self
23512    where
23513        T: std::iter::IntoIterator<Item = V>,
23514        V: std::convert::Into<crate::model::search_response::Facet>,
23515    {
23516        use std::iter::Iterator;
23517        self.facets = v.into_iter().map(|i| i.into()).collect();
23518        self
23519    }
23520
23521    /// Sets the value of [total_size][crate::model::SearchResponse::total_size].
23522    ///
23523    /// # Example
23524    /// ```ignore,no_run
23525    /// # use google_cloud_retail_v2::model::SearchResponse;
23526    /// let x = SearchResponse::new().set_total_size(42);
23527    /// ```
23528    pub fn set_total_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23529        self.total_size = v.into();
23530        self
23531    }
23532
23533    /// Sets the value of [corrected_query][crate::model::SearchResponse::corrected_query].
23534    ///
23535    /// # Example
23536    /// ```ignore,no_run
23537    /// # use google_cloud_retail_v2::model::SearchResponse;
23538    /// let x = SearchResponse::new().set_corrected_query("example");
23539    /// ```
23540    pub fn set_corrected_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23541        self.corrected_query = v.into();
23542        self
23543    }
23544
23545    /// Sets the value of [attribution_token][crate::model::SearchResponse::attribution_token].
23546    ///
23547    /// # Example
23548    /// ```ignore,no_run
23549    /// # use google_cloud_retail_v2::model::SearchResponse;
23550    /// let x = SearchResponse::new().set_attribution_token("example");
23551    /// ```
23552    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
23553        mut self,
23554        v: T,
23555    ) -> Self {
23556        self.attribution_token = v.into();
23557        self
23558    }
23559
23560    /// Sets the value of [next_page_token][crate::model::SearchResponse::next_page_token].
23561    ///
23562    /// # Example
23563    /// ```ignore,no_run
23564    /// # use google_cloud_retail_v2::model::SearchResponse;
23565    /// let x = SearchResponse::new().set_next_page_token("example");
23566    /// ```
23567    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23568        self.next_page_token = v.into();
23569        self
23570    }
23571
23572    /// Sets the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23573    ///
23574    /// # Example
23575    /// ```ignore,no_run
23576    /// # use google_cloud_retail_v2::model::SearchResponse;
23577    /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23578    /// let x = SearchResponse::new().set_query_expansion_info(QueryExpansionInfo::default()/* use setters */);
23579    /// ```
23580    pub fn set_query_expansion_info<T>(mut self, v: T) -> Self
23581    where
23582        T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23583    {
23584        self.query_expansion_info = std::option::Option::Some(v.into());
23585        self
23586    }
23587
23588    /// Sets or clears the value of [query_expansion_info][crate::model::SearchResponse::query_expansion_info].
23589    ///
23590    /// # Example
23591    /// ```ignore,no_run
23592    /// # use google_cloud_retail_v2::model::SearchResponse;
23593    /// use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
23594    /// let x = SearchResponse::new().set_or_clear_query_expansion_info(Some(QueryExpansionInfo::default()/* use setters */));
23595    /// let x = SearchResponse::new().set_or_clear_query_expansion_info(None::<QueryExpansionInfo>);
23596    /// ```
23597    pub fn set_or_clear_query_expansion_info<T>(mut self, v: std::option::Option<T>) -> Self
23598    where
23599        T: std::convert::Into<crate::model::search_response::QueryExpansionInfo>,
23600    {
23601        self.query_expansion_info = v.map(|x| x.into());
23602        self
23603    }
23604
23605    /// Sets the value of [redirect_uri][crate::model::SearchResponse::redirect_uri].
23606    ///
23607    /// # Example
23608    /// ```ignore,no_run
23609    /// # use google_cloud_retail_v2::model::SearchResponse;
23610    /// let x = SearchResponse::new().set_redirect_uri("example");
23611    /// ```
23612    pub fn set_redirect_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23613        self.redirect_uri = v.into();
23614        self
23615    }
23616
23617    /// Sets the value of [applied_controls][crate::model::SearchResponse::applied_controls].
23618    ///
23619    /// # Example
23620    /// ```ignore,no_run
23621    /// # use google_cloud_retail_v2::model::SearchResponse;
23622    /// let x = SearchResponse::new().set_applied_controls(["a", "b", "c"]);
23623    /// ```
23624    pub fn set_applied_controls<T, V>(mut self, v: T) -> Self
23625    where
23626        T: std::iter::IntoIterator<Item = V>,
23627        V: std::convert::Into<std::string::String>,
23628    {
23629        use std::iter::Iterator;
23630        self.applied_controls = v.into_iter().map(|i| i.into()).collect();
23631        self
23632    }
23633
23634    /// Sets the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23635    ///
23636    /// # Example
23637    /// ```ignore,no_run
23638    /// # use google_cloud_retail_v2::model::SearchResponse;
23639    /// use google_cloud_retail_v2::model::PinControlMetadata;
23640    /// let x = SearchResponse::new().set_pin_control_metadata(PinControlMetadata::default()/* use setters */);
23641    /// ```
23642    pub fn set_pin_control_metadata<T>(mut self, v: T) -> Self
23643    where
23644        T: std::convert::Into<crate::model::PinControlMetadata>,
23645    {
23646        self.pin_control_metadata = std::option::Option::Some(v.into());
23647        self
23648    }
23649
23650    /// Sets or clears the value of [pin_control_metadata][crate::model::SearchResponse::pin_control_metadata].
23651    ///
23652    /// # Example
23653    /// ```ignore,no_run
23654    /// # use google_cloud_retail_v2::model::SearchResponse;
23655    /// use google_cloud_retail_v2::model::PinControlMetadata;
23656    /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(Some(PinControlMetadata::default()/* use setters */));
23657    /// let x = SearchResponse::new().set_or_clear_pin_control_metadata(None::<PinControlMetadata>);
23658    /// ```
23659    pub fn set_or_clear_pin_control_metadata<T>(mut self, v: std::option::Option<T>) -> Self
23660    where
23661        T: std::convert::Into<crate::model::PinControlMetadata>,
23662    {
23663        self.pin_control_metadata = v.map(|x| x.into());
23664        self
23665    }
23666
23667    /// Sets the value of [invalid_condition_boost_specs][crate::model::SearchResponse::invalid_condition_boost_specs].
23668    ///
23669    /// # Example
23670    /// ```ignore,no_run
23671    /// # use google_cloud_retail_v2::model::SearchResponse;
23672    /// use google_cloud_retail_v2::model::search_request::boost_spec::ConditionBoostSpec;
23673    /// let x = SearchResponse::new()
23674    ///     .set_invalid_condition_boost_specs([
23675    ///         ConditionBoostSpec::default()/* use setters */,
23676    ///         ConditionBoostSpec::default()/* use (different) setters */,
23677    ///     ]);
23678    /// ```
23679    pub fn set_invalid_condition_boost_specs<T, V>(mut self, v: T) -> Self
23680    where
23681        T: std::iter::IntoIterator<Item = V>,
23682        V: std::convert::Into<crate::model::search_request::boost_spec::ConditionBoostSpec>,
23683    {
23684        use std::iter::Iterator;
23685        self.invalid_condition_boost_specs = v.into_iter().map(|i| i.into()).collect();
23686        self
23687    }
23688
23689    /// Sets the value of [experiment_info][crate::model::SearchResponse::experiment_info].
23690    ///
23691    /// # Example
23692    /// ```ignore,no_run
23693    /// # use google_cloud_retail_v2::model::SearchResponse;
23694    /// use google_cloud_retail_v2::model::ExperimentInfo;
23695    /// let x = SearchResponse::new()
23696    ///     .set_experiment_info([
23697    ///         ExperimentInfo::default()/* use setters */,
23698    ///         ExperimentInfo::default()/* use (different) setters */,
23699    ///     ]);
23700    /// ```
23701    pub fn set_experiment_info<T, V>(mut self, v: T) -> Self
23702    where
23703        T: std::iter::IntoIterator<Item = V>,
23704        V: std::convert::Into<crate::model::ExperimentInfo>,
23705    {
23706        use std::iter::Iterator;
23707        self.experiment_info = v.into_iter().map(|i| i.into()).collect();
23708        self
23709    }
23710
23711    /// Sets the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23712    ///
23713    /// # Example
23714    /// ```ignore,no_run
23715    /// # use google_cloud_retail_v2::model::SearchResponse;
23716    /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23717    /// let x = SearchResponse::new().set_conversational_search_result(ConversationalSearchResult::default()/* use setters */);
23718    /// ```
23719    pub fn set_conversational_search_result<T>(mut self, v: T) -> Self
23720    where
23721        T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23722    {
23723        self.conversational_search_result = std::option::Option::Some(v.into());
23724        self
23725    }
23726
23727    /// Sets or clears the value of [conversational_search_result][crate::model::SearchResponse::conversational_search_result].
23728    ///
23729    /// # Example
23730    /// ```ignore,no_run
23731    /// # use google_cloud_retail_v2::model::SearchResponse;
23732    /// use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
23733    /// let x = SearchResponse::new().set_or_clear_conversational_search_result(Some(ConversationalSearchResult::default()/* use setters */));
23734    /// let x = SearchResponse::new().set_or_clear_conversational_search_result(None::<ConversationalSearchResult>);
23735    /// ```
23736    pub fn set_or_clear_conversational_search_result<T>(mut self, v: std::option::Option<T>) -> Self
23737    where
23738        T: std::convert::Into<crate::model::search_response::ConversationalSearchResult>,
23739    {
23740        self.conversational_search_result = v.map(|x| x.into());
23741        self
23742    }
23743
23744    /// Sets the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23745    ///
23746    /// # Example
23747    /// ```ignore,no_run
23748    /// # use google_cloud_retail_v2::model::SearchResponse;
23749    /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23750    /// let x = SearchResponse::new().set_tile_navigation_result(TileNavigationResult::default()/* use setters */);
23751    /// ```
23752    pub fn set_tile_navigation_result<T>(mut self, v: T) -> Self
23753    where
23754        T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23755    {
23756        self.tile_navigation_result = std::option::Option::Some(v.into());
23757        self
23758    }
23759
23760    /// Sets or clears the value of [tile_navigation_result][crate::model::SearchResponse::tile_navigation_result].
23761    ///
23762    /// # Example
23763    /// ```ignore,no_run
23764    /// # use google_cloud_retail_v2::model::SearchResponse;
23765    /// use google_cloud_retail_v2::model::search_response::TileNavigationResult;
23766    /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(Some(TileNavigationResult::default()/* use setters */));
23767    /// let x = SearchResponse::new().set_or_clear_tile_navigation_result(None::<TileNavigationResult>);
23768    /// ```
23769    pub fn set_or_clear_tile_navigation_result<T>(mut self, v: std::option::Option<T>) -> Self
23770    where
23771        T: std::convert::Into<crate::model::search_response::TileNavigationResult>,
23772    {
23773        self.tile_navigation_result = v.map(|x| x.into());
23774        self
23775    }
23776}
23777
23778impl wkt::message::Message for SearchResponse {
23779    fn typename() -> &'static str {
23780        "type.googleapis.com/google.cloud.retail.v2.SearchResponse"
23781    }
23782}
23783
23784#[doc(hidden)]
23785impl google_cloud_gax::paginator::internal::PageableResponse for SearchResponse {
23786    type PageItem = crate::model::search_response::SearchResult;
23787
23788    fn items(self) -> std::vec::Vec<Self::PageItem> {
23789        self.results
23790    }
23791
23792    fn next_page_token(&self) -> std::string::String {
23793        use std::clone::Clone;
23794        self.next_page_token.clone()
23795    }
23796}
23797
23798/// Defines additional types related to [SearchResponse].
23799pub mod search_response {
23800    #[allow(unused_imports)]
23801    use super::*;
23802
23803    /// Represents the search results.
23804    #[derive(Clone, Default, PartialEq)]
23805    #[non_exhaustive]
23806    pub struct SearchResult {
23807        /// [Product.id][google.cloud.retail.v2.Product.id] of the searched
23808        /// [Product][google.cloud.retail.v2.Product].
23809        ///
23810        /// [google.cloud.retail.v2.Product]: crate::model::Product
23811        /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
23812        pub id: std::string::String,
23813
23814        /// The product data snippet in the search response. Only
23815        /// [Product.name][google.cloud.retail.v2.Product.name] is guaranteed to be
23816        /// populated.
23817        ///
23818        /// [Product.variants][google.cloud.retail.v2.Product.variants] contains the
23819        /// product variants that match the search query. If there are multiple
23820        /// product variants matching the query, top 5 most relevant product variants
23821        /// are returned and ordered by relevancy.
23822        ///
23823        /// If relevancy can be deternmined, use
23824        /// [matching_variant_fields][google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]
23825        /// to look up matched product variants fields. If relevancy cannot be
23826        /// determined, e.g. when searching "shoe" all products in a shoe product can
23827        /// be a match, 5 product variants are returned but order is meaningless.
23828        ///
23829        /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23830        /// [google.cloud.retail.v2.Product.variants]: crate::model::Product::variants
23831        /// [google.cloud.retail.v2.SearchResponse.SearchResult.matching_variant_fields]: crate::model::search_response::SearchResult::matching_variant_fields
23832        pub product: std::option::Option<crate::model::Product>,
23833
23834        /// The count of matched
23835        /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23836        /// [Product][google.cloud.retail.v2.Product]s.
23837        ///
23838        /// [google.cloud.retail.v2.Product]: crate::model::Product
23839        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23840        pub matching_variant_count: i32,
23841
23842        /// If a [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23843        /// [Product][google.cloud.retail.v2.Product] matches the search query, this
23844        /// map indicates which [Product][google.cloud.retail.v2.Product] fields are
23845        /// matched. The key is the
23846        /// [Product.name][google.cloud.retail.v2.Product.name], the value is a field
23847        /// mask of the matched [Product][google.cloud.retail.v2.Product] fields. If
23848        /// matched attributes cannot be determined, this map will be empty.
23849        ///
23850        /// For example, a key "sku1" with field mask
23851        /// "products.color_info" indicates there is a match between
23852        /// "sku1" [ColorInfo][google.cloud.retail.v2.ColorInfo] and the query.
23853        ///
23854        /// [google.cloud.retail.v2.ColorInfo]: crate::model::ColorInfo
23855        /// [google.cloud.retail.v2.Product]: crate::model::Product
23856        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23857        /// [google.cloud.retail.v2.Product.name]: crate::model::Product::name
23858        pub matching_variant_fields: std::collections::HashMap<std::string::String, wkt::FieldMask>,
23859
23860        /// The rollup matching
23861        /// [variant][google.cloud.retail.v2.Product.Type.VARIANT]
23862        /// [Product][google.cloud.retail.v2.Product] attributes. The key is one of
23863        /// the
23864        /// [SearchRequest.variant_rollup_keys][google.cloud.retail.v2.SearchRequest.variant_rollup_keys].
23865        /// The values are the merged and de-duplicated
23866        /// [Product][google.cloud.retail.v2.Product] attributes. Notice that the
23867        /// rollup values are respect filter. For example, when filtering by
23868        /// "colorFamilies:ANY(\"red\")" and rollup "colorFamilies", only "red" is
23869        /// returned.
23870        ///
23871        /// For textual and numerical attributes, the rollup values is a list of
23872        /// string or double values with type
23873        /// [google.protobuf.ListValue][google.protobuf.ListValue]. For example, if
23874        /// there are two variants with colors "red" and "blue", the rollup values
23875        /// are
23876        ///
23877        /// ```norust
23878        /// { key: "colorFamilies"
23879        ///   value {
23880        ///     list_value {
23881        ///       values { string_value: "red" }
23882        ///       values { string_value: "blue" }
23883        ///      }
23884        ///   }
23885        /// }
23886        /// ```
23887        ///
23888        /// For [FulfillmentInfo][google.cloud.retail.v2.FulfillmentInfo], the rollup
23889        /// values is a double value with type
23890        /// [google.protobuf.Value][google.protobuf.Value]. For example,
23891        /// `{key: "pickupInStore.store1" value { number_value: 10 }}` means a there
23892        /// are 10 variants in this product are available in the store "store1".
23893        ///
23894        /// [google.cloud.retail.v2.FulfillmentInfo]: crate::model::FulfillmentInfo
23895        /// [google.cloud.retail.v2.Product]: crate::model::Product
23896        /// [google.cloud.retail.v2.Product.Type.VARIANT]: crate::model::product::Type::Variant
23897        /// [google.cloud.retail.v2.SearchRequest.variant_rollup_keys]: crate::model::SearchRequest::variant_rollup_keys
23898        /// [google.protobuf.ListValue]: wkt::ListValue
23899        /// [google.protobuf.Value]: wkt::Value
23900        pub variant_rollup_values: std::collections::HashMap<std::string::String, wkt::Value>,
23901
23902        /// Specifies previous events related to this product for this user based on
23903        /// [UserEvent][google.cloud.retail.v2.UserEvent] with same
23904        /// [SearchRequest.visitor_id][google.cloud.retail.v2.SearchRequest.visitor_id]
23905        /// or [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id].
23906        ///
23907        /// This is set only when
23908        /// [SearchRequest.PersonalizationSpec.mode][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]
23909        /// is
23910        /// [SearchRequest.PersonalizationSpec.Mode.AUTO][google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO].
23911        ///
23912        /// Possible values:
23913        ///
23914        /// * `purchased`: Indicates that this product has been purchased before.
23915        ///
23916        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.Mode.AUTO]: crate::model::search_request::personalization_spec::Mode::Auto
23917        /// [google.cloud.retail.v2.SearchRequest.PersonalizationSpec.mode]: crate::model::search_request::PersonalizationSpec::mode
23918        /// [google.cloud.retail.v2.SearchRequest.visitor_id]: crate::model::SearchRequest::visitor_id
23919        /// [google.cloud.retail.v2.UserEvent]: crate::model::UserEvent
23920        /// [google.cloud.retail.v2.UserInfo.user_id]: crate::model::UserInfo::user_id
23921        pub personal_labels: std::vec::Vec<std::string::String>,
23922
23923        /// Google provided available scores.
23924        pub model_scores: std::collections::HashMap<std::string::String, crate::model::DoubleList>,
23925
23926        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
23927    }
23928
23929    impl SearchResult {
23930        /// Creates a new default instance.
23931        pub fn new() -> Self {
23932            std::default::Default::default()
23933        }
23934
23935        /// Sets the value of [id][crate::model::search_response::SearchResult::id].
23936        ///
23937        /// # Example
23938        /// ```ignore,no_run
23939        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23940        /// let x = SearchResult::new().set_id("example");
23941        /// ```
23942        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
23943            self.id = v.into();
23944            self
23945        }
23946
23947        /// Sets the value of [product][crate::model::search_response::SearchResult::product].
23948        ///
23949        /// # Example
23950        /// ```ignore,no_run
23951        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23952        /// use google_cloud_retail_v2::model::Product;
23953        /// let x = SearchResult::new().set_product(Product::default()/* use setters */);
23954        /// ```
23955        pub fn set_product<T>(mut self, v: T) -> Self
23956        where
23957            T: std::convert::Into<crate::model::Product>,
23958        {
23959            self.product = std::option::Option::Some(v.into());
23960            self
23961        }
23962
23963        /// Sets or clears the value of [product][crate::model::search_response::SearchResult::product].
23964        ///
23965        /// # Example
23966        /// ```ignore,no_run
23967        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23968        /// use google_cloud_retail_v2::model::Product;
23969        /// let x = SearchResult::new().set_or_clear_product(Some(Product::default()/* use setters */));
23970        /// let x = SearchResult::new().set_or_clear_product(None::<Product>);
23971        /// ```
23972        pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
23973        where
23974            T: std::convert::Into<crate::model::Product>,
23975        {
23976            self.product = v.map(|x| x.into());
23977            self
23978        }
23979
23980        /// Sets the value of [matching_variant_count][crate::model::search_response::SearchResult::matching_variant_count].
23981        ///
23982        /// # Example
23983        /// ```ignore,no_run
23984        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23985        /// let x = SearchResult::new().set_matching_variant_count(42);
23986        /// ```
23987        pub fn set_matching_variant_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
23988            self.matching_variant_count = v.into();
23989            self
23990        }
23991
23992        /// Sets the value of [matching_variant_fields][crate::model::search_response::SearchResult::matching_variant_fields].
23993        ///
23994        /// # Example
23995        /// ```ignore,no_run
23996        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
23997        /// use wkt::FieldMask;
23998        /// let x = SearchResult::new().set_matching_variant_fields([
23999        ///     ("key0", FieldMask::default()/* use setters */),
24000        ///     ("key1", FieldMask::default()/* use (different) setters */),
24001        /// ]);
24002        /// ```
24003        pub fn set_matching_variant_fields<T, K, V>(mut self, v: T) -> Self
24004        where
24005            T: std::iter::IntoIterator<Item = (K, V)>,
24006            K: std::convert::Into<std::string::String>,
24007            V: std::convert::Into<wkt::FieldMask>,
24008        {
24009            use std::iter::Iterator;
24010            self.matching_variant_fields =
24011                v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24012            self
24013        }
24014
24015        /// Sets the value of [variant_rollup_values][crate::model::search_response::SearchResult::variant_rollup_values].
24016        ///
24017        /// # Example
24018        /// ```ignore,no_run
24019        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
24020        /// use wkt::Value;
24021        /// let x = SearchResult::new().set_variant_rollup_values([
24022        ///     ("key0", Value::default()/* use setters */),
24023        ///     ("key1", Value::default()/* use (different) setters */),
24024        /// ]);
24025        /// ```
24026        pub fn set_variant_rollup_values<T, K, V>(mut self, v: T) -> Self
24027        where
24028            T: std::iter::IntoIterator<Item = (K, V)>,
24029            K: std::convert::Into<std::string::String>,
24030            V: std::convert::Into<wkt::Value>,
24031        {
24032            use std::iter::Iterator;
24033            self.variant_rollup_values = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24034            self
24035        }
24036
24037        /// Sets the value of [personal_labels][crate::model::search_response::SearchResult::personal_labels].
24038        ///
24039        /// # Example
24040        /// ```ignore,no_run
24041        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
24042        /// let x = SearchResult::new().set_personal_labels(["a", "b", "c"]);
24043        /// ```
24044        pub fn set_personal_labels<T, V>(mut self, v: T) -> Self
24045        where
24046            T: std::iter::IntoIterator<Item = V>,
24047            V: std::convert::Into<std::string::String>,
24048        {
24049            use std::iter::Iterator;
24050            self.personal_labels = v.into_iter().map(|i| i.into()).collect();
24051            self
24052        }
24053
24054        /// Sets the value of [model_scores][crate::model::search_response::SearchResult::model_scores].
24055        ///
24056        /// # Example
24057        /// ```ignore,no_run
24058        /// # use google_cloud_retail_v2::model::search_response::SearchResult;
24059        /// use google_cloud_retail_v2::model::DoubleList;
24060        /// let x = SearchResult::new().set_model_scores([
24061        ///     ("key0", DoubleList::default()/* use setters */),
24062        ///     ("key1", DoubleList::default()/* use (different) setters */),
24063        /// ]);
24064        /// ```
24065        pub fn set_model_scores<T, K, V>(mut self, v: T) -> Self
24066        where
24067            T: std::iter::IntoIterator<Item = (K, V)>,
24068            K: std::convert::Into<std::string::String>,
24069            V: std::convert::Into<crate::model::DoubleList>,
24070        {
24071            use std::iter::Iterator;
24072            self.model_scores = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
24073            self
24074        }
24075    }
24076
24077    impl wkt::message::Message for SearchResult {
24078        fn typename() -> &'static str {
24079            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.SearchResult"
24080        }
24081    }
24082
24083    /// A facet result.
24084    #[derive(Clone, Default, PartialEq)]
24085    #[non_exhaustive]
24086    pub struct Facet {
24087        /// The key for this facet. E.g., "colorFamilies" or "price" or
24088        /// "attributes.attr1".
24089        pub key: std::string::String,
24090
24091        /// The facet values for this field.
24092        pub values: std::vec::Vec<crate::model::search_response::facet::FacetValue>,
24093
24094        /// Whether the facet is dynamically generated.
24095        pub dynamic_facet: bool,
24096
24097        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24098    }
24099
24100    impl Facet {
24101        /// Creates a new default instance.
24102        pub fn new() -> Self {
24103            std::default::Default::default()
24104        }
24105
24106        /// Sets the value of [key][crate::model::search_response::Facet::key].
24107        ///
24108        /// # Example
24109        /// ```ignore,no_run
24110        /// # use google_cloud_retail_v2::model::search_response::Facet;
24111        /// let x = Facet::new().set_key("example");
24112        /// ```
24113        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24114            self.key = v.into();
24115            self
24116        }
24117
24118        /// Sets the value of [values][crate::model::search_response::Facet::values].
24119        ///
24120        /// # Example
24121        /// ```ignore,no_run
24122        /// # use google_cloud_retail_v2::model::search_response::Facet;
24123        /// use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24124        /// let x = Facet::new()
24125        ///     .set_values([
24126        ///         FacetValue::default()/* use setters */,
24127        ///         FacetValue::default()/* use (different) setters */,
24128        ///     ]);
24129        /// ```
24130        pub fn set_values<T, V>(mut self, v: T) -> Self
24131        where
24132            T: std::iter::IntoIterator<Item = V>,
24133            V: std::convert::Into<crate::model::search_response::facet::FacetValue>,
24134        {
24135            use std::iter::Iterator;
24136            self.values = v.into_iter().map(|i| i.into()).collect();
24137            self
24138        }
24139
24140        /// Sets the value of [dynamic_facet][crate::model::search_response::Facet::dynamic_facet].
24141        ///
24142        /// # Example
24143        /// ```ignore,no_run
24144        /// # use google_cloud_retail_v2::model::search_response::Facet;
24145        /// let x = Facet::new().set_dynamic_facet(true);
24146        /// ```
24147        pub fn set_dynamic_facet<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24148            self.dynamic_facet = v.into();
24149            self
24150        }
24151    }
24152
24153    impl wkt::message::Message for Facet {
24154        fn typename() -> &'static str {
24155            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet"
24156        }
24157    }
24158
24159    /// Defines additional types related to [Facet].
24160    pub mod facet {
24161        #[allow(unused_imports)]
24162        use super::*;
24163
24164        /// A facet value which contains value names and their count.
24165        #[derive(Clone, Default, PartialEq)]
24166        #[non_exhaustive]
24167        pub struct FacetValue {
24168            /// Number of items that have this facet value.
24169            pub count: i64,
24170
24171            /// The minimum value in the
24172            /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
24173            /// Only supported on numerical facets and returned if
24174            /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
24175            /// is true.
24176            ///
24177            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
24178            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
24179            pub min_value: f64,
24180
24181            /// The maximum value in the
24182            /// [FacetValue.interval][google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval].
24183            /// Only supported on numerical facets and returned if
24184            /// [SearchRequest.FacetSpec.FacetKey.return_min_max][google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]
24185            /// is true.
24186            ///
24187            /// [google.cloud.retail.v2.SearchRequest.FacetSpec.FacetKey.return_min_max]: crate::model::search_request::facet_spec::FacetKey::return_min_max
24188            /// [google.cloud.retail.v2.SearchResponse.Facet.FacetValue.interval]: crate::model::search_response::facet::FacetValue::facet_value
24189            pub max_value: f64,
24190
24191            /// A facet value which contains values.
24192            pub facet_value:
24193                std::option::Option<crate::model::search_response::facet::facet_value::FacetValue>,
24194
24195            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24196        }
24197
24198        impl FacetValue {
24199            /// Creates a new default instance.
24200            pub fn new() -> Self {
24201                std::default::Default::default()
24202            }
24203
24204            /// Sets the value of [count][crate::model::search_response::facet::FacetValue::count].
24205            ///
24206            /// # Example
24207            /// ```ignore,no_run
24208            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24209            /// let x = FacetValue::new().set_count(42);
24210            /// ```
24211            pub fn set_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24212                self.count = v.into();
24213                self
24214            }
24215
24216            /// Sets the value of [min_value][crate::model::search_response::facet::FacetValue::min_value].
24217            ///
24218            /// # Example
24219            /// ```ignore,no_run
24220            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24221            /// let x = FacetValue::new().set_min_value(42.0);
24222            /// ```
24223            pub fn set_min_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
24224                self.min_value = v.into();
24225                self
24226            }
24227
24228            /// Sets the value of [max_value][crate::model::search_response::facet::FacetValue::max_value].
24229            ///
24230            /// # Example
24231            /// ```ignore,no_run
24232            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24233            /// let x = FacetValue::new().set_max_value(42.0);
24234            /// ```
24235            pub fn set_max_value<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
24236                self.max_value = v.into();
24237                self
24238            }
24239
24240            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value].
24241            ///
24242            /// Note that all the setters affecting `facet_value` are mutually
24243            /// exclusive.
24244            ///
24245            /// # Example
24246            /// ```ignore,no_run
24247            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24248            /// use google_cloud_retail_v2::model::search_response::facet::facet_value::FacetValue as FacetValueOneOf;
24249            /// let x = FacetValue::new().set_facet_value(Some(FacetValueOneOf::Value("example".to_string())));
24250            /// ```
24251            pub fn set_facet_value<
24252                T: std::convert::Into<
24253                        std::option::Option<
24254                            crate::model::search_response::facet::facet_value::FacetValue,
24255                        >,
24256                    >,
24257            >(
24258                mut self,
24259                v: T,
24260            ) -> Self {
24261                self.facet_value = v.into();
24262                self
24263            }
24264
24265            /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24266            /// if it holds a `Value`, `None` if the field is not set or
24267            /// holds a different branch.
24268            pub fn value(&self) -> std::option::Option<&std::string::String> {
24269                #[allow(unreachable_patterns)]
24270                self.facet_value.as_ref().and_then(|v| match v {
24271                    crate::model::search_response::facet::facet_value::FacetValue::Value(v) => {
24272                        std::option::Option::Some(v)
24273                    }
24274                    _ => std::option::Option::None,
24275                })
24276            }
24277
24278            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24279            /// to hold a `Value`.
24280            ///
24281            /// Note that all the setters affecting `facet_value` are
24282            /// mutually exclusive.
24283            ///
24284            /// # Example
24285            /// ```ignore,no_run
24286            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24287            /// let x = FacetValue::new().set_value("example");
24288            /// assert!(x.value().is_some());
24289            /// assert!(x.interval().is_none());
24290            /// ```
24291            pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24292                self.facet_value = std::option::Option::Some(
24293                    crate::model::search_response::facet::facet_value::FacetValue::Value(v.into()),
24294                );
24295                self
24296            }
24297
24298            /// The value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24299            /// if it holds a `Interval`, `None` if the field is not set or
24300            /// holds a different branch.
24301            pub fn interval(
24302                &self,
24303            ) -> std::option::Option<&std::boxed::Box<crate::model::Interval>> {
24304                #[allow(unreachable_patterns)]
24305                self.facet_value.as_ref().and_then(|v| match v {
24306                    crate::model::search_response::facet::facet_value::FacetValue::Interval(v) => {
24307                        std::option::Option::Some(v)
24308                    }
24309                    _ => std::option::Option::None,
24310                })
24311            }
24312
24313            /// Sets the value of [facet_value][crate::model::search_response::facet::FacetValue::facet_value]
24314            /// to hold a `Interval`.
24315            ///
24316            /// Note that all the setters affecting `facet_value` are
24317            /// mutually exclusive.
24318            ///
24319            /// # Example
24320            /// ```ignore,no_run
24321            /// # use google_cloud_retail_v2::model::search_response::facet::FacetValue;
24322            /// use google_cloud_retail_v2::model::Interval;
24323            /// let x = FacetValue::new().set_interval(Interval::default()/* use setters */);
24324            /// assert!(x.interval().is_some());
24325            /// assert!(x.value().is_none());
24326            /// ```
24327            pub fn set_interval<T: std::convert::Into<std::boxed::Box<crate::model::Interval>>>(
24328                mut self,
24329                v: T,
24330            ) -> Self {
24331                self.facet_value = std::option::Option::Some(
24332                    crate::model::search_response::facet::facet_value::FacetValue::Interval(
24333                        v.into(),
24334                    ),
24335                );
24336                self
24337            }
24338        }
24339
24340        impl wkt::message::Message for FacetValue {
24341            fn typename() -> &'static str {
24342                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.Facet.FacetValue"
24343            }
24344        }
24345
24346        /// Defines additional types related to [FacetValue].
24347        pub mod facet_value {
24348            #[allow(unused_imports)]
24349            use super::*;
24350
24351            /// A facet value which contains values.
24352            #[derive(Clone, Debug, PartialEq)]
24353            #[non_exhaustive]
24354            pub enum FacetValue {
24355                /// Text value of a facet, such as "Black" for facet "colorFamilies".
24356                Value(std::string::String),
24357                /// Interval value for a facet, such as [10, 20) for facet "price".
24358                Interval(std::boxed::Box<crate::model::Interval>),
24359            }
24360        }
24361    }
24362
24363    /// Information describing query expansion including whether expansion has
24364    /// occurred.
24365    #[derive(Clone, Default, PartialEq)]
24366    #[non_exhaustive]
24367    pub struct QueryExpansionInfo {
24368        /// Bool describing whether query expansion has occurred.
24369        pub expanded_query: bool,
24370
24371        /// Number of pinned results. This field will only be set when expansion
24372        /// happens and
24373        /// [SearchRequest.QueryExpansionSpec.pin_unexpanded_results][google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]
24374        /// is set to true.
24375        ///
24376        /// [google.cloud.retail.v2.SearchRequest.QueryExpansionSpec.pin_unexpanded_results]: crate::model::search_request::QueryExpansionSpec::pin_unexpanded_results
24377        pub pinned_result_count: i64,
24378
24379        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24380    }
24381
24382    impl QueryExpansionInfo {
24383        /// Creates a new default instance.
24384        pub fn new() -> Self {
24385            std::default::Default::default()
24386        }
24387
24388        /// Sets the value of [expanded_query][crate::model::search_response::QueryExpansionInfo::expanded_query].
24389        ///
24390        /// # Example
24391        /// ```ignore,no_run
24392        /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24393        /// let x = QueryExpansionInfo::new().set_expanded_query(true);
24394        /// ```
24395        pub fn set_expanded_query<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
24396            self.expanded_query = v.into();
24397            self
24398        }
24399
24400        /// Sets the value of [pinned_result_count][crate::model::search_response::QueryExpansionInfo::pinned_result_count].
24401        ///
24402        /// # Example
24403        /// ```ignore,no_run
24404        /// # use google_cloud_retail_v2::model::search_response::QueryExpansionInfo;
24405        /// let x = QueryExpansionInfo::new().set_pinned_result_count(42);
24406        /// ```
24407        pub fn set_pinned_result_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
24408            self.pinned_result_count = v.into();
24409            self
24410        }
24411    }
24412
24413    impl wkt::message::Message for QueryExpansionInfo {
24414        fn typename() -> &'static str {
24415            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.QueryExpansionInfo"
24416        }
24417    }
24418
24419    /// This field specifies all related information that is needed on client
24420    /// side for UI rendering of conversational retail search.
24421    #[derive(Clone, Default, PartialEq)]
24422    #[non_exhaustive]
24423    pub struct ConversationalSearchResult {
24424        /// Conversation UUID. This field will be stored in client side storage to
24425        /// maintain the conversation session with server and will be used for next
24426        /// search request's
24427        /// [SearchRequest.ConversationalSearchSpec.conversation_id][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]
24428        /// to restore conversation state in server.
24429        ///
24430        /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.conversation_id]: crate::model::search_request::ConversationalSearchSpec::conversation_id
24431        pub conversation_id: std::string::String,
24432
24433        /// The current refined query for the conversational search. This field
24434        /// will be used in customer UI that the query in the search bar should be
24435        /// replaced with the refined query. For example, if
24436        /// [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] is
24437        /// `dress` and next
24438        /// [SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer][google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]
24439        /// is `red color`, which does not match any product attribute value filters,
24440        /// the refined query will be `dress, red color`.
24441        ///
24442        /// [google.cloud.retail.v2.SearchRequest.ConversationalSearchSpec.UserAnswer.text_answer]: crate::model::search_request::conversational_search_spec::UserAnswer::type
24443        /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
24444        pub refined_query: std::string::String,
24445
24446        /// This field is deprecated but will be kept for backward compatibility.
24447        /// There is expected to have only one additional filter and the value will
24448        /// be the same to the same as field `additional_filter`.
24449        #[deprecated]
24450        pub additional_filters: std::vec::Vec<
24451            crate::model::search_response::conversational_search_result::AdditionalFilter,
24452        >,
24453
24454        /// The follow-up question. e.g., `What is the color?`
24455        pub followup_question: std::string::String,
24456
24457        /// The answer options provided to client for the follow-up question.
24458        pub suggested_answers: std::vec::Vec<
24459            crate::model::search_response::conversational_search_result::SuggestedAnswer,
24460        >,
24461
24462        /// This is the incremental additional filters implied from the current
24463        /// user answer. User should add the suggested addition filters to the
24464        /// previous
24465        /// [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter],  and
24466        /// use the merged filter in the follow up search request.
24467        ///
24468        /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
24469        pub additional_filter: std::option::Option<
24470            crate::model::search_response::conversational_search_result::AdditionalFilter,
24471        >,
24472
24473        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24474    }
24475
24476    impl ConversationalSearchResult {
24477        /// Creates a new default instance.
24478        pub fn new() -> Self {
24479            std::default::Default::default()
24480        }
24481
24482        /// Sets the value of [conversation_id][crate::model::search_response::ConversationalSearchResult::conversation_id].
24483        ///
24484        /// # Example
24485        /// ```ignore,no_run
24486        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24487        /// let x = ConversationalSearchResult::new().set_conversation_id("example");
24488        /// ```
24489        pub fn set_conversation_id<T: std::convert::Into<std::string::String>>(
24490            mut self,
24491            v: T,
24492        ) -> Self {
24493            self.conversation_id = v.into();
24494            self
24495        }
24496
24497        /// Sets the value of [refined_query][crate::model::search_response::ConversationalSearchResult::refined_query].
24498        ///
24499        /// # Example
24500        /// ```ignore,no_run
24501        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24502        /// let x = ConversationalSearchResult::new().set_refined_query("example");
24503        /// ```
24504        pub fn set_refined_query<T: std::convert::Into<std::string::String>>(
24505            mut self,
24506            v: T,
24507        ) -> Self {
24508            self.refined_query = v.into();
24509            self
24510        }
24511
24512        /// Sets the value of [additional_filters][crate::model::search_response::ConversationalSearchResult::additional_filters].
24513        ///
24514        /// # Example
24515        /// ```ignore,no_run
24516        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24517        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24518        /// let x = ConversationalSearchResult::new()
24519        ///     .set_additional_filters([
24520        ///         AdditionalFilter::default()/* use setters */,
24521        ///         AdditionalFilter::default()/* use (different) setters */,
24522        ///     ]);
24523        /// ```
24524        #[deprecated]
24525        pub fn set_additional_filters<T, V>(mut self, v: T) -> Self
24526        where
24527            T: std::iter::IntoIterator<Item = V>,
24528            V: std::convert::Into<
24529                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24530                >,
24531        {
24532            use std::iter::Iterator;
24533            self.additional_filters = v.into_iter().map(|i| i.into()).collect();
24534            self
24535        }
24536
24537        /// Sets the value of [followup_question][crate::model::search_response::ConversationalSearchResult::followup_question].
24538        ///
24539        /// # Example
24540        /// ```ignore,no_run
24541        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24542        /// let x = ConversationalSearchResult::new().set_followup_question("example");
24543        /// ```
24544        pub fn set_followup_question<T: std::convert::Into<std::string::String>>(
24545            mut self,
24546            v: T,
24547        ) -> Self {
24548            self.followup_question = v.into();
24549            self
24550        }
24551
24552        /// Sets the value of [suggested_answers][crate::model::search_response::ConversationalSearchResult::suggested_answers].
24553        ///
24554        /// # Example
24555        /// ```ignore,no_run
24556        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24557        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24558        /// let x = ConversationalSearchResult::new()
24559        ///     .set_suggested_answers([
24560        ///         SuggestedAnswer::default()/* use setters */,
24561        ///         SuggestedAnswer::default()/* use (different) setters */,
24562        ///     ]);
24563        /// ```
24564        pub fn set_suggested_answers<T, V>(mut self, v: T) -> Self
24565        where
24566            T: std::iter::IntoIterator<Item = V>,
24567            V: std::convert::Into<
24568                    crate::model::search_response::conversational_search_result::SuggestedAnswer,
24569                >,
24570        {
24571            use std::iter::Iterator;
24572            self.suggested_answers = v.into_iter().map(|i| i.into()).collect();
24573            self
24574        }
24575
24576        /// Sets the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24577        ///
24578        /// # Example
24579        /// ```ignore,no_run
24580        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24581        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24582        /// let x = ConversationalSearchResult::new().set_additional_filter(AdditionalFilter::default()/* use setters */);
24583        /// ```
24584        pub fn set_additional_filter<T>(mut self, v: T) -> Self
24585        where
24586            T: std::convert::Into<
24587                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24588                >,
24589        {
24590            self.additional_filter = std::option::Option::Some(v.into());
24591            self
24592        }
24593
24594        /// Sets or clears the value of [additional_filter][crate::model::search_response::ConversationalSearchResult::additional_filter].
24595        ///
24596        /// # Example
24597        /// ```ignore,no_run
24598        /// # use google_cloud_retail_v2::model::search_response::ConversationalSearchResult;
24599        /// use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24600        /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(Some(AdditionalFilter::default()/* use setters */));
24601        /// let x = ConversationalSearchResult::new().set_or_clear_additional_filter(None::<AdditionalFilter>);
24602        /// ```
24603        pub fn set_or_clear_additional_filter<T>(mut self, v: std::option::Option<T>) -> Self
24604        where
24605            T: std::convert::Into<
24606                    crate::model::search_response::conversational_search_result::AdditionalFilter,
24607                >,
24608        {
24609            self.additional_filter = v.map(|x| x.into());
24610            self
24611        }
24612    }
24613
24614    impl wkt::message::Message for ConversationalSearchResult {
24615        fn typename() -> &'static str {
24616            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult"
24617        }
24618    }
24619
24620    /// Defines additional types related to [ConversationalSearchResult].
24621    pub mod conversational_search_result {
24622        #[allow(unused_imports)]
24623        use super::*;
24624
24625        /// Suggested answers to the follow-up question.
24626        #[derive(Clone, Default, PartialEq)]
24627        #[non_exhaustive]
24628        pub struct SuggestedAnswer {
24629            /// Product attribute value, including an attribute key and an
24630            /// attribute value. Other types can be added here in the future.
24631            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24632
24633            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24634        }
24635
24636        impl SuggestedAnswer {
24637            /// Creates a new default instance.
24638            pub fn new() -> Self {
24639                std::default::Default::default()
24640            }
24641
24642            /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24643            ///
24644            /// # Example
24645            /// ```ignore,no_run
24646            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24647            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24648            /// let x = SuggestedAnswer::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24649            /// ```
24650            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24651            where
24652                T: std::convert::Into<crate::model::ProductAttributeValue>,
24653            {
24654                self.product_attribute_value = std::option::Option::Some(v.into());
24655                self
24656            }
24657
24658            /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::SuggestedAnswer::product_attribute_value].
24659            ///
24660            /// # Example
24661            /// ```ignore,no_run
24662            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::SuggestedAnswer;
24663            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24664            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24665            /// let x = SuggestedAnswer::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24666            /// ```
24667            pub fn set_or_clear_product_attribute_value<T>(
24668                mut self,
24669                v: std::option::Option<T>,
24670            ) -> Self
24671            where
24672                T: std::convert::Into<crate::model::ProductAttributeValue>,
24673            {
24674                self.product_attribute_value = v.map(|x| x.into());
24675                self
24676            }
24677        }
24678
24679        impl wkt::message::Message for SuggestedAnswer {
24680            fn typename() -> &'static str {
24681                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.SuggestedAnswer"
24682            }
24683        }
24684
24685        /// Additional filter that client side need to apply.
24686        #[derive(Clone, Default, PartialEq)]
24687        #[non_exhaustive]
24688        pub struct AdditionalFilter {
24689            /// Product attribute value, including an attribute key and an
24690            /// attribute value. Other types can be added here in the future.
24691            pub product_attribute_value: std::option::Option<crate::model::ProductAttributeValue>,
24692
24693            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24694        }
24695
24696        impl AdditionalFilter {
24697            /// Creates a new default instance.
24698            pub fn new() -> Self {
24699                std::default::Default::default()
24700            }
24701
24702            /// Sets the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24703            ///
24704            /// # Example
24705            /// ```ignore,no_run
24706            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24707            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24708            /// let x = AdditionalFilter::new().set_product_attribute_value(ProductAttributeValue::default()/* use setters */);
24709            /// ```
24710            pub fn set_product_attribute_value<T>(mut self, v: T) -> Self
24711            where
24712                T: std::convert::Into<crate::model::ProductAttributeValue>,
24713            {
24714                self.product_attribute_value = std::option::Option::Some(v.into());
24715                self
24716            }
24717
24718            /// Sets or clears the value of [product_attribute_value][crate::model::search_response::conversational_search_result::AdditionalFilter::product_attribute_value].
24719            ///
24720            /// # Example
24721            /// ```ignore,no_run
24722            /// # use google_cloud_retail_v2::model::search_response::conversational_search_result::AdditionalFilter;
24723            /// use google_cloud_retail_v2::model::ProductAttributeValue;
24724            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(Some(ProductAttributeValue::default()/* use setters */));
24725            /// let x = AdditionalFilter::new().set_or_clear_product_attribute_value(None::<ProductAttributeValue>);
24726            /// ```
24727            pub fn set_or_clear_product_attribute_value<T>(
24728                mut self,
24729                v: std::option::Option<T>,
24730            ) -> Self
24731            where
24732                T: std::convert::Into<crate::model::ProductAttributeValue>,
24733            {
24734                self.product_attribute_value = v.map(|x| x.into());
24735                self
24736            }
24737        }
24738
24739        impl wkt::message::Message for AdditionalFilter {
24740            fn typename() -> &'static str {
24741                "type.googleapis.com/google.cloud.retail.v2.SearchResponse.ConversationalSearchResult.AdditionalFilter"
24742            }
24743        }
24744    }
24745
24746    /// This field specifies all related information for tile navigation that will
24747    /// be used in client side.
24748    #[derive(Clone, Default, PartialEq)]
24749    #[non_exhaustive]
24750    pub struct TileNavigationResult {
24751        /// The current tiles that are used for tile navigation, sorted by
24752        /// engagement.
24753        pub tiles: std::vec::Vec<crate::model::Tile>,
24754
24755        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24756    }
24757
24758    impl TileNavigationResult {
24759        /// Creates a new default instance.
24760        pub fn new() -> Self {
24761            std::default::Default::default()
24762        }
24763
24764        /// Sets the value of [tiles][crate::model::search_response::TileNavigationResult::tiles].
24765        ///
24766        /// # Example
24767        /// ```ignore,no_run
24768        /// # use google_cloud_retail_v2::model::search_response::TileNavigationResult;
24769        /// use google_cloud_retail_v2::model::Tile;
24770        /// let x = TileNavigationResult::new()
24771        ///     .set_tiles([
24772        ///         Tile::default()/* use setters */,
24773        ///         Tile::default()/* use (different) setters */,
24774        ///     ]);
24775        /// ```
24776        pub fn set_tiles<T, V>(mut self, v: T) -> Self
24777        where
24778            T: std::iter::IntoIterator<Item = V>,
24779            V: std::convert::Into<crate::model::Tile>,
24780        {
24781            use std::iter::Iterator;
24782            self.tiles = v.into_iter().map(|i| i.into()).collect();
24783            self
24784        }
24785    }
24786
24787    impl wkt::message::Message for TileNavigationResult {
24788        fn typename() -> &'static str {
24789            "type.googleapis.com/google.cloud.retail.v2.SearchResponse.TileNavigationResult"
24790        }
24791    }
24792}
24793
24794/// Metadata for active A/B testing experiment.
24795#[derive(Clone, Default, PartialEq)]
24796#[non_exhaustive]
24797pub struct ExperimentInfo {
24798    /// The fully qualified resource name of the experiment that provides the
24799    /// serving config under test, should an active experiment exist. For example:
24800    /// `projects/*/locations/global/catalogs/default_catalog/experiments/experiment_id`
24801    pub experiment: std::string::String,
24802
24803    /// Information associated with the specific experiment entity being recorded.
24804    pub experiment_metadata: std::option::Option<crate::model::experiment_info::ExperimentMetadata>,
24805
24806    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24807}
24808
24809impl ExperimentInfo {
24810    /// Creates a new default instance.
24811    pub fn new() -> Self {
24812        std::default::Default::default()
24813    }
24814
24815    /// Sets the value of [experiment][crate::model::ExperimentInfo::experiment].
24816    ///
24817    /// # Example
24818    /// ```ignore,no_run
24819    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24820    /// let x = ExperimentInfo::new().set_experiment("example");
24821    /// ```
24822    pub fn set_experiment<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
24823        self.experiment = v.into();
24824        self
24825    }
24826
24827    /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata].
24828    ///
24829    /// Note that all the setters affecting `experiment_metadata` are mutually
24830    /// exclusive.
24831    ///
24832    /// # Example
24833    /// ```ignore,no_run
24834    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24835    /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24836    /// let x = ExperimentInfo::new().set_experiment_metadata(Some(
24837    ///     google_cloud_retail_v2::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(ServingConfigExperiment::default().into())));
24838    /// ```
24839    pub fn set_experiment_metadata<
24840        T: std::convert::Into<std::option::Option<crate::model::experiment_info::ExperimentMetadata>>,
24841    >(
24842        mut self,
24843        v: T,
24844    ) -> Self {
24845        self.experiment_metadata = v.into();
24846        self
24847    }
24848
24849    /// The value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24850    /// if it holds a `ServingConfigExperiment`, `None` if the field is not set or
24851    /// holds a different branch.
24852    pub fn serving_config_experiment(
24853        &self,
24854    ) -> std::option::Option<&std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>
24855    {
24856        #[allow(unreachable_patterns)]
24857        self.experiment_metadata.as_ref().and_then(|v| match v {
24858            crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v) => {
24859                std::option::Option::Some(v)
24860            }
24861            _ => std::option::Option::None,
24862        })
24863    }
24864
24865    /// Sets the value of [experiment_metadata][crate::model::ExperimentInfo::experiment_metadata]
24866    /// to hold a `ServingConfigExperiment`.
24867    ///
24868    /// Note that all the setters affecting `experiment_metadata` are
24869    /// mutually exclusive.
24870    ///
24871    /// # Example
24872    /// ```ignore,no_run
24873    /// # use google_cloud_retail_v2::model::ExperimentInfo;
24874    /// use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24875    /// let x = ExperimentInfo::new().set_serving_config_experiment(ServingConfigExperiment::default()/* use setters */);
24876    /// assert!(x.serving_config_experiment().is_some());
24877    /// ```
24878    pub fn set_serving_config_experiment<
24879        T: std::convert::Into<std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>>,
24880    >(
24881        mut self,
24882        v: T,
24883    ) -> Self {
24884        self.experiment_metadata = std::option::Option::Some(
24885            crate::model::experiment_info::ExperimentMetadata::ServingConfigExperiment(v.into()),
24886        );
24887        self
24888    }
24889}
24890
24891impl wkt::message::Message for ExperimentInfo {
24892    fn typename() -> &'static str {
24893        "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo"
24894    }
24895}
24896
24897/// Defines additional types related to [ExperimentInfo].
24898pub mod experiment_info {
24899    #[allow(unused_imports)]
24900    use super::*;
24901
24902    /// Metadata for active serving config A/B tests.
24903    #[derive(Clone, Default, PartialEq)]
24904    #[non_exhaustive]
24905    pub struct ServingConfigExperiment {
24906        /// The fully qualified resource name of the original
24907        /// [SearchRequest.placement][google.cloud.retail.v2.SearchRequest.placement]
24908        /// in the search request prior to reassignment by experiment API. For
24909        /// example: `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24910        ///
24911        /// [google.cloud.retail.v2.SearchRequest.placement]: crate::model::SearchRequest::placement
24912        pub original_serving_config: std::string::String,
24913
24914        /// The fully qualified resource name of the serving config
24915        /// `Experiment.VariantArm.serving_config_id` responsible for generating
24916        /// the search response. For example:
24917        /// `projects/*/locations/*/catalogs/*/servingConfigs/*`.
24918        pub experiment_serving_config: std::string::String,
24919
24920        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
24921    }
24922
24923    impl ServingConfigExperiment {
24924        /// Creates a new default instance.
24925        pub fn new() -> Self {
24926            std::default::Default::default()
24927        }
24928
24929        /// Sets the value of [original_serving_config][crate::model::experiment_info::ServingConfigExperiment::original_serving_config].
24930        ///
24931        /// # Example
24932        /// ```ignore,no_run
24933        /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24934        /// # let project_id = "project_id";
24935        /// # let location_id = "location_id";
24936        /// # let catalog_id = "catalog_id";
24937        /// # let serving_config_id = "serving_config_id";
24938        /// let x = ServingConfigExperiment::new().set_original_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
24939        /// ```
24940        pub fn set_original_serving_config<T: std::convert::Into<std::string::String>>(
24941            mut self,
24942            v: T,
24943        ) -> Self {
24944            self.original_serving_config = v.into();
24945            self
24946        }
24947
24948        /// Sets the value of [experiment_serving_config][crate::model::experiment_info::ServingConfigExperiment::experiment_serving_config].
24949        ///
24950        /// # Example
24951        /// ```ignore,no_run
24952        /// # use google_cloud_retail_v2::model::experiment_info::ServingConfigExperiment;
24953        /// # let project_id = "project_id";
24954        /// # let location_id = "location_id";
24955        /// # let catalog_id = "catalog_id";
24956        /// # let serving_config_id = "serving_config_id";
24957        /// let x = ServingConfigExperiment::new().set_experiment_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
24958        /// ```
24959        pub fn set_experiment_serving_config<T: std::convert::Into<std::string::String>>(
24960            mut self,
24961            v: T,
24962        ) -> Self {
24963            self.experiment_serving_config = v.into();
24964            self
24965        }
24966    }
24967
24968    impl wkt::message::Message for ServingConfigExperiment {
24969        fn typename() -> &'static str {
24970            "type.googleapis.com/google.cloud.retail.v2.ExperimentInfo.ServingConfigExperiment"
24971        }
24972    }
24973
24974    /// Information associated with the specific experiment entity being recorded.
24975    #[derive(Clone, Debug, PartialEq)]
24976    #[non_exhaustive]
24977    pub enum ExperimentMetadata {
24978        /// A/B test between existing Cloud Retail Search
24979        /// [ServingConfig][google.cloud.retail.v2.ServingConfig]s.
24980        ///
24981        /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
24982        ServingConfigExperiment(
24983            std::boxed::Box<crate::model::experiment_info::ServingConfigExperiment>,
24984        ),
24985    }
24986}
24987
24988/// Configures metadata that is used to generate serving time results (e.g.
24989/// search results or recommendation predictions).
24990#[derive(Clone, Default, PartialEq)]
24991#[non_exhaustive]
24992pub struct ServingConfig {
24993    /// Immutable. Fully qualified name
24994    /// `projects/*/locations/global/catalogs/*/servingConfig/*`
24995    pub name: std::string::String,
24996
24997    /// Required. The human readable serving config display name. Used in Retail
24998    /// UI.
24999    ///
25000    /// This field must be a UTF-8 encoded string with a length limit of 128
25001    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
25002    pub display_name: std::string::String,
25003
25004    /// The id of the model in the same [Catalog][google.cloud.retail.v2.Catalog]
25005    /// to use at serving time. Currently only RecommendationModels are supported:
25006    /// <https://cloud.google.com/retail/recommendations-ai/docs/create-models>
25007    /// Can be changed but only to a compatible model (e.g.
25008    /// others-you-may-like CTR to others-you-may-like CVR).
25009    ///
25010    /// Required when
25011    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25012    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25013    ///
25014    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
25015    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25016    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25017    pub model_id: std::string::String,
25018
25019    /// How much price ranking we want in serving results.
25020    /// Price reranking causes product items with a similar
25021    /// recommendation probability to be ordered by price, with the
25022    /// highest-priced items first. This setting could result in a decrease in
25023    /// click-through and conversion rates.
25024    /// Allowed values are:
25025    ///
25026    /// * `no-price-reranking`
25027    /// * `low-price-reranking`
25028    /// * `medium-price-reranking`
25029    /// * `high-price-reranking`
25030    ///
25031    /// If not specified, we choose default based on model type. Default value:
25032    /// `no-price-reranking`.
25033    ///
25034    /// Can only be set if
25035    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25036    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25037    ///
25038    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25039    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25040    pub price_reranking_level: std::string::String,
25041
25042    /// Facet specifications for faceted search. If empty, no facets are returned.
25043    /// The ids refer to the ids of [Control][google.cloud.retail.v2.Control]
25044    /// resources with only the Facet control set. These controls are assumed to be
25045    /// in the same [Catalog][google.cloud.retail.v2.Catalog] as the
25046    /// [ServingConfig][google.cloud.retail.v2.ServingConfig].
25047    /// A maximum of 100 values are allowed. Otherwise, an INVALID_ARGUMENT error
25048    /// is returned.
25049    ///
25050    /// Can only be set if
25051    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25052    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25053    ///
25054    /// [google.cloud.retail.v2.Catalog]: crate::model::Catalog
25055    /// [google.cloud.retail.v2.Control]: crate::model::Control
25056    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25057    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25058    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25059    pub facet_control_ids: std::vec::Vec<std::string::String>,
25060
25061    /// The specification for dynamically generated facets. Notice that only
25062    /// textual facets can be dynamically generated.
25063    ///
25064    /// Can only be set if
25065    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25066    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25067    ///
25068    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25069    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25070    pub dynamic_facet_spec: std::option::Option<crate::model::search_request::DynamicFacetSpec>,
25071
25072    /// Condition boost specifications. If a product matches multiple conditions
25073    /// in the specifications, boost scores from these specifications are all
25074    /// applied and combined in a non-linear way. Maximum number of
25075    /// specifications is 100.
25076    ///
25077    /// Notice that if both
25078    /// [ServingConfig.boost_control_ids][google.cloud.retail.v2.ServingConfig.boost_control_ids]
25079    /// and
25080    /// [SearchRequest.boost_spec][google.cloud.retail.v2.SearchRequest.boost_spec]
25081    /// are set, the boost conditions from both places are evaluated. If a search
25082    /// request matches multiple boost conditions, the final boost score is equal
25083    /// to the sum of the boost scores from all matched boost conditions.
25084    ///
25085    /// Can only be set if
25086    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25087    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25088    ///
25089    /// [google.cloud.retail.v2.SearchRequest.boost_spec]: crate::model::SearchRequest::boost_spec
25090    /// [google.cloud.retail.v2.ServingConfig.boost_control_ids]: crate::model::ServingConfig::boost_control_ids
25091    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25092    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25093    pub boost_control_ids: std::vec::Vec<std::string::String>,
25094
25095    /// Condition filter specifications. If a product matches multiple conditions
25096    /// in the specifications, filters from these specifications are all
25097    /// applied and combined via the AND operator. Maximum number of
25098    /// specifications is 100.
25099    ///
25100    /// Can only be set if
25101    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25102    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25103    ///
25104    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25105    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25106    pub filter_control_ids: std::vec::Vec<std::string::String>,
25107
25108    /// Condition redirect specifications. Only the first triggered redirect action
25109    /// is applied, even if multiple apply. Maximum number of specifications is
25110    /// 1000.
25111    ///
25112    /// Can only be set if
25113    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25114    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25115    ///
25116    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25117    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25118    pub redirect_control_ids: std::vec::Vec<std::string::String>,
25119
25120    /// Condition synonyms specifications. If multiple syonyms conditions match,
25121    /// all matching synonyms control in the list will execute. Order of controls
25122    /// in the list will not matter. Maximum number of specifications is
25123    /// 100.
25124    ///
25125    /// Can only be set if
25126    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25127    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25128    ///
25129    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25130    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25131    pub twoway_synonyms_control_ids: std::vec::Vec<std::string::String>,
25132
25133    /// Condition oneway synonyms specifications. If multiple oneway synonyms
25134    /// conditions match, all matching oneway synonyms controls in the list will
25135    /// execute. Order of controls in the list will not matter. Maximum number of
25136    /// specifications is 100.
25137    ///
25138    /// Can only be set if
25139    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25140    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25141    ///
25142    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25143    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25144    pub oneway_synonyms_control_ids: std::vec::Vec<std::string::String>,
25145
25146    /// Condition do not associate specifications. If multiple do not associate
25147    /// conditions match, all matching do not associate controls in the list will
25148    /// execute.
25149    ///
25150    /// - Order does not matter.
25151    /// - Maximum number of specifications is 100.
25152    ///
25153    /// Can only be set if
25154    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25155    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25156    ///
25157    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25158    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25159    pub do_not_associate_control_ids: std::vec::Vec<std::string::String>,
25160
25161    /// Condition replacement specifications.
25162    ///
25163    /// - Applied according to the order in the list.
25164    /// - A previously replaced term can not be re-replaced.
25165    /// - Maximum number of specifications is 100.
25166    ///
25167    /// Can only be set if
25168    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25169    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25170    ///
25171    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25172    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25173    pub replacement_control_ids: std::vec::Vec<std::string::String>,
25174
25175    /// Condition ignore specifications. If multiple ignore
25176    /// conditions match, all matching ignore controls in the list will
25177    /// execute.
25178    ///
25179    /// - Order does not matter.
25180    /// - Maximum number of specifications is 100.
25181    ///
25182    /// Can only be set if
25183    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25184    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25185    ///
25186    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25187    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25188    pub ignore_control_ids: std::vec::Vec<std::string::String>,
25189
25190    /// How much diversity to use in recommendation model results e.g.
25191    /// `medium-diversity` or `high-diversity`. Currently supported values:
25192    ///
25193    /// * `no-diversity`
25194    /// * `low-diversity`
25195    /// * `medium-diversity`
25196    /// * `high-diversity`
25197    /// * `auto-diversity`
25198    ///
25199    /// If not specified, we choose default based on recommendation model
25200    /// type. Default value: `no-diversity`.
25201    ///
25202    /// Can only be set if
25203    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25204    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25205    ///
25206    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25207    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25208    pub diversity_level: std::string::String,
25209
25210    /// What kind of diversity to use - data driven or rule based. If unset, the
25211    /// server behavior defaults to
25212    /// [RULE_BASED_DIVERSITY][google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY].
25213    ///
25214    /// [google.cloud.retail.v2.ServingConfig.DiversityType.RULE_BASED_DIVERSITY]: crate::model::serving_config::DiversityType::RuleBasedDiversity
25215    pub diversity_type: crate::model::serving_config::DiversityType,
25216
25217    /// Whether to add additional category filters on the `similar-items` model.
25218    /// If not specified, we enable it by default.
25219    /// Allowed values are:
25220    ///
25221    /// * `no-category-match`: No additional filtering of original results from
25222    ///   the model and the customer's filters.
25223    /// * `relaxed-category-match`: Only keep results with categories that match
25224    ///   at least one item categories in the PredictRequests's context item.
25225    ///   * If customer also sends filters in the PredictRequest, then the results
25226    ///     will satisfy both conditions (user given and category match).
25227    ///
25228    /// Can only be set if
25229    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25230    /// [SOLUTION_TYPE_RECOMMENDATION][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION].
25231    ///
25232    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25233    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_RECOMMENDATION]: crate::model::SolutionType::Recommendation
25234    pub enable_category_filter_level: std::string::String,
25235
25236    /// When the flag is enabled, the products in the denylist will not be filtered
25237    /// out in the recommendation filtering results.
25238    pub ignore_recs_denylist: bool,
25239
25240    /// The specification for personalization spec.
25241    ///
25242    /// Can only be set if
25243    /// [solution_types][google.cloud.retail.v2.ServingConfig.solution_types] is
25244    /// [SOLUTION_TYPE_SEARCH][google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH].
25245    ///
25246    /// Notice that if both
25247    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec]
25248    /// and
25249    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
25250    /// are set.
25251    /// [SearchRequest.personalization_spec][google.cloud.retail.v2.SearchRequest.personalization_spec]
25252    /// will override
25253    /// [ServingConfig.personalization_spec][google.cloud.retail.v2.ServingConfig.personalization_spec].
25254    ///
25255    /// [google.cloud.retail.v2.SearchRequest.personalization_spec]: crate::model::SearchRequest::personalization_spec
25256    /// [google.cloud.retail.v2.ServingConfig.personalization_spec]: crate::model::ServingConfig::personalization_spec
25257    /// [google.cloud.retail.v2.ServingConfig.solution_types]: crate::model::ServingConfig::solution_types
25258    /// [google.cloud.retail.v2.SolutionType.SOLUTION_TYPE_SEARCH]: crate::model::SolutionType::Search
25259    pub personalization_spec:
25260        std::option::Option<crate::model::search_request::PersonalizationSpec>,
25261
25262    /// Required. Immutable. Specifies the solution types that a serving config can
25263    /// be associated with. Currently we support setting only one type of solution.
25264    pub solution_types: std::vec::Vec<crate::model::SolutionType>,
25265
25266    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25267}
25268
25269impl ServingConfig {
25270    /// Creates a new default instance.
25271    pub fn new() -> Self {
25272        std::default::Default::default()
25273    }
25274
25275    /// Sets the value of [name][crate::model::ServingConfig::name].
25276    ///
25277    /// # Example
25278    /// ```ignore,no_run
25279    /// # use google_cloud_retail_v2::model::ServingConfig;
25280    /// # let project_id = "project_id";
25281    /// # let location_id = "location_id";
25282    /// # let catalog_id = "catalog_id";
25283    /// # let serving_config_id = "serving_config_id";
25284    /// let x = ServingConfig::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
25285    /// ```
25286    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25287        self.name = v.into();
25288        self
25289    }
25290
25291    /// Sets the value of [display_name][crate::model::ServingConfig::display_name].
25292    ///
25293    /// # Example
25294    /// ```ignore,no_run
25295    /// # use google_cloud_retail_v2::model::ServingConfig;
25296    /// let x = ServingConfig::new().set_display_name("example");
25297    /// ```
25298    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25299        self.display_name = v.into();
25300        self
25301    }
25302
25303    /// Sets the value of [model_id][crate::model::ServingConfig::model_id].
25304    ///
25305    /// # Example
25306    /// ```ignore,no_run
25307    /// # use google_cloud_retail_v2::model::ServingConfig;
25308    /// let x = ServingConfig::new().set_model_id("example");
25309    /// ```
25310    pub fn set_model_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25311        self.model_id = v.into();
25312        self
25313    }
25314
25315    /// Sets the value of [price_reranking_level][crate::model::ServingConfig::price_reranking_level].
25316    ///
25317    /// # Example
25318    /// ```ignore,no_run
25319    /// # use google_cloud_retail_v2::model::ServingConfig;
25320    /// let x = ServingConfig::new().set_price_reranking_level("example");
25321    /// ```
25322    pub fn set_price_reranking_level<T: std::convert::Into<std::string::String>>(
25323        mut self,
25324        v: T,
25325    ) -> Self {
25326        self.price_reranking_level = v.into();
25327        self
25328    }
25329
25330    /// Sets the value of [facet_control_ids][crate::model::ServingConfig::facet_control_ids].
25331    ///
25332    /// # Example
25333    /// ```ignore,no_run
25334    /// # use google_cloud_retail_v2::model::ServingConfig;
25335    /// let x = ServingConfig::new().set_facet_control_ids(["a", "b", "c"]);
25336    /// ```
25337    pub fn set_facet_control_ids<T, V>(mut self, v: T) -> Self
25338    where
25339        T: std::iter::IntoIterator<Item = V>,
25340        V: std::convert::Into<std::string::String>,
25341    {
25342        use std::iter::Iterator;
25343        self.facet_control_ids = v.into_iter().map(|i| i.into()).collect();
25344        self
25345    }
25346
25347    /// Sets the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25348    ///
25349    /// # Example
25350    /// ```ignore,no_run
25351    /// # use google_cloud_retail_v2::model::ServingConfig;
25352    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25353    /// let x = ServingConfig::new().set_dynamic_facet_spec(DynamicFacetSpec::default()/* use setters */);
25354    /// ```
25355    pub fn set_dynamic_facet_spec<T>(mut self, v: T) -> Self
25356    where
25357        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25358    {
25359        self.dynamic_facet_spec = std::option::Option::Some(v.into());
25360        self
25361    }
25362
25363    /// Sets or clears the value of [dynamic_facet_spec][crate::model::ServingConfig::dynamic_facet_spec].
25364    ///
25365    /// # Example
25366    /// ```ignore,no_run
25367    /// # use google_cloud_retail_v2::model::ServingConfig;
25368    /// use google_cloud_retail_v2::model::search_request::DynamicFacetSpec;
25369    /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(Some(DynamicFacetSpec::default()/* use setters */));
25370    /// let x = ServingConfig::new().set_or_clear_dynamic_facet_spec(None::<DynamicFacetSpec>);
25371    /// ```
25372    pub fn set_or_clear_dynamic_facet_spec<T>(mut self, v: std::option::Option<T>) -> Self
25373    where
25374        T: std::convert::Into<crate::model::search_request::DynamicFacetSpec>,
25375    {
25376        self.dynamic_facet_spec = v.map(|x| x.into());
25377        self
25378    }
25379
25380    /// Sets the value of [boost_control_ids][crate::model::ServingConfig::boost_control_ids].
25381    ///
25382    /// # Example
25383    /// ```ignore,no_run
25384    /// # use google_cloud_retail_v2::model::ServingConfig;
25385    /// let x = ServingConfig::new().set_boost_control_ids(["a", "b", "c"]);
25386    /// ```
25387    pub fn set_boost_control_ids<T, V>(mut self, v: T) -> Self
25388    where
25389        T: std::iter::IntoIterator<Item = V>,
25390        V: std::convert::Into<std::string::String>,
25391    {
25392        use std::iter::Iterator;
25393        self.boost_control_ids = v.into_iter().map(|i| i.into()).collect();
25394        self
25395    }
25396
25397    /// Sets the value of [filter_control_ids][crate::model::ServingConfig::filter_control_ids].
25398    ///
25399    /// # Example
25400    /// ```ignore,no_run
25401    /// # use google_cloud_retail_v2::model::ServingConfig;
25402    /// let x = ServingConfig::new().set_filter_control_ids(["a", "b", "c"]);
25403    /// ```
25404    pub fn set_filter_control_ids<T, V>(mut self, v: T) -> Self
25405    where
25406        T: std::iter::IntoIterator<Item = V>,
25407        V: std::convert::Into<std::string::String>,
25408    {
25409        use std::iter::Iterator;
25410        self.filter_control_ids = v.into_iter().map(|i| i.into()).collect();
25411        self
25412    }
25413
25414    /// Sets the value of [redirect_control_ids][crate::model::ServingConfig::redirect_control_ids].
25415    ///
25416    /// # Example
25417    /// ```ignore,no_run
25418    /// # use google_cloud_retail_v2::model::ServingConfig;
25419    /// let x = ServingConfig::new().set_redirect_control_ids(["a", "b", "c"]);
25420    /// ```
25421    pub fn set_redirect_control_ids<T, V>(mut self, v: T) -> Self
25422    where
25423        T: std::iter::IntoIterator<Item = V>,
25424        V: std::convert::Into<std::string::String>,
25425    {
25426        use std::iter::Iterator;
25427        self.redirect_control_ids = v.into_iter().map(|i| i.into()).collect();
25428        self
25429    }
25430
25431    /// Sets the value of [twoway_synonyms_control_ids][crate::model::ServingConfig::twoway_synonyms_control_ids].
25432    ///
25433    /// # Example
25434    /// ```ignore,no_run
25435    /// # use google_cloud_retail_v2::model::ServingConfig;
25436    /// let x = ServingConfig::new().set_twoway_synonyms_control_ids(["a", "b", "c"]);
25437    /// ```
25438    pub fn set_twoway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25439    where
25440        T: std::iter::IntoIterator<Item = V>,
25441        V: std::convert::Into<std::string::String>,
25442    {
25443        use std::iter::Iterator;
25444        self.twoway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25445        self
25446    }
25447
25448    /// Sets the value of [oneway_synonyms_control_ids][crate::model::ServingConfig::oneway_synonyms_control_ids].
25449    ///
25450    /// # Example
25451    /// ```ignore,no_run
25452    /// # use google_cloud_retail_v2::model::ServingConfig;
25453    /// let x = ServingConfig::new().set_oneway_synonyms_control_ids(["a", "b", "c"]);
25454    /// ```
25455    pub fn set_oneway_synonyms_control_ids<T, V>(mut self, v: T) -> Self
25456    where
25457        T: std::iter::IntoIterator<Item = V>,
25458        V: std::convert::Into<std::string::String>,
25459    {
25460        use std::iter::Iterator;
25461        self.oneway_synonyms_control_ids = v.into_iter().map(|i| i.into()).collect();
25462        self
25463    }
25464
25465    /// Sets the value of [do_not_associate_control_ids][crate::model::ServingConfig::do_not_associate_control_ids].
25466    ///
25467    /// # Example
25468    /// ```ignore,no_run
25469    /// # use google_cloud_retail_v2::model::ServingConfig;
25470    /// let x = ServingConfig::new().set_do_not_associate_control_ids(["a", "b", "c"]);
25471    /// ```
25472    pub fn set_do_not_associate_control_ids<T, V>(mut self, v: T) -> Self
25473    where
25474        T: std::iter::IntoIterator<Item = V>,
25475        V: std::convert::Into<std::string::String>,
25476    {
25477        use std::iter::Iterator;
25478        self.do_not_associate_control_ids = v.into_iter().map(|i| i.into()).collect();
25479        self
25480    }
25481
25482    /// Sets the value of [replacement_control_ids][crate::model::ServingConfig::replacement_control_ids].
25483    ///
25484    /// # Example
25485    /// ```ignore,no_run
25486    /// # use google_cloud_retail_v2::model::ServingConfig;
25487    /// let x = ServingConfig::new().set_replacement_control_ids(["a", "b", "c"]);
25488    /// ```
25489    pub fn set_replacement_control_ids<T, V>(mut self, v: T) -> Self
25490    where
25491        T: std::iter::IntoIterator<Item = V>,
25492        V: std::convert::Into<std::string::String>,
25493    {
25494        use std::iter::Iterator;
25495        self.replacement_control_ids = v.into_iter().map(|i| i.into()).collect();
25496        self
25497    }
25498
25499    /// Sets the value of [ignore_control_ids][crate::model::ServingConfig::ignore_control_ids].
25500    ///
25501    /// # Example
25502    /// ```ignore,no_run
25503    /// # use google_cloud_retail_v2::model::ServingConfig;
25504    /// let x = ServingConfig::new().set_ignore_control_ids(["a", "b", "c"]);
25505    /// ```
25506    pub fn set_ignore_control_ids<T, V>(mut self, v: T) -> Self
25507    where
25508        T: std::iter::IntoIterator<Item = V>,
25509        V: std::convert::Into<std::string::String>,
25510    {
25511        use std::iter::Iterator;
25512        self.ignore_control_ids = v.into_iter().map(|i| i.into()).collect();
25513        self
25514    }
25515
25516    /// Sets the value of [diversity_level][crate::model::ServingConfig::diversity_level].
25517    ///
25518    /// # Example
25519    /// ```ignore,no_run
25520    /// # use google_cloud_retail_v2::model::ServingConfig;
25521    /// let x = ServingConfig::new().set_diversity_level("example");
25522    /// ```
25523    pub fn set_diversity_level<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25524        self.diversity_level = v.into();
25525        self
25526    }
25527
25528    /// Sets the value of [diversity_type][crate::model::ServingConfig::diversity_type].
25529    ///
25530    /// # Example
25531    /// ```ignore,no_run
25532    /// # use google_cloud_retail_v2::model::ServingConfig;
25533    /// use google_cloud_retail_v2::model::serving_config::DiversityType;
25534    /// let x0 = ServingConfig::new().set_diversity_type(DiversityType::RuleBasedDiversity);
25535    /// let x1 = ServingConfig::new().set_diversity_type(DiversityType::DataDrivenDiversity);
25536    /// ```
25537    pub fn set_diversity_type<
25538        T: std::convert::Into<crate::model::serving_config::DiversityType>,
25539    >(
25540        mut self,
25541        v: T,
25542    ) -> Self {
25543        self.diversity_type = v.into();
25544        self
25545    }
25546
25547    /// Sets the value of [enable_category_filter_level][crate::model::ServingConfig::enable_category_filter_level].
25548    ///
25549    /// # Example
25550    /// ```ignore,no_run
25551    /// # use google_cloud_retail_v2::model::ServingConfig;
25552    /// let x = ServingConfig::new().set_enable_category_filter_level("example");
25553    /// ```
25554    pub fn set_enable_category_filter_level<T: std::convert::Into<std::string::String>>(
25555        mut self,
25556        v: T,
25557    ) -> Self {
25558        self.enable_category_filter_level = v.into();
25559        self
25560    }
25561
25562    /// Sets the value of [ignore_recs_denylist][crate::model::ServingConfig::ignore_recs_denylist].
25563    ///
25564    /// # Example
25565    /// ```ignore,no_run
25566    /// # use google_cloud_retail_v2::model::ServingConfig;
25567    /// let x = ServingConfig::new().set_ignore_recs_denylist(true);
25568    /// ```
25569    pub fn set_ignore_recs_denylist<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
25570        self.ignore_recs_denylist = v.into();
25571        self
25572    }
25573
25574    /// Sets the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25575    ///
25576    /// # Example
25577    /// ```ignore,no_run
25578    /// # use google_cloud_retail_v2::model::ServingConfig;
25579    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25580    /// let x = ServingConfig::new().set_personalization_spec(PersonalizationSpec::default()/* use setters */);
25581    /// ```
25582    pub fn set_personalization_spec<T>(mut self, v: T) -> Self
25583    where
25584        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25585    {
25586        self.personalization_spec = std::option::Option::Some(v.into());
25587        self
25588    }
25589
25590    /// Sets or clears the value of [personalization_spec][crate::model::ServingConfig::personalization_spec].
25591    ///
25592    /// # Example
25593    /// ```ignore,no_run
25594    /// # use google_cloud_retail_v2::model::ServingConfig;
25595    /// use google_cloud_retail_v2::model::search_request::PersonalizationSpec;
25596    /// let x = ServingConfig::new().set_or_clear_personalization_spec(Some(PersonalizationSpec::default()/* use setters */));
25597    /// let x = ServingConfig::new().set_or_clear_personalization_spec(None::<PersonalizationSpec>);
25598    /// ```
25599    pub fn set_or_clear_personalization_spec<T>(mut self, v: std::option::Option<T>) -> Self
25600    where
25601        T: std::convert::Into<crate::model::search_request::PersonalizationSpec>,
25602    {
25603        self.personalization_spec = v.map(|x| x.into());
25604        self
25605    }
25606
25607    /// Sets the value of [solution_types][crate::model::ServingConfig::solution_types].
25608    ///
25609    /// # Example
25610    /// ```ignore,no_run
25611    /// # use google_cloud_retail_v2::model::ServingConfig;
25612    /// use google_cloud_retail_v2::model::SolutionType;
25613    /// let x = ServingConfig::new().set_solution_types([
25614    ///     SolutionType::Recommendation,
25615    ///     SolutionType::Search,
25616    /// ]);
25617    /// ```
25618    pub fn set_solution_types<T, V>(mut self, v: T) -> Self
25619    where
25620        T: std::iter::IntoIterator<Item = V>,
25621        V: std::convert::Into<crate::model::SolutionType>,
25622    {
25623        use std::iter::Iterator;
25624        self.solution_types = v.into_iter().map(|i| i.into()).collect();
25625        self
25626    }
25627}
25628
25629impl wkt::message::Message for ServingConfig {
25630    fn typename() -> &'static str {
25631        "type.googleapis.com/google.cloud.retail.v2.ServingConfig"
25632    }
25633}
25634
25635/// Defines additional types related to [ServingConfig].
25636pub mod serving_config {
25637    #[allow(unused_imports)]
25638    use super::*;
25639
25640    /// What type of diversity - data or rule based.
25641    ///
25642    /// # Working with unknown values
25643    ///
25644    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
25645    /// additional enum variants at any time. Adding new variants is not considered
25646    /// a breaking change. Applications should write their code in anticipation of:
25647    ///
25648    /// - New values appearing in future releases of the client library, **and**
25649    /// - New values received dynamically, without application changes.
25650    ///
25651    /// Please consult the [Working with enums] section in the user guide for some
25652    /// guidelines.
25653    ///
25654    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
25655    #[derive(Clone, Debug, PartialEq)]
25656    #[non_exhaustive]
25657    pub enum DiversityType {
25658        /// Default value.
25659        Unspecified,
25660        /// Rule based diversity.
25661        RuleBasedDiversity,
25662        /// Data driven diversity.
25663        DataDrivenDiversity,
25664        /// If set, the enum was initialized with an unknown value.
25665        ///
25666        /// Applications can examine the value using [DiversityType::value] or
25667        /// [DiversityType::name].
25668        UnknownValue(diversity_type::UnknownValue),
25669    }
25670
25671    #[doc(hidden)]
25672    pub mod diversity_type {
25673        #[allow(unused_imports)]
25674        use super::*;
25675        #[derive(Clone, Debug, PartialEq)]
25676        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
25677    }
25678
25679    impl DiversityType {
25680        /// Gets the enum value.
25681        ///
25682        /// Returns `None` if the enum contains an unknown value deserialized from
25683        /// the string representation of enums.
25684        pub fn value(&self) -> std::option::Option<i32> {
25685            match self {
25686                Self::Unspecified => std::option::Option::Some(0),
25687                Self::RuleBasedDiversity => std::option::Option::Some(2),
25688                Self::DataDrivenDiversity => std::option::Option::Some(3),
25689                Self::UnknownValue(u) => u.0.value(),
25690            }
25691        }
25692
25693        /// Gets the enum value as a string.
25694        ///
25695        /// Returns `None` if the enum contains an unknown value deserialized from
25696        /// the integer representation of enums.
25697        pub fn name(&self) -> std::option::Option<&str> {
25698            match self {
25699                Self::Unspecified => std::option::Option::Some("DIVERSITY_TYPE_UNSPECIFIED"),
25700                Self::RuleBasedDiversity => std::option::Option::Some("RULE_BASED_DIVERSITY"),
25701                Self::DataDrivenDiversity => std::option::Option::Some("DATA_DRIVEN_DIVERSITY"),
25702                Self::UnknownValue(u) => u.0.name(),
25703            }
25704        }
25705    }
25706
25707    impl std::default::Default for DiversityType {
25708        fn default() -> Self {
25709            use std::convert::From;
25710            Self::from(0)
25711        }
25712    }
25713
25714    impl std::fmt::Display for DiversityType {
25715        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
25716            wkt::internal::display_enum(f, self.name(), self.value())
25717        }
25718    }
25719
25720    impl std::convert::From<i32> for DiversityType {
25721        fn from(value: i32) -> Self {
25722            match value {
25723                0 => Self::Unspecified,
25724                2 => Self::RuleBasedDiversity,
25725                3 => Self::DataDrivenDiversity,
25726                _ => Self::UnknownValue(diversity_type::UnknownValue(
25727                    wkt::internal::UnknownEnumValue::Integer(value),
25728                )),
25729            }
25730        }
25731    }
25732
25733    impl std::convert::From<&str> for DiversityType {
25734        fn from(value: &str) -> Self {
25735            use std::string::ToString;
25736            match value {
25737                "DIVERSITY_TYPE_UNSPECIFIED" => Self::Unspecified,
25738                "RULE_BASED_DIVERSITY" => Self::RuleBasedDiversity,
25739                "DATA_DRIVEN_DIVERSITY" => Self::DataDrivenDiversity,
25740                _ => Self::UnknownValue(diversity_type::UnknownValue(
25741                    wkt::internal::UnknownEnumValue::String(value.to_string()),
25742                )),
25743            }
25744        }
25745    }
25746
25747    impl serde::ser::Serialize for DiversityType {
25748        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
25749        where
25750            S: serde::Serializer,
25751        {
25752            match self {
25753                Self::Unspecified => serializer.serialize_i32(0),
25754                Self::RuleBasedDiversity => serializer.serialize_i32(2),
25755                Self::DataDrivenDiversity => serializer.serialize_i32(3),
25756                Self::UnknownValue(u) => u.0.serialize(serializer),
25757            }
25758        }
25759    }
25760
25761    impl<'de> serde::de::Deserialize<'de> for DiversityType {
25762        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
25763        where
25764            D: serde::Deserializer<'de>,
25765        {
25766            deserializer.deserialize_any(wkt::internal::EnumVisitor::<DiversityType>::new(
25767                ".google.cloud.retail.v2.ServingConfig.DiversityType",
25768            ))
25769        }
25770    }
25771}
25772
25773/// Request for CreateServingConfig method.
25774#[derive(Clone, Default, PartialEq)]
25775#[non_exhaustive]
25776pub struct CreateServingConfigRequest {
25777    /// Required. Full resource name of parent. Format:
25778    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
25779    pub parent: std::string::String,
25780
25781    /// Required. The ServingConfig to create.
25782    pub serving_config: std::option::Option<crate::model::ServingConfig>,
25783
25784    /// Required. The ID to use for the ServingConfig, which will become the final
25785    /// component of the ServingConfig's resource name.
25786    ///
25787    /// This value should be 4-63 characters, and valid characters
25788    /// are /[a-z][0-9]-_/.
25789    pub serving_config_id: std::string::String,
25790
25791    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25792}
25793
25794impl CreateServingConfigRequest {
25795    /// Creates a new default instance.
25796    pub fn new() -> Self {
25797        std::default::Default::default()
25798    }
25799
25800    /// Sets the value of [parent][crate::model::CreateServingConfigRequest::parent].
25801    ///
25802    /// # Example
25803    /// ```ignore,no_run
25804    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25805    /// # let project_id = "project_id";
25806    /// # let location_id = "location_id";
25807    /// # let catalog_id = "catalog_id";
25808    /// let x = CreateServingConfigRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
25809    /// ```
25810    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
25811        self.parent = v.into();
25812        self
25813    }
25814
25815    /// Sets the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25816    ///
25817    /// # Example
25818    /// ```ignore,no_run
25819    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25820    /// use google_cloud_retail_v2::model::ServingConfig;
25821    /// let x = CreateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25822    /// ```
25823    pub fn set_serving_config<T>(mut self, v: T) -> Self
25824    where
25825        T: std::convert::Into<crate::model::ServingConfig>,
25826    {
25827        self.serving_config = std::option::Option::Some(v.into());
25828        self
25829    }
25830
25831    /// Sets or clears the value of [serving_config][crate::model::CreateServingConfigRequest::serving_config].
25832    ///
25833    /// # Example
25834    /// ```ignore,no_run
25835    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25836    /// use google_cloud_retail_v2::model::ServingConfig;
25837    /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25838    /// let x = CreateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25839    /// ```
25840    pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25841    where
25842        T: std::convert::Into<crate::model::ServingConfig>,
25843    {
25844        self.serving_config = v.map(|x| x.into());
25845        self
25846    }
25847
25848    /// Sets the value of [serving_config_id][crate::model::CreateServingConfigRequest::serving_config_id].
25849    ///
25850    /// # Example
25851    /// ```ignore,no_run
25852    /// # use google_cloud_retail_v2::model::CreateServingConfigRequest;
25853    /// let x = CreateServingConfigRequest::new().set_serving_config_id("example");
25854    /// ```
25855    pub fn set_serving_config_id<T: std::convert::Into<std::string::String>>(
25856        mut self,
25857        v: T,
25858    ) -> Self {
25859        self.serving_config_id = v.into();
25860        self
25861    }
25862}
25863
25864impl wkt::message::Message for CreateServingConfigRequest {
25865    fn typename() -> &'static str {
25866        "type.googleapis.com/google.cloud.retail.v2.CreateServingConfigRequest"
25867    }
25868}
25869
25870/// Request for UpdateServingConfig method.
25871#[derive(Clone, Default, PartialEq)]
25872#[non_exhaustive]
25873pub struct UpdateServingConfigRequest {
25874    /// Required. The ServingConfig to update.
25875    pub serving_config: std::option::Option<crate::model::ServingConfig>,
25876
25877    /// Indicates which fields in the provided
25878    /// [ServingConfig][google.cloud.retail.v2.ServingConfig] to update. The
25879    /// following are NOT supported:
25880    ///
25881    /// * [ServingConfig.name][google.cloud.retail.v2.ServingConfig.name]
25882    ///
25883    /// If not set, all supported fields are updated.
25884    ///
25885    /// [google.cloud.retail.v2.ServingConfig]: crate::model::ServingConfig
25886    /// [google.cloud.retail.v2.ServingConfig.name]: crate::model::ServingConfig::name
25887    pub update_mask: std::option::Option<wkt::FieldMask>,
25888
25889    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25890}
25891
25892impl UpdateServingConfigRequest {
25893    /// Creates a new default instance.
25894    pub fn new() -> Self {
25895        std::default::Default::default()
25896    }
25897
25898    /// Sets the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25899    ///
25900    /// # Example
25901    /// ```ignore,no_run
25902    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25903    /// use google_cloud_retail_v2::model::ServingConfig;
25904    /// let x = UpdateServingConfigRequest::new().set_serving_config(ServingConfig::default()/* use setters */);
25905    /// ```
25906    pub fn set_serving_config<T>(mut self, v: T) -> Self
25907    where
25908        T: std::convert::Into<crate::model::ServingConfig>,
25909    {
25910        self.serving_config = std::option::Option::Some(v.into());
25911        self
25912    }
25913
25914    /// Sets or clears the value of [serving_config][crate::model::UpdateServingConfigRequest::serving_config].
25915    ///
25916    /// # Example
25917    /// ```ignore,no_run
25918    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25919    /// use google_cloud_retail_v2::model::ServingConfig;
25920    /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(Some(ServingConfig::default()/* use setters */));
25921    /// let x = UpdateServingConfigRequest::new().set_or_clear_serving_config(None::<ServingConfig>);
25922    /// ```
25923    pub fn set_or_clear_serving_config<T>(mut self, v: std::option::Option<T>) -> Self
25924    where
25925        T: std::convert::Into<crate::model::ServingConfig>,
25926    {
25927        self.serving_config = v.map(|x| x.into());
25928        self
25929    }
25930
25931    /// Sets the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25932    ///
25933    /// # Example
25934    /// ```ignore,no_run
25935    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25936    /// use wkt::FieldMask;
25937    /// let x = UpdateServingConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
25938    /// ```
25939    pub fn set_update_mask<T>(mut self, v: T) -> Self
25940    where
25941        T: std::convert::Into<wkt::FieldMask>,
25942    {
25943        self.update_mask = std::option::Option::Some(v.into());
25944        self
25945    }
25946
25947    /// Sets or clears the value of [update_mask][crate::model::UpdateServingConfigRequest::update_mask].
25948    ///
25949    /// # Example
25950    /// ```ignore,no_run
25951    /// # use google_cloud_retail_v2::model::UpdateServingConfigRequest;
25952    /// use wkt::FieldMask;
25953    /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
25954    /// let x = UpdateServingConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
25955    /// ```
25956    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
25957    where
25958        T: std::convert::Into<wkt::FieldMask>,
25959    {
25960        self.update_mask = v.map(|x| x.into());
25961        self
25962    }
25963}
25964
25965impl wkt::message::Message for UpdateServingConfigRequest {
25966    fn typename() -> &'static str {
25967        "type.googleapis.com/google.cloud.retail.v2.UpdateServingConfigRequest"
25968    }
25969}
25970
25971/// Request for DeleteServingConfig method.
25972#[derive(Clone, Default, PartialEq)]
25973#[non_exhaustive]
25974pub struct DeleteServingConfigRequest {
25975    /// Required. The resource name of the ServingConfig to delete. Format:
25976    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
25977    pub name: std::string::String,
25978
25979    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
25980}
25981
25982impl DeleteServingConfigRequest {
25983    /// Creates a new default instance.
25984    pub fn new() -> Self {
25985        std::default::Default::default()
25986    }
25987
25988    /// Sets the value of [name][crate::model::DeleteServingConfigRequest::name].
25989    ///
25990    /// # Example
25991    /// ```ignore,no_run
25992    /// # use google_cloud_retail_v2::model::DeleteServingConfigRequest;
25993    /// # let project_id = "project_id";
25994    /// # let location_id = "location_id";
25995    /// # let catalog_id = "catalog_id";
25996    /// # let serving_config_id = "serving_config_id";
25997    /// let x = DeleteServingConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
25998    /// ```
25999    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26000        self.name = v.into();
26001        self
26002    }
26003}
26004
26005impl wkt::message::Message for DeleteServingConfigRequest {
26006    fn typename() -> &'static str {
26007        "type.googleapis.com/google.cloud.retail.v2.DeleteServingConfigRequest"
26008    }
26009}
26010
26011/// Request for GetServingConfig method.
26012#[derive(Clone, Default, PartialEq)]
26013#[non_exhaustive]
26014pub struct GetServingConfigRequest {
26015    /// Required. The resource name of the ServingConfig to get. Format:
26016    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26017    pub name: std::string::String,
26018
26019    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26020}
26021
26022impl GetServingConfigRequest {
26023    /// Creates a new default instance.
26024    pub fn new() -> Self {
26025        std::default::Default::default()
26026    }
26027
26028    /// Sets the value of [name][crate::model::GetServingConfigRequest::name].
26029    ///
26030    /// # Example
26031    /// ```ignore,no_run
26032    /// # use google_cloud_retail_v2::model::GetServingConfigRequest;
26033    /// # let project_id = "project_id";
26034    /// # let location_id = "location_id";
26035    /// # let catalog_id = "catalog_id";
26036    /// # let serving_config_id = "serving_config_id";
26037    /// let x = GetServingConfigRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
26038    /// ```
26039    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26040        self.name = v.into();
26041        self
26042    }
26043}
26044
26045impl wkt::message::Message for GetServingConfigRequest {
26046    fn typename() -> &'static str {
26047        "type.googleapis.com/google.cloud.retail.v2.GetServingConfigRequest"
26048    }
26049}
26050
26051/// Request for ListServingConfigs method.
26052#[derive(Clone, Default, PartialEq)]
26053#[non_exhaustive]
26054pub struct ListServingConfigsRequest {
26055    /// Required. The catalog resource name. Format:
26056    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
26057    pub parent: std::string::String,
26058
26059    /// Optional. Maximum number of results to return. If unspecified, defaults
26060    /// to 100. If a value greater than 100 is provided, at most 100 results are
26061    /// returned.
26062    pub page_size: i32,
26063
26064    /// Optional. A page token, received from a previous `ListServingConfigs` call.
26065    /// Provide this to retrieve the subsequent page.
26066    pub page_token: std::string::String,
26067
26068    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26069}
26070
26071impl ListServingConfigsRequest {
26072    /// Creates a new default instance.
26073    pub fn new() -> Self {
26074        std::default::Default::default()
26075    }
26076
26077    /// Sets the value of [parent][crate::model::ListServingConfigsRequest::parent].
26078    ///
26079    /// # Example
26080    /// ```ignore,no_run
26081    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
26082    /// # let project_id = "project_id";
26083    /// # let location_id = "location_id";
26084    /// # let catalog_id = "catalog_id";
26085    /// let x = ListServingConfigsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}"));
26086    /// ```
26087    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26088        self.parent = v.into();
26089        self
26090    }
26091
26092    /// Sets the value of [page_size][crate::model::ListServingConfigsRequest::page_size].
26093    ///
26094    /// # Example
26095    /// ```ignore,no_run
26096    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
26097    /// let x = ListServingConfigsRequest::new().set_page_size(42);
26098    /// ```
26099    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26100        self.page_size = v.into();
26101        self
26102    }
26103
26104    /// Sets the value of [page_token][crate::model::ListServingConfigsRequest::page_token].
26105    ///
26106    /// # Example
26107    /// ```ignore,no_run
26108    /// # use google_cloud_retail_v2::model::ListServingConfigsRequest;
26109    /// let x = ListServingConfigsRequest::new().set_page_token("example");
26110    /// ```
26111    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26112        self.page_token = v.into();
26113        self
26114    }
26115}
26116
26117impl wkt::message::Message for ListServingConfigsRequest {
26118    fn typename() -> &'static str {
26119        "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsRequest"
26120    }
26121}
26122
26123/// Response for ListServingConfigs method.
26124#[derive(Clone, Default, PartialEq)]
26125#[non_exhaustive]
26126pub struct ListServingConfigsResponse {
26127    /// All the ServingConfigs for a given catalog.
26128    pub serving_configs: std::vec::Vec<crate::model::ServingConfig>,
26129
26130    /// Pagination token, if not returned indicates the last page.
26131    pub next_page_token: std::string::String,
26132
26133    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26134}
26135
26136impl ListServingConfigsResponse {
26137    /// Creates a new default instance.
26138    pub fn new() -> Self {
26139        std::default::Default::default()
26140    }
26141
26142    /// Sets the value of [serving_configs][crate::model::ListServingConfigsResponse::serving_configs].
26143    ///
26144    /// # Example
26145    /// ```ignore,no_run
26146    /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
26147    /// use google_cloud_retail_v2::model::ServingConfig;
26148    /// let x = ListServingConfigsResponse::new()
26149    ///     .set_serving_configs([
26150    ///         ServingConfig::default()/* use setters */,
26151    ///         ServingConfig::default()/* use (different) setters */,
26152    ///     ]);
26153    /// ```
26154    pub fn set_serving_configs<T, V>(mut self, v: T) -> Self
26155    where
26156        T: std::iter::IntoIterator<Item = V>,
26157        V: std::convert::Into<crate::model::ServingConfig>,
26158    {
26159        use std::iter::Iterator;
26160        self.serving_configs = v.into_iter().map(|i| i.into()).collect();
26161        self
26162    }
26163
26164    /// Sets the value of [next_page_token][crate::model::ListServingConfigsResponse::next_page_token].
26165    ///
26166    /// # Example
26167    /// ```ignore,no_run
26168    /// # use google_cloud_retail_v2::model::ListServingConfigsResponse;
26169    /// let x = ListServingConfigsResponse::new().set_next_page_token("example");
26170    /// ```
26171    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26172        self.next_page_token = v.into();
26173        self
26174    }
26175}
26176
26177impl wkt::message::Message for ListServingConfigsResponse {
26178    fn typename() -> &'static str {
26179        "type.googleapis.com/google.cloud.retail.v2.ListServingConfigsResponse"
26180    }
26181}
26182
26183#[doc(hidden)]
26184impl google_cloud_gax::paginator::internal::PageableResponse for ListServingConfigsResponse {
26185    type PageItem = crate::model::ServingConfig;
26186
26187    fn items(self) -> std::vec::Vec<Self::PageItem> {
26188        self.serving_configs
26189    }
26190
26191    fn next_page_token(&self) -> std::string::String {
26192        use std::clone::Clone;
26193        self.next_page_token.clone()
26194    }
26195}
26196
26197/// Request for AddControl method.
26198#[derive(Clone, Default, PartialEq)]
26199#[non_exhaustive]
26200pub struct AddControlRequest {
26201    /// Required. The source ServingConfig resource name . Format:
26202    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26203    pub serving_config: std::string::String,
26204
26205    /// Required. The id of the control to apply. Assumed to be in the same catalog
26206    /// as the serving config - if id is not found a NOT_FOUND error is returned.
26207    pub control_id: std::string::String,
26208
26209    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26210}
26211
26212impl AddControlRequest {
26213    /// Creates a new default instance.
26214    pub fn new() -> Self {
26215        std::default::Default::default()
26216    }
26217
26218    /// Sets the value of [serving_config][crate::model::AddControlRequest::serving_config].
26219    ///
26220    /// # Example
26221    /// ```ignore,no_run
26222    /// # use google_cloud_retail_v2::model::AddControlRequest;
26223    /// # let project_id = "project_id";
26224    /// # let location_id = "location_id";
26225    /// # let catalog_id = "catalog_id";
26226    /// # let serving_config_id = "serving_config_id";
26227    /// let x = AddControlRequest::new().set_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
26228    /// ```
26229    pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26230        self.serving_config = v.into();
26231        self
26232    }
26233
26234    /// Sets the value of [control_id][crate::model::AddControlRequest::control_id].
26235    ///
26236    /// # Example
26237    /// ```ignore,no_run
26238    /// # use google_cloud_retail_v2::model::AddControlRequest;
26239    /// let x = AddControlRequest::new().set_control_id("example");
26240    /// ```
26241    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26242        self.control_id = v.into();
26243        self
26244    }
26245}
26246
26247impl wkt::message::Message for AddControlRequest {
26248    fn typename() -> &'static str {
26249        "type.googleapis.com/google.cloud.retail.v2.AddControlRequest"
26250    }
26251}
26252
26253/// Request for RemoveControl method.
26254#[derive(Clone, Default, PartialEq)]
26255#[non_exhaustive]
26256pub struct RemoveControlRequest {
26257    /// Required. The source ServingConfig resource name . Format:
26258    /// `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}`
26259    pub serving_config: std::string::String,
26260
26261    /// Required. The id of the control to apply. Assumed to be in the same catalog
26262    /// as the serving config.
26263    pub control_id: std::string::String,
26264
26265    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26266}
26267
26268impl RemoveControlRequest {
26269    /// Creates a new default instance.
26270    pub fn new() -> Self {
26271        std::default::Default::default()
26272    }
26273
26274    /// Sets the value of [serving_config][crate::model::RemoveControlRequest::serving_config].
26275    ///
26276    /// # Example
26277    /// ```ignore,no_run
26278    /// # use google_cloud_retail_v2::model::RemoveControlRequest;
26279    /// # let project_id = "project_id";
26280    /// # let location_id = "location_id";
26281    /// # let catalog_id = "catalog_id";
26282    /// # let serving_config_id = "serving_config_id";
26283    /// let x = RemoveControlRequest::new().set_serving_config(format!("projects/{project_id}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}"));
26284    /// ```
26285    pub fn set_serving_config<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26286        self.serving_config = v.into();
26287        self
26288    }
26289
26290    /// Sets the value of [control_id][crate::model::RemoveControlRequest::control_id].
26291    ///
26292    /// # Example
26293    /// ```ignore,no_run
26294    /// # use google_cloud_retail_v2::model::RemoveControlRequest;
26295    /// let x = RemoveControlRequest::new().set_control_id("example");
26296    /// ```
26297    pub fn set_control_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26298        self.control_id = v.into();
26299        self
26300    }
26301}
26302
26303impl wkt::message::Message for RemoveControlRequest {
26304    fn typename() -> &'static str {
26305        "type.googleapis.com/google.cloud.retail.v2.RemoveControlRequest"
26306    }
26307}
26308
26309/// UserEvent captures all metadata information Retail API needs to know about
26310/// how end users interact with customers' website.
26311#[derive(Clone, Default, PartialEq)]
26312#[non_exhaustive]
26313pub struct UserEvent {
26314    /// Required. User event type. Allowed values are:
26315    ///
26316    /// * `add-to-cart`: Products being added to cart.
26317    /// * `remove-from-cart`: Products being removed from cart.
26318    /// * `category-page-view`: Special pages such as sale or promotion pages
26319    ///   viewed.
26320    /// * `detail-page-view`: Products detail page viewed.
26321    /// * `home-page-view`: Homepage viewed.
26322    /// * `purchase-complete`: User finishing a purchase.
26323    /// * `search`: Product search.
26324    /// * `shopping-cart-page-view`: User viewing a shopping cart.
26325    pub event_type: std::string::String,
26326
26327    /// Required. A unique identifier for tracking visitors.
26328    ///
26329    /// For example, this could be implemented with an HTTP cookie, which should be
26330    /// able to uniquely identify a visitor on a single device. This unique
26331    /// identifier should not change if the visitor log in/out of the website.
26332    ///
26333    /// Don't set the field to the same fixed ID for different users. This mixes
26334    /// the event history of those users together, which results in degraded model
26335    /// quality.
26336    ///
26337    /// The field must be a UTF-8 encoded string with a length limit of 128
26338    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26339    ///
26340    /// The field should not contain PII or user-data. We recommend to use Google
26341    /// Analytics [Client
26342    /// ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId)
26343    /// for this field.
26344    pub visitor_id: std::string::String,
26345
26346    /// A unique identifier for tracking a visitor session with a length limit of
26347    /// 128 bytes. A session is an aggregation of an end user behavior in a time
26348    /// span.
26349    ///
26350    /// A general guideline to populate the session_id:
26351    ///
26352    /// 1. If user has no activity for 30 min, a new session_id should be assigned.
26353    /// 1. The session_id should be unique across users, suggest use uuid or add
26354    ///    visitor_id as prefix.
26355    pub session_id: std::string::String,
26356
26357    /// Only required for
26358    /// [UserEventService.ImportUserEvents][google.cloud.retail.v2.UserEventService.ImportUserEvents]
26359    /// method. Timestamp of when the user event happened.
26360    ///
26361    /// [google.cloud.retail.v2.UserEventService.ImportUserEvents]: crate::client::UserEventService::import_user_events
26362    pub event_time: std::option::Option<wkt::Timestamp>,
26363
26364    /// A list of identifiers for the independent experiment groups this user event
26365    /// belongs to. This is used to distinguish between user events associated with
26366    /// different experiment setups (e.g. using Retail API, using different
26367    /// recommendation models).
26368    pub experiment_ids: std::vec::Vec<std::string::String>,
26369
26370    /// Highly recommended for user events that are the result of
26371    /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26372    /// This field enables accurate attribution of recommendation model
26373    /// performance.
26374    ///
26375    /// The value must be a valid
26376    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26377    /// for user events that are the result of
26378    /// [PredictionService.Predict][google.cloud.retail.v2.PredictionService.Predict].
26379    /// The value must be a valid
26380    /// [SearchResponse.attribution_token][google.cloud.retail.v2.SearchResponse.attribution_token]
26381    /// for user events that are the result of
26382    /// [SearchService.Search][google.cloud.retail.v2.SearchService.Search].
26383    ///
26384    /// This token enables us to accurately attribute page view or purchase back to
26385    /// the event and the particular predict response containing this
26386    /// clicked/purchased product. If user clicks on product K in the
26387    /// recommendation results, pass
26388    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26389    /// as a URL parameter to product K's page. When recording events on product
26390    /// K's page, log the
26391    /// [PredictResponse.attribution_token][google.cloud.retail.v2.PredictResponse.attribution_token]
26392    /// to this field.
26393    ///
26394    /// [google.cloud.retail.v2.PredictResponse.attribution_token]: crate::model::PredictResponse::attribution_token
26395    /// [google.cloud.retail.v2.PredictionService.Predict]: crate::client::PredictionService::predict
26396    /// [google.cloud.retail.v2.SearchResponse.attribution_token]: crate::model::SearchResponse::attribution_token
26397    /// [google.cloud.retail.v2.SearchService.Search]: crate::client::SearchService::search
26398    pub attribution_token: std::string::String,
26399
26400    /// The main product details related to the event.
26401    ///
26402    /// This field is optional except for the following event types:
26403    ///
26404    /// * `add-to-cart`
26405    /// * `detail-page-view`
26406    /// * `purchase-complete`
26407    ///
26408    /// In a `search` event, this field represents the products returned to the end
26409    /// user on the current page (the end user may have not finished browsing the
26410    /// whole page yet). When a new page is returned to the end user, after
26411    /// pagination/filtering/ordering even for the same query, a new `search` event
26412    /// with different
26413    /// [product_details][google.cloud.retail.v2.UserEvent.product_details] is
26414    /// desired. The end user may have not finished browsing the whole page yet.
26415    ///
26416    /// [google.cloud.retail.v2.UserEvent.product_details]: crate::model::UserEvent::product_details
26417    pub product_details: std::vec::Vec<crate::model::ProductDetail>,
26418
26419    /// The main auto-completion details related to the event.
26420    ///
26421    /// This field should be set for `search` event when autocomplete function is
26422    /// enabled and the user clicks a suggestion for search.
26423    pub completion_detail: std::option::Option<crate::model::CompletionDetail>,
26424
26425    /// Extra user event features to include in the recommendation model.
26426    ///
26427    /// If you provide custom attributes for ingested user events, also include
26428    /// them in the user events that you associate with prediction requests. Custom
26429    /// attribute formatting must be consistent between imported events and events
26430    /// provided with prediction requests. This lets the Retail API use
26431    /// those custom attributes when training models and serving predictions, which
26432    /// helps improve recommendation quality.
26433    ///
26434    /// This field needs to pass all below criteria, otherwise an INVALID_ARGUMENT
26435    /// error is returned:
26436    ///
26437    /// * The key must be a UTF-8 encoded string with a length limit of 5,000
26438    ///   characters.
26439    /// * For text attributes, at most 400 values are allowed. Empty values are not
26440    ///   allowed. Each value must be a UTF-8 encoded string with a length limit of
26441    ///   256 characters.
26442    /// * For number attributes, at most 400 values are allowed.
26443    ///
26444    /// For product recommendations, an example of extra user information is
26445    /// traffic_channel, which is how a user arrives at the site. Users can arrive
26446    /// at the site by coming to the site directly, coming through Google
26447    /// search, or in other ways.
26448    pub attributes: std::collections::HashMap<std::string::String, crate::model::CustomAttribute>,
26449
26450    /// The ID or name of the associated shopping cart. This ID is used
26451    /// to associate multiple items added or present in the cart before purchase.
26452    ///
26453    /// This can only be set for `add-to-cart`, `purchase-complete`, or
26454    /// `shopping-cart-page-view` events.
26455    pub cart_id: std::string::String,
26456
26457    /// A transaction represents the entire purchase transaction.
26458    ///
26459    /// Required for `purchase-complete` events. Other event types should not set
26460    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26461    pub purchase_transaction: std::option::Option<crate::model::PurchaseTransaction>,
26462
26463    /// The user's search query.
26464    ///
26465    /// See [SearchRequest.query][google.cloud.retail.v2.SearchRequest.query] for
26466    /// definition.
26467    ///
26468    /// The value must be a UTF-8 encoded string with a length limit of 5,000
26469    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26470    ///
26471    /// At least one of
26472    /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26473    /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26474    /// required for `search` events. Other event types should not set this field.
26475    /// Otherwise, an INVALID_ARGUMENT error is returned.
26476    ///
26477    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
26478    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26479    /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26480    pub search_query: std::string::String,
26481
26482    /// The filter syntax consists of an expression language for constructing a
26483    /// predicate from one or more fields of the products being filtered.
26484    ///
26485    /// See [SearchRequest.filter][google.cloud.retail.v2.SearchRequest.filter] for
26486    /// definition and syntax.
26487    ///
26488    /// The value must be a UTF-8 encoded string with a length limit of 1,000
26489    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26490    ///
26491    /// [google.cloud.retail.v2.SearchRequest.filter]: crate::model::SearchRequest::filter
26492    pub filter: std::string::String,
26493
26494    /// The order in which products are returned.
26495    ///
26496    /// See [SearchRequest.order_by][google.cloud.retail.v2.SearchRequest.order_by]
26497    /// for definition and syntax.
26498    ///
26499    /// The value must be a UTF-8 encoded string with a length limit of 1,000
26500    /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
26501    ///
26502    /// This can only be set for `search` events. Other event types should not set
26503    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26504    ///
26505    /// [google.cloud.retail.v2.SearchRequest.order_by]: crate::model::SearchRequest::order_by
26506    pub order_by: std::string::String,
26507
26508    /// An integer that specifies the current offset for pagination (the 0-indexed
26509    /// starting location, amongst the products deemed by the API as relevant).
26510    ///
26511    /// See [SearchRequest.offset][google.cloud.retail.v2.SearchRequest.offset] for
26512    /// definition.
26513    ///
26514    /// If this field is negative, an INVALID_ARGUMENT is returned.
26515    ///
26516    /// This can only be set for `search` events. Other event types should not set
26517    /// this field. Otherwise, an INVALID_ARGUMENT error is returned.
26518    ///
26519    /// [google.cloud.retail.v2.SearchRequest.offset]: crate::model::SearchRequest::offset
26520    pub offset: i32,
26521
26522    /// The categories associated with a category page.
26523    ///
26524    /// To represent full path of category, use '>' sign to separate different
26525    /// hierarchies. If '>' is part of the category name, replace it with
26526    /// other character(s).
26527    ///
26528    /// Category pages include special pages such as sales or promotions. For
26529    /// instance, a special sale page may have the category hierarchy:
26530    /// "pageCategories" : ["Sales > 2017 Black Friday Deals"].
26531    ///
26532    /// Required for `category-page-view` events. At least one of
26533    /// [search_query][google.cloud.retail.v2.UserEvent.search_query] or
26534    /// [page_categories][google.cloud.retail.v2.UserEvent.page_categories] is
26535    /// required for `search` events. Other event types should not set this field.
26536    /// Otherwise, an INVALID_ARGUMENT error is returned.
26537    ///
26538    /// [google.cloud.retail.v2.UserEvent.page_categories]: crate::model::UserEvent::page_categories
26539    /// [google.cloud.retail.v2.UserEvent.search_query]: crate::model::UserEvent::search_query
26540    pub page_categories: std::vec::Vec<std::string::String>,
26541
26542    /// User information.
26543    pub user_info: std::option::Option<crate::model::UserInfo>,
26544
26545    /// Complete URL (window.location.href) of the user's current page.
26546    ///
26547    /// When using the client side event reporting with JavaScript pixel and Google
26548    /// Tag Manager, this value is filled in automatically. Maximum length 5,000
26549    /// characters.
26550    pub uri: std::string::String,
26551
26552    /// The referrer URL of the current page.
26553    ///
26554    /// When using the client side event reporting with JavaScript pixel and Google
26555    /// Tag Manager, this value is filled in automatically.
26556    pub referrer_uri: std::string::String,
26557
26558    /// A unique ID of a web page view.
26559    ///
26560    /// This should be kept the same for all user events triggered from the same
26561    /// pageview. For example, an item detail page view could trigger multiple
26562    /// events as the user is browsing the page. The `pageViewId` property should
26563    /// be kept the same for all these events so that they can be grouped together
26564    /// properly.
26565    ///
26566    /// When using the client side event reporting with JavaScript pixel and Google
26567    /// Tag Manager, this value is filled in automatically.
26568    pub page_view_id: std::string::String,
26569
26570    /// The entity for customers that may run multiple different entities, domains,
26571    /// sites or regions, for example, `Google US`, `Google Ads`, `Waymo`,
26572    /// `google.com`, `youtube.com`, etc.
26573    /// We recommend that you set this field to get better per-entity search,
26574    /// completion, and prediction results.
26575    pub entity: std::string::String,
26576
26577    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26578}
26579
26580impl UserEvent {
26581    /// Creates a new default instance.
26582    pub fn new() -> Self {
26583        std::default::Default::default()
26584    }
26585
26586    /// Sets the value of [event_type][crate::model::UserEvent::event_type].
26587    ///
26588    /// # Example
26589    /// ```ignore,no_run
26590    /// # use google_cloud_retail_v2::model::UserEvent;
26591    /// let x = UserEvent::new().set_event_type("example");
26592    /// ```
26593    pub fn set_event_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26594        self.event_type = v.into();
26595        self
26596    }
26597
26598    /// Sets the value of [visitor_id][crate::model::UserEvent::visitor_id].
26599    ///
26600    /// # Example
26601    /// ```ignore,no_run
26602    /// # use google_cloud_retail_v2::model::UserEvent;
26603    /// let x = UserEvent::new().set_visitor_id("example");
26604    /// ```
26605    pub fn set_visitor_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26606        self.visitor_id = v.into();
26607        self
26608    }
26609
26610    /// Sets the value of [session_id][crate::model::UserEvent::session_id].
26611    ///
26612    /// # Example
26613    /// ```ignore,no_run
26614    /// # use google_cloud_retail_v2::model::UserEvent;
26615    /// let x = UserEvent::new().set_session_id("example");
26616    /// ```
26617    pub fn set_session_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26618        self.session_id = v.into();
26619        self
26620    }
26621
26622    /// Sets the value of [event_time][crate::model::UserEvent::event_time].
26623    ///
26624    /// # Example
26625    /// ```ignore,no_run
26626    /// # use google_cloud_retail_v2::model::UserEvent;
26627    /// use wkt::Timestamp;
26628    /// let x = UserEvent::new().set_event_time(Timestamp::default()/* use setters */);
26629    /// ```
26630    pub fn set_event_time<T>(mut self, v: T) -> Self
26631    where
26632        T: std::convert::Into<wkt::Timestamp>,
26633    {
26634        self.event_time = std::option::Option::Some(v.into());
26635        self
26636    }
26637
26638    /// Sets or clears the value of [event_time][crate::model::UserEvent::event_time].
26639    ///
26640    /// # Example
26641    /// ```ignore,no_run
26642    /// # use google_cloud_retail_v2::model::UserEvent;
26643    /// use wkt::Timestamp;
26644    /// let x = UserEvent::new().set_or_clear_event_time(Some(Timestamp::default()/* use setters */));
26645    /// let x = UserEvent::new().set_or_clear_event_time(None::<Timestamp>);
26646    /// ```
26647    pub fn set_or_clear_event_time<T>(mut self, v: std::option::Option<T>) -> Self
26648    where
26649        T: std::convert::Into<wkt::Timestamp>,
26650    {
26651        self.event_time = v.map(|x| x.into());
26652        self
26653    }
26654
26655    /// Sets the value of [experiment_ids][crate::model::UserEvent::experiment_ids].
26656    ///
26657    /// # Example
26658    /// ```ignore,no_run
26659    /// # use google_cloud_retail_v2::model::UserEvent;
26660    /// let x = UserEvent::new().set_experiment_ids(["a", "b", "c"]);
26661    /// ```
26662    pub fn set_experiment_ids<T, V>(mut self, v: T) -> Self
26663    where
26664        T: std::iter::IntoIterator<Item = V>,
26665        V: std::convert::Into<std::string::String>,
26666    {
26667        use std::iter::Iterator;
26668        self.experiment_ids = v.into_iter().map(|i| i.into()).collect();
26669        self
26670    }
26671
26672    /// Sets the value of [attribution_token][crate::model::UserEvent::attribution_token].
26673    ///
26674    /// # Example
26675    /// ```ignore,no_run
26676    /// # use google_cloud_retail_v2::model::UserEvent;
26677    /// let x = UserEvent::new().set_attribution_token("example");
26678    /// ```
26679    pub fn set_attribution_token<T: std::convert::Into<std::string::String>>(
26680        mut self,
26681        v: T,
26682    ) -> Self {
26683        self.attribution_token = v.into();
26684        self
26685    }
26686
26687    /// Sets the value of [product_details][crate::model::UserEvent::product_details].
26688    ///
26689    /// # Example
26690    /// ```ignore,no_run
26691    /// # use google_cloud_retail_v2::model::UserEvent;
26692    /// use google_cloud_retail_v2::model::ProductDetail;
26693    /// let x = UserEvent::new()
26694    ///     .set_product_details([
26695    ///         ProductDetail::default()/* use setters */,
26696    ///         ProductDetail::default()/* use (different) setters */,
26697    ///     ]);
26698    /// ```
26699    pub fn set_product_details<T, V>(mut self, v: T) -> Self
26700    where
26701        T: std::iter::IntoIterator<Item = V>,
26702        V: std::convert::Into<crate::model::ProductDetail>,
26703    {
26704        use std::iter::Iterator;
26705        self.product_details = v.into_iter().map(|i| i.into()).collect();
26706        self
26707    }
26708
26709    /// Sets the value of [completion_detail][crate::model::UserEvent::completion_detail].
26710    ///
26711    /// # Example
26712    /// ```ignore,no_run
26713    /// # use google_cloud_retail_v2::model::UserEvent;
26714    /// use google_cloud_retail_v2::model::CompletionDetail;
26715    /// let x = UserEvent::new().set_completion_detail(CompletionDetail::default()/* use setters */);
26716    /// ```
26717    pub fn set_completion_detail<T>(mut self, v: T) -> Self
26718    where
26719        T: std::convert::Into<crate::model::CompletionDetail>,
26720    {
26721        self.completion_detail = std::option::Option::Some(v.into());
26722        self
26723    }
26724
26725    /// Sets or clears the value of [completion_detail][crate::model::UserEvent::completion_detail].
26726    ///
26727    /// # Example
26728    /// ```ignore,no_run
26729    /// # use google_cloud_retail_v2::model::UserEvent;
26730    /// use google_cloud_retail_v2::model::CompletionDetail;
26731    /// let x = UserEvent::new().set_or_clear_completion_detail(Some(CompletionDetail::default()/* use setters */));
26732    /// let x = UserEvent::new().set_or_clear_completion_detail(None::<CompletionDetail>);
26733    /// ```
26734    pub fn set_or_clear_completion_detail<T>(mut self, v: std::option::Option<T>) -> Self
26735    where
26736        T: std::convert::Into<crate::model::CompletionDetail>,
26737    {
26738        self.completion_detail = v.map(|x| x.into());
26739        self
26740    }
26741
26742    /// Sets the value of [attributes][crate::model::UserEvent::attributes].
26743    ///
26744    /// # Example
26745    /// ```ignore,no_run
26746    /// # use google_cloud_retail_v2::model::UserEvent;
26747    /// use google_cloud_retail_v2::model::CustomAttribute;
26748    /// let x = UserEvent::new().set_attributes([
26749    ///     ("key0", CustomAttribute::default()/* use setters */),
26750    ///     ("key1", CustomAttribute::default()/* use (different) setters */),
26751    /// ]);
26752    /// ```
26753    pub fn set_attributes<T, K, V>(mut self, v: T) -> Self
26754    where
26755        T: std::iter::IntoIterator<Item = (K, V)>,
26756        K: std::convert::Into<std::string::String>,
26757        V: std::convert::Into<crate::model::CustomAttribute>,
26758    {
26759        use std::iter::Iterator;
26760        self.attributes = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
26761        self
26762    }
26763
26764    /// Sets the value of [cart_id][crate::model::UserEvent::cart_id].
26765    ///
26766    /// # Example
26767    /// ```ignore,no_run
26768    /// # use google_cloud_retail_v2::model::UserEvent;
26769    /// let x = UserEvent::new().set_cart_id("example");
26770    /// ```
26771    pub fn set_cart_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26772        self.cart_id = v.into();
26773        self
26774    }
26775
26776    /// Sets the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26777    ///
26778    /// # Example
26779    /// ```ignore,no_run
26780    /// # use google_cloud_retail_v2::model::UserEvent;
26781    /// use google_cloud_retail_v2::model::PurchaseTransaction;
26782    /// let x = UserEvent::new().set_purchase_transaction(PurchaseTransaction::default()/* use setters */);
26783    /// ```
26784    pub fn set_purchase_transaction<T>(mut self, v: T) -> Self
26785    where
26786        T: std::convert::Into<crate::model::PurchaseTransaction>,
26787    {
26788        self.purchase_transaction = std::option::Option::Some(v.into());
26789        self
26790    }
26791
26792    /// Sets or clears the value of [purchase_transaction][crate::model::UserEvent::purchase_transaction].
26793    ///
26794    /// # Example
26795    /// ```ignore,no_run
26796    /// # use google_cloud_retail_v2::model::UserEvent;
26797    /// use google_cloud_retail_v2::model::PurchaseTransaction;
26798    /// let x = UserEvent::new().set_or_clear_purchase_transaction(Some(PurchaseTransaction::default()/* use setters */));
26799    /// let x = UserEvent::new().set_or_clear_purchase_transaction(None::<PurchaseTransaction>);
26800    /// ```
26801    pub fn set_or_clear_purchase_transaction<T>(mut self, v: std::option::Option<T>) -> Self
26802    where
26803        T: std::convert::Into<crate::model::PurchaseTransaction>,
26804    {
26805        self.purchase_transaction = v.map(|x| x.into());
26806        self
26807    }
26808
26809    /// Sets the value of [search_query][crate::model::UserEvent::search_query].
26810    ///
26811    /// # Example
26812    /// ```ignore,no_run
26813    /// # use google_cloud_retail_v2::model::UserEvent;
26814    /// let x = UserEvent::new().set_search_query("example");
26815    /// ```
26816    pub fn set_search_query<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26817        self.search_query = v.into();
26818        self
26819    }
26820
26821    /// Sets the value of [filter][crate::model::UserEvent::filter].
26822    ///
26823    /// # Example
26824    /// ```ignore,no_run
26825    /// # use google_cloud_retail_v2::model::UserEvent;
26826    /// let x = UserEvent::new().set_filter("example");
26827    /// ```
26828    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26829        self.filter = v.into();
26830        self
26831    }
26832
26833    /// Sets the value of [order_by][crate::model::UserEvent::order_by].
26834    ///
26835    /// # Example
26836    /// ```ignore,no_run
26837    /// # use google_cloud_retail_v2::model::UserEvent;
26838    /// let x = UserEvent::new().set_order_by("example");
26839    /// ```
26840    pub fn set_order_by<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26841        self.order_by = v.into();
26842        self
26843    }
26844
26845    /// Sets the value of [offset][crate::model::UserEvent::offset].
26846    ///
26847    /// # Example
26848    /// ```ignore,no_run
26849    /// # use google_cloud_retail_v2::model::UserEvent;
26850    /// let x = UserEvent::new().set_offset(42);
26851    /// ```
26852    pub fn set_offset<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
26853        self.offset = v.into();
26854        self
26855    }
26856
26857    /// Sets the value of [page_categories][crate::model::UserEvent::page_categories].
26858    ///
26859    /// # Example
26860    /// ```ignore,no_run
26861    /// # use google_cloud_retail_v2::model::UserEvent;
26862    /// let x = UserEvent::new().set_page_categories(["a", "b", "c"]);
26863    /// ```
26864    pub fn set_page_categories<T, V>(mut self, v: T) -> Self
26865    where
26866        T: std::iter::IntoIterator<Item = V>,
26867        V: std::convert::Into<std::string::String>,
26868    {
26869        use std::iter::Iterator;
26870        self.page_categories = v.into_iter().map(|i| i.into()).collect();
26871        self
26872    }
26873
26874    /// Sets the value of [user_info][crate::model::UserEvent::user_info].
26875    ///
26876    /// # Example
26877    /// ```ignore,no_run
26878    /// # use google_cloud_retail_v2::model::UserEvent;
26879    /// use google_cloud_retail_v2::model::UserInfo;
26880    /// let x = UserEvent::new().set_user_info(UserInfo::default()/* use setters */);
26881    /// ```
26882    pub fn set_user_info<T>(mut self, v: T) -> Self
26883    where
26884        T: std::convert::Into<crate::model::UserInfo>,
26885    {
26886        self.user_info = std::option::Option::Some(v.into());
26887        self
26888    }
26889
26890    /// Sets or clears the value of [user_info][crate::model::UserEvent::user_info].
26891    ///
26892    /// # Example
26893    /// ```ignore,no_run
26894    /// # use google_cloud_retail_v2::model::UserEvent;
26895    /// use google_cloud_retail_v2::model::UserInfo;
26896    /// let x = UserEvent::new().set_or_clear_user_info(Some(UserInfo::default()/* use setters */));
26897    /// let x = UserEvent::new().set_or_clear_user_info(None::<UserInfo>);
26898    /// ```
26899    pub fn set_or_clear_user_info<T>(mut self, v: std::option::Option<T>) -> Self
26900    where
26901        T: std::convert::Into<crate::model::UserInfo>,
26902    {
26903        self.user_info = v.map(|x| x.into());
26904        self
26905    }
26906
26907    /// Sets the value of [uri][crate::model::UserEvent::uri].
26908    ///
26909    /// # Example
26910    /// ```ignore,no_run
26911    /// # use google_cloud_retail_v2::model::UserEvent;
26912    /// let x = UserEvent::new().set_uri("example");
26913    /// ```
26914    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26915        self.uri = v.into();
26916        self
26917    }
26918
26919    /// Sets the value of [referrer_uri][crate::model::UserEvent::referrer_uri].
26920    ///
26921    /// # Example
26922    /// ```ignore,no_run
26923    /// # use google_cloud_retail_v2::model::UserEvent;
26924    /// let x = UserEvent::new().set_referrer_uri("example");
26925    /// ```
26926    pub fn set_referrer_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26927        self.referrer_uri = v.into();
26928        self
26929    }
26930
26931    /// Sets the value of [page_view_id][crate::model::UserEvent::page_view_id].
26932    ///
26933    /// # Example
26934    /// ```ignore,no_run
26935    /// # use google_cloud_retail_v2::model::UserEvent;
26936    /// let x = UserEvent::new().set_page_view_id("example");
26937    /// ```
26938    pub fn set_page_view_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26939        self.page_view_id = v.into();
26940        self
26941    }
26942
26943    /// Sets the value of [entity][crate::model::UserEvent::entity].
26944    ///
26945    /// # Example
26946    /// ```ignore,no_run
26947    /// # use google_cloud_retail_v2::model::UserEvent;
26948    /// let x = UserEvent::new().set_entity("example");
26949    /// ```
26950    pub fn set_entity<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
26951        self.entity = v.into();
26952        self
26953    }
26954}
26955
26956impl wkt::message::Message for UserEvent {
26957    fn typename() -> &'static str {
26958        "type.googleapis.com/google.cloud.retail.v2.UserEvent"
26959    }
26960}
26961
26962/// Detailed product information associated with a user event.
26963#[derive(Clone, Default, PartialEq)]
26964#[non_exhaustive]
26965pub struct ProductDetail {
26966    /// Required. [Product][google.cloud.retail.v2.Product] information.
26967    ///
26968    /// Required field(s):
26969    ///
26970    /// * [Product.id][google.cloud.retail.v2.Product.id]
26971    ///
26972    /// Optional override field(s):
26973    ///
26974    /// * [Product.price_info][google.cloud.retail.v2.Product.price_info]
26975    ///
26976    /// If any supported optional fields are provided, we will treat them as a full
26977    /// override when looking up product information from the catalog. Thus, it is
26978    /// important to ensure that the overriding fields are accurate and
26979    /// complete.
26980    ///
26981    /// All other product fields are ignored and instead populated via catalog
26982    /// lookup after event ingestion.
26983    ///
26984    /// [google.cloud.retail.v2.Product]: crate::model::Product
26985    /// [google.cloud.retail.v2.Product.id]: crate::model::Product::id
26986    /// [google.cloud.retail.v2.Product.price_info]: crate::model::Product::price_info
26987    pub product: std::option::Option<crate::model::Product>,
26988
26989    /// Quantity of the product associated with the user event.
26990    ///
26991    /// For example, this field will be 2 if two products are added to the shopping
26992    /// cart for `purchase-complete` event. Required for `add-to-cart` and
26993    /// `purchase-complete` event types.
26994    pub quantity: std::option::Option<wkt::Int32Value>,
26995
26996    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
26997}
26998
26999impl ProductDetail {
27000    /// Creates a new default instance.
27001    pub fn new() -> Self {
27002        std::default::Default::default()
27003    }
27004
27005    /// Sets the value of [product][crate::model::ProductDetail::product].
27006    ///
27007    /// # Example
27008    /// ```ignore,no_run
27009    /// # use google_cloud_retail_v2::model::ProductDetail;
27010    /// use google_cloud_retail_v2::model::Product;
27011    /// let x = ProductDetail::new().set_product(Product::default()/* use setters */);
27012    /// ```
27013    pub fn set_product<T>(mut self, v: T) -> Self
27014    where
27015        T: std::convert::Into<crate::model::Product>,
27016    {
27017        self.product = std::option::Option::Some(v.into());
27018        self
27019    }
27020
27021    /// Sets or clears the value of [product][crate::model::ProductDetail::product].
27022    ///
27023    /// # Example
27024    /// ```ignore,no_run
27025    /// # use google_cloud_retail_v2::model::ProductDetail;
27026    /// use google_cloud_retail_v2::model::Product;
27027    /// let x = ProductDetail::new().set_or_clear_product(Some(Product::default()/* use setters */));
27028    /// let x = ProductDetail::new().set_or_clear_product(None::<Product>);
27029    /// ```
27030    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
27031    where
27032        T: std::convert::Into<crate::model::Product>,
27033    {
27034        self.product = v.map(|x| x.into());
27035        self
27036    }
27037
27038    /// Sets the value of [quantity][crate::model::ProductDetail::quantity].
27039    ///
27040    /// # Example
27041    /// ```ignore,no_run
27042    /// # use google_cloud_retail_v2::model::ProductDetail;
27043    /// use wkt::Int32Value;
27044    /// let x = ProductDetail::new().set_quantity(Int32Value::default()/* use setters */);
27045    /// ```
27046    pub fn set_quantity<T>(mut self, v: T) -> Self
27047    where
27048        T: std::convert::Into<wkt::Int32Value>,
27049    {
27050        self.quantity = std::option::Option::Some(v.into());
27051        self
27052    }
27053
27054    /// Sets or clears the value of [quantity][crate::model::ProductDetail::quantity].
27055    ///
27056    /// # Example
27057    /// ```ignore,no_run
27058    /// # use google_cloud_retail_v2::model::ProductDetail;
27059    /// use wkt::Int32Value;
27060    /// let x = ProductDetail::new().set_or_clear_quantity(Some(Int32Value::default()/* use setters */));
27061    /// let x = ProductDetail::new().set_or_clear_quantity(None::<Int32Value>);
27062    /// ```
27063    pub fn set_or_clear_quantity<T>(mut self, v: std::option::Option<T>) -> Self
27064    where
27065        T: std::convert::Into<wkt::Int32Value>,
27066    {
27067        self.quantity = v.map(|x| x.into());
27068        self
27069    }
27070}
27071
27072impl wkt::message::Message for ProductDetail {
27073    fn typename() -> &'static str {
27074        "type.googleapis.com/google.cloud.retail.v2.ProductDetail"
27075    }
27076}
27077
27078/// Detailed completion information including completion attribution token and
27079/// clicked completion info.
27080#[derive(Clone, Default, PartialEq)]
27081#[non_exhaustive]
27082pub struct CompletionDetail {
27083    /// Completion attribution token in
27084    /// [CompleteQueryResponse.attribution_token][google.cloud.retail.v2.CompleteQueryResponse.attribution_token].
27085    ///
27086    /// [google.cloud.retail.v2.CompleteQueryResponse.attribution_token]: crate::model::CompleteQueryResponse::attribution_token
27087    pub completion_attribution_token: std::string::String,
27088
27089    /// End user selected
27090    /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion].
27091    ///
27092    /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
27093    pub selected_suggestion: std::string::String,
27094
27095    /// End user selected
27096    /// [CompleteQueryResponse.CompletionResult.suggestion][google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]
27097    /// position, starting from 0.
27098    ///
27099    /// [google.cloud.retail.v2.CompleteQueryResponse.CompletionResult.suggestion]: crate::model::complete_query_response::CompletionResult::suggestion
27100    pub selected_position: i32,
27101
27102    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27103}
27104
27105impl CompletionDetail {
27106    /// Creates a new default instance.
27107    pub fn new() -> Self {
27108        std::default::Default::default()
27109    }
27110
27111    /// Sets the value of [completion_attribution_token][crate::model::CompletionDetail::completion_attribution_token].
27112    ///
27113    /// # Example
27114    /// ```ignore,no_run
27115    /// # use google_cloud_retail_v2::model::CompletionDetail;
27116    /// let x = CompletionDetail::new().set_completion_attribution_token("example");
27117    /// ```
27118    pub fn set_completion_attribution_token<T: std::convert::Into<std::string::String>>(
27119        mut self,
27120        v: T,
27121    ) -> Self {
27122        self.completion_attribution_token = v.into();
27123        self
27124    }
27125
27126    /// Sets the value of [selected_suggestion][crate::model::CompletionDetail::selected_suggestion].
27127    ///
27128    /// # Example
27129    /// ```ignore,no_run
27130    /// # use google_cloud_retail_v2::model::CompletionDetail;
27131    /// let x = CompletionDetail::new().set_selected_suggestion("example");
27132    /// ```
27133    pub fn set_selected_suggestion<T: std::convert::Into<std::string::String>>(
27134        mut self,
27135        v: T,
27136    ) -> Self {
27137        self.selected_suggestion = v.into();
27138        self
27139    }
27140
27141    /// Sets the value of [selected_position][crate::model::CompletionDetail::selected_position].
27142    ///
27143    /// # Example
27144    /// ```ignore,no_run
27145    /// # use google_cloud_retail_v2::model::CompletionDetail;
27146    /// let x = CompletionDetail::new().set_selected_position(42);
27147    /// ```
27148    pub fn set_selected_position<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
27149        self.selected_position = v.into();
27150        self
27151    }
27152}
27153
27154impl wkt::message::Message for CompletionDetail {
27155    fn typename() -> &'static str {
27156        "type.googleapis.com/google.cloud.retail.v2.CompletionDetail"
27157    }
27158}
27159
27160/// A transaction represents the entire purchase transaction.
27161#[derive(Clone, Default, PartialEq)]
27162#[non_exhaustive]
27163pub struct PurchaseTransaction {
27164    /// The transaction ID with a length limit of 128 characters.
27165    pub id: std::string::String,
27166
27167    /// Required. Total non-zero revenue or grand total associated with the
27168    /// transaction. This value include shipping, tax, or other adjustments to
27169    /// total revenue that you want to include as part of your revenue
27170    /// calculations.
27171    pub revenue: f32,
27172
27173    /// All the taxes associated with the transaction.
27174    pub tax: f32,
27175
27176    /// All the costs associated with the products. These can be manufacturing
27177    /// costs, shipping expenses not borne by the end user, or any other costs,
27178    /// such that:
27179    ///
27180    /// * Profit = [revenue][google.cloud.retail.v2.PurchaseTransaction.revenue] -
27181    ///   [tax][google.cloud.retail.v2.PurchaseTransaction.tax] -
27182    ///   [cost][google.cloud.retail.v2.PurchaseTransaction.cost]
27183    ///
27184    /// [google.cloud.retail.v2.PurchaseTransaction.cost]: crate::model::PurchaseTransaction::cost
27185    /// [google.cloud.retail.v2.PurchaseTransaction.revenue]: crate::model::PurchaseTransaction::revenue
27186    /// [google.cloud.retail.v2.PurchaseTransaction.tax]: crate::model::PurchaseTransaction::tax
27187    pub cost: f32,
27188
27189    /// Required. Currency code. Use three-character ISO-4217 code.
27190    pub currency_code: std::string::String,
27191
27192    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27193}
27194
27195impl PurchaseTransaction {
27196    /// Creates a new default instance.
27197    pub fn new() -> Self {
27198        std::default::Default::default()
27199    }
27200
27201    /// Sets the value of [id][crate::model::PurchaseTransaction::id].
27202    ///
27203    /// # Example
27204    /// ```ignore,no_run
27205    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27206    /// let x = PurchaseTransaction::new().set_id("example");
27207    /// ```
27208    pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27209        self.id = v.into();
27210        self
27211    }
27212
27213    /// Sets the value of [revenue][crate::model::PurchaseTransaction::revenue].
27214    ///
27215    /// # Example
27216    /// ```ignore,no_run
27217    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27218    /// let x = PurchaseTransaction::new().set_revenue(42.0);
27219    /// ```
27220    pub fn set_revenue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27221        self.revenue = v.into();
27222        self
27223    }
27224
27225    /// Sets the value of [tax][crate::model::PurchaseTransaction::tax].
27226    ///
27227    /// # Example
27228    /// ```ignore,no_run
27229    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27230    /// let x = PurchaseTransaction::new().set_tax(42.0);
27231    /// ```
27232    pub fn set_tax<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27233        self.tax = v.into();
27234        self
27235    }
27236
27237    /// Sets the value of [cost][crate::model::PurchaseTransaction::cost].
27238    ///
27239    /// # Example
27240    /// ```ignore,no_run
27241    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27242    /// let x = PurchaseTransaction::new().set_cost(42.0);
27243    /// ```
27244    pub fn set_cost<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
27245        self.cost = v.into();
27246        self
27247    }
27248
27249    /// Sets the value of [currency_code][crate::model::PurchaseTransaction::currency_code].
27250    ///
27251    /// # Example
27252    /// ```ignore,no_run
27253    /// # use google_cloud_retail_v2::model::PurchaseTransaction;
27254    /// let x = PurchaseTransaction::new().set_currency_code("example");
27255    /// ```
27256    pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27257        self.currency_code = v.into();
27258        self
27259    }
27260}
27261
27262impl wkt::message::Message for PurchaseTransaction {
27263    fn typename() -> &'static str {
27264        "type.googleapis.com/google.cloud.retail.v2.PurchaseTransaction"
27265    }
27266}
27267
27268/// Request message for WriteUserEvent method.
27269#[derive(Clone, Default, PartialEq)]
27270#[non_exhaustive]
27271pub struct WriteUserEventRequest {
27272    /// Required. The parent catalog resource name, such as
27273    /// `projects/1234/locations/global/catalogs/default_catalog`.
27274    pub parent: std::string::String,
27275
27276    /// Required. User event to write.
27277    pub user_event: std::option::Option<crate::model::UserEvent>,
27278
27279    /// If set to true, the user event will be written asynchronously after
27280    /// validation, and the API will respond without waiting for the write.
27281    /// Therefore, silent failures can occur even if the API returns success. In
27282    /// case of silent failures, error messages can be found in Stackdriver logs.
27283    pub write_async: bool,
27284
27285    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27286}
27287
27288impl WriteUserEventRequest {
27289    /// Creates a new default instance.
27290    pub fn new() -> Self {
27291        std::default::Default::default()
27292    }
27293
27294    /// Sets the value of [parent][crate::model::WriteUserEventRequest::parent].
27295    ///
27296    /// # Example
27297    /// ```ignore,no_run
27298    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27299    /// let x = WriteUserEventRequest::new().set_parent("example");
27300    /// ```
27301    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27302        self.parent = v.into();
27303        self
27304    }
27305
27306    /// Sets the value of [user_event][crate::model::WriteUserEventRequest::user_event].
27307    ///
27308    /// # Example
27309    /// ```ignore,no_run
27310    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27311    /// use google_cloud_retail_v2::model::UserEvent;
27312    /// let x = WriteUserEventRequest::new().set_user_event(UserEvent::default()/* use setters */);
27313    /// ```
27314    pub fn set_user_event<T>(mut self, v: T) -> Self
27315    where
27316        T: std::convert::Into<crate::model::UserEvent>,
27317    {
27318        self.user_event = std::option::Option::Some(v.into());
27319        self
27320    }
27321
27322    /// Sets or clears the value of [user_event][crate::model::WriteUserEventRequest::user_event].
27323    ///
27324    /// # Example
27325    /// ```ignore,no_run
27326    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27327    /// use google_cloud_retail_v2::model::UserEvent;
27328    /// let x = WriteUserEventRequest::new().set_or_clear_user_event(Some(UserEvent::default()/* use setters */));
27329    /// let x = WriteUserEventRequest::new().set_or_clear_user_event(None::<UserEvent>);
27330    /// ```
27331    pub fn set_or_clear_user_event<T>(mut self, v: std::option::Option<T>) -> Self
27332    where
27333        T: std::convert::Into<crate::model::UserEvent>,
27334    {
27335        self.user_event = v.map(|x| x.into());
27336        self
27337    }
27338
27339    /// Sets the value of [write_async][crate::model::WriteUserEventRequest::write_async].
27340    ///
27341    /// # Example
27342    /// ```ignore,no_run
27343    /// # use google_cloud_retail_v2::model::WriteUserEventRequest;
27344    /// let x = WriteUserEventRequest::new().set_write_async(true);
27345    /// ```
27346    pub fn set_write_async<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
27347        self.write_async = v.into();
27348        self
27349    }
27350}
27351
27352impl wkt::message::Message for WriteUserEventRequest {
27353    fn typename() -> &'static str {
27354        "type.googleapis.com/google.cloud.retail.v2.WriteUserEventRequest"
27355    }
27356}
27357
27358/// Request message for CollectUserEvent method.
27359#[derive(Clone, Default, PartialEq)]
27360#[non_exhaustive]
27361pub struct CollectUserEventRequest {
27362    /// Required. The parent catalog name, such as
27363    /// `projects/1234/locations/global/catalogs/default_catalog`.
27364    pub parent: std::string::String,
27365
27366    /// Required. URL encoded UserEvent proto with a length limit of 2,000,000
27367    /// characters.
27368    pub user_event: std::string::String,
27369
27370    /// The URL including cgi-parameters but excluding the hash fragment with a
27371    /// length limit of 5,000 characters. This is often more useful than the
27372    /// referer URL, because many browsers only send the domain for 3rd party
27373    /// requests.
27374    pub uri: std::string::String,
27375
27376    /// The event timestamp in milliseconds. This prevents browser caching of
27377    /// otherwise identical get requests. The name is abbreviated to reduce the
27378    /// payload bytes.
27379    pub ets: i64,
27380
27381    /// An arbitrary serialized JSON string that contains necessary information
27382    /// that can comprise a user event. When this field is specified, the
27383    /// user_event field will be ignored. Note: line-delimited JSON is not
27384    /// supported, a single JSON only.
27385    pub raw_json: std::string::String,
27386
27387    /// The rule that can convert the raw_json to a user event. It is needed
27388    /// only when the raw_json is set.
27389    pub conversion_rule:
27390        std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27391
27392    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27393}
27394
27395impl CollectUserEventRequest {
27396    /// Creates a new default instance.
27397    pub fn new() -> Self {
27398        std::default::Default::default()
27399    }
27400
27401    /// Sets the value of [parent][crate::model::CollectUserEventRequest::parent].
27402    ///
27403    /// # Example
27404    /// ```ignore,no_run
27405    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27406    /// let x = CollectUserEventRequest::new().set_parent("example");
27407    /// ```
27408    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27409        self.parent = v.into();
27410        self
27411    }
27412
27413    /// Sets the value of [user_event][crate::model::CollectUserEventRequest::user_event].
27414    ///
27415    /// # Example
27416    /// ```ignore,no_run
27417    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27418    /// let x = CollectUserEventRequest::new().set_user_event("example");
27419    /// ```
27420    pub fn set_user_event<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27421        self.user_event = v.into();
27422        self
27423    }
27424
27425    /// Sets the value of [uri][crate::model::CollectUserEventRequest::uri].
27426    ///
27427    /// # Example
27428    /// ```ignore,no_run
27429    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27430    /// let x = CollectUserEventRequest::new().set_uri("example");
27431    /// ```
27432    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27433        self.uri = v.into();
27434        self
27435    }
27436
27437    /// Sets the value of [ets][crate::model::CollectUserEventRequest::ets].
27438    ///
27439    /// # Example
27440    /// ```ignore,no_run
27441    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27442    /// let x = CollectUserEventRequest::new().set_ets(42);
27443    /// ```
27444    pub fn set_ets<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27445        self.ets = v.into();
27446        self
27447    }
27448
27449    /// Sets the value of [raw_json][crate::model::CollectUserEventRequest::raw_json].
27450    ///
27451    /// # Example
27452    /// ```ignore,no_run
27453    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27454    /// let x = CollectUserEventRequest::new().set_raw_json("example");
27455    /// ```
27456    pub fn set_raw_json<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27457        self.raw_json = v.into();
27458        self
27459    }
27460
27461    /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule].
27462    ///
27463    /// Note that all the setters affecting `conversion_rule` are mutually
27464    /// exclusive.
27465    ///
27466    /// # Example
27467    /// ```ignore,no_run
27468    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27469    /// use google_cloud_retail_v2::model::collect_user_event_request::ConversionRule;
27470    /// let x = CollectUserEventRequest::new().set_conversion_rule(Some(ConversionRule::PrebuiltRule("example".to_string())));
27471    /// ```
27472    pub fn set_conversion_rule<
27473        T: std::convert::Into<
27474                std::option::Option<crate::model::collect_user_event_request::ConversionRule>,
27475            >,
27476    >(
27477        mut self,
27478        v: T,
27479    ) -> Self {
27480        self.conversion_rule = v.into();
27481        self
27482    }
27483
27484    /// The value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27485    /// if it holds a `PrebuiltRule`, `None` if the field is not set or
27486    /// holds a different branch.
27487    pub fn prebuilt_rule(&self) -> std::option::Option<&std::string::String> {
27488        #[allow(unreachable_patterns)]
27489        self.conversion_rule.as_ref().and_then(|v| match v {
27490            crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v) => {
27491                std::option::Option::Some(v)
27492            }
27493            _ => std::option::Option::None,
27494        })
27495    }
27496
27497    /// Sets the value of [conversion_rule][crate::model::CollectUserEventRequest::conversion_rule]
27498    /// to hold a `PrebuiltRule`.
27499    ///
27500    /// Note that all the setters affecting `conversion_rule` are
27501    /// mutually exclusive.
27502    ///
27503    /// # Example
27504    /// ```ignore,no_run
27505    /// # use google_cloud_retail_v2::model::CollectUserEventRequest;
27506    /// let x = CollectUserEventRequest::new().set_prebuilt_rule("example");
27507    /// assert!(x.prebuilt_rule().is_some());
27508    /// ```
27509    pub fn set_prebuilt_rule<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27510        self.conversion_rule = std::option::Option::Some(
27511            crate::model::collect_user_event_request::ConversionRule::PrebuiltRule(v.into()),
27512        );
27513        self
27514    }
27515}
27516
27517impl wkt::message::Message for CollectUserEventRequest {
27518    fn typename() -> &'static str {
27519        "type.googleapis.com/google.cloud.retail.v2.CollectUserEventRequest"
27520    }
27521}
27522
27523/// Defines additional types related to [CollectUserEventRequest].
27524pub mod collect_user_event_request {
27525    #[allow(unused_imports)]
27526    use super::*;
27527
27528    /// The rule that can convert the raw_json to a user event. It is needed
27529    /// only when the raw_json is set.
27530    #[derive(Clone, Debug, PartialEq)]
27531    #[non_exhaustive]
27532    pub enum ConversionRule {
27533        /// The prebuilt rule name that can convert a specific type of raw_json.
27534        /// For example: "ga4_bq" rule for the GA4 user event schema.
27535        PrebuiltRule(std::string::String),
27536    }
27537}
27538
27539/// Request message for RejoinUserEvents method.
27540#[derive(Clone, Default, PartialEq)]
27541#[non_exhaustive]
27542pub struct RejoinUserEventsRequest {
27543    /// Required. The parent catalog resource name, such as
27544    /// `projects/1234/locations/global/catalogs/default_catalog`.
27545    pub parent: std::string::String,
27546
27547    /// The type of the user event rejoin to define the scope and range of the user
27548    /// events to be rejoined with the latest product catalog. Defaults to
27549    /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED` if this field is not set, or set to
27550    /// an invalid integer value.
27551    pub user_event_rejoin_scope: crate::model::rejoin_user_events_request::UserEventRejoinScope,
27552
27553    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27554}
27555
27556impl RejoinUserEventsRequest {
27557    /// Creates a new default instance.
27558    pub fn new() -> Self {
27559        std::default::Default::default()
27560    }
27561
27562    /// Sets the value of [parent][crate::model::RejoinUserEventsRequest::parent].
27563    ///
27564    /// # Example
27565    /// ```ignore,no_run
27566    /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27567    /// let x = RejoinUserEventsRequest::new().set_parent("example");
27568    /// ```
27569    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
27570        self.parent = v.into();
27571        self
27572    }
27573
27574    /// Sets the value of [user_event_rejoin_scope][crate::model::RejoinUserEventsRequest::user_event_rejoin_scope].
27575    ///
27576    /// # Example
27577    /// ```ignore,no_run
27578    /// # use google_cloud_retail_v2::model::RejoinUserEventsRequest;
27579    /// use google_cloud_retail_v2::model::rejoin_user_events_request::UserEventRejoinScope;
27580    /// let x0 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::JoinedEvents);
27581    /// let x1 = RejoinUserEventsRequest::new().set_user_event_rejoin_scope(UserEventRejoinScope::UnjoinedEvents);
27582    /// ```
27583    pub fn set_user_event_rejoin_scope<
27584        T: std::convert::Into<crate::model::rejoin_user_events_request::UserEventRejoinScope>,
27585    >(
27586        mut self,
27587        v: T,
27588    ) -> Self {
27589        self.user_event_rejoin_scope = v.into();
27590        self
27591    }
27592}
27593
27594impl wkt::message::Message for RejoinUserEventsRequest {
27595    fn typename() -> &'static str {
27596        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsRequest"
27597    }
27598}
27599
27600/// Defines additional types related to [RejoinUserEventsRequest].
27601pub mod rejoin_user_events_request {
27602    #[allow(unused_imports)]
27603    use super::*;
27604
27605    /// The scope of user events to be rejoined with the latest product catalog.
27606    /// If the rejoining aims at reducing number of unjoined events, set
27607    /// `UserEventRejoinScope` to `UNJOINED_EVENTS`.
27608    /// If the rejoining aims at correcting product catalog information in joined
27609    /// events, set `UserEventRejoinScope` to `JOINED_EVENTS`.
27610    /// If all events needs to be rejoined, set `UserEventRejoinScope` to
27611    /// `USER_EVENT_REJOIN_SCOPE_UNSPECIFIED`.
27612    ///
27613    /// # Working with unknown values
27614    ///
27615    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27616    /// additional enum variants at any time. Adding new variants is not considered
27617    /// a breaking change. Applications should write their code in anticipation of:
27618    ///
27619    /// - New values appearing in future releases of the client library, **and**
27620    /// - New values received dynamically, without application changes.
27621    ///
27622    /// Please consult the [Working with enums] section in the user guide for some
27623    /// guidelines.
27624    ///
27625    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27626    #[derive(Clone, Debug, PartialEq)]
27627    #[non_exhaustive]
27628    pub enum UserEventRejoinScope {
27629        /// Rejoin all events with the latest product catalog, including both joined
27630        /// events and unjoined events.
27631        Unspecified,
27632        /// Only rejoin joined events with the latest product catalog.
27633        JoinedEvents,
27634        /// Only rejoin unjoined events with the latest product catalog.
27635        UnjoinedEvents,
27636        /// If set, the enum was initialized with an unknown value.
27637        ///
27638        /// Applications can examine the value using [UserEventRejoinScope::value] or
27639        /// [UserEventRejoinScope::name].
27640        UnknownValue(user_event_rejoin_scope::UnknownValue),
27641    }
27642
27643    #[doc(hidden)]
27644    pub mod user_event_rejoin_scope {
27645        #[allow(unused_imports)]
27646        use super::*;
27647        #[derive(Clone, Debug, PartialEq)]
27648        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27649    }
27650
27651    impl UserEventRejoinScope {
27652        /// Gets the enum value.
27653        ///
27654        /// Returns `None` if the enum contains an unknown value deserialized from
27655        /// the string representation of enums.
27656        pub fn value(&self) -> std::option::Option<i32> {
27657            match self {
27658                Self::Unspecified => std::option::Option::Some(0),
27659                Self::JoinedEvents => std::option::Option::Some(1),
27660                Self::UnjoinedEvents => std::option::Option::Some(2),
27661                Self::UnknownValue(u) => u.0.value(),
27662            }
27663        }
27664
27665        /// Gets the enum value as a string.
27666        ///
27667        /// Returns `None` if the enum contains an unknown value deserialized from
27668        /// the integer representation of enums.
27669        pub fn name(&self) -> std::option::Option<&str> {
27670            match self {
27671                Self::Unspecified => {
27672                    std::option::Option::Some("USER_EVENT_REJOIN_SCOPE_UNSPECIFIED")
27673                }
27674                Self::JoinedEvents => std::option::Option::Some("JOINED_EVENTS"),
27675                Self::UnjoinedEvents => std::option::Option::Some("UNJOINED_EVENTS"),
27676                Self::UnknownValue(u) => u.0.name(),
27677            }
27678        }
27679    }
27680
27681    impl std::default::Default for UserEventRejoinScope {
27682        fn default() -> Self {
27683            use std::convert::From;
27684            Self::from(0)
27685        }
27686    }
27687
27688    impl std::fmt::Display for UserEventRejoinScope {
27689        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27690            wkt::internal::display_enum(f, self.name(), self.value())
27691        }
27692    }
27693
27694    impl std::convert::From<i32> for UserEventRejoinScope {
27695        fn from(value: i32) -> Self {
27696            match value {
27697                0 => Self::Unspecified,
27698                1 => Self::JoinedEvents,
27699                2 => Self::UnjoinedEvents,
27700                _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27701                    wkt::internal::UnknownEnumValue::Integer(value),
27702                )),
27703            }
27704        }
27705    }
27706
27707    impl std::convert::From<&str> for UserEventRejoinScope {
27708        fn from(value: &str) -> Self {
27709            use std::string::ToString;
27710            match value {
27711                "USER_EVENT_REJOIN_SCOPE_UNSPECIFIED" => Self::Unspecified,
27712                "JOINED_EVENTS" => Self::JoinedEvents,
27713                "UNJOINED_EVENTS" => Self::UnjoinedEvents,
27714                _ => Self::UnknownValue(user_event_rejoin_scope::UnknownValue(
27715                    wkt::internal::UnknownEnumValue::String(value.to_string()),
27716                )),
27717            }
27718        }
27719    }
27720
27721    impl serde::ser::Serialize for UserEventRejoinScope {
27722        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27723        where
27724            S: serde::Serializer,
27725        {
27726            match self {
27727                Self::Unspecified => serializer.serialize_i32(0),
27728                Self::JoinedEvents => serializer.serialize_i32(1),
27729                Self::UnjoinedEvents => serializer.serialize_i32(2),
27730                Self::UnknownValue(u) => u.0.serialize(serializer),
27731            }
27732        }
27733    }
27734
27735    impl<'de> serde::de::Deserialize<'de> for UserEventRejoinScope {
27736        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27737        where
27738            D: serde::Deserializer<'de>,
27739        {
27740            deserializer.deserialize_any(wkt::internal::EnumVisitor::<UserEventRejoinScope>::new(
27741                ".google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope",
27742            ))
27743        }
27744    }
27745}
27746
27747/// Response message for `RejoinUserEvents` method.
27748#[derive(Clone, Default, PartialEq)]
27749#[non_exhaustive]
27750pub struct RejoinUserEventsResponse {
27751    /// Number of user events that were joined with latest product catalog.
27752    pub rejoined_user_events_count: i64,
27753
27754    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27755}
27756
27757impl RejoinUserEventsResponse {
27758    /// Creates a new default instance.
27759    pub fn new() -> Self {
27760        std::default::Default::default()
27761    }
27762
27763    /// Sets the value of [rejoined_user_events_count][crate::model::RejoinUserEventsResponse::rejoined_user_events_count].
27764    ///
27765    /// # Example
27766    /// ```ignore,no_run
27767    /// # use google_cloud_retail_v2::model::RejoinUserEventsResponse;
27768    /// let x = RejoinUserEventsResponse::new().set_rejoined_user_events_count(42);
27769    /// ```
27770    pub fn set_rejoined_user_events_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
27771        self.rejoined_user_events_count = v.into();
27772        self
27773    }
27774}
27775
27776impl wkt::message::Message for RejoinUserEventsResponse {
27777    fn typename() -> &'static str {
27778        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsResponse"
27779    }
27780}
27781
27782/// Metadata for `RejoinUserEvents` method.
27783#[derive(Clone, Default, PartialEq)]
27784#[non_exhaustive]
27785pub struct RejoinUserEventsMetadata {
27786    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
27787}
27788
27789impl RejoinUserEventsMetadata {
27790    /// Creates a new default instance.
27791    pub fn new() -> Self {
27792        std::default::Default::default()
27793    }
27794}
27795
27796impl wkt::message::Message for RejoinUserEventsMetadata {
27797    fn typename() -> &'static str {
27798        "type.googleapis.com/google.cloud.retail.v2.RejoinUserEventsMetadata"
27799    }
27800}
27801
27802/// At which level we offer configuration for attributes.
27803///
27804/// # Working with unknown values
27805///
27806/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27807/// additional enum variants at any time. Adding new variants is not considered
27808/// a breaking change. Applications should write their code in anticipation of:
27809///
27810/// - New values appearing in future releases of the client library, **and**
27811/// - New values received dynamically, without application changes.
27812///
27813/// Please consult the [Working with enums] section in the user guide for some
27814/// guidelines.
27815///
27816/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27817#[derive(Clone, Debug, PartialEq)]
27818#[non_exhaustive]
27819pub enum AttributeConfigLevel {
27820    /// Value used when unset. In this case, server behavior defaults to
27821    /// [CATALOG_LEVEL_ATTRIBUTE_CONFIG][google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG].
27822    ///
27823    /// [google.cloud.retail.v2.AttributeConfigLevel.CATALOG_LEVEL_ATTRIBUTE_CONFIG]: crate::model::AttributeConfigLevel::CatalogLevelAttributeConfig
27824    Unspecified,
27825    /// At this level, we honor the attribute configurations set in
27826    /// [Product.attributes][google.cloud.retail.v2.Product.attributes].
27827    ///
27828    /// [google.cloud.retail.v2.Product.attributes]: crate::model::Product::attributes
27829    ProductLevelAttributeConfig,
27830    /// At this level, we honor the attribute configurations set in
27831    /// `CatalogConfig.attribute_configs`.
27832    CatalogLevelAttributeConfig,
27833    /// If set, the enum was initialized with an unknown value.
27834    ///
27835    /// Applications can examine the value using [AttributeConfigLevel::value] or
27836    /// [AttributeConfigLevel::name].
27837    UnknownValue(attribute_config_level::UnknownValue),
27838}
27839
27840#[doc(hidden)]
27841pub mod attribute_config_level {
27842    #[allow(unused_imports)]
27843    use super::*;
27844    #[derive(Clone, Debug, PartialEq)]
27845    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27846}
27847
27848impl AttributeConfigLevel {
27849    /// Gets the enum value.
27850    ///
27851    /// Returns `None` if the enum contains an unknown value deserialized from
27852    /// the string representation of enums.
27853    pub fn value(&self) -> std::option::Option<i32> {
27854        match self {
27855            Self::Unspecified => std::option::Option::Some(0),
27856            Self::ProductLevelAttributeConfig => std::option::Option::Some(1),
27857            Self::CatalogLevelAttributeConfig => std::option::Option::Some(2),
27858            Self::UnknownValue(u) => u.0.value(),
27859        }
27860    }
27861
27862    /// Gets the enum value as a string.
27863    ///
27864    /// Returns `None` if the enum contains an unknown value deserialized from
27865    /// the integer representation of enums.
27866    pub fn name(&self) -> std::option::Option<&str> {
27867        match self {
27868            Self::Unspecified => std::option::Option::Some("ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED"),
27869            Self::ProductLevelAttributeConfig => {
27870                std::option::Option::Some("PRODUCT_LEVEL_ATTRIBUTE_CONFIG")
27871            }
27872            Self::CatalogLevelAttributeConfig => {
27873                std::option::Option::Some("CATALOG_LEVEL_ATTRIBUTE_CONFIG")
27874            }
27875            Self::UnknownValue(u) => u.0.name(),
27876        }
27877    }
27878}
27879
27880impl std::default::Default for AttributeConfigLevel {
27881    fn default() -> Self {
27882        use std::convert::From;
27883        Self::from(0)
27884    }
27885}
27886
27887impl std::fmt::Display for AttributeConfigLevel {
27888    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
27889        wkt::internal::display_enum(f, self.name(), self.value())
27890    }
27891}
27892
27893impl std::convert::From<i32> for AttributeConfigLevel {
27894    fn from(value: i32) -> Self {
27895        match value {
27896            0 => Self::Unspecified,
27897            1 => Self::ProductLevelAttributeConfig,
27898            2 => Self::CatalogLevelAttributeConfig,
27899            _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27900                wkt::internal::UnknownEnumValue::Integer(value),
27901            )),
27902        }
27903    }
27904}
27905
27906impl std::convert::From<&str> for AttributeConfigLevel {
27907    fn from(value: &str) -> Self {
27908        use std::string::ToString;
27909        match value {
27910            "ATTRIBUTE_CONFIG_LEVEL_UNSPECIFIED" => Self::Unspecified,
27911            "PRODUCT_LEVEL_ATTRIBUTE_CONFIG" => Self::ProductLevelAttributeConfig,
27912            "CATALOG_LEVEL_ATTRIBUTE_CONFIG" => Self::CatalogLevelAttributeConfig,
27913            _ => Self::UnknownValue(attribute_config_level::UnknownValue(
27914                wkt::internal::UnknownEnumValue::String(value.to_string()),
27915            )),
27916        }
27917    }
27918}
27919
27920impl serde::ser::Serialize for AttributeConfigLevel {
27921    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
27922    where
27923        S: serde::Serializer,
27924    {
27925        match self {
27926            Self::Unspecified => serializer.serialize_i32(0),
27927            Self::ProductLevelAttributeConfig => serializer.serialize_i32(1),
27928            Self::CatalogLevelAttributeConfig => serializer.serialize_i32(2),
27929            Self::UnknownValue(u) => u.0.serialize(serializer),
27930        }
27931    }
27932}
27933
27934impl<'de> serde::de::Deserialize<'de> for AttributeConfigLevel {
27935    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
27936    where
27937        D: serde::Deserializer<'de>,
27938    {
27939        deserializer.deserialize_any(wkt::internal::EnumVisitor::<AttributeConfigLevel>::new(
27940            ".google.cloud.retail.v2.AttributeConfigLevel",
27941        ))
27942    }
27943}
27944
27945/// The type of solution.
27946///
27947/// # Working with unknown values
27948///
27949/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
27950/// additional enum variants at any time. Adding new variants is not considered
27951/// a breaking change. Applications should write their code in anticipation of:
27952///
27953/// - New values appearing in future releases of the client library, **and**
27954/// - New values received dynamically, without application changes.
27955///
27956/// Please consult the [Working with enums] section in the user guide for some
27957/// guidelines.
27958///
27959/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
27960#[derive(Clone, Debug, PartialEq)]
27961#[non_exhaustive]
27962pub enum SolutionType {
27963    /// Default value.
27964    Unspecified,
27965    /// Used for Recommendations AI.
27966    Recommendation,
27967    /// Used for Retail Search.
27968    Search,
27969    /// If set, the enum was initialized with an unknown value.
27970    ///
27971    /// Applications can examine the value using [SolutionType::value] or
27972    /// [SolutionType::name].
27973    UnknownValue(solution_type::UnknownValue),
27974}
27975
27976#[doc(hidden)]
27977pub mod solution_type {
27978    #[allow(unused_imports)]
27979    use super::*;
27980    #[derive(Clone, Debug, PartialEq)]
27981    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
27982}
27983
27984impl SolutionType {
27985    /// Gets the enum value.
27986    ///
27987    /// Returns `None` if the enum contains an unknown value deserialized from
27988    /// the string representation of enums.
27989    pub fn value(&self) -> std::option::Option<i32> {
27990        match self {
27991            Self::Unspecified => std::option::Option::Some(0),
27992            Self::Recommendation => std::option::Option::Some(1),
27993            Self::Search => std::option::Option::Some(2),
27994            Self::UnknownValue(u) => u.0.value(),
27995        }
27996    }
27997
27998    /// Gets the enum value as a string.
27999    ///
28000    /// Returns `None` if the enum contains an unknown value deserialized from
28001    /// the integer representation of enums.
28002    pub fn name(&self) -> std::option::Option<&str> {
28003        match self {
28004            Self::Unspecified => std::option::Option::Some("SOLUTION_TYPE_UNSPECIFIED"),
28005            Self::Recommendation => std::option::Option::Some("SOLUTION_TYPE_RECOMMENDATION"),
28006            Self::Search => std::option::Option::Some("SOLUTION_TYPE_SEARCH"),
28007            Self::UnknownValue(u) => u.0.name(),
28008        }
28009    }
28010}
28011
28012impl std::default::Default for SolutionType {
28013    fn default() -> Self {
28014        use std::convert::From;
28015        Self::from(0)
28016    }
28017}
28018
28019impl std::fmt::Display for SolutionType {
28020    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28021        wkt::internal::display_enum(f, self.name(), self.value())
28022    }
28023}
28024
28025impl std::convert::From<i32> for SolutionType {
28026    fn from(value: i32) -> Self {
28027        match value {
28028            0 => Self::Unspecified,
28029            1 => Self::Recommendation,
28030            2 => Self::Search,
28031            _ => Self::UnknownValue(solution_type::UnknownValue(
28032                wkt::internal::UnknownEnumValue::Integer(value),
28033            )),
28034        }
28035    }
28036}
28037
28038impl std::convert::From<&str> for SolutionType {
28039    fn from(value: &str) -> Self {
28040        use std::string::ToString;
28041        match value {
28042            "SOLUTION_TYPE_UNSPECIFIED" => Self::Unspecified,
28043            "SOLUTION_TYPE_RECOMMENDATION" => Self::Recommendation,
28044            "SOLUTION_TYPE_SEARCH" => Self::Search,
28045            _ => Self::UnknownValue(solution_type::UnknownValue(
28046                wkt::internal::UnknownEnumValue::String(value.to_string()),
28047            )),
28048        }
28049    }
28050}
28051
28052impl serde::ser::Serialize for SolutionType {
28053    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28054    where
28055        S: serde::Serializer,
28056    {
28057        match self {
28058            Self::Unspecified => serializer.serialize_i32(0),
28059            Self::Recommendation => serializer.serialize_i32(1),
28060            Self::Search => serializer.serialize_i32(2),
28061            Self::UnknownValue(u) => u.0.serialize(serializer),
28062        }
28063    }
28064}
28065
28066impl<'de> serde::de::Deserialize<'de> for SolutionType {
28067    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28068    where
28069        D: serde::Deserializer<'de>,
28070    {
28071        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SolutionType>::new(
28072            ".google.cloud.retail.v2.SolutionType",
28073        ))
28074    }
28075}
28076
28077/// If filtering for recommendations is enabled.
28078///
28079/// # Working with unknown values
28080///
28081/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28082/// additional enum variants at any time. Adding new variants is not considered
28083/// a breaking change. Applications should write their code in anticipation of:
28084///
28085/// - New values appearing in future releases of the client library, **and**
28086/// - New values received dynamically, without application changes.
28087///
28088/// Please consult the [Working with enums] section in the user guide for some
28089/// guidelines.
28090///
28091/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28092#[derive(Clone, Debug, PartialEq)]
28093#[non_exhaustive]
28094pub enum RecommendationsFilteringOption {
28095    /// Value used when unset.
28096    /// In this case, server behavior defaults to
28097    /// [RECOMMENDATIONS_FILTERING_DISABLED][google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED].
28098    ///
28099    /// [google.cloud.retail.v2.RecommendationsFilteringOption.RECOMMENDATIONS_FILTERING_DISABLED]: crate::model::RecommendationsFilteringOption::RecommendationsFilteringDisabled
28100    Unspecified,
28101    /// Recommendation filtering is disabled.
28102    RecommendationsFilteringDisabled,
28103    /// Recommendation filtering is enabled.
28104    RecommendationsFilteringEnabled,
28105    /// If set, the enum was initialized with an unknown value.
28106    ///
28107    /// Applications can examine the value using [RecommendationsFilteringOption::value] or
28108    /// [RecommendationsFilteringOption::name].
28109    UnknownValue(recommendations_filtering_option::UnknownValue),
28110}
28111
28112#[doc(hidden)]
28113pub mod recommendations_filtering_option {
28114    #[allow(unused_imports)]
28115    use super::*;
28116    #[derive(Clone, Debug, PartialEq)]
28117    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28118}
28119
28120impl RecommendationsFilteringOption {
28121    /// Gets the enum value.
28122    ///
28123    /// Returns `None` if the enum contains an unknown value deserialized from
28124    /// the string representation of enums.
28125    pub fn value(&self) -> std::option::Option<i32> {
28126        match self {
28127            Self::Unspecified => std::option::Option::Some(0),
28128            Self::RecommendationsFilteringDisabled => std::option::Option::Some(1),
28129            Self::RecommendationsFilteringEnabled => std::option::Option::Some(3),
28130            Self::UnknownValue(u) => u.0.value(),
28131        }
28132    }
28133
28134    /// Gets the enum value as a string.
28135    ///
28136    /// Returns `None` if the enum contains an unknown value deserialized from
28137    /// the integer representation of enums.
28138    pub fn name(&self) -> std::option::Option<&str> {
28139        match self {
28140            Self::Unspecified => {
28141                std::option::Option::Some("RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED")
28142            }
28143            Self::RecommendationsFilteringDisabled => {
28144                std::option::Option::Some("RECOMMENDATIONS_FILTERING_DISABLED")
28145            }
28146            Self::RecommendationsFilteringEnabled => {
28147                std::option::Option::Some("RECOMMENDATIONS_FILTERING_ENABLED")
28148            }
28149            Self::UnknownValue(u) => u.0.name(),
28150        }
28151    }
28152}
28153
28154impl std::default::Default for RecommendationsFilteringOption {
28155    fn default() -> Self {
28156        use std::convert::From;
28157        Self::from(0)
28158    }
28159}
28160
28161impl std::fmt::Display for RecommendationsFilteringOption {
28162    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28163        wkt::internal::display_enum(f, self.name(), self.value())
28164    }
28165}
28166
28167impl std::convert::From<i32> for RecommendationsFilteringOption {
28168    fn from(value: i32) -> Self {
28169        match value {
28170            0 => Self::Unspecified,
28171            1 => Self::RecommendationsFilteringDisabled,
28172            3 => Self::RecommendationsFilteringEnabled,
28173            _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
28174                wkt::internal::UnknownEnumValue::Integer(value),
28175            )),
28176        }
28177    }
28178}
28179
28180impl std::convert::From<&str> for RecommendationsFilteringOption {
28181    fn from(value: &str) -> Self {
28182        use std::string::ToString;
28183        match value {
28184            "RECOMMENDATIONS_FILTERING_OPTION_UNSPECIFIED" => Self::Unspecified,
28185            "RECOMMENDATIONS_FILTERING_DISABLED" => Self::RecommendationsFilteringDisabled,
28186            "RECOMMENDATIONS_FILTERING_ENABLED" => Self::RecommendationsFilteringEnabled,
28187            _ => Self::UnknownValue(recommendations_filtering_option::UnknownValue(
28188                wkt::internal::UnknownEnumValue::String(value.to_string()),
28189            )),
28190        }
28191    }
28192}
28193
28194impl serde::ser::Serialize for RecommendationsFilteringOption {
28195    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28196    where
28197        S: serde::Serializer,
28198    {
28199        match self {
28200            Self::Unspecified => serializer.serialize_i32(0),
28201            Self::RecommendationsFilteringDisabled => serializer.serialize_i32(1),
28202            Self::RecommendationsFilteringEnabled => serializer.serialize_i32(3),
28203            Self::UnknownValue(u) => u.0.serialize(serializer),
28204        }
28205    }
28206}
28207
28208impl<'de> serde::de::Deserialize<'de> for RecommendationsFilteringOption {
28209    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28210    where
28211        D: serde::Deserializer<'de>,
28212    {
28213        deserializer.deserialize_any(
28214            wkt::internal::EnumVisitor::<RecommendationsFilteringOption>::new(
28215                ".google.cloud.retail.v2.RecommendationsFilteringOption",
28216            ),
28217        )
28218    }
28219}
28220
28221/// The use case of Cloud Retail Search.
28222///
28223/// # Working with unknown values
28224///
28225/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28226/// additional enum variants at any time. Adding new variants is not considered
28227/// a breaking change. Applications should write their code in anticipation of:
28228///
28229/// - New values appearing in future releases of the client library, **and**
28230/// - New values received dynamically, without application changes.
28231///
28232/// Please consult the [Working with enums] section in the user guide for some
28233/// guidelines.
28234///
28235/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28236#[derive(Clone, Debug, PartialEq)]
28237#[non_exhaustive]
28238pub enum SearchSolutionUseCase {
28239    /// The value when it's unspecified. In this case, server behavior defaults to
28240    /// [SEARCH_SOLUTION_USE_CASE_SEARCH][google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH].
28241    ///
28242    /// [google.cloud.retail.v2.SearchSolutionUseCase.SEARCH_SOLUTION_USE_CASE_SEARCH]: crate::model::SearchSolutionUseCase::Search
28243    Unspecified,
28244    /// Search use case. Expects the traffic has a non-empty
28245    /// [query][google.cloud.retail.v2.SearchRequest.query].
28246    ///
28247    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
28248    Search,
28249    /// Browse use case. Expects the traffic has an empty
28250    /// [query][google.cloud.retail.v2.SearchRequest.query].
28251    ///
28252    /// [google.cloud.retail.v2.SearchRequest.query]: crate::model::SearchRequest::query
28253    Browse,
28254    /// If set, the enum was initialized with an unknown value.
28255    ///
28256    /// Applications can examine the value using [SearchSolutionUseCase::value] or
28257    /// [SearchSolutionUseCase::name].
28258    UnknownValue(search_solution_use_case::UnknownValue),
28259}
28260
28261#[doc(hidden)]
28262pub mod search_solution_use_case {
28263    #[allow(unused_imports)]
28264    use super::*;
28265    #[derive(Clone, Debug, PartialEq)]
28266    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28267}
28268
28269impl SearchSolutionUseCase {
28270    /// Gets the enum value.
28271    ///
28272    /// Returns `None` if the enum contains an unknown value deserialized from
28273    /// the string representation of enums.
28274    pub fn value(&self) -> std::option::Option<i32> {
28275        match self {
28276            Self::Unspecified => std::option::Option::Some(0),
28277            Self::Search => std::option::Option::Some(1),
28278            Self::Browse => std::option::Option::Some(2),
28279            Self::UnknownValue(u) => u.0.value(),
28280        }
28281    }
28282
28283    /// Gets the enum value as a string.
28284    ///
28285    /// Returns `None` if the enum contains an unknown value deserialized from
28286    /// the integer representation of enums.
28287    pub fn name(&self) -> std::option::Option<&str> {
28288        match self {
28289            Self::Unspecified => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_UNSPECIFIED"),
28290            Self::Search => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_SEARCH"),
28291            Self::Browse => std::option::Option::Some("SEARCH_SOLUTION_USE_CASE_BROWSE"),
28292            Self::UnknownValue(u) => u.0.name(),
28293        }
28294    }
28295}
28296
28297impl std::default::Default for SearchSolutionUseCase {
28298    fn default() -> Self {
28299        use std::convert::From;
28300        Self::from(0)
28301    }
28302}
28303
28304impl std::fmt::Display for SearchSolutionUseCase {
28305    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28306        wkt::internal::display_enum(f, self.name(), self.value())
28307    }
28308}
28309
28310impl std::convert::From<i32> for SearchSolutionUseCase {
28311    fn from(value: i32) -> Self {
28312        match value {
28313            0 => Self::Unspecified,
28314            1 => Self::Search,
28315            2 => Self::Browse,
28316            _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
28317                wkt::internal::UnknownEnumValue::Integer(value),
28318            )),
28319        }
28320    }
28321}
28322
28323impl std::convert::From<&str> for SearchSolutionUseCase {
28324    fn from(value: &str) -> Self {
28325        use std::string::ToString;
28326        match value {
28327            "SEARCH_SOLUTION_USE_CASE_UNSPECIFIED" => Self::Unspecified,
28328            "SEARCH_SOLUTION_USE_CASE_SEARCH" => Self::Search,
28329            "SEARCH_SOLUTION_USE_CASE_BROWSE" => Self::Browse,
28330            _ => Self::UnknownValue(search_solution_use_case::UnknownValue(
28331                wkt::internal::UnknownEnumValue::String(value.to_string()),
28332            )),
28333        }
28334    }
28335}
28336
28337impl serde::ser::Serialize for SearchSolutionUseCase {
28338    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28339    where
28340        S: serde::Serializer,
28341    {
28342        match self {
28343            Self::Unspecified => serializer.serialize_i32(0),
28344            Self::Search => serializer.serialize_i32(1),
28345            Self::Browse => serializer.serialize_i32(2),
28346            Self::UnknownValue(u) => u.0.serialize(serializer),
28347        }
28348    }
28349}
28350
28351impl<'de> serde::de::Deserialize<'de> for SearchSolutionUseCase {
28352    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28353    where
28354        D: serde::Deserializer<'de>,
28355    {
28356        deserializer.deserialize_any(wkt::internal::EnumVisitor::<SearchSolutionUseCase>::new(
28357            ".google.cloud.retail.v2.SearchSolutionUseCase",
28358        ))
28359    }
28360}
28361
28362/// Harm categories that will block the content.
28363///
28364/// # Working with unknown values
28365///
28366/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
28367/// additional enum variants at any time. Adding new variants is not considered
28368/// a breaking change. Applications should write their code in anticipation of:
28369///
28370/// - New values appearing in future releases of the client library, **and**
28371/// - New values received dynamically, without application changes.
28372///
28373/// Please consult the [Working with enums] section in the user guide for some
28374/// guidelines.
28375///
28376/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
28377#[derive(Clone, Debug, PartialEq)]
28378#[non_exhaustive]
28379pub enum HarmCategory {
28380    /// The harm category is unspecified.
28381    Unspecified,
28382    /// The harm category is hate speech.
28383    HateSpeech,
28384    /// The harm category is dangerous content.
28385    DangerousContent,
28386    /// The harm category is harassment.
28387    Harassment,
28388    /// The harm category is sexually explicit content.
28389    SexuallyExplicit,
28390    /// The harm category is civic integrity.
28391    CivicIntegrity,
28392    /// If set, the enum was initialized with an unknown value.
28393    ///
28394    /// Applications can examine the value using [HarmCategory::value] or
28395    /// [HarmCategory::name].
28396    UnknownValue(harm_category::UnknownValue),
28397}
28398
28399#[doc(hidden)]
28400pub mod harm_category {
28401    #[allow(unused_imports)]
28402    use super::*;
28403    #[derive(Clone, Debug, PartialEq)]
28404    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
28405}
28406
28407impl HarmCategory {
28408    /// Gets the enum value.
28409    ///
28410    /// Returns `None` if the enum contains an unknown value deserialized from
28411    /// the string representation of enums.
28412    pub fn value(&self) -> std::option::Option<i32> {
28413        match self {
28414            Self::Unspecified => std::option::Option::Some(0),
28415            Self::HateSpeech => std::option::Option::Some(1),
28416            Self::DangerousContent => std::option::Option::Some(2),
28417            Self::Harassment => std::option::Option::Some(3),
28418            Self::SexuallyExplicit => std::option::Option::Some(4),
28419            Self::CivicIntegrity => std::option::Option::Some(5),
28420            Self::UnknownValue(u) => u.0.value(),
28421        }
28422    }
28423
28424    /// Gets the enum value as a string.
28425    ///
28426    /// Returns `None` if the enum contains an unknown value deserialized from
28427    /// the integer representation of enums.
28428    pub fn name(&self) -> std::option::Option<&str> {
28429        match self {
28430            Self::Unspecified => std::option::Option::Some("HARM_CATEGORY_UNSPECIFIED"),
28431            Self::HateSpeech => std::option::Option::Some("HARM_CATEGORY_HATE_SPEECH"),
28432            Self::DangerousContent => std::option::Option::Some("HARM_CATEGORY_DANGEROUS_CONTENT"),
28433            Self::Harassment => std::option::Option::Some("HARM_CATEGORY_HARASSMENT"),
28434            Self::SexuallyExplicit => std::option::Option::Some("HARM_CATEGORY_SEXUALLY_EXPLICIT"),
28435            Self::CivicIntegrity => std::option::Option::Some("HARM_CATEGORY_CIVIC_INTEGRITY"),
28436            Self::UnknownValue(u) => u.0.name(),
28437        }
28438    }
28439}
28440
28441impl std::default::Default for HarmCategory {
28442    fn default() -> Self {
28443        use std::convert::From;
28444        Self::from(0)
28445    }
28446}
28447
28448impl std::fmt::Display for HarmCategory {
28449    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
28450        wkt::internal::display_enum(f, self.name(), self.value())
28451    }
28452}
28453
28454impl std::convert::From<i32> for HarmCategory {
28455    fn from(value: i32) -> Self {
28456        match value {
28457            0 => Self::Unspecified,
28458            1 => Self::HateSpeech,
28459            2 => Self::DangerousContent,
28460            3 => Self::Harassment,
28461            4 => Self::SexuallyExplicit,
28462            5 => Self::CivicIntegrity,
28463            _ => Self::UnknownValue(harm_category::UnknownValue(
28464                wkt::internal::UnknownEnumValue::Integer(value),
28465            )),
28466        }
28467    }
28468}
28469
28470impl std::convert::From<&str> for HarmCategory {
28471    fn from(value: &str) -> Self {
28472        use std::string::ToString;
28473        match value {
28474            "HARM_CATEGORY_UNSPECIFIED" => Self::Unspecified,
28475            "HARM_CATEGORY_HATE_SPEECH" => Self::HateSpeech,
28476            "HARM_CATEGORY_DANGEROUS_CONTENT" => Self::DangerousContent,
28477            "HARM_CATEGORY_HARASSMENT" => Self::Harassment,
28478            "HARM_CATEGORY_SEXUALLY_EXPLICIT" => Self::SexuallyExplicit,
28479            "HARM_CATEGORY_CIVIC_INTEGRITY" => Self::CivicIntegrity,
28480            _ => Self::UnknownValue(harm_category::UnknownValue(
28481                wkt::internal::UnknownEnumValue::String(value.to_string()),
28482            )),
28483        }
28484    }
28485}
28486
28487impl serde::ser::Serialize for HarmCategory {
28488    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
28489    where
28490        S: serde::Serializer,
28491    {
28492        match self {
28493            Self::Unspecified => serializer.serialize_i32(0),
28494            Self::HateSpeech => serializer.serialize_i32(1),
28495            Self::DangerousContent => serializer.serialize_i32(2),
28496            Self::Harassment => serializer.serialize_i32(3),
28497            Self::SexuallyExplicit => serializer.serialize_i32(4),
28498            Self::CivicIntegrity => serializer.serialize_i32(5),
28499            Self::UnknownValue(u) => u.0.serialize(serializer),
28500        }
28501    }
28502}
28503
28504impl<'de> serde::de::Deserialize<'de> for HarmCategory {
28505    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
28506    where
28507        D: serde::Deserializer<'de>,
28508    {
28509        deserializer.deserialize_any(wkt::internal::EnumVisitor::<HarmCategory>::new(
28510            ".google.cloud.retail.v2.HarmCategory",
28511        ))
28512    }
28513}