Skip to main content

google_cloud_documentai_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_rpc;
29extern crate google_cloud_type;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Encodes the detailed information of a barcode.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct Barcode {
45    /// Format of a barcode.
46    /// The supported formats are:
47    ///
48    /// - `CODE_128`: Code 128 type.
49    /// - `CODE_39`: Code 39 type.
50    /// - `CODE_93`: Code 93 type.
51    /// - `CODABAR`: Codabar type.
52    /// - `DATA_MATRIX`: 2D Data Matrix type.
53    /// - `ITF`: ITF type.
54    /// - `EAN_13`: EAN-13 type.
55    /// - `EAN_8`: EAN-8 type.
56    /// - `QR_CODE`: 2D QR code type.
57    /// - `UPC_A`: UPC-A type.
58    /// - `UPC_E`: UPC-E type.
59    /// - `PDF417`: PDF417 type.
60    /// - `AZTEC`: 2D Aztec code type.
61    /// - `DATABAR`: GS1 DataBar code type.
62    pub format: std::string::String,
63
64    /// Value format describes the format of the value that a barcode
65    /// encodes.
66    /// The supported formats are:
67    ///
68    /// - `CONTACT_INFO`: Contact information.
69    /// - `EMAIL`: Email address.
70    /// - `ISBN`: ISBN identifier.
71    /// - `PHONE`: Phone number.
72    /// - `PRODUCT`: Product.
73    /// - `SMS`: SMS message.
74    /// - `TEXT`: Text string.
75    /// - `URL`: URL address.
76    /// - `WIFI`: Wifi information.
77    /// - `GEO`: Geo-localization.
78    /// - `CALENDAR_EVENT`: Calendar event.
79    /// - `DRIVER_LICENSE`: Driver's license.
80    pub value_format: std::string::String,
81
82    /// Raw value encoded in the barcode.
83    /// For example: `'MEBKM:TITLE:Google;URL:<https://www.google.com>;;'`.
84    pub raw_value: std::string::String,
85
86    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl Barcode {
90    pub fn new() -> Self {
91        std::default::Default::default()
92    }
93
94    /// Sets the value of [format][crate::model::Barcode::format].
95    ///
96    /// # Example
97    /// ```ignore,no_run
98    /// # use google_cloud_documentai_v1::model::Barcode;
99    /// let x = Barcode::new().set_format("example");
100    /// ```
101    pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
102        self.format = v.into();
103        self
104    }
105
106    /// Sets the value of [value_format][crate::model::Barcode::value_format].
107    ///
108    /// # Example
109    /// ```ignore,no_run
110    /// # use google_cloud_documentai_v1::model::Barcode;
111    /// let x = Barcode::new().set_value_format("example");
112    /// ```
113    pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
114        self.value_format = v.into();
115        self
116    }
117
118    /// Sets the value of [raw_value][crate::model::Barcode::raw_value].
119    ///
120    /// # Example
121    /// ```ignore,no_run
122    /// # use google_cloud_documentai_v1::model::Barcode;
123    /// let x = Barcode::new().set_raw_value("example");
124    /// ```
125    pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
126        self.raw_value = v.into();
127        self
128    }
129}
130
131impl wkt::message::Message for Barcode {
132    fn typename() -> &'static str {
133        "type.googleapis.com/google.cloud.documentai.v1.Barcode"
134    }
135}
136
137/// Document represents the canonical document resource in Document AI. It is an
138/// interchange format that provides insights into documents and allows for
139/// collaboration between users and Document AI to iterate and optimize for
140/// quality.
141#[derive(Clone, Default, PartialEq)]
142#[non_exhaustive]
143pub struct Document {
144    /// Optional. An internal identifier for document. Should be loggable (no PII).
145    pub docid: std::string::String,
146
147    /// An IANA published [media type (MIME
148    /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
149    pub mime_type: std::string::String,
150
151    /// Optional. UTF-8 encoded text in reading order from the document.
152    pub text: std::string::String,
153
154    /// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
155    ///
156    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
157    #[deprecated]
158    pub text_styles: std::vec::Vec<crate::model::document::Style>,
159
160    /// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
161    ///
162    /// [google.cloud.documentai.v1.Document]: crate::model::Document
163    pub pages: std::vec::Vec<crate::model::document::Page>,
164
165    /// A list of entities detected on
166    /// [Document.text][google.cloud.documentai.v1.Document.text]. For document
167    /// shards, entities in this list may cross shard boundaries.
168    ///
169    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
170    pub entities: std::vec::Vec<crate::model::document::Entity>,
171
172    /// Placeholder.  Relationship among
173    /// [Document.entities][google.cloud.documentai.v1.Document.entities].
174    ///
175    /// [google.cloud.documentai.v1.Document.entities]: crate::model::Document::entities
176    pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,
177
178    /// Placeholder.  A list of text corrections made to
179    /// [Document.text][google.cloud.documentai.v1.Document.text].  This is usually
180    /// used for annotating corrections to OCR mistakes.  Text changes for a given
181    /// revision may not overlap with each other.
182    ///
183    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
184    pub text_changes: std::vec::Vec<crate::model::document::TextChange>,
185
186    /// Information about the sharding if this document is sharded part of a larger
187    /// document. If the document is not sharded, this message is not specified.
188    pub shard_info: std::option::Option<crate::model::document::ShardInfo>,
189
190    /// Any error that occurred while processing this document.
191    pub error: std::option::Option<google_cloud_rpc::model::Status>,
192
193    /// Placeholder. Revision history of this document.
194    pub revisions: std::vec::Vec<crate::model::document::Revision>,
195
196    /// Parsed layout of the document.
197    pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,
198
199    /// Document chunked based on chunking config.
200    pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,
201
202    /// The entity validation output for the document. This is the validation
203    /// output for `document.entities` field.
204    pub entity_validation_output:
205        std::option::Option<crate::model::document::EntityValidationOutput>,
206
207    /// A list of entity revisions. The entity revisions are appended to the
208    /// document in the processing order. This field can be used for comparing the
209    /// entity extraction results at different stages of the processing.
210    pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,
211
212    /// The entity revision ID that `document.entities` field is based on.
213    /// If this field is set and `entities_revisions` is not empty, the entities in
214    /// `document.entities` field are the entities in the entity revision with this
215    /// ID and `document.entity_validation_output` field is the
216    /// `entity_validation_output` field in this entity revision.
217    pub entities_revision_id: std::string::String,
218
219    /// Original source document from the user.
220    pub source: std::option::Option<crate::model::document::Source>,
221
222    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
223}
224
225impl Document {
226    pub fn new() -> Self {
227        std::default::Default::default()
228    }
229
230    /// Sets the value of [docid][crate::model::Document::docid].
231    ///
232    /// # Example
233    /// ```ignore,no_run
234    /// # use google_cloud_documentai_v1::model::Document;
235    /// let x = Document::new().set_docid("example");
236    /// ```
237    pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
238        self.docid = v.into();
239        self
240    }
241
242    /// Sets the value of [mime_type][crate::model::Document::mime_type].
243    ///
244    /// # Example
245    /// ```ignore,no_run
246    /// # use google_cloud_documentai_v1::model::Document;
247    /// let x = Document::new().set_mime_type("example");
248    /// ```
249    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
250        self.mime_type = v.into();
251        self
252    }
253
254    /// Sets the value of [text][crate::model::Document::text].
255    ///
256    /// # Example
257    /// ```ignore,no_run
258    /// # use google_cloud_documentai_v1::model::Document;
259    /// let x = Document::new().set_text("example");
260    /// ```
261    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
262        self.text = v.into();
263        self
264    }
265
266    /// Sets the value of [text_styles][crate::model::Document::text_styles].
267    ///
268    /// # Example
269    /// ```ignore,no_run
270    /// # use google_cloud_documentai_v1::model::Document;
271    /// use google_cloud_documentai_v1::model::document::Style;
272    /// let x = Document::new()
273    ///     .set_text_styles([
274    ///         Style::default()/* use setters */,
275    ///         Style::default()/* use (different) setters */,
276    ///     ]);
277    /// ```
278    #[deprecated]
279    pub fn set_text_styles<T, V>(mut self, v: T) -> Self
280    where
281        T: std::iter::IntoIterator<Item = V>,
282        V: std::convert::Into<crate::model::document::Style>,
283    {
284        use std::iter::Iterator;
285        self.text_styles = v.into_iter().map(|i| i.into()).collect();
286        self
287    }
288
289    /// Sets the value of [pages][crate::model::Document::pages].
290    ///
291    /// # Example
292    /// ```ignore,no_run
293    /// # use google_cloud_documentai_v1::model::Document;
294    /// use google_cloud_documentai_v1::model::document::Page;
295    /// let x = Document::new()
296    ///     .set_pages([
297    ///         Page::default()/* use setters */,
298    ///         Page::default()/* use (different) setters */,
299    ///     ]);
300    /// ```
301    pub fn set_pages<T, V>(mut self, v: T) -> Self
302    where
303        T: std::iter::IntoIterator<Item = V>,
304        V: std::convert::Into<crate::model::document::Page>,
305    {
306        use std::iter::Iterator;
307        self.pages = v.into_iter().map(|i| i.into()).collect();
308        self
309    }
310
311    /// Sets the value of [entities][crate::model::Document::entities].
312    ///
313    /// # Example
314    /// ```ignore,no_run
315    /// # use google_cloud_documentai_v1::model::Document;
316    /// use google_cloud_documentai_v1::model::document::Entity;
317    /// let x = Document::new()
318    ///     .set_entities([
319    ///         Entity::default()/* use setters */,
320    ///         Entity::default()/* use (different) setters */,
321    ///     ]);
322    /// ```
323    pub fn set_entities<T, V>(mut self, v: T) -> Self
324    where
325        T: std::iter::IntoIterator<Item = V>,
326        V: std::convert::Into<crate::model::document::Entity>,
327    {
328        use std::iter::Iterator;
329        self.entities = v.into_iter().map(|i| i.into()).collect();
330        self
331    }
332
333    /// Sets the value of [entity_relations][crate::model::Document::entity_relations].
334    ///
335    /// # Example
336    /// ```ignore,no_run
337    /// # use google_cloud_documentai_v1::model::Document;
338    /// use google_cloud_documentai_v1::model::document::EntityRelation;
339    /// let x = Document::new()
340    ///     .set_entity_relations([
341    ///         EntityRelation::default()/* use setters */,
342    ///         EntityRelation::default()/* use (different) setters */,
343    ///     ]);
344    /// ```
345    pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
346    where
347        T: std::iter::IntoIterator<Item = V>,
348        V: std::convert::Into<crate::model::document::EntityRelation>,
349    {
350        use std::iter::Iterator;
351        self.entity_relations = v.into_iter().map(|i| i.into()).collect();
352        self
353    }
354
355    /// Sets the value of [text_changes][crate::model::Document::text_changes].
356    ///
357    /// # Example
358    /// ```ignore,no_run
359    /// # use google_cloud_documentai_v1::model::Document;
360    /// use google_cloud_documentai_v1::model::document::TextChange;
361    /// let x = Document::new()
362    ///     .set_text_changes([
363    ///         TextChange::default()/* use setters */,
364    ///         TextChange::default()/* use (different) setters */,
365    ///     ]);
366    /// ```
367    pub fn set_text_changes<T, V>(mut self, v: T) -> Self
368    where
369        T: std::iter::IntoIterator<Item = V>,
370        V: std::convert::Into<crate::model::document::TextChange>,
371    {
372        use std::iter::Iterator;
373        self.text_changes = v.into_iter().map(|i| i.into()).collect();
374        self
375    }
376
377    /// Sets the value of [shard_info][crate::model::Document::shard_info].
378    ///
379    /// # Example
380    /// ```ignore,no_run
381    /// # use google_cloud_documentai_v1::model::Document;
382    /// use google_cloud_documentai_v1::model::document::ShardInfo;
383    /// let x = Document::new().set_shard_info(ShardInfo::default()/* use setters */);
384    /// ```
385    pub fn set_shard_info<T>(mut self, v: T) -> Self
386    where
387        T: std::convert::Into<crate::model::document::ShardInfo>,
388    {
389        self.shard_info = std::option::Option::Some(v.into());
390        self
391    }
392
393    /// Sets or clears the value of [shard_info][crate::model::Document::shard_info].
394    ///
395    /// # Example
396    /// ```ignore,no_run
397    /// # use google_cloud_documentai_v1::model::Document;
398    /// use google_cloud_documentai_v1::model::document::ShardInfo;
399    /// let x = Document::new().set_or_clear_shard_info(Some(ShardInfo::default()/* use setters */));
400    /// let x = Document::new().set_or_clear_shard_info(None::<ShardInfo>);
401    /// ```
402    pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
403    where
404        T: std::convert::Into<crate::model::document::ShardInfo>,
405    {
406        self.shard_info = v.map(|x| x.into());
407        self
408    }
409
410    /// Sets the value of [error][crate::model::Document::error].
411    ///
412    /// # Example
413    /// ```ignore,no_run
414    /// # use google_cloud_documentai_v1::model::Document;
415    /// use google_cloud_rpc::model::Status;
416    /// let x = Document::new().set_error(Status::default()/* use setters */);
417    /// ```
418    pub fn set_error<T>(mut self, v: T) -> Self
419    where
420        T: std::convert::Into<google_cloud_rpc::model::Status>,
421    {
422        self.error = std::option::Option::Some(v.into());
423        self
424    }
425
426    /// Sets or clears the value of [error][crate::model::Document::error].
427    ///
428    /// # Example
429    /// ```ignore,no_run
430    /// # use google_cloud_documentai_v1::model::Document;
431    /// use google_cloud_rpc::model::Status;
432    /// let x = Document::new().set_or_clear_error(Some(Status::default()/* use setters */));
433    /// let x = Document::new().set_or_clear_error(None::<Status>);
434    /// ```
435    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
436    where
437        T: std::convert::Into<google_cloud_rpc::model::Status>,
438    {
439        self.error = v.map(|x| x.into());
440        self
441    }
442
443    /// Sets the value of [revisions][crate::model::Document::revisions].
444    ///
445    /// # Example
446    /// ```ignore,no_run
447    /// # use google_cloud_documentai_v1::model::Document;
448    /// use google_cloud_documentai_v1::model::document::Revision;
449    /// let x = Document::new()
450    ///     .set_revisions([
451    ///         Revision::default()/* use setters */,
452    ///         Revision::default()/* use (different) setters */,
453    ///     ]);
454    /// ```
455    pub fn set_revisions<T, V>(mut self, v: T) -> Self
456    where
457        T: std::iter::IntoIterator<Item = V>,
458        V: std::convert::Into<crate::model::document::Revision>,
459    {
460        use std::iter::Iterator;
461        self.revisions = v.into_iter().map(|i| i.into()).collect();
462        self
463    }
464
465    /// Sets the value of [document_layout][crate::model::Document::document_layout].
466    ///
467    /// # Example
468    /// ```ignore,no_run
469    /// # use google_cloud_documentai_v1::model::Document;
470    /// use google_cloud_documentai_v1::model::document::DocumentLayout;
471    /// let x = Document::new().set_document_layout(DocumentLayout::default()/* use setters */);
472    /// ```
473    pub fn set_document_layout<T>(mut self, v: T) -> Self
474    where
475        T: std::convert::Into<crate::model::document::DocumentLayout>,
476    {
477        self.document_layout = std::option::Option::Some(v.into());
478        self
479    }
480
481    /// Sets or clears the value of [document_layout][crate::model::Document::document_layout].
482    ///
483    /// # Example
484    /// ```ignore,no_run
485    /// # use google_cloud_documentai_v1::model::Document;
486    /// use google_cloud_documentai_v1::model::document::DocumentLayout;
487    /// let x = Document::new().set_or_clear_document_layout(Some(DocumentLayout::default()/* use setters */));
488    /// let x = Document::new().set_or_clear_document_layout(None::<DocumentLayout>);
489    /// ```
490    pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
491    where
492        T: std::convert::Into<crate::model::document::DocumentLayout>,
493    {
494        self.document_layout = v.map(|x| x.into());
495        self
496    }
497
498    /// Sets the value of [chunked_document][crate::model::Document::chunked_document].
499    ///
500    /// # Example
501    /// ```ignore,no_run
502    /// # use google_cloud_documentai_v1::model::Document;
503    /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
504    /// let x = Document::new().set_chunked_document(ChunkedDocument::default()/* use setters */);
505    /// ```
506    pub fn set_chunked_document<T>(mut self, v: T) -> Self
507    where
508        T: std::convert::Into<crate::model::document::ChunkedDocument>,
509    {
510        self.chunked_document = std::option::Option::Some(v.into());
511        self
512    }
513
514    /// Sets or clears the value of [chunked_document][crate::model::Document::chunked_document].
515    ///
516    /// # Example
517    /// ```ignore,no_run
518    /// # use google_cloud_documentai_v1::model::Document;
519    /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
520    /// let x = Document::new().set_or_clear_chunked_document(Some(ChunkedDocument::default()/* use setters */));
521    /// let x = Document::new().set_or_clear_chunked_document(None::<ChunkedDocument>);
522    /// ```
523    pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
524    where
525        T: std::convert::Into<crate::model::document::ChunkedDocument>,
526    {
527        self.chunked_document = v.map(|x| x.into());
528        self
529    }
530
531    /// Sets the value of [entity_validation_output][crate::model::Document::entity_validation_output].
532    ///
533    /// # Example
534    /// ```ignore,no_run
535    /// # use google_cloud_documentai_v1::model::Document;
536    /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
537    /// let x = Document::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
538    /// ```
539    pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
540    where
541        T: std::convert::Into<crate::model::document::EntityValidationOutput>,
542    {
543        self.entity_validation_output = std::option::Option::Some(v.into());
544        self
545    }
546
547    /// Sets or clears the value of [entity_validation_output][crate::model::Document::entity_validation_output].
548    ///
549    /// # Example
550    /// ```ignore,no_run
551    /// # use google_cloud_documentai_v1::model::Document;
552    /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
553    /// let x = Document::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
554    /// let x = Document::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
555    /// ```
556    pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
557    where
558        T: std::convert::Into<crate::model::document::EntityValidationOutput>,
559    {
560        self.entity_validation_output = v.map(|x| x.into());
561        self
562    }
563
564    /// Sets the value of [entities_revisions][crate::model::Document::entities_revisions].
565    ///
566    /// # Example
567    /// ```ignore,no_run
568    /// # use google_cloud_documentai_v1::model::Document;
569    /// use google_cloud_documentai_v1::model::document::EntitiesRevision;
570    /// let x = Document::new()
571    ///     .set_entities_revisions([
572    ///         EntitiesRevision::default()/* use setters */,
573    ///         EntitiesRevision::default()/* use (different) setters */,
574    ///     ]);
575    /// ```
576    pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
577    where
578        T: std::iter::IntoIterator<Item = V>,
579        V: std::convert::Into<crate::model::document::EntitiesRevision>,
580    {
581        use std::iter::Iterator;
582        self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
583        self
584    }
585
586    /// Sets the value of [entities_revision_id][crate::model::Document::entities_revision_id].
587    ///
588    /// # Example
589    /// ```ignore,no_run
590    /// # use google_cloud_documentai_v1::model::Document;
591    /// let x = Document::new().set_entities_revision_id("example");
592    /// ```
593    pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
594        mut self,
595        v: T,
596    ) -> Self {
597        self.entities_revision_id = v.into();
598        self
599    }
600
601    /// Sets the value of [source][crate::model::Document::source].
602    ///
603    /// Note that all the setters affecting `source` are mutually
604    /// exclusive.
605    ///
606    /// # Example
607    /// ```ignore,no_run
608    /// # use google_cloud_documentai_v1::model::Document;
609    /// use google_cloud_documentai_v1::model::document::Source;
610    /// let x = Document::new().set_source(Some(Source::Uri("example".to_string())));
611    /// ```
612    pub fn set_source<
613        T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
614    >(
615        mut self,
616        v: T,
617    ) -> Self {
618        self.source = v.into();
619        self
620    }
621
622    /// The value of [source][crate::model::Document::source]
623    /// if it holds a `Uri`, `None` if the field is not set or
624    /// holds a different branch.
625    pub fn uri(&self) -> std::option::Option<&std::string::String> {
626        #[allow(unreachable_patterns)]
627        self.source.as_ref().and_then(|v| match v {
628            crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
629            _ => std::option::Option::None,
630        })
631    }
632
633    /// Sets the value of [source][crate::model::Document::source]
634    /// to hold a `Uri`.
635    ///
636    /// Note that all the setters affecting `source` are
637    /// mutually exclusive.
638    ///
639    /// # Example
640    /// ```ignore,no_run
641    /// # use google_cloud_documentai_v1::model::Document;
642    /// let x = Document::new().set_uri("example");
643    /// assert!(x.uri().is_some());
644    /// assert!(x.content().is_none());
645    /// ```
646    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
647        self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
648        self
649    }
650
651    /// The value of [source][crate::model::Document::source]
652    /// if it holds a `Content`, `None` if the field is not set or
653    /// holds a different branch.
654    pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
655        #[allow(unreachable_patterns)]
656        self.source.as_ref().and_then(|v| match v {
657            crate::model::document::Source::Content(v) => std::option::Option::Some(v),
658            _ => std::option::Option::None,
659        })
660    }
661
662    /// Sets the value of [source][crate::model::Document::source]
663    /// to hold a `Content`.
664    ///
665    /// Note that all the setters affecting `source` are
666    /// mutually exclusive.
667    ///
668    /// # Example
669    /// ```ignore,no_run
670    /// # use google_cloud_documentai_v1::model::Document;
671    /// let x = Document::new().set_content(bytes::Bytes::from_static(b"example"));
672    /// assert!(x.content().is_some());
673    /// assert!(x.uri().is_none());
674    /// ```
675    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
676        self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
677        self
678    }
679}
680
681impl wkt::message::Message for Document {
682    fn typename() -> &'static str {
683        "type.googleapis.com/google.cloud.documentai.v1.Document"
684    }
685}
686
687/// Defines additional types related to [Document].
688pub mod document {
689    #[allow(unused_imports)]
690    use super::*;
691
692    /// For a large document, sharding may be performed to produce several
693    /// document shards. Each document shard contains this field to detail which
694    /// shard it is.
695    #[derive(Clone, Default, PartialEq)]
696    #[non_exhaustive]
697    pub struct ShardInfo {
698        /// The 0-based index of this shard.
699        pub shard_index: i64,
700
701        /// Total number of shards.
702        pub shard_count: i64,
703
704        /// The index of the first character in
705        /// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
706        /// document global text.
707        ///
708        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
709        pub text_offset: i64,
710
711        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
712    }
713
714    impl ShardInfo {
715        pub fn new() -> Self {
716            std::default::Default::default()
717        }
718
719        /// Sets the value of [shard_index][crate::model::document::ShardInfo::shard_index].
720        ///
721        /// # Example
722        /// ```ignore,no_run
723        /// # use google_cloud_documentai_v1::model::document::ShardInfo;
724        /// let x = ShardInfo::new().set_shard_index(42);
725        /// ```
726        pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
727            self.shard_index = v.into();
728            self
729        }
730
731        /// Sets the value of [shard_count][crate::model::document::ShardInfo::shard_count].
732        ///
733        /// # Example
734        /// ```ignore,no_run
735        /// # use google_cloud_documentai_v1::model::document::ShardInfo;
736        /// let x = ShardInfo::new().set_shard_count(42);
737        /// ```
738        pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
739            self.shard_count = v.into();
740            self
741        }
742
743        /// Sets the value of [text_offset][crate::model::document::ShardInfo::text_offset].
744        ///
745        /// # Example
746        /// ```ignore,no_run
747        /// # use google_cloud_documentai_v1::model::document::ShardInfo;
748        /// let x = ShardInfo::new().set_text_offset(42);
749        /// ```
750        pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
751            self.text_offset = v.into();
752            self
753        }
754    }
755
756    impl wkt::message::Message for ShardInfo {
757        fn typename() -> &'static str {
758            "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
759        }
760    }
761
762    /// Annotation for common text style attributes. This adheres to CSS
763    /// conventions as much as possible.
764    #[derive(Clone, Default, PartialEq)]
765    #[non_exhaustive]
766    pub struct Style {
767        /// Text anchor indexing into the
768        /// [Document.text][google.cloud.documentai.v1.Document.text].
769        ///
770        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
771        pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
772
773        /// Text color.
774        pub color: std::option::Option<google_cloud_type::model::Color>,
775
776        /// Text background color.
777        pub background_color: std::option::Option<google_cloud_type::model::Color>,
778
779        /// [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp).
780        /// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
781        pub font_weight: std::string::String,
782
783        /// [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp).
784        /// Possible values are `normal`, `italic`, and `oblique`.
785        pub text_style: std::string::String,
786
787        /// [Text
788        /// decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp).
789        /// Follows CSS standard. \<text-decoration-line\> \<text-decoration-color\>
790        /// \<text-decoration-style\>
791        pub text_decoration: std::string::String,
792
793        /// Font size.
794        pub font_size: std::option::Option<crate::model::document::style::FontSize>,
795
796        /// Font family such as `Arial`, `Times New Roman`.
797        /// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
798        pub font_family: std::string::String,
799
800        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
801    }
802
803    impl Style {
804        pub fn new() -> Self {
805            std::default::Default::default()
806        }
807
808        /// Sets the value of [text_anchor][crate::model::document::Style::text_anchor].
809        ///
810        /// # Example
811        /// ```ignore,no_run
812        /// # use google_cloud_documentai_v1::model::document::Style;
813        /// use google_cloud_documentai_v1::model::document::TextAnchor;
814        /// let x = Style::new().set_text_anchor(TextAnchor::default()/* use setters */);
815        /// ```
816        pub fn set_text_anchor<T>(mut self, v: T) -> Self
817        where
818            T: std::convert::Into<crate::model::document::TextAnchor>,
819        {
820            self.text_anchor = std::option::Option::Some(v.into());
821            self
822        }
823
824        /// Sets or clears the value of [text_anchor][crate::model::document::Style::text_anchor].
825        ///
826        /// # Example
827        /// ```ignore,no_run
828        /// # use google_cloud_documentai_v1::model::document::Style;
829        /// use google_cloud_documentai_v1::model::document::TextAnchor;
830        /// let x = Style::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
831        /// let x = Style::new().set_or_clear_text_anchor(None::<TextAnchor>);
832        /// ```
833        pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
834        where
835            T: std::convert::Into<crate::model::document::TextAnchor>,
836        {
837            self.text_anchor = v.map(|x| x.into());
838            self
839        }
840
841        /// Sets the value of [color][crate::model::document::Style::color].
842        ///
843        /// # Example
844        /// ```ignore,no_run
845        /// # use google_cloud_documentai_v1::model::document::Style;
846        /// use google_cloud_type::model::Color;
847        /// let x = Style::new().set_color(Color::default()/* use setters */);
848        /// ```
849        pub fn set_color<T>(mut self, v: T) -> Self
850        where
851            T: std::convert::Into<google_cloud_type::model::Color>,
852        {
853            self.color = std::option::Option::Some(v.into());
854            self
855        }
856
857        /// Sets or clears the value of [color][crate::model::document::Style::color].
858        ///
859        /// # Example
860        /// ```ignore,no_run
861        /// # use google_cloud_documentai_v1::model::document::Style;
862        /// use google_cloud_type::model::Color;
863        /// let x = Style::new().set_or_clear_color(Some(Color::default()/* use setters */));
864        /// let x = Style::new().set_or_clear_color(None::<Color>);
865        /// ```
866        pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
867        where
868            T: std::convert::Into<google_cloud_type::model::Color>,
869        {
870            self.color = v.map(|x| x.into());
871            self
872        }
873
874        /// Sets the value of [background_color][crate::model::document::Style::background_color].
875        ///
876        /// # Example
877        /// ```ignore,no_run
878        /// # use google_cloud_documentai_v1::model::document::Style;
879        /// use google_cloud_type::model::Color;
880        /// let x = Style::new().set_background_color(Color::default()/* use setters */);
881        /// ```
882        pub fn set_background_color<T>(mut self, v: T) -> Self
883        where
884            T: std::convert::Into<google_cloud_type::model::Color>,
885        {
886            self.background_color = std::option::Option::Some(v.into());
887            self
888        }
889
890        /// Sets or clears the value of [background_color][crate::model::document::Style::background_color].
891        ///
892        /// # Example
893        /// ```ignore,no_run
894        /// # use google_cloud_documentai_v1::model::document::Style;
895        /// use google_cloud_type::model::Color;
896        /// let x = Style::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
897        /// let x = Style::new().set_or_clear_background_color(None::<Color>);
898        /// ```
899        pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
900        where
901            T: std::convert::Into<google_cloud_type::model::Color>,
902        {
903            self.background_color = v.map(|x| x.into());
904            self
905        }
906
907        /// Sets the value of [font_weight][crate::model::document::Style::font_weight].
908        ///
909        /// # Example
910        /// ```ignore,no_run
911        /// # use google_cloud_documentai_v1::model::document::Style;
912        /// let x = Style::new().set_font_weight("example");
913        /// ```
914        pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
915            self.font_weight = v.into();
916            self
917        }
918
919        /// Sets the value of [text_style][crate::model::document::Style::text_style].
920        ///
921        /// # Example
922        /// ```ignore,no_run
923        /// # use google_cloud_documentai_v1::model::document::Style;
924        /// let x = Style::new().set_text_style("example");
925        /// ```
926        pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
927            self.text_style = v.into();
928            self
929        }
930
931        /// Sets the value of [text_decoration][crate::model::document::Style::text_decoration].
932        ///
933        /// # Example
934        /// ```ignore,no_run
935        /// # use google_cloud_documentai_v1::model::document::Style;
936        /// let x = Style::new().set_text_decoration("example");
937        /// ```
938        pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
939            mut self,
940            v: T,
941        ) -> Self {
942            self.text_decoration = v.into();
943            self
944        }
945
946        /// Sets the value of [font_size][crate::model::document::Style::font_size].
947        ///
948        /// # Example
949        /// ```ignore,no_run
950        /// # use google_cloud_documentai_v1::model::document::Style;
951        /// use google_cloud_documentai_v1::model::document::style::FontSize;
952        /// let x = Style::new().set_font_size(FontSize::default()/* use setters */);
953        /// ```
954        pub fn set_font_size<T>(mut self, v: T) -> Self
955        where
956            T: std::convert::Into<crate::model::document::style::FontSize>,
957        {
958            self.font_size = std::option::Option::Some(v.into());
959            self
960        }
961
962        /// Sets or clears the value of [font_size][crate::model::document::Style::font_size].
963        ///
964        /// # Example
965        /// ```ignore,no_run
966        /// # use google_cloud_documentai_v1::model::document::Style;
967        /// use google_cloud_documentai_v1::model::document::style::FontSize;
968        /// let x = Style::new().set_or_clear_font_size(Some(FontSize::default()/* use setters */));
969        /// let x = Style::new().set_or_clear_font_size(None::<FontSize>);
970        /// ```
971        pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
972        where
973            T: std::convert::Into<crate::model::document::style::FontSize>,
974        {
975            self.font_size = v.map(|x| x.into());
976            self
977        }
978
979        /// Sets the value of [font_family][crate::model::document::Style::font_family].
980        ///
981        /// # Example
982        /// ```ignore,no_run
983        /// # use google_cloud_documentai_v1::model::document::Style;
984        /// let x = Style::new().set_font_family("example");
985        /// ```
986        pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
987            self.font_family = v.into();
988            self
989        }
990    }
991
992    impl wkt::message::Message for Style {
993        fn typename() -> &'static str {
994            "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
995        }
996    }
997
998    /// Defines additional types related to [Style].
999    pub mod style {
1000        #[allow(unused_imports)]
1001        use super::*;
1002
1003        /// Font size with unit.
1004        #[derive(Clone, Default, PartialEq)]
1005        #[non_exhaustive]
1006        pub struct FontSize {
1007            /// Font size for the text.
1008            pub size: f32,
1009
1010            /// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
1011            /// `pt`).
1012            pub unit: std::string::String,
1013
1014            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1015        }
1016
1017        impl FontSize {
1018            pub fn new() -> Self {
1019                std::default::Default::default()
1020            }
1021
1022            /// Sets the value of [size][crate::model::document::style::FontSize::size].
1023            ///
1024            /// # Example
1025            /// ```ignore,no_run
1026            /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1027            /// let x = FontSize::new().set_size(42.0);
1028            /// ```
1029            pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1030                self.size = v.into();
1031                self
1032            }
1033
1034            /// Sets the value of [unit][crate::model::document::style::FontSize::unit].
1035            ///
1036            /// # Example
1037            /// ```ignore,no_run
1038            /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1039            /// let x = FontSize::new().set_unit("example");
1040            /// ```
1041            pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1042                self.unit = v.into();
1043                self
1044            }
1045        }
1046
1047        impl wkt::message::Message for FontSize {
1048            fn typename() -> &'static str {
1049                "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
1050            }
1051        }
1052    }
1053
1054    /// A page in a [Document][google.cloud.documentai.v1.Document].
1055    ///
1056    /// [google.cloud.documentai.v1.Document]: crate::model::Document
1057    #[derive(Clone, Default, PartialEq)]
1058    #[non_exhaustive]
1059    pub struct Page {
1060        /// 1-based index for current
1061        /// [Page][google.cloud.documentai.v1.Document.Page] in a parent
1062        /// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
1063        /// taken out of a [Document][google.cloud.documentai.v1.Document] for
1064        /// individual processing.
1065        ///
1066        /// [google.cloud.documentai.v1.Document]: crate::model::Document
1067        /// [google.cloud.documentai.v1.Document.Page]: crate::model::document::Page
1068        pub page_number: i32,
1069
1070        /// Rendered image for this page. This image is preprocessed to remove any
1071        /// skew, rotation, and distortions such that the annotation bounding boxes
1072        /// can be upright and axis-aligned.
1073        pub image: std::option::Option<crate::model::document::page::Image>,
1074
1075        /// Transformation matrices that were applied to the original document image
1076        /// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
1077        ///
1078        /// [google.cloud.documentai.v1.Document.Page.image]: crate::model::document::Page::image
1079        pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,
1080
1081        /// Physical dimension of the page.
1082        pub dimension: std::option::Option<crate::model::document::page::Dimension>,
1083
1084        /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
1085        ///
1086        /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1087        pub layout: std::option::Option<crate::model::document::page::Layout>,
1088
1089        /// A list of detected languages together with confidence.
1090        pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1091
1092        /// A list of visually detected text blocks on the page.
1093        /// A block has a set of lines (collected into paragraphs) that have a common
1094        /// line-spacing and orientation.
1095        pub blocks: std::vec::Vec<crate::model::document::page::Block>,
1096
1097        /// A list of visually detected text paragraphs on the page.
1098        /// A collection of lines that a human would perceive as a paragraph.
1099        pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,
1100
1101        /// A list of visually detected text lines on the page.
1102        /// A collection of tokens that a human would perceive as a line.
1103        pub lines: std::vec::Vec<crate::model::document::page::Line>,
1104
1105        /// A list of visually detected tokens on the page.
1106        pub tokens: std::vec::Vec<crate::model::document::page::Token>,
1107
1108        /// A list of detected non-text visual elements e.g. checkbox,
1109        /// signature etc. on the page.
1110        pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,
1111
1112        /// A list of visually detected tables on the page.
1113        pub tables: std::vec::Vec<crate::model::document::page::Table>,
1114
1115        /// A list of visually detected form fields on the page.
1116        pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,
1117
1118        /// A list of visually detected symbols on the page.
1119        pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,
1120
1121        /// A list of detected barcodes.
1122        pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,
1123
1124        /// Image quality scores.
1125        pub image_quality_scores:
1126            std::option::Option<crate::model::document::page::ImageQualityScores>,
1127
1128        /// The history of this page.
1129        #[deprecated]
1130        pub provenance: std::option::Option<crate::model::document::Provenance>,
1131
1132        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1133    }
1134
1135    impl Page {
1136        pub fn new() -> Self {
1137            std::default::Default::default()
1138        }
1139
1140        /// Sets the value of [page_number][crate::model::document::Page::page_number].
1141        ///
1142        /// # Example
1143        /// ```ignore,no_run
1144        /// # use google_cloud_documentai_v1::model::document::Page;
1145        /// let x = Page::new().set_page_number(42);
1146        /// ```
1147        pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1148            self.page_number = v.into();
1149            self
1150        }
1151
1152        /// Sets the value of [image][crate::model::document::Page::image].
1153        ///
1154        /// # Example
1155        /// ```ignore,no_run
1156        /// # use google_cloud_documentai_v1::model::document::Page;
1157        /// use google_cloud_documentai_v1::model::document::page::Image;
1158        /// let x = Page::new().set_image(Image::default()/* use setters */);
1159        /// ```
1160        pub fn set_image<T>(mut self, v: T) -> Self
1161        where
1162            T: std::convert::Into<crate::model::document::page::Image>,
1163        {
1164            self.image = std::option::Option::Some(v.into());
1165            self
1166        }
1167
1168        /// Sets or clears the value of [image][crate::model::document::Page::image].
1169        ///
1170        /// # Example
1171        /// ```ignore,no_run
1172        /// # use google_cloud_documentai_v1::model::document::Page;
1173        /// use google_cloud_documentai_v1::model::document::page::Image;
1174        /// let x = Page::new().set_or_clear_image(Some(Image::default()/* use setters */));
1175        /// let x = Page::new().set_or_clear_image(None::<Image>);
1176        /// ```
1177        pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
1178        where
1179            T: std::convert::Into<crate::model::document::page::Image>,
1180        {
1181            self.image = v.map(|x| x.into());
1182            self
1183        }
1184
1185        /// Sets the value of [transforms][crate::model::document::Page::transforms].
1186        ///
1187        /// # Example
1188        /// ```ignore,no_run
1189        /// # use google_cloud_documentai_v1::model::document::Page;
1190        /// use google_cloud_documentai_v1::model::document::page::Matrix;
1191        /// let x = Page::new()
1192        ///     .set_transforms([
1193        ///         Matrix::default()/* use setters */,
1194        ///         Matrix::default()/* use (different) setters */,
1195        ///     ]);
1196        /// ```
1197        pub fn set_transforms<T, V>(mut self, v: T) -> Self
1198        where
1199            T: std::iter::IntoIterator<Item = V>,
1200            V: std::convert::Into<crate::model::document::page::Matrix>,
1201        {
1202            use std::iter::Iterator;
1203            self.transforms = v.into_iter().map(|i| i.into()).collect();
1204            self
1205        }
1206
1207        /// Sets the value of [dimension][crate::model::document::Page::dimension].
1208        ///
1209        /// # Example
1210        /// ```ignore,no_run
1211        /// # use google_cloud_documentai_v1::model::document::Page;
1212        /// use google_cloud_documentai_v1::model::document::page::Dimension;
1213        /// let x = Page::new().set_dimension(Dimension::default()/* use setters */);
1214        /// ```
1215        pub fn set_dimension<T>(mut self, v: T) -> Self
1216        where
1217            T: std::convert::Into<crate::model::document::page::Dimension>,
1218        {
1219            self.dimension = std::option::Option::Some(v.into());
1220            self
1221        }
1222
1223        /// Sets or clears the value of [dimension][crate::model::document::Page::dimension].
1224        ///
1225        /// # Example
1226        /// ```ignore,no_run
1227        /// # use google_cloud_documentai_v1::model::document::Page;
1228        /// use google_cloud_documentai_v1::model::document::page::Dimension;
1229        /// let x = Page::new().set_or_clear_dimension(Some(Dimension::default()/* use setters */));
1230        /// let x = Page::new().set_or_clear_dimension(None::<Dimension>);
1231        /// ```
1232        pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
1233        where
1234            T: std::convert::Into<crate::model::document::page::Dimension>,
1235        {
1236            self.dimension = v.map(|x| x.into());
1237            self
1238        }
1239
1240        /// Sets the value of [layout][crate::model::document::Page::layout].
1241        ///
1242        /// # Example
1243        /// ```ignore,no_run
1244        /// # use google_cloud_documentai_v1::model::document::Page;
1245        /// use google_cloud_documentai_v1::model::document::page::Layout;
1246        /// let x = Page::new().set_layout(Layout::default()/* use setters */);
1247        /// ```
1248        pub fn set_layout<T>(mut self, v: T) -> Self
1249        where
1250            T: std::convert::Into<crate::model::document::page::Layout>,
1251        {
1252            self.layout = std::option::Option::Some(v.into());
1253            self
1254        }
1255
1256        /// Sets or clears the value of [layout][crate::model::document::Page::layout].
1257        ///
1258        /// # Example
1259        /// ```ignore,no_run
1260        /// # use google_cloud_documentai_v1::model::document::Page;
1261        /// use google_cloud_documentai_v1::model::document::page::Layout;
1262        /// let x = Page::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
1263        /// let x = Page::new().set_or_clear_layout(None::<Layout>);
1264        /// ```
1265        pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1266        where
1267            T: std::convert::Into<crate::model::document::page::Layout>,
1268        {
1269            self.layout = v.map(|x| x.into());
1270            self
1271        }
1272
1273        /// Sets the value of [detected_languages][crate::model::document::Page::detected_languages].
1274        ///
1275        /// # Example
1276        /// ```ignore,no_run
1277        /// # use google_cloud_documentai_v1::model::document::Page;
1278        /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
1279        /// let x = Page::new()
1280        ///     .set_detected_languages([
1281        ///         DetectedLanguage::default()/* use setters */,
1282        ///         DetectedLanguage::default()/* use (different) setters */,
1283        ///     ]);
1284        /// ```
1285        pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1286        where
1287            T: std::iter::IntoIterator<Item = V>,
1288            V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1289        {
1290            use std::iter::Iterator;
1291            self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1292            self
1293        }
1294
1295        /// Sets the value of [blocks][crate::model::document::Page::blocks].
1296        ///
1297        /// # Example
1298        /// ```ignore,no_run
1299        /// # use google_cloud_documentai_v1::model::document::Page;
1300        /// use google_cloud_documentai_v1::model::document::page::Block;
1301        /// let x = Page::new()
1302        ///     .set_blocks([
1303        ///         Block::default()/* use setters */,
1304        ///         Block::default()/* use (different) setters */,
1305        ///     ]);
1306        /// ```
1307        pub fn set_blocks<T, V>(mut self, v: T) -> Self
1308        where
1309            T: std::iter::IntoIterator<Item = V>,
1310            V: std::convert::Into<crate::model::document::page::Block>,
1311        {
1312            use std::iter::Iterator;
1313            self.blocks = v.into_iter().map(|i| i.into()).collect();
1314            self
1315        }
1316
1317        /// Sets the value of [paragraphs][crate::model::document::Page::paragraphs].
1318        ///
1319        /// # Example
1320        /// ```ignore,no_run
1321        /// # use google_cloud_documentai_v1::model::document::Page;
1322        /// use google_cloud_documentai_v1::model::document::page::Paragraph;
1323        /// let x = Page::new()
1324        ///     .set_paragraphs([
1325        ///         Paragraph::default()/* use setters */,
1326        ///         Paragraph::default()/* use (different) setters */,
1327        ///     ]);
1328        /// ```
1329        pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
1330        where
1331            T: std::iter::IntoIterator<Item = V>,
1332            V: std::convert::Into<crate::model::document::page::Paragraph>,
1333        {
1334            use std::iter::Iterator;
1335            self.paragraphs = v.into_iter().map(|i| i.into()).collect();
1336            self
1337        }
1338
1339        /// Sets the value of [lines][crate::model::document::Page::lines].
1340        ///
1341        /// # Example
1342        /// ```ignore,no_run
1343        /// # use google_cloud_documentai_v1::model::document::Page;
1344        /// use google_cloud_documentai_v1::model::document::page::Line;
1345        /// let x = Page::new()
1346        ///     .set_lines([
1347        ///         Line::default()/* use setters */,
1348        ///         Line::default()/* use (different) setters */,
1349        ///     ]);
1350        /// ```
1351        pub fn set_lines<T, V>(mut self, v: T) -> Self
1352        where
1353            T: std::iter::IntoIterator<Item = V>,
1354            V: std::convert::Into<crate::model::document::page::Line>,
1355        {
1356            use std::iter::Iterator;
1357            self.lines = v.into_iter().map(|i| i.into()).collect();
1358            self
1359        }
1360
1361        /// Sets the value of [tokens][crate::model::document::Page::tokens].
1362        ///
1363        /// # Example
1364        /// ```ignore,no_run
1365        /// # use google_cloud_documentai_v1::model::document::Page;
1366        /// use google_cloud_documentai_v1::model::document::page::Token;
1367        /// let x = Page::new()
1368        ///     .set_tokens([
1369        ///         Token::default()/* use setters */,
1370        ///         Token::default()/* use (different) setters */,
1371        ///     ]);
1372        /// ```
1373        pub fn set_tokens<T, V>(mut self, v: T) -> Self
1374        where
1375            T: std::iter::IntoIterator<Item = V>,
1376            V: std::convert::Into<crate::model::document::page::Token>,
1377        {
1378            use std::iter::Iterator;
1379            self.tokens = v.into_iter().map(|i| i.into()).collect();
1380            self
1381        }
1382
1383        /// Sets the value of [visual_elements][crate::model::document::Page::visual_elements].
1384        ///
1385        /// # Example
1386        /// ```ignore,no_run
1387        /// # use google_cloud_documentai_v1::model::document::Page;
1388        /// use google_cloud_documentai_v1::model::document::page::VisualElement;
1389        /// let x = Page::new()
1390        ///     .set_visual_elements([
1391        ///         VisualElement::default()/* use setters */,
1392        ///         VisualElement::default()/* use (different) setters */,
1393        ///     ]);
1394        /// ```
1395        pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
1396        where
1397            T: std::iter::IntoIterator<Item = V>,
1398            V: std::convert::Into<crate::model::document::page::VisualElement>,
1399        {
1400            use std::iter::Iterator;
1401            self.visual_elements = v.into_iter().map(|i| i.into()).collect();
1402            self
1403        }
1404
1405        /// Sets the value of [tables][crate::model::document::Page::tables].
1406        ///
1407        /// # Example
1408        /// ```ignore,no_run
1409        /// # use google_cloud_documentai_v1::model::document::Page;
1410        /// use google_cloud_documentai_v1::model::document::page::Table;
1411        /// let x = Page::new()
1412        ///     .set_tables([
1413        ///         Table::default()/* use setters */,
1414        ///         Table::default()/* use (different) setters */,
1415        ///     ]);
1416        /// ```
1417        pub fn set_tables<T, V>(mut self, v: T) -> Self
1418        where
1419            T: std::iter::IntoIterator<Item = V>,
1420            V: std::convert::Into<crate::model::document::page::Table>,
1421        {
1422            use std::iter::Iterator;
1423            self.tables = v.into_iter().map(|i| i.into()).collect();
1424            self
1425        }
1426
1427        /// Sets the value of [form_fields][crate::model::document::Page::form_fields].
1428        ///
1429        /// # Example
1430        /// ```ignore,no_run
1431        /// # use google_cloud_documentai_v1::model::document::Page;
1432        /// use google_cloud_documentai_v1::model::document::page::FormField;
1433        /// let x = Page::new()
1434        ///     .set_form_fields([
1435        ///         FormField::default()/* use setters */,
1436        ///         FormField::default()/* use (different) setters */,
1437        ///     ]);
1438        /// ```
1439        pub fn set_form_fields<T, V>(mut self, v: T) -> Self
1440        where
1441            T: std::iter::IntoIterator<Item = V>,
1442            V: std::convert::Into<crate::model::document::page::FormField>,
1443        {
1444            use std::iter::Iterator;
1445            self.form_fields = v.into_iter().map(|i| i.into()).collect();
1446            self
1447        }
1448
1449        /// Sets the value of [symbols][crate::model::document::Page::symbols].
1450        ///
1451        /// # Example
1452        /// ```ignore,no_run
1453        /// # use google_cloud_documentai_v1::model::document::Page;
1454        /// use google_cloud_documentai_v1::model::document::page::Symbol;
1455        /// let x = Page::new()
1456        ///     .set_symbols([
1457        ///         Symbol::default()/* use setters */,
1458        ///         Symbol::default()/* use (different) setters */,
1459        ///     ]);
1460        /// ```
1461        pub fn set_symbols<T, V>(mut self, v: T) -> Self
1462        where
1463            T: std::iter::IntoIterator<Item = V>,
1464            V: std::convert::Into<crate::model::document::page::Symbol>,
1465        {
1466            use std::iter::Iterator;
1467            self.symbols = v.into_iter().map(|i| i.into()).collect();
1468            self
1469        }
1470
1471        /// Sets the value of [detected_barcodes][crate::model::document::Page::detected_barcodes].
1472        ///
1473        /// # Example
1474        /// ```ignore,no_run
1475        /// # use google_cloud_documentai_v1::model::document::Page;
1476        /// use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
1477        /// let x = Page::new()
1478        ///     .set_detected_barcodes([
1479        ///         DetectedBarcode::default()/* use setters */,
1480        ///         DetectedBarcode::default()/* use (different) setters */,
1481        ///     ]);
1482        /// ```
1483        pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
1484        where
1485            T: std::iter::IntoIterator<Item = V>,
1486            V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
1487        {
1488            use std::iter::Iterator;
1489            self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
1490            self
1491        }
1492
1493        /// Sets the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1494        ///
1495        /// # Example
1496        /// ```ignore,no_run
1497        /// # use google_cloud_documentai_v1::model::document::Page;
1498        /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1499        /// let x = Page::new().set_image_quality_scores(ImageQualityScores::default()/* use setters */);
1500        /// ```
1501        pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
1502        where
1503            T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1504        {
1505            self.image_quality_scores = std::option::Option::Some(v.into());
1506            self
1507        }
1508
1509        /// Sets or clears the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1510        ///
1511        /// # Example
1512        /// ```ignore,no_run
1513        /// # use google_cloud_documentai_v1::model::document::Page;
1514        /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1515        /// let x = Page::new().set_or_clear_image_quality_scores(Some(ImageQualityScores::default()/* use setters */));
1516        /// let x = Page::new().set_or_clear_image_quality_scores(None::<ImageQualityScores>);
1517        /// ```
1518        pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
1519        where
1520            T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1521        {
1522            self.image_quality_scores = v.map(|x| x.into());
1523            self
1524        }
1525
1526        /// Sets the value of [provenance][crate::model::document::Page::provenance].
1527        ///
1528        /// # Example
1529        /// ```ignore,no_run
1530        /// # use google_cloud_documentai_v1::model::document::Page;
1531        /// use google_cloud_documentai_v1::model::document::Provenance;
1532        /// let x = Page::new().set_provenance(Provenance::default()/* use setters */);
1533        /// ```
1534        #[deprecated]
1535        pub fn set_provenance<T>(mut self, v: T) -> Self
1536        where
1537            T: std::convert::Into<crate::model::document::Provenance>,
1538        {
1539            self.provenance = std::option::Option::Some(v.into());
1540            self
1541        }
1542
1543        /// Sets or clears the value of [provenance][crate::model::document::Page::provenance].
1544        ///
1545        /// # Example
1546        /// ```ignore,no_run
1547        /// # use google_cloud_documentai_v1::model::document::Page;
1548        /// use google_cloud_documentai_v1::model::document::Provenance;
1549        /// let x = Page::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
1550        /// let x = Page::new().set_or_clear_provenance(None::<Provenance>);
1551        /// ```
1552        #[deprecated]
1553        pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1554        where
1555            T: std::convert::Into<crate::model::document::Provenance>,
1556        {
1557            self.provenance = v.map(|x| x.into());
1558            self
1559        }
1560    }
1561
1562    impl wkt::message::Message for Page {
1563        fn typename() -> &'static str {
1564            "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
1565        }
1566    }
1567
1568    /// Defines additional types related to [Page].
1569    pub mod page {
1570        #[allow(unused_imports)]
1571        use super::*;
1572
1573        /// Dimension for the page.
1574        #[derive(Clone, Default, PartialEq)]
1575        #[non_exhaustive]
1576        pub struct Dimension {
1577            /// Page width.
1578            pub width: f32,
1579
1580            /// Page height.
1581            pub height: f32,
1582
1583            /// Dimension unit.
1584            pub unit: std::string::String,
1585
1586            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1587        }
1588
1589        impl Dimension {
1590            pub fn new() -> Self {
1591                std::default::Default::default()
1592            }
1593
1594            /// Sets the value of [width][crate::model::document::page::Dimension::width].
1595            ///
1596            /// # Example
1597            /// ```ignore,no_run
1598            /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1599            /// let x = Dimension::new().set_width(42.0);
1600            /// ```
1601            pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1602                self.width = v.into();
1603                self
1604            }
1605
1606            /// Sets the value of [height][crate::model::document::page::Dimension::height].
1607            ///
1608            /// # Example
1609            /// ```ignore,no_run
1610            /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1611            /// let x = Dimension::new().set_height(42.0);
1612            /// ```
1613            pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1614                self.height = v.into();
1615                self
1616            }
1617
1618            /// Sets the value of [unit][crate::model::document::page::Dimension::unit].
1619            ///
1620            /// # Example
1621            /// ```ignore,no_run
1622            /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1623            /// let x = Dimension::new().set_unit("example");
1624            /// ```
1625            pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1626                self.unit = v.into();
1627                self
1628            }
1629        }
1630
1631        impl wkt::message::Message for Dimension {
1632            fn typename() -> &'static str {
1633                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
1634            }
1635        }
1636
1637        /// Rendered image contents for this page.
1638        #[derive(Clone, Default, PartialEq)]
1639        #[non_exhaustive]
1640        pub struct Image {
1641            /// Raw byte content of the image.
1642            pub content: ::bytes::Bytes,
1643
1644            /// Encoding [media type (MIME
1645            /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml)
1646            /// for the image.
1647            pub mime_type: std::string::String,
1648
1649            /// Width of the image in pixels.
1650            pub width: i32,
1651
1652            /// Height of the image in pixels.
1653            pub height: i32,
1654
1655            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1656        }
1657
1658        impl Image {
1659            pub fn new() -> Self {
1660                std::default::Default::default()
1661            }
1662
1663            /// Sets the value of [content][crate::model::document::page::Image::content].
1664            ///
1665            /// # Example
1666            /// ```ignore,no_run
1667            /// # use google_cloud_documentai_v1::model::document::page::Image;
1668            /// let x = Image::new().set_content(bytes::Bytes::from_static(b"example"));
1669            /// ```
1670            pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1671                self.content = v.into();
1672                self
1673            }
1674
1675            /// Sets the value of [mime_type][crate::model::document::page::Image::mime_type].
1676            ///
1677            /// # Example
1678            /// ```ignore,no_run
1679            /// # use google_cloud_documentai_v1::model::document::page::Image;
1680            /// let x = Image::new().set_mime_type("example");
1681            /// ```
1682            pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
1683                mut self,
1684                v: T,
1685            ) -> Self {
1686                self.mime_type = v.into();
1687                self
1688            }
1689
1690            /// Sets the value of [width][crate::model::document::page::Image::width].
1691            ///
1692            /// # Example
1693            /// ```ignore,no_run
1694            /// # use google_cloud_documentai_v1::model::document::page::Image;
1695            /// let x = Image::new().set_width(42);
1696            /// ```
1697            pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1698                self.width = v.into();
1699                self
1700            }
1701
1702            /// Sets the value of [height][crate::model::document::page::Image::height].
1703            ///
1704            /// # Example
1705            /// ```ignore,no_run
1706            /// # use google_cloud_documentai_v1::model::document::page::Image;
1707            /// let x = Image::new().set_height(42);
1708            /// ```
1709            pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1710                self.height = v.into();
1711                self
1712            }
1713        }
1714
1715        impl wkt::message::Message for Image {
1716            fn typename() -> &'static str {
1717                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
1718            }
1719        }
1720
1721        /// Representation for transformation matrix, intended to be compatible and
1722        /// used with OpenCV format for image manipulation.
1723        #[derive(Clone, Default, PartialEq)]
1724        #[non_exhaustive]
1725        pub struct Matrix {
1726            /// Number of rows in the matrix.
1727            pub rows: i32,
1728
1729            /// Number of columns in the matrix.
1730            pub cols: i32,
1731
1732            /// This encodes information about what data type the matrix uses.
1733            /// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
1734            /// of OpenCV primitive data types, please refer to
1735            /// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
1736            pub r#type: i32,
1737
1738            /// The matrix data.
1739            pub data: ::bytes::Bytes,
1740
1741            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1742        }
1743
1744        impl Matrix {
1745            pub fn new() -> Self {
1746                std::default::Default::default()
1747            }
1748
1749            /// Sets the value of [rows][crate::model::document::page::Matrix::rows].
1750            ///
1751            /// # Example
1752            /// ```ignore,no_run
1753            /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1754            /// let x = Matrix::new().set_rows(42);
1755            /// ```
1756            pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1757                self.rows = v.into();
1758                self
1759            }
1760
1761            /// Sets the value of [cols][crate::model::document::page::Matrix::cols].
1762            ///
1763            /// # Example
1764            /// ```ignore,no_run
1765            /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1766            /// let x = Matrix::new().set_cols(42);
1767            /// ```
1768            pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1769                self.cols = v.into();
1770                self
1771            }
1772
1773            /// Sets the value of [r#type][crate::model::document::page::Matrix::type].
1774            ///
1775            /// # Example
1776            /// ```ignore,no_run
1777            /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1778            /// let x = Matrix::new().set_type(42);
1779            /// ```
1780            pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1781                self.r#type = v.into();
1782                self
1783            }
1784
1785            /// Sets the value of [data][crate::model::document::page::Matrix::data].
1786            ///
1787            /// # Example
1788            /// ```ignore,no_run
1789            /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1790            /// let x = Matrix::new().set_data(bytes::Bytes::from_static(b"example"));
1791            /// ```
1792            pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1793                self.data = v.into();
1794                self
1795            }
1796        }
1797
1798        impl wkt::message::Message for Matrix {
1799            fn typename() -> &'static str {
1800                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
1801            }
1802        }
1803
1804        /// Visual element describing a layout unit on a page.
1805        #[derive(Clone, Default, PartialEq)]
1806        #[non_exhaustive]
1807        pub struct Layout {
1808            /// Text anchor indexing into the
1809            /// [Document.text][google.cloud.documentai.v1.Document.text].
1810            ///
1811            /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
1812            pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
1813
1814            /// Confidence of the current
1815            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
1816            /// context of the object this layout is for. e.g. confidence can be for a
1817            /// single token, a table, a visual element, etc. depending on context.
1818            /// Range `[0, 1]`.
1819            ///
1820            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1821            pub confidence: f32,
1822
1823            /// The bounding polygon for the
1824            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1825            ///
1826            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1827            pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1828
1829            /// Detected orientation for the
1830            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1831            ///
1832            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1833            pub orientation: crate::model::document::page::layout::Orientation,
1834
1835            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1836        }
1837
1838        impl Layout {
1839            pub fn new() -> Self {
1840                std::default::Default::default()
1841            }
1842
1843            /// Sets the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1844            ///
1845            /// # Example
1846            /// ```ignore,no_run
1847            /// # use google_cloud_documentai_v1::model::document::page::Layout;
1848            /// use google_cloud_documentai_v1::model::document::TextAnchor;
1849            /// let x = Layout::new().set_text_anchor(TextAnchor::default()/* use setters */);
1850            /// ```
1851            pub fn set_text_anchor<T>(mut self, v: T) -> Self
1852            where
1853                T: std::convert::Into<crate::model::document::TextAnchor>,
1854            {
1855                self.text_anchor = std::option::Option::Some(v.into());
1856                self
1857            }
1858
1859            /// Sets or clears the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1860            ///
1861            /// # Example
1862            /// ```ignore,no_run
1863            /// # use google_cloud_documentai_v1::model::document::page::Layout;
1864            /// use google_cloud_documentai_v1::model::document::TextAnchor;
1865            /// let x = Layout::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
1866            /// let x = Layout::new().set_or_clear_text_anchor(None::<TextAnchor>);
1867            /// ```
1868            pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
1869            where
1870                T: std::convert::Into<crate::model::document::TextAnchor>,
1871            {
1872                self.text_anchor = v.map(|x| x.into());
1873                self
1874            }
1875
1876            /// Sets the value of [confidence][crate::model::document::page::Layout::confidence].
1877            ///
1878            /// # Example
1879            /// ```ignore,no_run
1880            /// # use google_cloud_documentai_v1::model::document::page::Layout;
1881            /// let x = Layout::new().set_confidence(42.0);
1882            /// ```
1883            pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1884                self.confidence = v.into();
1885                self
1886            }
1887
1888            /// Sets the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1889            ///
1890            /// # Example
1891            /// ```ignore,no_run
1892            /// # use google_cloud_documentai_v1::model::document::page::Layout;
1893            /// use google_cloud_documentai_v1::model::BoundingPoly;
1894            /// let x = Layout::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
1895            /// ```
1896            pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1897            where
1898                T: std::convert::Into<crate::model::BoundingPoly>,
1899            {
1900                self.bounding_poly = std::option::Option::Some(v.into());
1901                self
1902            }
1903
1904            /// Sets or clears the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1905            ///
1906            /// # Example
1907            /// ```ignore,no_run
1908            /// # use google_cloud_documentai_v1::model::document::page::Layout;
1909            /// use google_cloud_documentai_v1::model::BoundingPoly;
1910            /// let x = Layout::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
1911            /// let x = Layout::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
1912            /// ```
1913            pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1914            where
1915                T: std::convert::Into<crate::model::BoundingPoly>,
1916            {
1917                self.bounding_poly = v.map(|x| x.into());
1918                self
1919            }
1920
1921            /// Sets the value of [orientation][crate::model::document::page::Layout::orientation].
1922            ///
1923            /// # Example
1924            /// ```ignore,no_run
1925            /// # use google_cloud_documentai_v1::model::document::page::Layout;
1926            /// use google_cloud_documentai_v1::model::document::page::layout::Orientation;
1927            /// let x0 = Layout::new().set_orientation(Orientation::PageUp);
1928            /// let x1 = Layout::new().set_orientation(Orientation::PageRight);
1929            /// let x2 = Layout::new().set_orientation(Orientation::PageDown);
1930            /// ```
1931            pub fn set_orientation<
1932                T: std::convert::Into<crate::model::document::page::layout::Orientation>,
1933            >(
1934                mut self,
1935                v: T,
1936            ) -> Self {
1937                self.orientation = v.into();
1938                self
1939            }
1940        }
1941
1942        impl wkt::message::Message for Layout {
1943            fn typename() -> &'static str {
1944                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
1945            }
1946        }
1947
1948        /// Defines additional types related to [Layout].
1949        pub mod layout {
1950            #[allow(unused_imports)]
1951            use super::*;
1952
1953            /// Detected human reading orientation.
1954            ///
1955            /// # Working with unknown values
1956            ///
1957            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1958            /// additional enum variants at any time. Adding new variants is not considered
1959            /// a breaking change. Applications should write their code in anticipation of:
1960            ///
1961            /// - New values appearing in future releases of the client library, **and**
1962            /// - New values received dynamically, without application changes.
1963            ///
1964            /// Please consult the [Working with enums] section in the user guide for some
1965            /// guidelines.
1966            ///
1967            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1968            #[derive(Clone, Debug, PartialEq)]
1969            #[non_exhaustive]
1970            pub enum Orientation {
1971                /// Unspecified orientation.
1972                Unspecified,
1973                /// Orientation is aligned with page up.
1974                PageUp,
1975                /// Orientation is aligned with page right.
1976                /// Turn the head 90 degrees clockwise from upright to read.
1977                PageRight,
1978                /// Orientation is aligned with page down.
1979                /// Turn the head 180 degrees from upright to read.
1980                PageDown,
1981                /// Orientation is aligned with page left.
1982                /// Turn the head 90 degrees counterclockwise from upright to read.
1983                PageLeft,
1984                /// If set, the enum was initialized with an unknown value.
1985                ///
1986                /// Applications can examine the value using [Orientation::value] or
1987                /// [Orientation::name].
1988                UnknownValue(orientation::UnknownValue),
1989            }
1990
1991            #[doc(hidden)]
1992            pub mod orientation {
1993                #[allow(unused_imports)]
1994                use super::*;
1995                #[derive(Clone, Debug, PartialEq)]
1996                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1997            }
1998
1999            impl Orientation {
2000                /// Gets the enum value.
2001                ///
2002                /// Returns `None` if the enum contains an unknown value deserialized from
2003                /// the string representation of enums.
2004                pub fn value(&self) -> std::option::Option<i32> {
2005                    match self {
2006                        Self::Unspecified => std::option::Option::Some(0),
2007                        Self::PageUp => std::option::Option::Some(1),
2008                        Self::PageRight => std::option::Option::Some(2),
2009                        Self::PageDown => std::option::Option::Some(3),
2010                        Self::PageLeft => std::option::Option::Some(4),
2011                        Self::UnknownValue(u) => u.0.value(),
2012                    }
2013                }
2014
2015                /// Gets the enum value as a string.
2016                ///
2017                /// Returns `None` if the enum contains an unknown value deserialized from
2018                /// the integer representation of enums.
2019                pub fn name(&self) -> std::option::Option<&str> {
2020                    match self {
2021                        Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
2022                        Self::PageUp => std::option::Option::Some("PAGE_UP"),
2023                        Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
2024                        Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
2025                        Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
2026                        Self::UnknownValue(u) => u.0.name(),
2027                    }
2028                }
2029            }
2030
2031            impl std::default::Default for Orientation {
2032                fn default() -> Self {
2033                    use std::convert::From;
2034                    Self::from(0)
2035                }
2036            }
2037
2038            impl std::fmt::Display for Orientation {
2039                fn fmt(
2040                    &self,
2041                    f: &mut std::fmt::Formatter<'_>,
2042                ) -> std::result::Result<(), std::fmt::Error> {
2043                    wkt::internal::display_enum(f, self.name(), self.value())
2044                }
2045            }
2046
2047            impl std::convert::From<i32> for Orientation {
2048                fn from(value: i32) -> Self {
2049                    match value {
2050                        0 => Self::Unspecified,
2051                        1 => Self::PageUp,
2052                        2 => Self::PageRight,
2053                        3 => Self::PageDown,
2054                        4 => Self::PageLeft,
2055                        _ => Self::UnknownValue(orientation::UnknownValue(
2056                            wkt::internal::UnknownEnumValue::Integer(value),
2057                        )),
2058                    }
2059                }
2060            }
2061
2062            impl std::convert::From<&str> for Orientation {
2063                fn from(value: &str) -> Self {
2064                    use std::string::ToString;
2065                    match value {
2066                        "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
2067                        "PAGE_UP" => Self::PageUp,
2068                        "PAGE_RIGHT" => Self::PageRight,
2069                        "PAGE_DOWN" => Self::PageDown,
2070                        "PAGE_LEFT" => Self::PageLeft,
2071                        _ => Self::UnknownValue(orientation::UnknownValue(
2072                            wkt::internal::UnknownEnumValue::String(value.to_string()),
2073                        )),
2074                    }
2075                }
2076            }
2077
2078            impl serde::ser::Serialize for Orientation {
2079                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2080                where
2081                    S: serde::Serializer,
2082                {
2083                    match self {
2084                        Self::Unspecified => serializer.serialize_i32(0),
2085                        Self::PageUp => serializer.serialize_i32(1),
2086                        Self::PageRight => serializer.serialize_i32(2),
2087                        Self::PageDown => serializer.serialize_i32(3),
2088                        Self::PageLeft => serializer.serialize_i32(4),
2089                        Self::UnknownValue(u) => u.0.serialize(serializer),
2090                    }
2091                }
2092            }
2093
2094            impl<'de> serde::de::Deserialize<'de> for Orientation {
2095                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2096                where
2097                    D: serde::Deserializer<'de>,
2098                {
2099                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
2100                        ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
2101                    ))
2102                }
2103            }
2104        }
2105
2106        /// A block has a set of lines (collected into paragraphs) that have a
2107        /// common line-spacing and orientation.
2108        #[derive(Clone, Default, PartialEq)]
2109        #[non_exhaustive]
2110        pub struct Block {
2111            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2112            /// [Block][google.cloud.documentai.v1.Document.Page.Block].
2113            ///
2114            /// [google.cloud.documentai.v1.Document.Page.Block]: crate::model::document::page::Block
2115            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2116            pub layout: std::option::Option<crate::model::document::page::Layout>,
2117
2118            /// A list of detected languages together with confidence.
2119            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2120
2121            /// The history of this annotation.
2122            #[deprecated]
2123            pub provenance: std::option::Option<crate::model::document::Provenance>,
2124
2125            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2126        }
2127
2128        impl Block {
2129            pub fn new() -> Self {
2130                std::default::Default::default()
2131            }
2132
2133            /// Sets the value of [layout][crate::model::document::page::Block::layout].
2134            ///
2135            /// # Example
2136            /// ```ignore,no_run
2137            /// # use google_cloud_documentai_v1::model::document::page::Block;
2138            /// use google_cloud_documentai_v1::model::document::page::Layout;
2139            /// let x = Block::new().set_layout(Layout::default()/* use setters */);
2140            /// ```
2141            pub fn set_layout<T>(mut self, v: T) -> Self
2142            where
2143                T: std::convert::Into<crate::model::document::page::Layout>,
2144            {
2145                self.layout = std::option::Option::Some(v.into());
2146                self
2147            }
2148
2149            /// Sets or clears the value of [layout][crate::model::document::page::Block::layout].
2150            ///
2151            /// # Example
2152            /// ```ignore,no_run
2153            /// # use google_cloud_documentai_v1::model::document::page::Block;
2154            /// use google_cloud_documentai_v1::model::document::page::Layout;
2155            /// let x = Block::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2156            /// let x = Block::new().set_or_clear_layout(None::<Layout>);
2157            /// ```
2158            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2159            where
2160                T: std::convert::Into<crate::model::document::page::Layout>,
2161            {
2162                self.layout = v.map(|x| x.into());
2163                self
2164            }
2165
2166            /// Sets the value of [detected_languages][crate::model::document::page::Block::detected_languages].
2167            ///
2168            /// # Example
2169            /// ```ignore,no_run
2170            /// # use google_cloud_documentai_v1::model::document::page::Block;
2171            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2172            /// let x = Block::new()
2173            ///     .set_detected_languages([
2174            ///         DetectedLanguage::default()/* use setters */,
2175            ///         DetectedLanguage::default()/* use (different) setters */,
2176            ///     ]);
2177            /// ```
2178            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2179            where
2180                T: std::iter::IntoIterator<Item = V>,
2181                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2182            {
2183                use std::iter::Iterator;
2184                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2185                self
2186            }
2187
2188            /// Sets the value of [provenance][crate::model::document::page::Block::provenance].
2189            ///
2190            /// # Example
2191            /// ```ignore,no_run
2192            /// # use google_cloud_documentai_v1::model::document::page::Block;
2193            /// use google_cloud_documentai_v1::model::document::Provenance;
2194            /// let x = Block::new().set_provenance(Provenance::default()/* use setters */);
2195            /// ```
2196            #[deprecated]
2197            pub fn set_provenance<T>(mut self, v: T) -> Self
2198            where
2199                T: std::convert::Into<crate::model::document::Provenance>,
2200            {
2201                self.provenance = std::option::Option::Some(v.into());
2202                self
2203            }
2204
2205            /// Sets or clears the value of [provenance][crate::model::document::page::Block::provenance].
2206            ///
2207            /// # Example
2208            /// ```ignore,no_run
2209            /// # use google_cloud_documentai_v1::model::document::page::Block;
2210            /// use google_cloud_documentai_v1::model::document::Provenance;
2211            /// let x = Block::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2212            /// let x = Block::new().set_or_clear_provenance(None::<Provenance>);
2213            /// ```
2214            #[deprecated]
2215            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2216            where
2217                T: std::convert::Into<crate::model::document::Provenance>,
2218            {
2219                self.provenance = v.map(|x| x.into());
2220                self
2221            }
2222        }
2223
2224        impl wkt::message::Message for Block {
2225            fn typename() -> &'static str {
2226                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
2227            }
2228        }
2229
2230        /// A collection of lines that a human would perceive as a paragraph.
2231        #[derive(Clone, Default, PartialEq)]
2232        #[non_exhaustive]
2233        pub struct Paragraph {
2234            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2235            /// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
2236            ///
2237            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2238            /// [google.cloud.documentai.v1.Document.Page.Paragraph]: crate::model::document::page::Paragraph
2239            pub layout: std::option::Option<crate::model::document::page::Layout>,
2240
2241            /// A list of detected languages together with confidence.
2242            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2243
2244            /// The  history of this annotation.
2245            #[deprecated]
2246            pub provenance: std::option::Option<crate::model::document::Provenance>,
2247
2248            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2249        }
2250
2251        impl Paragraph {
2252            pub fn new() -> Self {
2253                std::default::Default::default()
2254            }
2255
2256            /// Sets the value of [layout][crate::model::document::page::Paragraph::layout].
2257            ///
2258            /// # Example
2259            /// ```ignore,no_run
2260            /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2261            /// use google_cloud_documentai_v1::model::document::page::Layout;
2262            /// let x = Paragraph::new().set_layout(Layout::default()/* use setters */);
2263            /// ```
2264            pub fn set_layout<T>(mut self, v: T) -> Self
2265            where
2266                T: std::convert::Into<crate::model::document::page::Layout>,
2267            {
2268                self.layout = std::option::Option::Some(v.into());
2269                self
2270            }
2271
2272            /// Sets or clears the value of [layout][crate::model::document::page::Paragraph::layout].
2273            ///
2274            /// # Example
2275            /// ```ignore,no_run
2276            /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2277            /// use google_cloud_documentai_v1::model::document::page::Layout;
2278            /// let x = Paragraph::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2279            /// let x = Paragraph::new().set_or_clear_layout(None::<Layout>);
2280            /// ```
2281            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2282            where
2283                T: std::convert::Into<crate::model::document::page::Layout>,
2284            {
2285                self.layout = v.map(|x| x.into());
2286                self
2287            }
2288
2289            /// Sets the value of [detected_languages][crate::model::document::page::Paragraph::detected_languages].
2290            ///
2291            /// # Example
2292            /// ```ignore,no_run
2293            /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2294            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2295            /// let x = Paragraph::new()
2296            ///     .set_detected_languages([
2297            ///         DetectedLanguage::default()/* use setters */,
2298            ///         DetectedLanguage::default()/* use (different) setters */,
2299            ///     ]);
2300            /// ```
2301            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2302            where
2303                T: std::iter::IntoIterator<Item = V>,
2304                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2305            {
2306                use std::iter::Iterator;
2307                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2308                self
2309            }
2310
2311            /// Sets the value of [provenance][crate::model::document::page::Paragraph::provenance].
2312            ///
2313            /// # Example
2314            /// ```ignore,no_run
2315            /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2316            /// use google_cloud_documentai_v1::model::document::Provenance;
2317            /// let x = Paragraph::new().set_provenance(Provenance::default()/* use setters */);
2318            /// ```
2319            #[deprecated]
2320            pub fn set_provenance<T>(mut self, v: T) -> Self
2321            where
2322                T: std::convert::Into<crate::model::document::Provenance>,
2323            {
2324                self.provenance = std::option::Option::Some(v.into());
2325                self
2326            }
2327
2328            /// Sets or clears the value of [provenance][crate::model::document::page::Paragraph::provenance].
2329            ///
2330            /// # Example
2331            /// ```ignore,no_run
2332            /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2333            /// use google_cloud_documentai_v1::model::document::Provenance;
2334            /// let x = Paragraph::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2335            /// let x = Paragraph::new().set_or_clear_provenance(None::<Provenance>);
2336            /// ```
2337            #[deprecated]
2338            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2339            where
2340                T: std::convert::Into<crate::model::document::Provenance>,
2341            {
2342                self.provenance = v.map(|x| x.into());
2343                self
2344            }
2345        }
2346
2347        impl wkt::message::Message for Paragraph {
2348            fn typename() -> &'static str {
2349                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
2350            }
2351        }
2352
2353        /// A collection of tokens that a human would perceive as a line.
2354        /// Does not cross column boundaries, can be horizontal, vertical, etc.
2355        #[derive(Clone, Default, PartialEq)]
2356        #[non_exhaustive]
2357        pub struct Line {
2358            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2359            /// [Line][google.cloud.documentai.v1.Document.Page.Line].
2360            ///
2361            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2362            /// [google.cloud.documentai.v1.Document.Page.Line]: crate::model::document::page::Line
2363            pub layout: std::option::Option<crate::model::document::page::Layout>,
2364
2365            /// A list of detected languages together with confidence.
2366            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2367
2368            /// The  history of this annotation.
2369            #[deprecated]
2370            pub provenance: std::option::Option<crate::model::document::Provenance>,
2371
2372            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2373        }
2374
2375        impl Line {
2376            pub fn new() -> Self {
2377                std::default::Default::default()
2378            }
2379
2380            /// Sets the value of [layout][crate::model::document::page::Line::layout].
2381            ///
2382            /// # Example
2383            /// ```ignore,no_run
2384            /// # use google_cloud_documentai_v1::model::document::page::Line;
2385            /// use google_cloud_documentai_v1::model::document::page::Layout;
2386            /// let x = Line::new().set_layout(Layout::default()/* use setters */);
2387            /// ```
2388            pub fn set_layout<T>(mut self, v: T) -> Self
2389            where
2390                T: std::convert::Into<crate::model::document::page::Layout>,
2391            {
2392                self.layout = std::option::Option::Some(v.into());
2393                self
2394            }
2395
2396            /// Sets or clears the value of [layout][crate::model::document::page::Line::layout].
2397            ///
2398            /// # Example
2399            /// ```ignore,no_run
2400            /// # use google_cloud_documentai_v1::model::document::page::Line;
2401            /// use google_cloud_documentai_v1::model::document::page::Layout;
2402            /// let x = Line::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2403            /// let x = Line::new().set_or_clear_layout(None::<Layout>);
2404            /// ```
2405            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2406            where
2407                T: std::convert::Into<crate::model::document::page::Layout>,
2408            {
2409                self.layout = v.map(|x| x.into());
2410                self
2411            }
2412
2413            /// Sets the value of [detected_languages][crate::model::document::page::Line::detected_languages].
2414            ///
2415            /// # Example
2416            /// ```ignore,no_run
2417            /// # use google_cloud_documentai_v1::model::document::page::Line;
2418            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2419            /// let x = Line::new()
2420            ///     .set_detected_languages([
2421            ///         DetectedLanguage::default()/* use setters */,
2422            ///         DetectedLanguage::default()/* use (different) setters */,
2423            ///     ]);
2424            /// ```
2425            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2426            where
2427                T: std::iter::IntoIterator<Item = V>,
2428                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2429            {
2430                use std::iter::Iterator;
2431                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2432                self
2433            }
2434
2435            /// Sets the value of [provenance][crate::model::document::page::Line::provenance].
2436            ///
2437            /// # Example
2438            /// ```ignore,no_run
2439            /// # use google_cloud_documentai_v1::model::document::page::Line;
2440            /// use google_cloud_documentai_v1::model::document::Provenance;
2441            /// let x = Line::new().set_provenance(Provenance::default()/* use setters */);
2442            /// ```
2443            #[deprecated]
2444            pub fn set_provenance<T>(mut self, v: T) -> Self
2445            where
2446                T: std::convert::Into<crate::model::document::Provenance>,
2447            {
2448                self.provenance = std::option::Option::Some(v.into());
2449                self
2450            }
2451
2452            /// Sets or clears the value of [provenance][crate::model::document::page::Line::provenance].
2453            ///
2454            /// # Example
2455            /// ```ignore,no_run
2456            /// # use google_cloud_documentai_v1::model::document::page::Line;
2457            /// use google_cloud_documentai_v1::model::document::Provenance;
2458            /// let x = Line::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2459            /// let x = Line::new().set_or_clear_provenance(None::<Provenance>);
2460            /// ```
2461            #[deprecated]
2462            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2463            where
2464                T: std::convert::Into<crate::model::document::Provenance>,
2465            {
2466                self.provenance = v.map(|x| x.into());
2467                self
2468            }
2469        }
2470
2471        impl wkt::message::Message for Line {
2472            fn typename() -> &'static str {
2473                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
2474            }
2475        }
2476
2477        /// A detected token.
2478        #[derive(Clone, Default, PartialEq)]
2479        #[non_exhaustive]
2480        pub struct Token {
2481            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2482            /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2483            ///
2484            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2485            /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2486            pub layout: std::option::Option<crate::model::document::page::Layout>,
2487
2488            /// Detected break at the end of a
2489            /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2490            ///
2491            /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2492            pub detected_break:
2493                std::option::Option<crate::model::document::page::token::DetectedBreak>,
2494
2495            /// A list of detected languages together with confidence.
2496            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2497
2498            /// The history of this annotation.
2499            #[deprecated]
2500            pub provenance: std::option::Option<crate::model::document::Provenance>,
2501
2502            /// Text style attributes.
2503            pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,
2504
2505            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2506        }
2507
2508        impl Token {
2509            pub fn new() -> Self {
2510                std::default::Default::default()
2511            }
2512
2513            /// Sets the value of [layout][crate::model::document::page::Token::layout].
2514            ///
2515            /// # Example
2516            /// ```ignore,no_run
2517            /// # use google_cloud_documentai_v1::model::document::page::Token;
2518            /// use google_cloud_documentai_v1::model::document::page::Layout;
2519            /// let x = Token::new().set_layout(Layout::default()/* use setters */);
2520            /// ```
2521            pub fn set_layout<T>(mut self, v: T) -> Self
2522            where
2523                T: std::convert::Into<crate::model::document::page::Layout>,
2524            {
2525                self.layout = std::option::Option::Some(v.into());
2526                self
2527            }
2528
2529            /// Sets or clears the value of [layout][crate::model::document::page::Token::layout].
2530            ///
2531            /// # Example
2532            /// ```ignore,no_run
2533            /// # use google_cloud_documentai_v1::model::document::page::Token;
2534            /// use google_cloud_documentai_v1::model::document::page::Layout;
2535            /// let x = Token::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2536            /// let x = Token::new().set_or_clear_layout(None::<Layout>);
2537            /// ```
2538            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2539            where
2540                T: std::convert::Into<crate::model::document::page::Layout>,
2541            {
2542                self.layout = v.map(|x| x.into());
2543                self
2544            }
2545
2546            /// Sets the value of [detected_break][crate::model::document::page::Token::detected_break].
2547            ///
2548            /// # Example
2549            /// ```ignore,no_run
2550            /// # use google_cloud_documentai_v1::model::document::page::Token;
2551            /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2552            /// let x = Token::new().set_detected_break(DetectedBreak::default()/* use setters */);
2553            /// ```
2554            pub fn set_detected_break<T>(mut self, v: T) -> Self
2555            where
2556                T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2557            {
2558                self.detected_break = std::option::Option::Some(v.into());
2559                self
2560            }
2561
2562            /// Sets or clears the value of [detected_break][crate::model::document::page::Token::detected_break].
2563            ///
2564            /// # Example
2565            /// ```ignore,no_run
2566            /// # use google_cloud_documentai_v1::model::document::page::Token;
2567            /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2568            /// let x = Token::new().set_or_clear_detected_break(Some(DetectedBreak::default()/* use setters */));
2569            /// let x = Token::new().set_or_clear_detected_break(None::<DetectedBreak>);
2570            /// ```
2571            pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
2572            where
2573                T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2574            {
2575                self.detected_break = v.map(|x| x.into());
2576                self
2577            }
2578
2579            /// Sets the value of [detected_languages][crate::model::document::page::Token::detected_languages].
2580            ///
2581            /// # Example
2582            /// ```ignore,no_run
2583            /// # use google_cloud_documentai_v1::model::document::page::Token;
2584            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2585            /// let x = Token::new()
2586            ///     .set_detected_languages([
2587            ///         DetectedLanguage::default()/* use setters */,
2588            ///         DetectedLanguage::default()/* use (different) setters */,
2589            ///     ]);
2590            /// ```
2591            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2592            where
2593                T: std::iter::IntoIterator<Item = V>,
2594                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2595            {
2596                use std::iter::Iterator;
2597                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2598                self
2599            }
2600
2601            /// Sets the value of [provenance][crate::model::document::page::Token::provenance].
2602            ///
2603            /// # Example
2604            /// ```ignore,no_run
2605            /// # use google_cloud_documentai_v1::model::document::page::Token;
2606            /// use google_cloud_documentai_v1::model::document::Provenance;
2607            /// let x = Token::new().set_provenance(Provenance::default()/* use setters */);
2608            /// ```
2609            #[deprecated]
2610            pub fn set_provenance<T>(mut self, v: T) -> Self
2611            where
2612                T: std::convert::Into<crate::model::document::Provenance>,
2613            {
2614                self.provenance = std::option::Option::Some(v.into());
2615                self
2616            }
2617
2618            /// Sets or clears the value of [provenance][crate::model::document::page::Token::provenance].
2619            ///
2620            /// # Example
2621            /// ```ignore,no_run
2622            /// # use google_cloud_documentai_v1::model::document::page::Token;
2623            /// use google_cloud_documentai_v1::model::document::Provenance;
2624            /// let x = Token::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2625            /// let x = Token::new().set_or_clear_provenance(None::<Provenance>);
2626            /// ```
2627            #[deprecated]
2628            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2629            where
2630                T: std::convert::Into<crate::model::document::Provenance>,
2631            {
2632                self.provenance = v.map(|x| x.into());
2633                self
2634            }
2635
2636            /// Sets the value of [style_info][crate::model::document::page::Token::style_info].
2637            ///
2638            /// # Example
2639            /// ```ignore,no_run
2640            /// # use google_cloud_documentai_v1::model::document::page::Token;
2641            /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2642            /// let x = Token::new().set_style_info(StyleInfo::default()/* use setters */);
2643            /// ```
2644            pub fn set_style_info<T>(mut self, v: T) -> Self
2645            where
2646                T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2647            {
2648                self.style_info = std::option::Option::Some(v.into());
2649                self
2650            }
2651
2652            /// Sets or clears the value of [style_info][crate::model::document::page::Token::style_info].
2653            ///
2654            /// # Example
2655            /// ```ignore,no_run
2656            /// # use google_cloud_documentai_v1::model::document::page::Token;
2657            /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2658            /// let x = Token::new().set_or_clear_style_info(Some(StyleInfo::default()/* use setters */));
2659            /// let x = Token::new().set_or_clear_style_info(None::<StyleInfo>);
2660            /// ```
2661            pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
2662            where
2663                T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2664            {
2665                self.style_info = v.map(|x| x.into());
2666                self
2667            }
2668        }
2669
2670        impl wkt::message::Message for Token {
2671            fn typename() -> &'static str {
2672                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
2673            }
2674        }
2675
2676        /// Defines additional types related to [Token].
2677        pub mod token {
2678            #[allow(unused_imports)]
2679            use super::*;
2680
2681            /// Detected break at the end of a
2682            /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2683            ///
2684            /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2685            #[derive(Clone, Default, PartialEq)]
2686            #[non_exhaustive]
2687            pub struct DetectedBreak {
2688                /// Detected break type.
2689                pub r#type: crate::model::document::page::token::detected_break::Type,
2690
2691                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2692            }
2693
2694            impl DetectedBreak {
2695                pub fn new() -> Self {
2696                    std::default::Default::default()
2697                }
2698
2699                /// Sets the value of [r#type][crate::model::document::page::token::DetectedBreak::type].
2700                ///
2701                /// # Example
2702                /// ```ignore,no_run
2703                /// # use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2704                /// use google_cloud_documentai_v1::model::document::page::token::detected_break::Type;
2705                /// let x0 = DetectedBreak::new().set_type(Type::Space);
2706                /// let x1 = DetectedBreak::new().set_type(Type::WideSpace);
2707                /// let x2 = DetectedBreak::new().set_type(Type::Hyphen);
2708                /// ```
2709                pub fn set_type<
2710                    T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
2711                >(
2712                    mut self,
2713                    v: T,
2714                ) -> Self {
2715                    self.r#type = v.into();
2716                    self
2717                }
2718            }
2719
2720            impl wkt::message::Message for DetectedBreak {
2721                fn typename() -> &'static str {
2722                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
2723                }
2724            }
2725
2726            /// Defines additional types related to [DetectedBreak].
2727            pub mod detected_break {
2728                #[allow(unused_imports)]
2729                use super::*;
2730
2731                /// Enum to denote the type of break found.
2732                ///
2733                /// # Working with unknown values
2734                ///
2735                /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2736                /// additional enum variants at any time. Adding new variants is not considered
2737                /// a breaking change. Applications should write their code in anticipation of:
2738                ///
2739                /// - New values appearing in future releases of the client library, **and**
2740                /// - New values received dynamically, without application changes.
2741                ///
2742                /// Please consult the [Working with enums] section in the user guide for some
2743                /// guidelines.
2744                ///
2745                /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2746                #[derive(Clone, Debug, PartialEq)]
2747                #[non_exhaustive]
2748                pub enum Type {
2749                    /// Unspecified break type.
2750                    Unspecified,
2751                    /// A single whitespace.
2752                    Space,
2753                    /// A wider whitespace.
2754                    WideSpace,
2755                    /// A hyphen that indicates that a token has been split across lines.
2756                    Hyphen,
2757                    /// If set, the enum was initialized with an unknown value.
2758                    ///
2759                    /// Applications can examine the value using [Type::value] or
2760                    /// [Type::name].
2761                    UnknownValue(r#type::UnknownValue),
2762                }
2763
2764                #[doc(hidden)]
2765                pub mod r#type {
2766                    #[allow(unused_imports)]
2767                    use super::*;
2768                    #[derive(Clone, Debug, PartialEq)]
2769                    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2770                }
2771
2772                impl Type {
2773                    /// Gets the enum value.
2774                    ///
2775                    /// Returns `None` if the enum contains an unknown value deserialized from
2776                    /// the string representation of enums.
2777                    pub fn value(&self) -> std::option::Option<i32> {
2778                        match self {
2779                            Self::Unspecified => std::option::Option::Some(0),
2780                            Self::Space => std::option::Option::Some(1),
2781                            Self::WideSpace => std::option::Option::Some(2),
2782                            Self::Hyphen => std::option::Option::Some(3),
2783                            Self::UnknownValue(u) => u.0.value(),
2784                        }
2785                    }
2786
2787                    /// Gets the enum value as a string.
2788                    ///
2789                    /// Returns `None` if the enum contains an unknown value deserialized from
2790                    /// the integer representation of enums.
2791                    pub fn name(&self) -> std::option::Option<&str> {
2792                        match self {
2793                            Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2794                            Self::Space => std::option::Option::Some("SPACE"),
2795                            Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
2796                            Self::Hyphen => std::option::Option::Some("HYPHEN"),
2797                            Self::UnknownValue(u) => u.0.name(),
2798                        }
2799                    }
2800                }
2801
2802                impl std::default::Default for Type {
2803                    fn default() -> Self {
2804                        use std::convert::From;
2805                        Self::from(0)
2806                    }
2807                }
2808
2809                impl std::fmt::Display for Type {
2810                    fn fmt(
2811                        &self,
2812                        f: &mut std::fmt::Formatter<'_>,
2813                    ) -> std::result::Result<(), std::fmt::Error> {
2814                        wkt::internal::display_enum(f, self.name(), self.value())
2815                    }
2816                }
2817
2818                impl std::convert::From<i32> for Type {
2819                    fn from(value: i32) -> Self {
2820                        match value {
2821                            0 => Self::Unspecified,
2822                            1 => Self::Space,
2823                            2 => Self::WideSpace,
2824                            3 => Self::Hyphen,
2825                            _ => Self::UnknownValue(r#type::UnknownValue(
2826                                wkt::internal::UnknownEnumValue::Integer(value),
2827                            )),
2828                        }
2829                    }
2830                }
2831
2832                impl std::convert::From<&str> for Type {
2833                    fn from(value: &str) -> Self {
2834                        use std::string::ToString;
2835                        match value {
2836                            "TYPE_UNSPECIFIED" => Self::Unspecified,
2837                            "SPACE" => Self::Space,
2838                            "WIDE_SPACE" => Self::WideSpace,
2839                            "HYPHEN" => Self::Hyphen,
2840                            _ => Self::UnknownValue(r#type::UnknownValue(
2841                                wkt::internal::UnknownEnumValue::String(value.to_string()),
2842                            )),
2843                        }
2844                    }
2845                }
2846
2847                impl serde::ser::Serialize for Type {
2848                    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2849                    where
2850                        S: serde::Serializer,
2851                    {
2852                        match self {
2853                            Self::Unspecified => serializer.serialize_i32(0),
2854                            Self::Space => serializer.serialize_i32(1),
2855                            Self::WideSpace => serializer.serialize_i32(2),
2856                            Self::Hyphen => serializer.serialize_i32(3),
2857                            Self::UnknownValue(u) => u.0.serialize(serializer),
2858                        }
2859                    }
2860                }
2861
2862                impl<'de> serde::de::Deserialize<'de> for Type {
2863                    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2864                    where
2865                        D: serde::Deserializer<'de>,
2866                    {
2867                        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2868                            ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
2869                        ))
2870                    }
2871                }
2872            }
2873
2874            /// Font and other text style attributes.
2875            #[derive(Clone, Default, PartialEq)]
2876            #[non_exhaustive]
2877            pub struct StyleInfo {
2878                /// Font size in points (`1` point is `¹⁄₇₂` inches).
2879                pub font_size: i32,
2880
2881                /// Font size in pixels, equal to _unrounded
2882                /// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
2883                ///
2884                /// * _resolution_ ÷ `72.0`.
2885                ///
2886                /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]: crate::model::document::page::token::StyleInfo::font_size
2887                pub pixel_font_size: f64,
2888
2889                /// Letter spacing in points.
2890                pub letter_spacing: f64,
2891
2892                /// Name or style of the font.
2893                pub font_type: std::string::String,
2894
2895                /// Whether the text is bold (equivalent to
2896                /// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
2897                /// is at least `700`).
2898                ///
2899                /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]: crate::model::document::page::token::StyleInfo::font_weight
2900                pub bold: bool,
2901
2902                /// Whether the text is italic.
2903                pub italic: bool,
2904
2905                /// Whether the text is underlined.
2906                pub underlined: bool,
2907
2908                /// Whether the text is strikethrough. This feature is not supported yet.
2909                pub strikeout: bool,
2910
2911                /// Whether the text is a subscript. This feature is not supported yet.
2912                pub subscript: bool,
2913
2914                /// Whether the text is a superscript. This feature is not supported yet.
2915                pub superscript: bool,
2916
2917                /// Whether the text is in small caps. This feature is not supported yet.
2918                pub smallcaps: bool,
2919
2920                /// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
2921                /// Normal is `400`, bold is `700`.
2922                pub font_weight: i32,
2923
2924                /// Whether the text is handwritten.
2925                pub handwritten: bool,
2926
2927                /// Color of the text.
2928                pub text_color: std::option::Option<google_cloud_type::model::Color>,
2929
2930                /// Color of the background.
2931                pub background_color: std::option::Option<google_cloud_type::model::Color>,
2932
2933                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2934            }
2935
2936            impl StyleInfo {
2937                pub fn new() -> Self {
2938                    std::default::Default::default()
2939                }
2940
2941                /// Sets the value of [font_size][crate::model::document::page::token::StyleInfo::font_size].
2942                ///
2943                /// # Example
2944                /// ```ignore,no_run
2945                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2946                /// let x = StyleInfo::new().set_font_size(42);
2947                /// ```
2948                pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2949                    self.font_size = v.into();
2950                    self
2951                }
2952
2953                /// Sets the value of [pixel_font_size][crate::model::document::page::token::StyleInfo::pixel_font_size].
2954                ///
2955                /// # Example
2956                /// ```ignore,no_run
2957                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2958                /// let x = StyleInfo::new().set_pixel_font_size(42.0);
2959                /// ```
2960                pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2961                    self.pixel_font_size = v.into();
2962                    self
2963                }
2964
2965                /// Sets the value of [letter_spacing][crate::model::document::page::token::StyleInfo::letter_spacing].
2966                ///
2967                /// # Example
2968                /// ```ignore,no_run
2969                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2970                /// let x = StyleInfo::new().set_letter_spacing(42.0);
2971                /// ```
2972                pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2973                    self.letter_spacing = v.into();
2974                    self
2975                }
2976
2977                /// Sets the value of [font_type][crate::model::document::page::token::StyleInfo::font_type].
2978                ///
2979                /// # Example
2980                /// ```ignore,no_run
2981                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2982                /// let x = StyleInfo::new().set_font_type("example");
2983                /// ```
2984                pub fn set_font_type<T: std::convert::Into<std::string::String>>(
2985                    mut self,
2986                    v: T,
2987                ) -> Self {
2988                    self.font_type = v.into();
2989                    self
2990                }
2991
2992                /// Sets the value of [bold][crate::model::document::page::token::StyleInfo::bold].
2993                ///
2994                /// # Example
2995                /// ```ignore,no_run
2996                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2997                /// let x = StyleInfo::new().set_bold(true);
2998                /// ```
2999                pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3000                    self.bold = v.into();
3001                    self
3002                }
3003
3004                /// Sets the value of [italic][crate::model::document::page::token::StyleInfo::italic].
3005                ///
3006                /// # Example
3007                /// ```ignore,no_run
3008                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3009                /// let x = StyleInfo::new().set_italic(true);
3010                /// ```
3011                pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3012                    self.italic = v.into();
3013                    self
3014                }
3015
3016                /// Sets the value of [underlined][crate::model::document::page::token::StyleInfo::underlined].
3017                ///
3018                /// # Example
3019                /// ```ignore,no_run
3020                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3021                /// let x = StyleInfo::new().set_underlined(true);
3022                /// ```
3023                pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3024                    self.underlined = v.into();
3025                    self
3026                }
3027
3028                /// Sets the value of [strikeout][crate::model::document::page::token::StyleInfo::strikeout].
3029                ///
3030                /// # Example
3031                /// ```ignore,no_run
3032                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3033                /// let x = StyleInfo::new().set_strikeout(true);
3034                /// ```
3035                pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3036                    self.strikeout = v.into();
3037                    self
3038                }
3039
3040                /// Sets the value of [subscript][crate::model::document::page::token::StyleInfo::subscript].
3041                ///
3042                /// # Example
3043                /// ```ignore,no_run
3044                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3045                /// let x = StyleInfo::new().set_subscript(true);
3046                /// ```
3047                pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3048                    self.subscript = v.into();
3049                    self
3050                }
3051
3052                /// Sets the value of [superscript][crate::model::document::page::token::StyleInfo::superscript].
3053                ///
3054                /// # Example
3055                /// ```ignore,no_run
3056                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3057                /// let x = StyleInfo::new().set_superscript(true);
3058                /// ```
3059                pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3060                    self.superscript = v.into();
3061                    self
3062                }
3063
3064                /// Sets the value of [smallcaps][crate::model::document::page::token::StyleInfo::smallcaps].
3065                ///
3066                /// # Example
3067                /// ```ignore,no_run
3068                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3069                /// let x = StyleInfo::new().set_smallcaps(true);
3070                /// ```
3071                pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3072                    self.smallcaps = v.into();
3073                    self
3074                }
3075
3076                /// Sets the value of [font_weight][crate::model::document::page::token::StyleInfo::font_weight].
3077                ///
3078                /// # Example
3079                /// ```ignore,no_run
3080                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3081                /// let x = StyleInfo::new().set_font_weight(42);
3082                /// ```
3083                pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3084                    self.font_weight = v.into();
3085                    self
3086                }
3087
3088                /// Sets the value of [handwritten][crate::model::document::page::token::StyleInfo::handwritten].
3089                ///
3090                /// # Example
3091                /// ```ignore,no_run
3092                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3093                /// let x = StyleInfo::new().set_handwritten(true);
3094                /// ```
3095                pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3096                    self.handwritten = v.into();
3097                    self
3098                }
3099
3100                /// Sets the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3101                ///
3102                /// # Example
3103                /// ```ignore,no_run
3104                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3105                /// use google_cloud_type::model::Color;
3106                /// let x = StyleInfo::new().set_text_color(Color::default()/* use setters */);
3107                /// ```
3108                pub fn set_text_color<T>(mut self, v: T) -> Self
3109                where
3110                    T: std::convert::Into<google_cloud_type::model::Color>,
3111                {
3112                    self.text_color = std::option::Option::Some(v.into());
3113                    self
3114                }
3115
3116                /// Sets or clears the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3117                ///
3118                /// # Example
3119                /// ```ignore,no_run
3120                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3121                /// use google_cloud_type::model::Color;
3122                /// let x = StyleInfo::new().set_or_clear_text_color(Some(Color::default()/* use setters */));
3123                /// let x = StyleInfo::new().set_or_clear_text_color(None::<Color>);
3124                /// ```
3125                pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
3126                where
3127                    T: std::convert::Into<google_cloud_type::model::Color>,
3128                {
3129                    self.text_color = v.map(|x| x.into());
3130                    self
3131                }
3132
3133                /// Sets the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3134                ///
3135                /// # Example
3136                /// ```ignore,no_run
3137                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3138                /// use google_cloud_type::model::Color;
3139                /// let x = StyleInfo::new().set_background_color(Color::default()/* use setters */);
3140                /// ```
3141                pub fn set_background_color<T>(mut self, v: T) -> Self
3142                where
3143                    T: std::convert::Into<google_cloud_type::model::Color>,
3144                {
3145                    self.background_color = std::option::Option::Some(v.into());
3146                    self
3147                }
3148
3149                /// Sets or clears the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3150                ///
3151                /// # Example
3152                /// ```ignore,no_run
3153                /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3154                /// use google_cloud_type::model::Color;
3155                /// let x = StyleInfo::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
3156                /// let x = StyleInfo::new().set_or_clear_background_color(None::<Color>);
3157                /// ```
3158                pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
3159                where
3160                    T: std::convert::Into<google_cloud_type::model::Color>,
3161                {
3162                    self.background_color = v.map(|x| x.into());
3163                    self
3164                }
3165            }
3166
3167            impl wkt::message::Message for StyleInfo {
3168                fn typename() -> &'static str {
3169                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
3170                }
3171            }
3172        }
3173
3174        /// A detected symbol.
3175        #[derive(Clone, Default, PartialEq)]
3176        #[non_exhaustive]
3177        pub struct Symbol {
3178            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3179            /// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
3180            ///
3181            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3182            /// [google.cloud.documentai.v1.Document.Page.Symbol]: crate::model::document::page::Symbol
3183            pub layout: std::option::Option<crate::model::document::page::Layout>,
3184
3185            /// A list of detected languages together with confidence.
3186            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3187
3188            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3189        }
3190
3191        impl Symbol {
3192            pub fn new() -> Self {
3193                std::default::Default::default()
3194            }
3195
3196            /// Sets the value of [layout][crate::model::document::page::Symbol::layout].
3197            ///
3198            /// # Example
3199            /// ```ignore,no_run
3200            /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3201            /// use google_cloud_documentai_v1::model::document::page::Layout;
3202            /// let x = Symbol::new().set_layout(Layout::default()/* use setters */);
3203            /// ```
3204            pub fn set_layout<T>(mut self, v: T) -> Self
3205            where
3206                T: std::convert::Into<crate::model::document::page::Layout>,
3207            {
3208                self.layout = std::option::Option::Some(v.into());
3209                self
3210            }
3211
3212            /// Sets or clears the value of [layout][crate::model::document::page::Symbol::layout].
3213            ///
3214            /// # Example
3215            /// ```ignore,no_run
3216            /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3217            /// use google_cloud_documentai_v1::model::document::page::Layout;
3218            /// let x = Symbol::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3219            /// let x = Symbol::new().set_or_clear_layout(None::<Layout>);
3220            /// ```
3221            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3222            where
3223                T: std::convert::Into<crate::model::document::page::Layout>,
3224            {
3225                self.layout = v.map(|x| x.into());
3226                self
3227            }
3228
3229            /// Sets the value of [detected_languages][crate::model::document::page::Symbol::detected_languages].
3230            ///
3231            /// # Example
3232            /// ```ignore,no_run
3233            /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3234            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3235            /// let x = Symbol::new()
3236            ///     .set_detected_languages([
3237            ///         DetectedLanguage::default()/* use setters */,
3238            ///         DetectedLanguage::default()/* use (different) setters */,
3239            ///     ]);
3240            /// ```
3241            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3242            where
3243                T: std::iter::IntoIterator<Item = V>,
3244                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3245            {
3246                use std::iter::Iterator;
3247                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3248                self
3249            }
3250        }
3251
3252        impl wkt::message::Message for Symbol {
3253            fn typename() -> &'static str {
3254                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
3255            }
3256        }
3257
3258        /// Detected non-text visual elements e.g. checkbox, signature etc. on the
3259        /// page.
3260        #[derive(Clone, Default, PartialEq)]
3261        #[non_exhaustive]
3262        pub struct VisualElement {
3263            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3264            /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3265            ///
3266            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3267            /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3268            pub layout: std::option::Option<crate::model::document::page::Layout>,
3269
3270            /// Type of the
3271            /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3272            ///
3273            /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3274            pub r#type: std::string::String,
3275
3276            /// A list of detected languages together with confidence.
3277            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3278
3279            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3280        }
3281
3282        impl VisualElement {
3283            pub fn new() -> Self {
3284                std::default::Default::default()
3285            }
3286
3287            /// Sets the value of [layout][crate::model::document::page::VisualElement::layout].
3288            ///
3289            /// # Example
3290            /// ```ignore,no_run
3291            /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3292            /// use google_cloud_documentai_v1::model::document::page::Layout;
3293            /// let x = VisualElement::new().set_layout(Layout::default()/* use setters */);
3294            /// ```
3295            pub fn set_layout<T>(mut self, v: T) -> Self
3296            where
3297                T: std::convert::Into<crate::model::document::page::Layout>,
3298            {
3299                self.layout = std::option::Option::Some(v.into());
3300                self
3301            }
3302
3303            /// Sets or clears the value of [layout][crate::model::document::page::VisualElement::layout].
3304            ///
3305            /// # Example
3306            /// ```ignore,no_run
3307            /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3308            /// use google_cloud_documentai_v1::model::document::page::Layout;
3309            /// let x = VisualElement::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3310            /// let x = VisualElement::new().set_or_clear_layout(None::<Layout>);
3311            /// ```
3312            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3313            where
3314                T: std::convert::Into<crate::model::document::page::Layout>,
3315            {
3316                self.layout = v.map(|x| x.into());
3317                self
3318            }
3319
3320            /// Sets the value of [r#type][crate::model::document::page::VisualElement::type].
3321            ///
3322            /// # Example
3323            /// ```ignore,no_run
3324            /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3325            /// let x = VisualElement::new().set_type("example");
3326            /// ```
3327            pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3328                self.r#type = v.into();
3329                self
3330            }
3331
3332            /// Sets the value of [detected_languages][crate::model::document::page::VisualElement::detected_languages].
3333            ///
3334            /// # Example
3335            /// ```ignore,no_run
3336            /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3337            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3338            /// let x = VisualElement::new()
3339            ///     .set_detected_languages([
3340            ///         DetectedLanguage::default()/* use setters */,
3341            ///         DetectedLanguage::default()/* use (different) setters */,
3342            ///     ]);
3343            /// ```
3344            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3345            where
3346                T: std::iter::IntoIterator<Item = V>,
3347                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3348            {
3349                use std::iter::Iterator;
3350                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3351                self
3352            }
3353        }
3354
3355        impl wkt::message::Message for VisualElement {
3356            fn typename() -> &'static str {
3357                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
3358            }
3359        }
3360
3361        /// A table representation similar to HTML table structure.
3362        #[derive(Clone, Default, PartialEq)]
3363        #[non_exhaustive]
3364        pub struct Table {
3365            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3366            /// [Table][google.cloud.documentai.v1.Document.Page.Table].
3367            ///
3368            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3369            /// [google.cloud.documentai.v1.Document.Page.Table]: crate::model::document::page::Table
3370            pub layout: std::option::Option<crate::model::document::page::Layout>,
3371
3372            /// Header rows of the table.
3373            pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3374
3375            /// Body rows of the table.
3376            pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3377
3378            /// A list of detected languages together with confidence.
3379            pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3380
3381            /// The history of this table.
3382            #[deprecated]
3383            pub provenance: std::option::Option<crate::model::document::Provenance>,
3384
3385            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3386        }
3387
3388        impl Table {
3389            pub fn new() -> Self {
3390                std::default::Default::default()
3391            }
3392
3393            /// Sets the value of [layout][crate::model::document::page::Table::layout].
3394            ///
3395            /// # Example
3396            /// ```ignore,no_run
3397            /// # use google_cloud_documentai_v1::model::document::page::Table;
3398            /// use google_cloud_documentai_v1::model::document::page::Layout;
3399            /// let x = Table::new().set_layout(Layout::default()/* use setters */);
3400            /// ```
3401            pub fn set_layout<T>(mut self, v: T) -> Self
3402            where
3403                T: std::convert::Into<crate::model::document::page::Layout>,
3404            {
3405                self.layout = std::option::Option::Some(v.into());
3406                self
3407            }
3408
3409            /// Sets or clears the value of [layout][crate::model::document::page::Table::layout].
3410            ///
3411            /// # Example
3412            /// ```ignore,no_run
3413            /// # use google_cloud_documentai_v1::model::document::page::Table;
3414            /// use google_cloud_documentai_v1::model::document::page::Layout;
3415            /// let x = Table::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3416            /// let x = Table::new().set_or_clear_layout(None::<Layout>);
3417            /// ```
3418            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3419            where
3420                T: std::convert::Into<crate::model::document::page::Layout>,
3421            {
3422                self.layout = v.map(|x| x.into());
3423                self
3424            }
3425
3426            /// Sets the value of [header_rows][crate::model::document::page::Table::header_rows].
3427            ///
3428            /// # Example
3429            /// ```ignore,no_run
3430            /// # use google_cloud_documentai_v1::model::document::page::Table;
3431            /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3432            /// let x = Table::new()
3433            ///     .set_header_rows([
3434            ///         TableRow::default()/* use setters */,
3435            ///         TableRow::default()/* use (different) setters */,
3436            ///     ]);
3437            /// ```
3438            pub fn set_header_rows<T, V>(mut self, v: T) -> Self
3439            where
3440                T: std::iter::IntoIterator<Item = V>,
3441                V: std::convert::Into<crate::model::document::page::table::TableRow>,
3442            {
3443                use std::iter::Iterator;
3444                self.header_rows = v.into_iter().map(|i| i.into()).collect();
3445                self
3446            }
3447
3448            /// Sets the value of [body_rows][crate::model::document::page::Table::body_rows].
3449            ///
3450            /// # Example
3451            /// ```ignore,no_run
3452            /// # use google_cloud_documentai_v1::model::document::page::Table;
3453            /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3454            /// let x = Table::new()
3455            ///     .set_body_rows([
3456            ///         TableRow::default()/* use setters */,
3457            ///         TableRow::default()/* use (different) setters */,
3458            ///     ]);
3459            /// ```
3460            pub fn set_body_rows<T, V>(mut self, v: T) -> Self
3461            where
3462                T: std::iter::IntoIterator<Item = V>,
3463                V: std::convert::Into<crate::model::document::page::table::TableRow>,
3464            {
3465                use std::iter::Iterator;
3466                self.body_rows = v.into_iter().map(|i| i.into()).collect();
3467                self
3468            }
3469
3470            /// Sets the value of [detected_languages][crate::model::document::page::Table::detected_languages].
3471            ///
3472            /// # Example
3473            /// ```ignore,no_run
3474            /// # use google_cloud_documentai_v1::model::document::page::Table;
3475            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3476            /// let x = Table::new()
3477            ///     .set_detected_languages([
3478            ///         DetectedLanguage::default()/* use setters */,
3479            ///         DetectedLanguage::default()/* use (different) setters */,
3480            ///     ]);
3481            /// ```
3482            pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3483            where
3484                T: std::iter::IntoIterator<Item = V>,
3485                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3486            {
3487                use std::iter::Iterator;
3488                self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3489                self
3490            }
3491
3492            /// Sets the value of [provenance][crate::model::document::page::Table::provenance].
3493            ///
3494            /// # Example
3495            /// ```ignore,no_run
3496            /// # use google_cloud_documentai_v1::model::document::page::Table;
3497            /// use google_cloud_documentai_v1::model::document::Provenance;
3498            /// let x = Table::new().set_provenance(Provenance::default()/* use setters */);
3499            /// ```
3500            #[deprecated]
3501            pub fn set_provenance<T>(mut self, v: T) -> Self
3502            where
3503                T: std::convert::Into<crate::model::document::Provenance>,
3504            {
3505                self.provenance = std::option::Option::Some(v.into());
3506                self
3507            }
3508
3509            /// Sets or clears the value of [provenance][crate::model::document::page::Table::provenance].
3510            ///
3511            /// # Example
3512            /// ```ignore,no_run
3513            /// # use google_cloud_documentai_v1::model::document::page::Table;
3514            /// use google_cloud_documentai_v1::model::document::Provenance;
3515            /// let x = Table::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3516            /// let x = Table::new().set_or_clear_provenance(None::<Provenance>);
3517            /// ```
3518            #[deprecated]
3519            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3520            where
3521                T: std::convert::Into<crate::model::document::Provenance>,
3522            {
3523                self.provenance = v.map(|x| x.into());
3524                self
3525            }
3526        }
3527
3528        impl wkt::message::Message for Table {
3529            fn typename() -> &'static str {
3530                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
3531            }
3532        }
3533
3534        /// Defines additional types related to [Table].
3535        pub mod table {
3536            #[allow(unused_imports)]
3537            use super::*;
3538
3539            /// A row of table cells.
3540            #[derive(Clone, Default, PartialEq)]
3541            #[non_exhaustive]
3542            pub struct TableRow {
3543                /// Cells that make up this row.
3544                pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,
3545
3546                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3547            }
3548
3549            impl TableRow {
3550                pub fn new() -> Self {
3551                    std::default::Default::default()
3552                }
3553
3554                /// Sets the value of [cells][crate::model::document::page::table::TableRow::cells].
3555                ///
3556                /// # Example
3557                /// ```ignore,no_run
3558                /// # use google_cloud_documentai_v1::model::document::page::table::TableRow;
3559                /// use google_cloud_documentai_v1::model::document::page::table::TableCell;
3560                /// let x = TableRow::new()
3561                ///     .set_cells([
3562                ///         TableCell::default()/* use setters */,
3563                ///         TableCell::default()/* use (different) setters */,
3564                ///     ]);
3565                /// ```
3566                pub fn set_cells<T, V>(mut self, v: T) -> Self
3567                where
3568                    T: std::iter::IntoIterator<Item = V>,
3569                    V: std::convert::Into<crate::model::document::page::table::TableCell>,
3570                {
3571                    use std::iter::Iterator;
3572                    self.cells = v.into_iter().map(|i| i.into()).collect();
3573                    self
3574                }
3575            }
3576
3577            impl wkt::message::Message for TableRow {
3578                fn typename() -> &'static str {
3579                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
3580                }
3581            }
3582
3583            /// A cell representation inside the table.
3584            #[derive(Clone, Default, PartialEq)]
3585            #[non_exhaustive]
3586            pub struct TableCell {
3587                /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3588                /// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
3589                ///
3590                /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3591                /// [google.cloud.documentai.v1.Document.Page.Table.TableCell]: crate::model::document::page::table::TableCell
3592                pub layout: std::option::Option<crate::model::document::page::Layout>,
3593
3594                /// How many rows this cell spans.
3595                pub row_span: i32,
3596
3597                /// How many columns this cell spans.
3598                pub col_span: i32,
3599
3600                /// A list of detected languages together with confidence.
3601                pub detected_languages:
3602                    std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3603
3604                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3605            }
3606
3607            impl TableCell {
3608                pub fn new() -> Self {
3609                    std::default::Default::default()
3610                }
3611
3612                /// Sets the value of [layout][crate::model::document::page::table::TableCell::layout].
3613                ///
3614                /// # Example
3615                /// ```ignore,no_run
3616                /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3617                /// use google_cloud_documentai_v1::model::document::page::Layout;
3618                /// let x = TableCell::new().set_layout(Layout::default()/* use setters */);
3619                /// ```
3620                pub fn set_layout<T>(mut self, v: T) -> Self
3621                where
3622                    T: std::convert::Into<crate::model::document::page::Layout>,
3623                {
3624                    self.layout = std::option::Option::Some(v.into());
3625                    self
3626                }
3627
3628                /// Sets or clears the value of [layout][crate::model::document::page::table::TableCell::layout].
3629                ///
3630                /// # Example
3631                /// ```ignore,no_run
3632                /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3633                /// use google_cloud_documentai_v1::model::document::page::Layout;
3634                /// let x = TableCell::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3635                /// let x = TableCell::new().set_or_clear_layout(None::<Layout>);
3636                /// ```
3637                pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3638                where
3639                    T: std::convert::Into<crate::model::document::page::Layout>,
3640                {
3641                    self.layout = v.map(|x| x.into());
3642                    self
3643                }
3644
3645                /// Sets the value of [row_span][crate::model::document::page::table::TableCell::row_span].
3646                ///
3647                /// # Example
3648                /// ```ignore,no_run
3649                /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3650                /// let x = TableCell::new().set_row_span(42);
3651                /// ```
3652                pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3653                    self.row_span = v.into();
3654                    self
3655                }
3656
3657                /// Sets the value of [col_span][crate::model::document::page::table::TableCell::col_span].
3658                ///
3659                /// # Example
3660                /// ```ignore,no_run
3661                /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3662                /// let x = TableCell::new().set_col_span(42);
3663                /// ```
3664                pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3665                    self.col_span = v.into();
3666                    self
3667                }
3668
3669                /// Sets the value of [detected_languages][crate::model::document::page::table::TableCell::detected_languages].
3670                ///
3671                /// # Example
3672                /// ```ignore,no_run
3673                /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3674                /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3675                /// let x = TableCell::new()
3676                ///     .set_detected_languages([
3677                ///         DetectedLanguage::default()/* use setters */,
3678                ///         DetectedLanguage::default()/* use (different) setters */,
3679                ///     ]);
3680                /// ```
3681                pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3682                where
3683                    T: std::iter::IntoIterator<Item = V>,
3684                    V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3685                {
3686                    use std::iter::Iterator;
3687                    self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3688                    self
3689                }
3690            }
3691
3692            impl wkt::message::Message for TableCell {
3693                fn typename() -> &'static str {
3694                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
3695                }
3696            }
3697        }
3698
3699        /// A form field detected on the page.
3700        #[derive(Clone, Default, PartialEq)]
3701        #[non_exhaustive]
3702        pub struct FormField {
3703            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3704            /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
3705            /// e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc.
3706            ///
3707            /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3708            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3709            pub field_name: std::option::Option<crate::model::document::page::Layout>,
3710
3711            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3712            /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
3713            ///
3714            /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3715            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3716            pub field_value: std::option::Option<crate::model::document::page::Layout>,
3717
3718            /// A list of detected languages for name together with confidence.
3719            pub name_detected_languages:
3720                std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3721
3722            /// A list of detected languages for value together with confidence.
3723            pub value_detected_languages:
3724                std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3725
3726            /// If the value is non-textual, this field represents the type. Current
3727            /// valid values are:
3728            ///
3729            /// - blank (this indicates the `field_value` is normal text)
3730            /// - `unfilled_checkbox`
3731            /// - `filled_checkbox`
3732            pub value_type: std::string::String,
3733
3734            /// Created for Labeling UI to export key text.
3735            /// If corrections were made to the text identified by the
3736            /// `field_name.text_anchor`, this field will contain the correction.
3737            pub corrected_key_text: std::string::String,
3738
3739            /// Created for Labeling UI to export value text.
3740            /// If corrections were made to the text identified by the
3741            /// `field_value.text_anchor`, this field will contain the correction.
3742            pub corrected_value_text: std::string::String,
3743
3744            /// The history of this annotation.
3745            pub provenance: std::option::Option<crate::model::document::Provenance>,
3746
3747            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3748        }
3749
3750        impl FormField {
3751            pub fn new() -> Self {
3752                std::default::Default::default()
3753            }
3754
3755            /// Sets the value of [field_name][crate::model::document::page::FormField::field_name].
3756            ///
3757            /// # Example
3758            /// ```ignore,no_run
3759            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3760            /// use google_cloud_documentai_v1::model::document::page::Layout;
3761            /// let x = FormField::new().set_field_name(Layout::default()/* use setters */);
3762            /// ```
3763            pub fn set_field_name<T>(mut self, v: T) -> Self
3764            where
3765                T: std::convert::Into<crate::model::document::page::Layout>,
3766            {
3767                self.field_name = std::option::Option::Some(v.into());
3768                self
3769            }
3770
3771            /// Sets or clears the value of [field_name][crate::model::document::page::FormField::field_name].
3772            ///
3773            /// # Example
3774            /// ```ignore,no_run
3775            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3776            /// use google_cloud_documentai_v1::model::document::page::Layout;
3777            /// let x = FormField::new().set_or_clear_field_name(Some(Layout::default()/* use setters */));
3778            /// let x = FormField::new().set_or_clear_field_name(None::<Layout>);
3779            /// ```
3780            pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
3781            where
3782                T: std::convert::Into<crate::model::document::page::Layout>,
3783            {
3784                self.field_name = v.map(|x| x.into());
3785                self
3786            }
3787
3788            /// Sets the value of [field_value][crate::model::document::page::FormField::field_value].
3789            ///
3790            /// # Example
3791            /// ```ignore,no_run
3792            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3793            /// use google_cloud_documentai_v1::model::document::page::Layout;
3794            /// let x = FormField::new().set_field_value(Layout::default()/* use setters */);
3795            /// ```
3796            pub fn set_field_value<T>(mut self, v: T) -> Self
3797            where
3798                T: std::convert::Into<crate::model::document::page::Layout>,
3799            {
3800                self.field_value = std::option::Option::Some(v.into());
3801                self
3802            }
3803
3804            /// Sets or clears the value of [field_value][crate::model::document::page::FormField::field_value].
3805            ///
3806            /// # Example
3807            /// ```ignore,no_run
3808            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3809            /// use google_cloud_documentai_v1::model::document::page::Layout;
3810            /// let x = FormField::new().set_or_clear_field_value(Some(Layout::default()/* use setters */));
3811            /// let x = FormField::new().set_or_clear_field_value(None::<Layout>);
3812            /// ```
3813            pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
3814            where
3815                T: std::convert::Into<crate::model::document::page::Layout>,
3816            {
3817                self.field_value = v.map(|x| x.into());
3818                self
3819            }
3820
3821            /// Sets the value of [name_detected_languages][crate::model::document::page::FormField::name_detected_languages].
3822            ///
3823            /// # Example
3824            /// ```ignore,no_run
3825            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3826            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3827            /// let x = FormField::new()
3828            ///     .set_name_detected_languages([
3829            ///         DetectedLanguage::default()/* use setters */,
3830            ///         DetectedLanguage::default()/* use (different) setters */,
3831            ///     ]);
3832            /// ```
3833            pub fn set_name_detected_languages<T, V>(mut self, v: T) -> Self
3834            where
3835                T: std::iter::IntoIterator<Item = V>,
3836                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3837            {
3838                use std::iter::Iterator;
3839                self.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
3840                self
3841            }
3842
3843            /// Sets the value of [value_detected_languages][crate::model::document::page::FormField::value_detected_languages].
3844            ///
3845            /// # Example
3846            /// ```ignore,no_run
3847            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3848            /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3849            /// let x = FormField::new()
3850            ///     .set_value_detected_languages([
3851            ///         DetectedLanguage::default()/* use setters */,
3852            ///         DetectedLanguage::default()/* use (different) setters */,
3853            ///     ]);
3854            /// ```
3855            pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
3856            where
3857                T: std::iter::IntoIterator<Item = V>,
3858                V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3859            {
3860                use std::iter::Iterator;
3861                self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
3862                self
3863            }
3864
3865            /// Sets the value of [value_type][crate::model::document::page::FormField::value_type].
3866            ///
3867            /// # Example
3868            /// ```ignore,no_run
3869            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3870            /// let x = FormField::new().set_value_type("example");
3871            /// ```
3872            pub fn set_value_type<T: std::convert::Into<std::string::String>>(
3873                mut self,
3874                v: T,
3875            ) -> Self {
3876                self.value_type = v.into();
3877                self
3878            }
3879
3880            /// Sets the value of [corrected_key_text][crate::model::document::page::FormField::corrected_key_text].
3881            ///
3882            /// # Example
3883            /// ```ignore,no_run
3884            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3885            /// let x = FormField::new().set_corrected_key_text("example");
3886            /// ```
3887            pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
3888                mut self,
3889                v: T,
3890            ) -> Self {
3891                self.corrected_key_text = v.into();
3892                self
3893            }
3894
3895            /// Sets the value of [corrected_value_text][crate::model::document::page::FormField::corrected_value_text].
3896            ///
3897            /// # Example
3898            /// ```ignore,no_run
3899            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3900            /// let x = FormField::new().set_corrected_value_text("example");
3901            /// ```
3902            pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
3903                mut self,
3904                v: T,
3905            ) -> Self {
3906                self.corrected_value_text = v.into();
3907                self
3908            }
3909
3910            /// Sets the value of [provenance][crate::model::document::page::FormField::provenance].
3911            ///
3912            /// # Example
3913            /// ```ignore,no_run
3914            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3915            /// use google_cloud_documentai_v1::model::document::Provenance;
3916            /// let x = FormField::new().set_provenance(Provenance::default()/* use setters */);
3917            /// ```
3918            pub fn set_provenance<T>(mut self, v: T) -> Self
3919            where
3920                T: std::convert::Into<crate::model::document::Provenance>,
3921            {
3922                self.provenance = std::option::Option::Some(v.into());
3923                self
3924            }
3925
3926            /// Sets or clears the value of [provenance][crate::model::document::page::FormField::provenance].
3927            ///
3928            /// # Example
3929            /// ```ignore,no_run
3930            /// # use google_cloud_documentai_v1::model::document::page::FormField;
3931            /// use google_cloud_documentai_v1::model::document::Provenance;
3932            /// let x = FormField::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3933            /// let x = FormField::new().set_or_clear_provenance(None::<Provenance>);
3934            /// ```
3935            pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3936            where
3937                T: std::convert::Into<crate::model::document::Provenance>,
3938            {
3939                self.provenance = v.map(|x| x.into());
3940                self
3941            }
3942        }
3943
3944        impl wkt::message::Message for FormField {
3945            fn typename() -> &'static str {
3946                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
3947            }
3948        }
3949
3950        /// A detected barcode.
3951        #[derive(Clone, Default, PartialEq)]
3952        #[non_exhaustive]
3953        pub struct DetectedBarcode {
3954            /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3955            /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
3956            ///
3957            /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
3958            /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3959            pub layout: std::option::Option<crate::model::document::page::Layout>,
3960
3961            /// Detailed barcode information of the
3962            /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
3963            ///
3964            /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
3965            pub barcode: std::option::Option<crate::model::Barcode>,
3966
3967            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3968        }
3969
3970        impl DetectedBarcode {
3971            pub fn new() -> Self {
3972                std::default::Default::default()
3973            }
3974
3975            /// Sets the value of [layout][crate::model::document::page::DetectedBarcode::layout].
3976            ///
3977            /// # Example
3978            /// ```ignore,no_run
3979            /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
3980            /// use google_cloud_documentai_v1::model::document::page::Layout;
3981            /// let x = DetectedBarcode::new().set_layout(Layout::default()/* use setters */);
3982            /// ```
3983            pub fn set_layout<T>(mut self, v: T) -> Self
3984            where
3985                T: std::convert::Into<crate::model::document::page::Layout>,
3986            {
3987                self.layout = std::option::Option::Some(v.into());
3988                self
3989            }
3990
3991            /// Sets or clears the value of [layout][crate::model::document::page::DetectedBarcode::layout].
3992            ///
3993            /// # Example
3994            /// ```ignore,no_run
3995            /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
3996            /// use google_cloud_documentai_v1::model::document::page::Layout;
3997            /// let x = DetectedBarcode::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3998            /// let x = DetectedBarcode::new().set_or_clear_layout(None::<Layout>);
3999            /// ```
4000            pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
4001            where
4002                T: std::convert::Into<crate::model::document::page::Layout>,
4003            {
4004                self.layout = v.map(|x| x.into());
4005                self
4006            }
4007
4008            /// Sets the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4009            ///
4010            /// # Example
4011            /// ```ignore,no_run
4012            /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4013            /// use google_cloud_documentai_v1::model::Barcode;
4014            /// let x = DetectedBarcode::new().set_barcode(Barcode::default()/* use setters */);
4015            /// ```
4016            pub fn set_barcode<T>(mut self, v: T) -> Self
4017            where
4018                T: std::convert::Into<crate::model::Barcode>,
4019            {
4020                self.barcode = std::option::Option::Some(v.into());
4021                self
4022            }
4023
4024            /// Sets or clears the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4025            ///
4026            /// # Example
4027            /// ```ignore,no_run
4028            /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4029            /// use google_cloud_documentai_v1::model::Barcode;
4030            /// let x = DetectedBarcode::new().set_or_clear_barcode(Some(Barcode::default()/* use setters */));
4031            /// let x = DetectedBarcode::new().set_or_clear_barcode(None::<Barcode>);
4032            /// ```
4033            pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
4034            where
4035                T: std::convert::Into<crate::model::Barcode>,
4036            {
4037                self.barcode = v.map(|x| x.into());
4038                self
4039            }
4040        }
4041
4042        impl wkt::message::Message for DetectedBarcode {
4043            fn typename() -> &'static str {
4044                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
4045            }
4046        }
4047
4048        /// Detected language for a structural component.
4049        #[derive(Clone, Default, PartialEq)]
4050        #[non_exhaustive]
4051        pub struct DetectedLanguage {
4052            /// The [BCP-47 language
4053            /// code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier),
4054            /// such as `en-US` or `sr-Latn`.
4055            pub language_code: std::string::String,
4056
4057            /// Confidence of detected language. Range `[0, 1]`.
4058            pub confidence: f32,
4059
4060            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4061        }
4062
4063        impl DetectedLanguage {
4064            pub fn new() -> Self {
4065                std::default::Default::default()
4066            }
4067
4068            /// Sets the value of [language_code][crate::model::document::page::DetectedLanguage::language_code].
4069            ///
4070            /// # Example
4071            /// ```ignore,no_run
4072            /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4073            /// let x = DetectedLanguage::new().set_language_code("example");
4074            /// ```
4075            pub fn set_language_code<T: std::convert::Into<std::string::String>>(
4076                mut self,
4077                v: T,
4078            ) -> Self {
4079                self.language_code = v.into();
4080                self
4081            }
4082
4083            /// Sets the value of [confidence][crate::model::document::page::DetectedLanguage::confidence].
4084            ///
4085            /// # Example
4086            /// ```ignore,no_run
4087            /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4088            /// let x = DetectedLanguage::new().set_confidence(42.0);
4089            /// ```
4090            pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4091                self.confidence = v.into();
4092                self
4093            }
4094        }
4095
4096        impl wkt::message::Message for DetectedLanguage {
4097            fn typename() -> &'static str {
4098                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
4099            }
4100        }
4101
4102        /// Image quality scores for the page image.
4103        #[derive(Clone, Default, PartialEq)]
4104        #[non_exhaustive]
4105        pub struct ImageQualityScores {
4106            /// The overall quality score. Range `[0, 1]` where `1` is perfect quality.
4107            pub quality_score: f32,
4108
4109            /// A list of detected defects.
4110            pub detected_defects:
4111                std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,
4112
4113            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4114        }
4115
4116        impl ImageQualityScores {
4117            pub fn new() -> Self {
4118                std::default::Default::default()
4119            }
4120
4121            /// Sets the value of [quality_score][crate::model::document::page::ImageQualityScores::quality_score].
4122            ///
4123            /// # Example
4124            /// ```ignore,no_run
4125            /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4126            /// let x = ImageQualityScores::new().set_quality_score(42.0);
4127            /// ```
4128            pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4129                self.quality_score = v.into();
4130                self
4131            }
4132
4133            /// Sets the value of [detected_defects][crate::model::document::page::ImageQualityScores::detected_defects].
4134            ///
4135            /// # Example
4136            /// ```ignore,no_run
4137            /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4138            /// use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4139            /// let x = ImageQualityScores::new()
4140            ///     .set_detected_defects([
4141            ///         DetectedDefect::default()/* use setters */,
4142            ///         DetectedDefect::default()/* use (different) setters */,
4143            ///     ]);
4144            /// ```
4145            pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
4146            where
4147                T: std::iter::IntoIterator<Item = V>,
4148                V: std::convert::Into<
4149                        crate::model::document::page::image_quality_scores::DetectedDefect,
4150                    >,
4151            {
4152                use std::iter::Iterator;
4153                self.detected_defects = v.into_iter().map(|i| i.into()).collect();
4154                self
4155            }
4156        }
4157
4158        impl wkt::message::Message for ImageQualityScores {
4159            fn typename() -> &'static str {
4160                "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
4161            }
4162        }
4163
4164        /// Defines additional types related to [ImageQualityScores].
4165        pub mod image_quality_scores {
4166            #[allow(unused_imports)]
4167            use super::*;
4168
4169            /// Image Quality Defects
4170            #[derive(Clone, Default, PartialEq)]
4171            #[non_exhaustive]
4172            pub struct DetectedDefect {
4173                /// Name of the defect type. Supported values are:
4174                ///
4175                /// - `quality/defect_blurry`
4176                /// - `quality/defect_noisy`
4177                /// - `quality/defect_dark`
4178                /// - `quality/defect_faint`
4179                /// - `quality/defect_text_too_small`
4180                /// - `quality/defect_document_cutoff`
4181                /// - `quality/defect_text_cutoff`
4182                /// - `quality/defect_glare`
4183                pub r#type: std::string::String,
4184
4185                /// Confidence of detected defect. Range `[0, 1]` where `1` indicates
4186                /// strong confidence that the defect exists.
4187                pub confidence: f32,
4188
4189                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4190            }
4191
4192            impl DetectedDefect {
4193                pub fn new() -> Self {
4194                    std::default::Default::default()
4195                }
4196
4197                /// Sets the value of [r#type][crate::model::document::page::image_quality_scores::DetectedDefect::type].
4198                ///
4199                /// # Example
4200                /// ```ignore,no_run
4201                /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4202                /// let x = DetectedDefect::new().set_type("example");
4203                /// ```
4204                pub fn set_type<T: std::convert::Into<std::string::String>>(
4205                    mut self,
4206                    v: T,
4207                ) -> Self {
4208                    self.r#type = v.into();
4209                    self
4210                }
4211
4212                /// Sets the value of [confidence][crate::model::document::page::image_quality_scores::DetectedDefect::confidence].
4213                ///
4214                /// # Example
4215                /// ```ignore,no_run
4216                /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4217                /// let x = DetectedDefect::new().set_confidence(42.0);
4218                /// ```
4219                pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4220                    self.confidence = v.into();
4221                    self
4222                }
4223            }
4224
4225            impl wkt::message::Message for DetectedDefect {
4226                fn typename() -> &'static str {
4227                    "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
4228                }
4229            }
4230        }
4231    }
4232
4233    /// An entity that could be a phrase in the text or a property that belongs to
4234    /// the document. It is a known entity type, such as a person, an organization,
4235    /// or location.
4236    #[derive(Clone, Default, PartialEq)]
4237    #[non_exhaustive]
4238    pub struct Entity {
4239        /// Optional. Provenance of the entity.
4240        /// Text anchor indexing into the
4241        /// [Document.text][google.cloud.documentai.v1.Document.text].
4242        ///
4243        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
4244        pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
4245
4246        /// Required. Entity type from a schema e.g. `Address`.
4247        pub r#type: std::string::String,
4248
4249        /// Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`.
4250        pub mention_text: std::string::String,
4251
4252        /// Optional. Deprecated.  Use `id` field instead.
4253        pub mention_id: std::string::String,
4254
4255        /// Optional. Confidence of detected Schema entity. Range `[0, 1]`.
4256        pub confidence: f32,
4257
4258        /// Optional. Represents the provenance of this entity wrt. the location on
4259        /// the page where it was found.
4260        pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,
4261
4262        /// Optional. Canonical id. This will be a unique value in the entity list
4263        /// for this document.
4264        pub id: std::string::String,
4265
4266        /// Optional. Normalized entity value. Absent if the extracted value could
4267        /// not be converted or the type (e.g. address) is not supported for certain
4268        /// parsers. This field is also only populated for certain supported document
4269        /// types.
4270        pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,
4271
4272        /// Optional. Entities can be nested to form a hierarchical data structure
4273        /// representing the content in the document.
4274        pub properties: std::vec::Vec<crate::model::document::Entity>,
4275
4276        /// Optional. The history of this annotation.
4277        pub provenance: std::option::Option<crate::model::document::Provenance>,
4278
4279        /// Optional. Whether the entity will be redacted for de-identification
4280        /// purposes.
4281        pub redacted: bool,
4282
4283        /// Optional. Specifies how the entity's value is obtained.
4284        pub method: crate::model::document::entity::Method,
4285
4286        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4287    }
4288
4289    impl Entity {
4290        pub fn new() -> Self {
4291            std::default::Default::default()
4292        }
4293
4294        /// Sets the value of [text_anchor][crate::model::document::Entity::text_anchor].
4295        ///
4296        /// # Example
4297        /// ```ignore,no_run
4298        /// # use google_cloud_documentai_v1::model::document::Entity;
4299        /// use google_cloud_documentai_v1::model::document::TextAnchor;
4300        /// let x = Entity::new().set_text_anchor(TextAnchor::default()/* use setters */);
4301        /// ```
4302        pub fn set_text_anchor<T>(mut self, v: T) -> Self
4303        where
4304            T: std::convert::Into<crate::model::document::TextAnchor>,
4305        {
4306            self.text_anchor = std::option::Option::Some(v.into());
4307            self
4308        }
4309
4310        /// Sets or clears the value of [text_anchor][crate::model::document::Entity::text_anchor].
4311        ///
4312        /// # Example
4313        /// ```ignore,no_run
4314        /// # use google_cloud_documentai_v1::model::document::Entity;
4315        /// use google_cloud_documentai_v1::model::document::TextAnchor;
4316        /// let x = Entity::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
4317        /// let x = Entity::new().set_or_clear_text_anchor(None::<TextAnchor>);
4318        /// ```
4319        pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4320        where
4321            T: std::convert::Into<crate::model::document::TextAnchor>,
4322        {
4323            self.text_anchor = v.map(|x| x.into());
4324            self
4325        }
4326
4327        /// Sets the value of [r#type][crate::model::document::Entity::type].
4328        ///
4329        /// # Example
4330        /// ```ignore,no_run
4331        /// # use google_cloud_documentai_v1::model::document::Entity;
4332        /// let x = Entity::new().set_type("example");
4333        /// ```
4334        pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4335            self.r#type = v.into();
4336            self
4337        }
4338
4339        /// Sets the value of [mention_text][crate::model::document::Entity::mention_text].
4340        ///
4341        /// # Example
4342        /// ```ignore,no_run
4343        /// # use google_cloud_documentai_v1::model::document::Entity;
4344        /// let x = Entity::new().set_mention_text("example");
4345        /// ```
4346        pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
4347            mut self,
4348            v: T,
4349        ) -> Self {
4350            self.mention_text = v.into();
4351            self
4352        }
4353
4354        /// Sets the value of [mention_id][crate::model::document::Entity::mention_id].
4355        ///
4356        /// # Example
4357        /// ```ignore,no_run
4358        /// # use google_cloud_documentai_v1::model::document::Entity;
4359        /// let x = Entity::new().set_mention_id("example");
4360        /// ```
4361        pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4362            self.mention_id = v.into();
4363            self
4364        }
4365
4366        /// Sets the value of [confidence][crate::model::document::Entity::confidence].
4367        ///
4368        /// # Example
4369        /// ```ignore,no_run
4370        /// # use google_cloud_documentai_v1::model::document::Entity;
4371        /// let x = Entity::new().set_confidence(42.0);
4372        /// ```
4373        pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4374            self.confidence = v.into();
4375            self
4376        }
4377
4378        /// Sets the value of [page_anchor][crate::model::document::Entity::page_anchor].
4379        ///
4380        /// # Example
4381        /// ```ignore,no_run
4382        /// # use google_cloud_documentai_v1::model::document::Entity;
4383        /// use google_cloud_documentai_v1::model::document::PageAnchor;
4384        /// let x = Entity::new().set_page_anchor(PageAnchor::default()/* use setters */);
4385        /// ```
4386        pub fn set_page_anchor<T>(mut self, v: T) -> Self
4387        where
4388            T: std::convert::Into<crate::model::document::PageAnchor>,
4389        {
4390            self.page_anchor = std::option::Option::Some(v.into());
4391            self
4392        }
4393
4394        /// Sets or clears the value of [page_anchor][crate::model::document::Entity::page_anchor].
4395        ///
4396        /// # Example
4397        /// ```ignore,no_run
4398        /// # use google_cloud_documentai_v1::model::document::Entity;
4399        /// use google_cloud_documentai_v1::model::document::PageAnchor;
4400        /// let x = Entity::new().set_or_clear_page_anchor(Some(PageAnchor::default()/* use setters */));
4401        /// let x = Entity::new().set_or_clear_page_anchor(None::<PageAnchor>);
4402        /// ```
4403        pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4404        where
4405            T: std::convert::Into<crate::model::document::PageAnchor>,
4406        {
4407            self.page_anchor = v.map(|x| x.into());
4408            self
4409        }
4410
4411        /// Sets the value of [id][crate::model::document::Entity::id].
4412        ///
4413        /// # Example
4414        /// ```ignore,no_run
4415        /// # use google_cloud_documentai_v1::model::document::Entity;
4416        /// let x = Entity::new().set_id("example");
4417        /// ```
4418        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4419            self.id = v.into();
4420            self
4421        }
4422
4423        /// Sets the value of [normalized_value][crate::model::document::Entity::normalized_value].
4424        ///
4425        /// # Example
4426        /// ```ignore,no_run
4427        /// # use google_cloud_documentai_v1::model::document::Entity;
4428        /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4429        /// let x = Entity::new().set_normalized_value(NormalizedValue::default()/* use setters */);
4430        /// ```
4431        pub fn set_normalized_value<T>(mut self, v: T) -> Self
4432        where
4433            T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4434        {
4435            self.normalized_value = std::option::Option::Some(v.into());
4436            self
4437        }
4438
4439        /// Sets or clears the value of [normalized_value][crate::model::document::Entity::normalized_value].
4440        ///
4441        /// # Example
4442        /// ```ignore,no_run
4443        /// # use google_cloud_documentai_v1::model::document::Entity;
4444        /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4445        /// let x = Entity::new().set_or_clear_normalized_value(Some(NormalizedValue::default()/* use setters */));
4446        /// let x = Entity::new().set_or_clear_normalized_value(None::<NormalizedValue>);
4447        /// ```
4448        pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
4449        where
4450            T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4451        {
4452            self.normalized_value = v.map(|x| x.into());
4453            self
4454        }
4455
4456        /// Sets the value of [properties][crate::model::document::Entity::properties].
4457        ///
4458        /// # Example
4459        /// ```ignore,no_run
4460        /// # use google_cloud_documentai_v1::model::document::Entity;
4461        /// let x = Entity::new()
4462        ///     .set_properties([
4463        ///         Entity::default()/* use setters */,
4464        ///         Entity::default()/* use (different) setters */,
4465        ///     ]);
4466        /// ```
4467        pub fn set_properties<T, V>(mut self, v: T) -> Self
4468        where
4469            T: std::iter::IntoIterator<Item = V>,
4470            V: std::convert::Into<crate::model::document::Entity>,
4471        {
4472            use std::iter::Iterator;
4473            self.properties = v.into_iter().map(|i| i.into()).collect();
4474            self
4475        }
4476
4477        /// Sets the value of [provenance][crate::model::document::Entity::provenance].
4478        ///
4479        /// # Example
4480        /// ```ignore,no_run
4481        /// # use google_cloud_documentai_v1::model::document::Entity;
4482        /// use google_cloud_documentai_v1::model::document::Provenance;
4483        /// let x = Entity::new().set_provenance(Provenance::default()/* use setters */);
4484        /// ```
4485        pub fn set_provenance<T>(mut self, v: T) -> Self
4486        where
4487            T: std::convert::Into<crate::model::document::Provenance>,
4488        {
4489            self.provenance = std::option::Option::Some(v.into());
4490            self
4491        }
4492
4493        /// Sets or clears the value of [provenance][crate::model::document::Entity::provenance].
4494        ///
4495        /// # Example
4496        /// ```ignore,no_run
4497        /// # use google_cloud_documentai_v1::model::document::Entity;
4498        /// use google_cloud_documentai_v1::model::document::Provenance;
4499        /// let x = Entity::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
4500        /// let x = Entity::new().set_or_clear_provenance(None::<Provenance>);
4501        /// ```
4502        pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
4503        where
4504            T: std::convert::Into<crate::model::document::Provenance>,
4505        {
4506            self.provenance = v.map(|x| x.into());
4507            self
4508        }
4509
4510        /// Sets the value of [redacted][crate::model::document::Entity::redacted].
4511        ///
4512        /// # Example
4513        /// ```ignore,no_run
4514        /// # use google_cloud_documentai_v1::model::document::Entity;
4515        /// let x = Entity::new().set_redacted(true);
4516        /// ```
4517        pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4518            self.redacted = v.into();
4519            self
4520        }
4521
4522        /// Sets the value of [method][crate::model::document::Entity::method].
4523        ///
4524        /// # Example
4525        /// ```ignore,no_run
4526        /// # use google_cloud_documentai_v1::model::document::Entity;
4527        /// use google_cloud_documentai_v1::model::document::entity::Method;
4528        /// let x0 = Entity::new().set_method(Method::Extract);
4529        /// let x1 = Entity::new().set_method(Method::Derive);
4530        /// ```
4531        pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
4532            mut self,
4533            v: T,
4534        ) -> Self {
4535            self.method = v.into();
4536            self
4537        }
4538    }
4539
4540    impl wkt::message::Message for Entity {
4541        fn typename() -> &'static str {
4542            "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
4543        }
4544    }
4545
4546    /// Defines additional types related to [Entity].
4547    pub mod entity {
4548        #[allow(unused_imports)]
4549        use super::*;
4550
4551        /// Parsed and normalized entity value.
4552        #[derive(Clone, Default, PartialEq)]
4553        #[non_exhaustive]
4554        pub struct NormalizedValue {
4555            /// Optional. An optional field to store a normalized string.
4556            /// For some entity types, one of respective `structured_value` fields may
4557            /// also be populated. Also not all the types of `structured_value` will be
4558            /// normalized. For example, some processors may not generate `float`
4559            /// or `integer` normalized text by default.
4560            ///
4561            /// Below are sample formats mapped to structured values.
4562            ///
4563            /// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
4564            /// - Date type (`date_value`) is in the ISO 8601 text format.
4565            /// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
4566            pub text: std::string::String,
4567
4568            /// An optional structured entity value.
4569            /// Must match entity type defined in schema if
4570            /// known. If this field is present, the `text` field could also be
4571            /// populated.
4572            pub structured_value: std::option::Option<
4573                crate::model::document::entity::normalized_value::StructuredValue,
4574            >,
4575
4576            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4577        }
4578
4579        impl NormalizedValue {
4580            pub fn new() -> Self {
4581                std::default::Default::default()
4582            }
4583
4584            /// Sets the value of [text][crate::model::document::entity::NormalizedValue::text].
4585            ///
4586            /// # Example
4587            /// ```ignore,no_run
4588            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4589            /// let x = NormalizedValue::new().set_text("example");
4590            /// ```
4591            pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4592                self.text = v.into();
4593                self
4594            }
4595
4596            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value].
4597            ///
4598            /// Note that all the setters affecting `structured_value` are mutually
4599            /// exclusive.
4600            ///
4601            /// # Example
4602            /// ```ignore,no_run
4603            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4604            /// use google_cloud_documentai_v1::model::document::entity::normalized_value::StructuredValue;
4605            /// let x = NormalizedValue::new().set_structured_value(Some(StructuredValue::BooleanValue(true)));
4606            /// ```
4607            pub fn set_structured_value<
4608                T: std::convert::Into<
4609                        std::option::Option<
4610                            crate::model::document::entity::normalized_value::StructuredValue,
4611                        >,
4612                    >,
4613            >(
4614                mut self,
4615                v: T,
4616            ) -> Self {
4617                self.structured_value = v.into();
4618                self
4619            }
4620
4621            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4622            /// if it holds a `MoneyValue`, `None` if the field is not set or
4623            /// holds a different branch.
4624            pub fn money_value(
4625                &self,
4626            ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Money>>
4627            {
4628                #[allow(unreachable_patterns)]
4629                self.structured_value.as_ref().and_then(|v| match v {
4630                    crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
4631                    _ => std::option::Option::None,
4632                })
4633            }
4634
4635            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4636            /// to hold a `MoneyValue`.
4637            ///
4638            /// Note that all the setters affecting `structured_value` are
4639            /// mutually exclusive.
4640            ///
4641            /// # Example
4642            /// ```ignore,no_run
4643            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4644            /// use google_cloud_type::model::Money;
4645            /// let x = NormalizedValue::new().set_money_value(Money::default()/* use setters */);
4646            /// assert!(x.money_value().is_some());
4647            /// assert!(x.date_value().is_none());
4648            /// assert!(x.datetime_value().is_none());
4649            /// assert!(x.address_value().is_none());
4650            /// assert!(x.boolean_value().is_none());
4651            /// assert!(x.integer_value().is_none());
4652            /// assert!(x.float_value().is_none());
4653            /// assert!(x.signature_value().is_none());
4654            /// ```
4655            pub fn set_money_value<
4656                T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Money>>,
4657            >(
4658                mut self,
4659                v: T,
4660            ) -> Self {
4661                self.structured_value = std::option::Option::Some(
4662                    crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
4663                        v.into(),
4664                    ),
4665                );
4666                self
4667            }
4668
4669            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4670            /// if it holds a `DateValue`, `None` if the field is not set or
4671            /// holds a different branch.
4672            pub fn date_value(
4673                &self,
4674            ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
4675                #[allow(unreachable_patterns)]
4676                self.structured_value.as_ref().and_then(|v| match v {
4677                    crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
4678                    _ => std::option::Option::None,
4679                })
4680            }
4681
4682            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4683            /// to hold a `DateValue`.
4684            ///
4685            /// Note that all the setters affecting `structured_value` are
4686            /// mutually exclusive.
4687            ///
4688            /// # Example
4689            /// ```ignore,no_run
4690            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4691            /// use google_cloud_type::model::Date;
4692            /// let x = NormalizedValue::new().set_date_value(Date::default()/* use setters */);
4693            /// assert!(x.date_value().is_some());
4694            /// assert!(x.money_value().is_none());
4695            /// assert!(x.datetime_value().is_none());
4696            /// assert!(x.address_value().is_none());
4697            /// assert!(x.boolean_value().is_none());
4698            /// assert!(x.integer_value().is_none());
4699            /// assert!(x.float_value().is_none());
4700            /// assert!(x.signature_value().is_none());
4701            /// ```
4702            pub fn set_date_value<
4703                T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
4704            >(
4705                mut self,
4706                v: T,
4707            ) -> Self {
4708                self.structured_value = std::option::Option::Some(
4709                    crate::model::document::entity::normalized_value::StructuredValue::DateValue(
4710                        v.into(),
4711                    ),
4712                );
4713                self
4714            }
4715
4716            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4717            /// if it holds a `DatetimeValue`, `None` if the field is not set or
4718            /// holds a different branch.
4719            pub fn datetime_value(
4720                &self,
4721            ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::DateTime>>
4722            {
4723                #[allow(unreachable_patterns)]
4724                self.structured_value.as_ref().and_then(|v| match v {
4725                    crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
4726                    _ => std::option::Option::None,
4727                })
4728            }
4729
4730            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4731            /// to hold a `DatetimeValue`.
4732            ///
4733            /// Note that all the setters affecting `structured_value` are
4734            /// mutually exclusive.
4735            ///
4736            /// # Example
4737            /// ```ignore,no_run
4738            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4739            /// use google_cloud_type::model::DateTime;
4740            /// let x = NormalizedValue::new().set_datetime_value(DateTime::default()/* use setters */);
4741            /// assert!(x.datetime_value().is_some());
4742            /// assert!(x.money_value().is_none());
4743            /// assert!(x.date_value().is_none());
4744            /// assert!(x.address_value().is_none());
4745            /// assert!(x.boolean_value().is_none());
4746            /// assert!(x.integer_value().is_none());
4747            /// assert!(x.float_value().is_none());
4748            /// assert!(x.signature_value().is_none());
4749            /// ```
4750            pub fn set_datetime_value<
4751                T: std::convert::Into<std::boxed::Box<google_cloud_type::model::DateTime>>,
4752            >(
4753                mut self,
4754                v: T,
4755            ) -> Self {
4756                self.structured_value = std::option::Option::Some(
4757                    crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
4758                        v.into()
4759                    )
4760                );
4761                self
4762            }
4763
4764            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4765            /// if it holds a `AddressValue`, `None` if the field is not set or
4766            /// holds a different branch.
4767            pub fn address_value(
4768                &self,
4769            ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::PostalAddress>>
4770            {
4771                #[allow(unreachable_patterns)]
4772                self.structured_value.as_ref().and_then(|v| match v {
4773                    crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
4774                    _ => std::option::Option::None,
4775                })
4776            }
4777
4778            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4779            /// to hold a `AddressValue`.
4780            ///
4781            /// Note that all the setters affecting `structured_value` are
4782            /// mutually exclusive.
4783            ///
4784            /// # Example
4785            /// ```ignore,no_run
4786            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4787            /// use google_cloud_type::model::PostalAddress;
4788            /// let x = NormalizedValue::new().set_address_value(PostalAddress::default()/* use setters */);
4789            /// assert!(x.address_value().is_some());
4790            /// assert!(x.money_value().is_none());
4791            /// assert!(x.date_value().is_none());
4792            /// assert!(x.datetime_value().is_none());
4793            /// assert!(x.boolean_value().is_none());
4794            /// assert!(x.integer_value().is_none());
4795            /// assert!(x.float_value().is_none());
4796            /// assert!(x.signature_value().is_none());
4797            /// ```
4798            pub fn set_address_value<
4799                T: std::convert::Into<std::boxed::Box<google_cloud_type::model::PostalAddress>>,
4800            >(
4801                mut self,
4802                v: T,
4803            ) -> Self {
4804                self.structured_value = std::option::Option::Some(
4805                    crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
4806                        v.into(),
4807                    ),
4808                );
4809                self
4810            }
4811
4812            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4813            /// if it holds a `BooleanValue`, `None` if the field is not set or
4814            /// holds a different branch.
4815            pub fn boolean_value(&self) -> std::option::Option<&bool> {
4816                #[allow(unreachable_patterns)]
4817                self.structured_value.as_ref().and_then(|v| match v {
4818                    crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
4819                    _ => std::option::Option::None,
4820                })
4821            }
4822
4823            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4824            /// to hold a `BooleanValue`.
4825            ///
4826            /// Note that all the setters affecting `structured_value` are
4827            /// mutually exclusive.
4828            ///
4829            /// # Example
4830            /// ```ignore,no_run
4831            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4832            /// let x = NormalizedValue::new().set_boolean_value(true);
4833            /// assert!(x.boolean_value().is_some());
4834            /// assert!(x.money_value().is_none());
4835            /// assert!(x.date_value().is_none());
4836            /// assert!(x.datetime_value().is_none());
4837            /// assert!(x.address_value().is_none());
4838            /// assert!(x.integer_value().is_none());
4839            /// assert!(x.float_value().is_none());
4840            /// assert!(x.signature_value().is_none());
4841            /// ```
4842            pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4843                self.structured_value = std::option::Option::Some(
4844                    crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
4845                        v.into(),
4846                    ),
4847                );
4848                self
4849            }
4850
4851            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4852            /// if it holds a `IntegerValue`, `None` if the field is not set or
4853            /// holds a different branch.
4854            pub fn integer_value(&self) -> std::option::Option<&i32> {
4855                #[allow(unreachable_patterns)]
4856                self.structured_value.as_ref().and_then(|v| match v {
4857                    crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
4858                    _ => std::option::Option::None,
4859                })
4860            }
4861
4862            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4863            /// to hold a `IntegerValue`.
4864            ///
4865            /// Note that all the setters affecting `structured_value` are
4866            /// mutually exclusive.
4867            ///
4868            /// # Example
4869            /// ```ignore,no_run
4870            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4871            /// let x = NormalizedValue::new().set_integer_value(42);
4872            /// assert!(x.integer_value().is_some());
4873            /// assert!(x.money_value().is_none());
4874            /// assert!(x.date_value().is_none());
4875            /// assert!(x.datetime_value().is_none());
4876            /// assert!(x.address_value().is_none());
4877            /// assert!(x.boolean_value().is_none());
4878            /// assert!(x.float_value().is_none());
4879            /// assert!(x.signature_value().is_none());
4880            /// ```
4881            pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4882                self.structured_value = std::option::Option::Some(
4883                    crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
4884                        v.into(),
4885                    ),
4886                );
4887                self
4888            }
4889
4890            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4891            /// if it holds a `FloatValue`, `None` if the field is not set or
4892            /// holds a different branch.
4893            pub fn float_value(&self) -> std::option::Option<&f32> {
4894                #[allow(unreachable_patterns)]
4895                self.structured_value.as_ref().and_then(|v| match v {
4896                    crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
4897                    _ => std::option::Option::None,
4898                })
4899            }
4900
4901            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4902            /// to hold a `FloatValue`.
4903            ///
4904            /// Note that all the setters affecting `structured_value` are
4905            /// mutually exclusive.
4906            ///
4907            /// # Example
4908            /// ```ignore,no_run
4909            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4910            /// let x = NormalizedValue::new().set_float_value(42.0);
4911            /// assert!(x.float_value().is_some());
4912            /// assert!(x.money_value().is_none());
4913            /// assert!(x.date_value().is_none());
4914            /// assert!(x.datetime_value().is_none());
4915            /// assert!(x.address_value().is_none());
4916            /// assert!(x.boolean_value().is_none());
4917            /// assert!(x.integer_value().is_none());
4918            /// assert!(x.signature_value().is_none());
4919            /// ```
4920            pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4921                self.structured_value = std::option::Option::Some(
4922                    crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
4923                        v.into(),
4924                    ),
4925                );
4926                self
4927            }
4928
4929            /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4930            /// if it holds a `SignatureValue`, `None` if the field is not set or
4931            /// holds a different branch.
4932            pub fn signature_value(&self) -> std::option::Option<&bool> {
4933                #[allow(unreachable_patterns)]
4934                self.structured_value.as_ref().and_then(|v| match v {
4935                    crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
4936                    _ => std::option::Option::None,
4937                })
4938            }
4939
4940            /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4941            /// to hold a `SignatureValue`.
4942            ///
4943            /// Note that all the setters affecting `structured_value` are
4944            /// mutually exclusive.
4945            ///
4946            /// # Example
4947            /// ```ignore,no_run
4948            /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4949            /// let x = NormalizedValue::new().set_signature_value(true);
4950            /// assert!(x.signature_value().is_some());
4951            /// assert!(x.money_value().is_none());
4952            /// assert!(x.date_value().is_none());
4953            /// assert!(x.datetime_value().is_none());
4954            /// assert!(x.address_value().is_none());
4955            /// assert!(x.boolean_value().is_none());
4956            /// assert!(x.integer_value().is_none());
4957            /// assert!(x.float_value().is_none());
4958            /// ```
4959            pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4960                self.structured_value = std::option::Option::Some(
4961                    crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
4962                        v.into()
4963                    )
4964                );
4965                self
4966            }
4967        }
4968
4969        impl wkt::message::Message for NormalizedValue {
4970            fn typename() -> &'static str {
4971                "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
4972            }
4973        }
4974
4975        /// Defines additional types related to [NormalizedValue].
4976        pub mod normalized_value {
4977            #[allow(unused_imports)]
4978            use super::*;
4979
4980            /// An optional structured entity value.
4981            /// Must match entity type defined in schema if
4982            /// known. If this field is present, the `text` field could also be
4983            /// populated.
4984            #[derive(Clone, Debug, PartialEq)]
4985            #[non_exhaustive]
4986            pub enum StructuredValue {
4987                /// Money value. See also:
4988                /// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
4989                MoneyValue(std::boxed::Box<google_cloud_type::model::Money>),
4990                /// Date value. Includes year, month, day. See also:
4991                /// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
4992                DateValue(std::boxed::Box<google_cloud_type::model::Date>),
4993                /// DateTime value. Includes date, time, and timezone. See also:
4994                /// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
4995                DatetimeValue(std::boxed::Box<google_cloud_type::model::DateTime>),
4996                /// Postal address. See also:
4997                /// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
4998                AddressValue(std::boxed::Box<google_cloud_type::model::PostalAddress>),
4999                /// Boolean value. Can be used for entities with binary values, or for
5000                /// checkboxes.
5001                BooleanValue(bool),
5002                /// Integer value.
5003                IntegerValue(i32),
5004                /// Float value.
5005                FloatValue(f32),
5006                SignatureValue(bool),
5007            }
5008        }
5009
5010        /// Specifies how the entity's value is obtained.
5011        ///
5012        /// # Working with unknown values
5013        ///
5014        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5015        /// additional enum variants at any time. Adding new variants is not considered
5016        /// a breaking change. Applications should write their code in anticipation of:
5017        ///
5018        /// - New values appearing in future releases of the client library, **and**
5019        /// - New values received dynamically, without application changes.
5020        ///
5021        /// Please consult the [Working with enums] section in the user guide for some
5022        /// guidelines.
5023        ///
5024        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5025        #[derive(Clone, Debug, PartialEq)]
5026        #[non_exhaustive]
5027        pub enum Method {
5028            /// When the method is not specified, it should be treated as `EXTRACT`.
5029            Unspecified,
5030            /// The entity's value is directly extracted as-is from the document
5031            /// text.
5032            Extract,
5033            /// The entity's value is derived through inference and is not
5034            /// necessarily an exact text extraction from the document.
5035            Derive,
5036            /// If set, the enum was initialized with an unknown value.
5037            ///
5038            /// Applications can examine the value using [Method::value] or
5039            /// [Method::name].
5040            UnknownValue(method::UnknownValue),
5041        }
5042
5043        #[doc(hidden)]
5044        pub mod method {
5045            #[allow(unused_imports)]
5046            use super::*;
5047            #[derive(Clone, Debug, PartialEq)]
5048            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5049        }
5050
5051        impl Method {
5052            /// Gets the enum value.
5053            ///
5054            /// Returns `None` if the enum contains an unknown value deserialized from
5055            /// the string representation of enums.
5056            pub fn value(&self) -> std::option::Option<i32> {
5057                match self {
5058                    Self::Unspecified => std::option::Option::Some(0),
5059                    Self::Extract => std::option::Option::Some(1),
5060                    Self::Derive => std::option::Option::Some(2),
5061                    Self::UnknownValue(u) => u.0.value(),
5062                }
5063            }
5064
5065            /// Gets the enum value as a string.
5066            ///
5067            /// Returns `None` if the enum contains an unknown value deserialized from
5068            /// the integer representation of enums.
5069            pub fn name(&self) -> std::option::Option<&str> {
5070                match self {
5071                    Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
5072                    Self::Extract => std::option::Option::Some("EXTRACT"),
5073                    Self::Derive => std::option::Option::Some("DERIVE"),
5074                    Self::UnknownValue(u) => u.0.name(),
5075                }
5076            }
5077        }
5078
5079        impl std::default::Default for Method {
5080            fn default() -> Self {
5081                use std::convert::From;
5082                Self::from(0)
5083            }
5084        }
5085
5086        impl std::fmt::Display for Method {
5087            fn fmt(
5088                &self,
5089                f: &mut std::fmt::Formatter<'_>,
5090            ) -> std::result::Result<(), std::fmt::Error> {
5091                wkt::internal::display_enum(f, self.name(), self.value())
5092            }
5093        }
5094
5095        impl std::convert::From<i32> for Method {
5096            fn from(value: i32) -> Self {
5097                match value {
5098                    0 => Self::Unspecified,
5099                    1 => Self::Extract,
5100                    2 => Self::Derive,
5101                    _ => Self::UnknownValue(method::UnknownValue(
5102                        wkt::internal::UnknownEnumValue::Integer(value),
5103                    )),
5104                }
5105            }
5106        }
5107
5108        impl std::convert::From<&str> for Method {
5109            fn from(value: &str) -> Self {
5110                use std::string::ToString;
5111                match value {
5112                    "METHOD_UNSPECIFIED" => Self::Unspecified,
5113                    "EXTRACT" => Self::Extract,
5114                    "DERIVE" => Self::Derive,
5115                    _ => Self::UnknownValue(method::UnknownValue(
5116                        wkt::internal::UnknownEnumValue::String(value.to_string()),
5117                    )),
5118                }
5119            }
5120        }
5121
5122        impl serde::ser::Serialize for Method {
5123            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5124            where
5125                S: serde::Serializer,
5126            {
5127                match self {
5128                    Self::Unspecified => serializer.serialize_i32(0),
5129                    Self::Extract => serializer.serialize_i32(1),
5130                    Self::Derive => serializer.serialize_i32(2),
5131                    Self::UnknownValue(u) => u.0.serialize(serializer),
5132                }
5133            }
5134        }
5135
5136        impl<'de> serde::de::Deserialize<'de> for Method {
5137            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5138            where
5139                D: serde::Deserializer<'de>,
5140            {
5141                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
5142                    ".google.cloud.documentai.v1.Document.Entity.Method",
5143                ))
5144            }
5145        }
5146    }
5147
5148    /// Relationship between
5149    /// [Entities][google.cloud.documentai.v1.Document.Entity].
5150    ///
5151    /// [google.cloud.documentai.v1.Document.Entity]: crate::model::document::Entity
5152    #[derive(Clone, Default, PartialEq)]
5153    #[non_exhaustive]
5154    pub struct EntityRelation {
5155        /// Subject entity id.
5156        pub subject_id: std::string::String,
5157
5158        /// Object entity id.
5159        pub object_id: std::string::String,
5160
5161        /// Relationship description.
5162        pub relation: std::string::String,
5163
5164        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5165    }
5166
5167    impl EntityRelation {
5168        pub fn new() -> Self {
5169            std::default::Default::default()
5170        }
5171
5172        /// Sets the value of [subject_id][crate::model::document::EntityRelation::subject_id].
5173        ///
5174        /// # Example
5175        /// ```ignore,no_run
5176        /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5177        /// let x = EntityRelation::new().set_subject_id("example");
5178        /// ```
5179        pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5180            self.subject_id = v.into();
5181            self
5182        }
5183
5184        /// Sets the value of [object_id][crate::model::document::EntityRelation::object_id].
5185        ///
5186        /// # Example
5187        /// ```ignore,no_run
5188        /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5189        /// let x = EntityRelation::new().set_object_id("example");
5190        /// ```
5191        pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5192            self.object_id = v.into();
5193            self
5194        }
5195
5196        /// Sets the value of [relation][crate::model::document::EntityRelation::relation].
5197        ///
5198        /// # Example
5199        /// ```ignore,no_run
5200        /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5201        /// let x = EntityRelation::new().set_relation("example");
5202        /// ```
5203        pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5204            self.relation = v.into();
5205            self
5206        }
5207    }
5208
5209    impl wkt::message::Message for EntityRelation {
5210        fn typename() -> &'static str {
5211            "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
5212        }
5213    }
5214
5215    /// Text reference indexing into the
5216    /// [Document.text][google.cloud.documentai.v1.Document.text].
5217    ///
5218    /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5219    #[derive(Clone, Default, PartialEq)]
5220    #[non_exhaustive]
5221    pub struct TextAnchor {
5222        /// The text segments from the
5223        /// [Document.text][google.cloud.documentai.v1.Document.text].
5224        ///
5225        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5226        pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,
5227
5228        /// Contains the content of the text span so that users do
5229        /// not have to look it up in the text_segments.  It is always
5230        /// populated for formFields.
5231        pub content: std::string::String,
5232
5233        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5234    }
5235
5236    impl TextAnchor {
5237        pub fn new() -> Self {
5238            std::default::Default::default()
5239        }
5240
5241        /// Sets the value of [text_segments][crate::model::document::TextAnchor::text_segments].
5242        ///
5243        /// # Example
5244        /// ```ignore,no_run
5245        /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5246        /// use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5247        /// let x = TextAnchor::new()
5248        ///     .set_text_segments([
5249        ///         TextSegment::default()/* use setters */,
5250        ///         TextSegment::default()/* use (different) setters */,
5251        ///     ]);
5252        /// ```
5253        pub fn set_text_segments<T, V>(mut self, v: T) -> Self
5254        where
5255            T: std::iter::IntoIterator<Item = V>,
5256            V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
5257        {
5258            use std::iter::Iterator;
5259            self.text_segments = v.into_iter().map(|i| i.into()).collect();
5260            self
5261        }
5262
5263        /// Sets the value of [content][crate::model::document::TextAnchor::content].
5264        ///
5265        /// # Example
5266        /// ```ignore,no_run
5267        /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5268        /// let x = TextAnchor::new().set_content("example");
5269        /// ```
5270        pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5271            self.content = v.into();
5272            self
5273        }
5274    }
5275
5276    impl wkt::message::Message for TextAnchor {
5277        fn typename() -> &'static str {
5278            "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
5279        }
5280    }
5281
5282    /// Defines additional types related to [TextAnchor].
5283    pub mod text_anchor {
5284        #[allow(unused_imports)]
5285        use super::*;
5286
5287        /// A text segment in the
5288        /// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
5289        /// may be out of bounds which indicate that the text extends into another
5290        /// document shard for large sharded documents. See
5291        /// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
5292        ///
5293        /// [google.cloud.documentai.v1.Document.ShardInfo.text_offset]: crate::model::document::ShardInfo::text_offset
5294        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5295        #[derive(Clone, Default, PartialEq)]
5296        #[non_exhaustive]
5297        pub struct TextSegment {
5298            /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5299            /// start UTF-8 char index in the
5300            /// [Document.text][google.cloud.documentai.v1.Document.text].
5301            ///
5302            /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5303            /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5304            pub start_index: i64,
5305
5306            /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5307            /// half open end UTF-8 char index in the
5308            /// [Document.text][google.cloud.documentai.v1.Document.text].
5309            ///
5310            /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5311            /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5312            pub end_index: i64,
5313
5314            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5315        }
5316
5317        impl TextSegment {
5318            pub fn new() -> Self {
5319                std::default::Default::default()
5320            }
5321
5322            /// Sets the value of [start_index][crate::model::document::text_anchor::TextSegment::start_index].
5323            ///
5324            /// # Example
5325            /// ```ignore,no_run
5326            /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5327            /// let x = TextSegment::new().set_start_index(42);
5328            /// ```
5329            pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5330                self.start_index = v.into();
5331                self
5332            }
5333
5334            /// Sets the value of [end_index][crate::model::document::text_anchor::TextSegment::end_index].
5335            ///
5336            /// # Example
5337            /// ```ignore,no_run
5338            /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5339            /// let x = TextSegment::new().set_end_index(42);
5340            /// ```
5341            pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5342                self.end_index = v.into();
5343                self
5344            }
5345        }
5346
5347        impl wkt::message::Message for TextSegment {
5348            fn typename() -> &'static str {
5349                "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
5350            }
5351        }
5352    }
5353
5354    /// Referencing the visual context of the entity in the
5355    /// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
5356    /// can be cross-page, consist of multiple bounding polygons and optionally
5357    /// reference specific layout element types.
5358    ///
5359    /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5360    #[derive(Clone, Default, PartialEq)]
5361    #[non_exhaustive]
5362    pub struct PageAnchor {
5363        /// One or more references to visual page elements
5364        pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,
5365
5366        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5367    }
5368
5369    impl PageAnchor {
5370        pub fn new() -> Self {
5371            std::default::Default::default()
5372        }
5373
5374        /// Sets the value of [page_refs][crate::model::document::PageAnchor::page_refs].
5375        ///
5376        /// # Example
5377        /// ```ignore,no_run
5378        /// # use google_cloud_documentai_v1::model::document::PageAnchor;
5379        /// use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5380        /// let x = PageAnchor::new()
5381        ///     .set_page_refs([
5382        ///         PageRef::default()/* use setters */,
5383        ///         PageRef::default()/* use (different) setters */,
5384        ///     ]);
5385        /// ```
5386        pub fn set_page_refs<T, V>(mut self, v: T) -> Self
5387        where
5388            T: std::iter::IntoIterator<Item = V>,
5389            V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
5390        {
5391            use std::iter::Iterator;
5392            self.page_refs = v.into_iter().map(|i| i.into()).collect();
5393            self
5394        }
5395    }
5396
5397    impl wkt::message::Message for PageAnchor {
5398        fn typename() -> &'static str {
5399            "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
5400        }
5401    }
5402
5403    /// Defines additional types related to [PageAnchor].
5404    pub mod page_anchor {
5405        #[allow(unused_imports)]
5406        use super::*;
5407
5408        /// Represents a weak reference to a page element within a document.
5409        #[derive(Clone, Default, PartialEq)]
5410        #[non_exhaustive]
5411        pub struct PageRef {
5412            /// Required. Index into the
5413            /// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
5414            /// for example using
5415            /// `[Document.pages][page_refs.page]` to locate the related page element.
5416            /// This field is skipped when its value is the default `0`. See
5417            /// <https://developers.google.com/protocol-buffers/docs/proto3#json>.
5418            ///
5419            /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5420            pub page: i64,
5421
5422            /// Optional. The type of the layout element that is being referenced if
5423            /// any.
5424            pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,
5425
5426            /// Optional. Deprecated.  Use
5427            /// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
5428            /// instead.
5429            ///
5430            /// [google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]: crate::model::document::page_anchor::PageRef::bounding_poly
5431            #[deprecated]
5432            pub layout_id: std::string::String,
5433
5434            /// Optional. Identifies the bounding polygon of a layout element on the
5435            /// page. If `layout_type` is set, the bounding polygon must be exactly the
5436            /// same to the layout element it's referring to.
5437            pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
5438
5439            /// Optional. Confidence of detected page element, if applicable. Range
5440            /// `[0, 1]`.
5441            pub confidence: f32,
5442
5443            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5444        }
5445
5446        impl PageRef {
5447            pub fn new() -> Self {
5448                std::default::Default::default()
5449            }
5450
5451            /// Sets the value of [page][crate::model::document::page_anchor::PageRef::page].
5452            ///
5453            /// # Example
5454            /// ```ignore,no_run
5455            /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5456            /// let x = PageRef::new().set_page(42);
5457            /// ```
5458            pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5459                self.page = v.into();
5460                self
5461            }
5462
5463            /// Sets the value of [layout_type][crate::model::document::page_anchor::PageRef::layout_type].
5464            ///
5465            /// # Example
5466            /// ```ignore,no_run
5467            /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5468            /// use google_cloud_documentai_v1::model::document::page_anchor::page_ref::LayoutType;
5469            /// let x0 = PageRef::new().set_layout_type(LayoutType::Block);
5470            /// let x1 = PageRef::new().set_layout_type(LayoutType::Paragraph);
5471            /// let x2 = PageRef::new().set_layout_type(LayoutType::Line);
5472            /// ```
5473            pub fn set_layout_type<
5474                T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
5475            >(
5476                mut self,
5477                v: T,
5478            ) -> Self {
5479                self.layout_type = v.into();
5480                self
5481            }
5482
5483            /// Sets the value of [layout_id][crate::model::document::page_anchor::PageRef::layout_id].
5484            ///
5485            /// # Example
5486            /// ```ignore,no_run
5487            /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5488            /// let x = PageRef::new().set_layout_id("example");
5489            /// ```
5490            #[deprecated]
5491            pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
5492                mut self,
5493                v: T,
5494            ) -> Self {
5495                self.layout_id = v.into();
5496                self
5497            }
5498
5499            /// Sets the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5500            ///
5501            /// # Example
5502            /// ```ignore,no_run
5503            /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5504            /// use google_cloud_documentai_v1::model::BoundingPoly;
5505            /// let x = PageRef::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
5506            /// ```
5507            pub fn set_bounding_poly<T>(mut self, v: T) -> Self
5508            where
5509                T: std::convert::Into<crate::model::BoundingPoly>,
5510            {
5511                self.bounding_poly = std::option::Option::Some(v.into());
5512                self
5513            }
5514
5515            /// Sets or clears the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5516            ///
5517            /// # Example
5518            /// ```ignore,no_run
5519            /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5520            /// use google_cloud_documentai_v1::model::BoundingPoly;
5521            /// let x = PageRef::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
5522            /// let x = PageRef::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
5523            /// ```
5524            pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
5525            where
5526                T: std::convert::Into<crate::model::BoundingPoly>,
5527            {
5528                self.bounding_poly = v.map(|x| x.into());
5529                self
5530            }
5531
5532            /// Sets the value of [confidence][crate::model::document::page_anchor::PageRef::confidence].
5533            ///
5534            /// # Example
5535            /// ```ignore,no_run
5536            /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5537            /// let x = PageRef::new().set_confidence(42.0);
5538            /// ```
5539            pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5540                self.confidence = v.into();
5541                self
5542            }
5543        }
5544
5545        impl wkt::message::Message for PageRef {
5546            fn typename() -> &'static str {
5547                "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
5548            }
5549        }
5550
5551        /// Defines additional types related to [PageRef].
5552        pub mod page_ref {
5553            #[allow(unused_imports)]
5554            use super::*;
5555
5556            /// The type of layout that is being referenced.
5557            ///
5558            /// # Working with unknown values
5559            ///
5560            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5561            /// additional enum variants at any time. Adding new variants is not considered
5562            /// a breaking change. Applications should write their code in anticipation of:
5563            ///
5564            /// - New values appearing in future releases of the client library, **and**
5565            /// - New values received dynamically, without application changes.
5566            ///
5567            /// Please consult the [Working with enums] section in the user guide for some
5568            /// guidelines.
5569            ///
5570            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5571            #[derive(Clone, Debug, PartialEq)]
5572            #[non_exhaustive]
5573            pub enum LayoutType {
5574                /// Layout Unspecified.
5575                Unspecified,
5576                /// References a
5577                /// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
5578                /// element.
5579                ///
5580                /// [google.cloud.documentai.v1.Document.Page.blocks]: crate::model::document::Page::blocks
5581                Block,
5582                /// References a
5583                /// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
5584                /// element.
5585                ///
5586                /// [google.cloud.documentai.v1.Document.Page.paragraphs]: crate::model::document::Page::paragraphs
5587                Paragraph,
5588                /// References a
5589                /// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
5590                ///
5591                /// [google.cloud.documentai.v1.Document.Page.lines]: crate::model::document::Page::lines
5592                Line,
5593                /// References a
5594                /// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
5595                /// element.
5596                ///
5597                /// [google.cloud.documentai.v1.Document.Page.tokens]: crate::model::document::Page::tokens
5598                Token,
5599                /// References a
5600                /// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
5601                /// element.
5602                ///
5603                /// [google.cloud.documentai.v1.Document.Page.visual_elements]: crate::model::document::Page::visual_elements
5604                VisualElement,
5605                /// Refrrences a
5606                /// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
5607                /// element.
5608                ///
5609                /// [google.cloud.documentai.v1.Document.Page.tables]: crate::model::document::Page::tables
5610                Table,
5611                /// References a
5612                /// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
5613                /// element.
5614                ///
5615                /// [google.cloud.documentai.v1.Document.Page.form_fields]: crate::model::document::Page::form_fields
5616                FormField,
5617                /// If set, the enum was initialized with an unknown value.
5618                ///
5619                /// Applications can examine the value using [LayoutType::value] or
5620                /// [LayoutType::name].
5621                UnknownValue(layout_type::UnknownValue),
5622            }
5623
5624            #[doc(hidden)]
5625            pub mod layout_type {
5626                #[allow(unused_imports)]
5627                use super::*;
5628                #[derive(Clone, Debug, PartialEq)]
5629                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5630            }
5631
5632            impl LayoutType {
5633                /// Gets the enum value.
5634                ///
5635                /// Returns `None` if the enum contains an unknown value deserialized from
5636                /// the string representation of enums.
5637                pub fn value(&self) -> std::option::Option<i32> {
5638                    match self {
5639                        Self::Unspecified => std::option::Option::Some(0),
5640                        Self::Block => std::option::Option::Some(1),
5641                        Self::Paragraph => std::option::Option::Some(2),
5642                        Self::Line => std::option::Option::Some(3),
5643                        Self::Token => std::option::Option::Some(4),
5644                        Self::VisualElement => std::option::Option::Some(5),
5645                        Self::Table => std::option::Option::Some(6),
5646                        Self::FormField => std::option::Option::Some(7),
5647                        Self::UnknownValue(u) => u.0.value(),
5648                    }
5649                }
5650
5651                /// Gets the enum value as a string.
5652                ///
5653                /// Returns `None` if the enum contains an unknown value deserialized from
5654                /// the integer representation of enums.
5655                pub fn name(&self) -> std::option::Option<&str> {
5656                    match self {
5657                        Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
5658                        Self::Block => std::option::Option::Some("BLOCK"),
5659                        Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
5660                        Self::Line => std::option::Option::Some("LINE"),
5661                        Self::Token => std::option::Option::Some("TOKEN"),
5662                        Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
5663                        Self::Table => std::option::Option::Some("TABLE"),
5664                        Self::FormField => std::option::Option::Some("FORM_FIELD"),
5665                        Self::UnknownValue(u) => u.0.name(),
5666                    }
5667                }
5668            }
5669
5670            impl std::default::Default for LayoutType {
5671                fn default() -> Self {
5672                    use std::convert::From;
5673                    Self::from(0)
5674                }
5675            }
5676
5677            impl std::fmt::Display for LayoutType {
5678                fn fmt(
5679                    &self,
5680                    f: &mut std::fmt::Formatter<'_>,
5681                ) -> std::result::Result<(), std::fmt::Error> {
5682                    wkt::internal::display_enum(f, self.name(), self.value())
5683                }
5684            }
5685
5686            impl std::convert::From<i32> for LayoutType {
5687                fn from(value: i32) -> Self {
5688                    match value {
5689                        0 => Self::Unspecified,
5690                        1 => Self::Block,
5691                        2 => Self::Paragraph,
5692                        3 => Self::Line,
5693                        4 => Self::Token,
5694                        5 => Self::VisualElement,
5695                        6 => Self::Table,
5696                        7 => Self::FormField,
5697                        _ => Self::UnknownValue(layout_type::UnknownValue(
5698                            wkt::internal::UnknownEnumValue::Integer(value),
5699                        )),
5700                    }
5701                }
5702            }
5703
5704            impl std::convert::From<&str> for LayoutType {
5705                fn from(value: &str) -> Self {
5706                    use std::string::ToString;
5707                    match value {
5708                        "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
5709                        "BLOCK" => Self::Block,
5710                        "PARAGRAPH" => Self::Paragraph,
5711                        "LINE" => Self::Line,
5712                        "TOKEN" => Self::Token,
5713                        "VISUAL_ELEMENT" => Self::VisualElement,
5714                        "TABLE" => Self::Table,
5715                        "FORM_FIELD" => Self::FormField,
5716                        _ => Self::UnknownValue(layout_type::UnknownValue(
5717                            wkt::internal::UnknownEnumValue::String(value.to_string()),
5718                        )),
5719                    }
5720                }
5721            }
5722
5723            impl serde::ser::Serialize for LayoutType {
5724                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5725                where
5726                    S: serde::Serializer,
5727                {
5728                    match self {
5729                        Self::Unspecified => serializer.serialize_i32(0),
5730                        Self::Block => serializer.serialize_i32(1),
5731                        Self::Paragraph => serializer.serialize_i32(2),
5732                        Self::Line => serializer.serialize_i32(3),
5733                        Self::Token => serializer.serialize_i32(4),
5734                        Self::VisualElement => serializer.serialize_i32(5),
5735                        Self::Table => serializer.serialize_i32(6),
5736                        Self::FormField => serializer.serialize_i32(7),
5737                        Self::UnknownValue(u) => u.0.serialize(serializer),
5738                    }
5739                }
5740            }
5741
5742            impl<'de> serde::de::Deserialize<'de> for LayoutType {
5743                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5744                where
5745                    D: serde::Deserializer<'de>,
5746                {
5747                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
5748                        ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
5749                    ))
5750                }
5751            }
5752        }
5753    }
5754
5755    /// Structure to identify provenance relationships between annotations in
5756    /// different revisions.
5757    #[derive(Clone, Default, PartialEq)]
5758    #[non_exhaustive]
5759    pub struct Provenance {
5760        /// The index of the revision that produced this element.
5761        #[deprecated]
5762        pub revision: i32,
5763
5764        /// The Id of this operation.  Needs to be unique within the scope of the
5765        /// revision.
5766        #[deprecated]
5767        pub id: i32,
5768
5769        /// References to the original elements that are replaced.
5770        pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,
5771
5772        /// The type of provenance operation.
5773        pub r#type: crate::model::document::provenance::OperationType,
5774
5775        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5776    }
5777
5778    impl Provenance {
5779        pub fn new() -> Self {
5780            std::default::Default::default()
5781        }
5782
5783        /// Sets the value of [revision][crate::model::document::Provenance::revision].
5784        ///
5785        /// # Example
5786        /// ```ignore,no_run
5787        /// # use google_cloud_documentai_v1::model::document::Provenance;
5788        /// let x = Provenance::new().set_revision(42);
5789        /// ```
5790        #[deprecated]
5791        pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5792            self.revision = v.into();
5793            self
5794        }
5795
5796        /// Sets the value of [id][crate::model::document::Provenance::id].
5797        ///
5798        /// # Example
5799        /// ```ignore,no_run
5800        /// # use google_cloud_documentai_v1::model::document::Provenance;
5801        /// let x = Provenance::new().set_id(42);
5802        /// ```
5803        #[deprecated]
5804        pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5805            self.id = v.into();
5806            self
5807        }
5808
5809        /// Sets the value of [parents][crate::model::document::Provenance::parents].
5810        ///
5811        /// # Example
5812        /// ```ignore,no_run
5813        /// # use google_cloud_documentai_v1::model::document::Provenance;
5814        /// use google_cloud_documentai_v1::model::document::provenance::Parent;
5815        /// let x = Provenance::new()
5816        ///     .set_parents([
5817        ///         Parent::default()/* use setters */,
5818        ///         Parent::default()/* use (different) setters */,
5819        ///     ]);
5820        /// ```
5821        pub fn set_parents<T, V>(mut self, v: T) -> Self
5822        where
5823            T: std::iter::IntoIterator<Item = V>,
5824            V: std::convert::Into<crate::model::document::provenance::Parent>,
5825        {
5826            use std::iter::Iterator;
5827            self.parents = v.into_iter().map(|i| i.into()).collect();
5828            self
5829        }
5830
5831        /// Sets the value of [r#type][crate::model::document::Provenance::type].
5832        ///
5833        /// # Example
5834        /// ```ignore,no_run
5835        /// # use google_cloud_documentai_v1::model::document::Provenance;
5836        /// use google_cloud_documentai_v1::model::document::provenance::OperationType;
5837        /// let x0 = Provenance::new().set_type(OperationType::Add);
5838        /// let x1 = Provenance::new().set_type(OperationType::Remove);
5839        /// let x2 = Provenance::new().set_type(OperationType::Update);
5840        /// ```
5841        pub fn set_type<
5842            T: std::convert::Into<crate::model::document::provenance::OperationType>,
5843        >(
5844            mut self,
5845            v: T,
5846        ) -> Self {
5847            self.r#type = v.into();
5848            self
5849        }
5850    }
5851
5852    impl wkt::message::Message for Provenance {
5853        fn typename() -> &'static str {
5854            "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
5855        }
5856    }
5857
5858    /// Defines additional types related to [Provenance].
5859    pub mod provenance {
5860        #[allow(unused_imports)]
5861        use super::*;
5862
5863        /// The parent element the current element is based on. Used for
5864        /// referencing/aligning, removal and replacement operations.
5865        #[derive(Clone, Default, PartialEq)]
5866        #[non_exhaustive]
5867        pub struct Parent {
5868            /// The index of the index into current revision's parent_ids list.
5869            pub revision: i32,
5870
5871            /// The index of the parent item in the corresponding item list (eg. list
5872            /// of entities, properties within entities, etc.) in the parent revision.
5873            pub index: i32,
5874
5875            /// The id of the parent provenance.
5876            #[deprecated]
5877            pub id: i32,
5878
5879            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5880        }
5881
5882        impl Parent {
5883            pub fn new() -> Self {
5884                std::default::Default::default()
5885            }
5886
5887            /// Sets the value of [revision][crate::model::document::provenance::Parent::revision].
5888            ///
5889            /// # Example
5890            /// ```ignore,no_run
5891            /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5892            /// let x = Parent::new().set_revision(42);
5893            /// ```
5894            pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5895                self.revision = v.into();
5896                self
5897            }
5898
5899            /// Sets the value of [index][crate::model::document::provenance::Parent::index].
5900            ///
5901            /// # Example
5902            /// ```ignore,no_run
5903            /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5904            /// let x = Parent::new().set_index(42);
5905            /// ```
5906            pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5907                self.index = v.into();
5908                self
5909            }
5910
5911            /// Sets the value of [id][crate::model::document::provenance::Parent::id].
5912            ///
5913            /// # Example
5914            /// ```ignore,no_run
5915            /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5916            /// let x = Parent::new().set_id(42);
5917            /// ```
5918            #[deprecated]
5919            pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5920                self.id = v.into();
5921                self
5922            }
5923        }
5924
5925        impl wkt::message::Message for Parent {
5926            fn typename() -> &'static str {
5927                "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
5928            }
5929        }
5930
5931        /// If a processor or agent does an explicit operation on existing elements.
5932        ///
5933        /// # Working with unknown values
5934        ///
5935        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5936        /// additional enum variants at any time. Adding new variants is not considered
5937        /// a breaking change. Applications should write their code in anticipation of:
5938        ///
5939        /// - New values appearing in future releases of the client library, **and**
5940        /// - New values received dynamically, without application changes.
5941        ///
5942        /// Please consult the [Working with enums] section in the user guide for some
5943        /// guidelines.
5944        ///
5945        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5946        #[derive(Clone, Debug, PartialEq)]
5947        #[non_exhaustive]
5948        pub enum OperationType {
5949            /// Operation type unspecified. If no operation is specified a provenance
5950            /// entry is simply used to match against a `parent`.
5951            Unspecified,
5952            /// Add an element.
5953            Add,
5954            /// Remove an element identified by `parent`.
5955            Remove,
5956            /// Updates any fields within the given provenance scope of the message. It
5957            /// overwrites the fields rather than replacing them.  Use this when you
5958            /// want to update a field value of an entity without also updating all the
5959            /// child properties.
5960            Update,
5961            /// Currently unused. Replace an element identified by `parent`.
5962            Replace,
5963            /// Deprecated. Request human review for the element identified by
5964            /// `parent`.
5965            #[deprecated]
5966            EvalRequested,
5967            /// Deprecated. Element is reviewed and approved at human review,
5968            /// confidence will be set to 1.0.
5969            #[deprecated]
5970            EvalApproved,
5971            /// Deprecated. Element is skipped in the validation process.
5972            #[deprecated]
5973            EvalSkipped,
5974            /// If set, the enum was initialized with an unknown value.
5975            ///
5976            /// Applications can examine the value using [OperationType::value] or
5977            /// [OperationType::name].
5978            UnknownValue(operation_type::UnknownValue),
5979        }
5980
5981        #[doc(hidden)]
5982        pub mod operation_type {
5983            #[allow(unused_imports)]
5984            use super::*;
5985            #[derive(Clone, Debug, PartialEq)]
5986            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5987        }
5988
5989        impl OperationType {
5990            /// Gets the enum value.
5991            ///
5992            /// Returns `None` if the enum contains an unknown value deserialized from
5993            /// the string representation of enums.
5994            pub fn value(&self) -> std::option::Option<i32> {
5995                match self {
5996                    Self::Unspecified => std::option::Option::Some(0),
5997                    Self::Add => std::option::Option::Some(1),
5998                    Self::Remove => std::option::Option::Some(2),
5999                    Self::Update => std::option::Option::Some(7),
6000                    Self::Replace => std::option::Option::Some(3),
6001                    Self::EvalRequested => std::option::Option::Some(4),
6002                    Self::EvalApproved => std::option::Option::Some(5),
6003                    Self::EvalSkipped => std::option::Option::Some(6),
6004                    Self::UnknownValue(u) => u.0.value(),
6005                }
6006            }
6007
6008            /// Gets the enum value as a string.
6009            ///
6010            /// Returns `None` if the enum contains an unknown value deserialized from
6011            /// the integer representation of enums.
6012            pub fn name(&self) -> std::option::Option<&str> {
6013                match self {
6014                    Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
6015                    Self::Add => std::option::Option::Some("ADD"),
6016                    Self::Remove => std::option::Option::Some("REMOVE"),
6017                    Self::Update => std::option::Option::Some("UPDATE"),
6018                    Self::Replace => std::option::Option::Some("REPLACE"),
6019                    Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
6020                    Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
6021                    Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
6022                    Self::UnknownValue(u) => u.0.name(),
6023                }
6024            }
6025        }
6026
6027        impl std::default::Default for OperationType {
6028            fn default() -> Self {
6029                use std::convert::From;
6030                Self::from(0)
6031            }
6032        }
6033
6034        impl std::fmt::Display for OperationType {
6035            fn fmt(
6036                &self,
6037                f: &mut std::fmt::Formatter<'_>,
6038            ) -> std::result::Result<(), std::fmt::Error> {
6039                wkt::internal::display_enum(f, self.name(), self.value())
6040            }
6041        }
6042
6043        impl std::convert::From<i32> for OperationType {
6044            fn from(value: i32) -> Self {
6045                match value {
6046                    0 => Self::Unspecified,
6047                    1 => Self::Add,
6048                    2 => Self::Remove,
6049                    3 => Self::Replace,
6050                    4 => Self::EvalRequested,
6051                    5 => Self::EvalApproved,
6052                    6 => Self::EvalSkipped,
6053                    7 => Self::Update,
6054                    _ => Self::UnknownValue(operation_type::UnknownValue(
6055                        wkt::internal::UnknownEnumValue::Integer(value),
6056                    )),
6057                }
6058            }
6059        }
6060
6061        impl std::convert::From<&str> for OperationType {
6062            fn from(value: &str) -> Self {
6063                use std::string::ToString;
6064                match value {
6065                    "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
6066                    "ADD" => Self::Add,
6067                    "REMOVE" => Self::Remove,
6068                    "UPDATE" => Self::Update,
6069                    "REPLACE" => Self::Replace,
6070                    "EVAL_REQUESTED" => Self::EvalRequested,
6071                    "EVAL_APPROVED" => Self::EvalApproved,
6072                    "EVAL_SKIPPED" => Self::EvalSkipped,
6073                    _ => Self::UnknownValue(operation_type::UnknownValue(
6074                        wkt::internal::UnknownEnumValue::String(value.to_string()),
6075                    )),
6076                }
6077            }
6078        }
6079
6080        impl serde::ser::Serialize for OperationType {
6081            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6082            where
6083                S: serde::Serializer,
6084            {
6085                match self {
6086                    Self::Unspecified => serializer.serialize_i32(0),
6087                    Self::Add => serializer.serialize_i32(1),
6088                    Self::Remove => serializer.serialize_i32(2),
6089                    Self::Update => serializer.serialize_i32(7),
6090                    Self::Replace => serializer.serialize_i32(3),
6091                    Self::EvalRequested => serializer.serialize_i32(4),
6092                    Self::EvalApproved => serializer.serialize_i32(5),
6093                    Self::EvalSkipped => serializer.serialize_i32(6),
6094                    Self::UnknownValue(u) => u.0.serialize(serializer),
6095                }
6096            }
6097        }
6098
6099        impl<'de> serde::de::Deserialize<'de> for OperationType {
6100            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6101            where
6102                D: serde::Deserializer<'de>,
6103            {
6104                deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
6105                    ".google.cloud.documentai.v1.Document.Provenance.OperationType",
6106                ))
6107            }
6108        }
6109    }
6110
6111    /// Contains past or forward revisions of this document.
6112    #[derive(Clone, Default, PartialEq)]
6113    #[non_exhaustive]
6114    pub struct Revision {
6115        /// Id of the revision, internally generated by doc proto storage.
6116        /// Unique within the context of the document.
6117        pub id: std::string::String,
6118
6119        /// The revisions that this revision is based on.  This can include one or
6120        /// more parent (when documents are merged.)  This field represents the
6121        /// index into the `revisions` field.
6122        #[deprecated]
6123        pub parent: std::vec::Vec<i32>,
6124
6125        /// The revisions that this revision is based on. Must include all the ids
6126        /// that have anything to do with this revision - eg. there are
6127        /// `provenance.parent.revision` fields that index into this field.
6128        pub parent_ids: std::vec::Vec<std::string::String>,
6129
6130        /// The time that the revision was created, internally generated by
6131        /// doc proto storage at the time of create.
6132        pub create_time: std::option::Option<wkt::Timestamp>,
6133
6134        /// Human Review information of this revision.
6135        pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,
6136
6137        /// Who/what made the change
6138        pub source: std::option::Option<crate::model::document::revision::Source>,
6139
6140        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6141    }
6142
6143    impl Revision {
6144        pub fn new() -> Self {
6145            std::default::Default::default()
6146        }
6147
6148        /// Sets the value of [id][crate::model::document::Revision::id].
6149        ///
6150        /// # Example
6151        /// ```ignore,no_run
6152        /// # use google_cloud_documentai_v1::model::document::Revision;
6153        /// let x = Revision::new().set_id("example");
6154        /// ```
6155        pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6156            self.id = v.into();
6157            self
6158        }
6159
6160        /// Sets the value of [parent][crate::model::document::Revision::parent].
6161        ///
6162        /// # Example
6163        /// ```ignore,no_run
6164        /// # use google_cloud_documentai_v1::model::document::Revision;
6165        /// let x = Revision::new().set_parent([1, 2, 3]);
6166        /// ```
6167        #[deprecated]
6168        pub fn set_parent<T, V>(mut self, v: T) -> Self
6169        where
6170            T: std::iter::IntoIterator<Item = V>,
6171            V: std::convert::Into<i32>,
6172        {
6173            use std::iter::Iterator;
6174            self.parent = v.into_iter().map(|i| i.into()).collect();
6175            self
6176        }
6177
6178        /// Sets the value of [parent_ids][crate::model::document::Revision::parent_ids].
6179        ///
6180        /// # Example
6181        /// ```ignore,no_run
6182        /// # use google_cloud_documentai_v1::model::document::Revision;
6183        /// let x = Revision::new().set_parent_ids(["a", "b", "c"]);
6184        /// ```
6185        pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
6186        where
6187            T: std::iter::IntoIterator<Item = V>,
6188            V: std::convert::Into<std::string::String>,
6189        {
6190            use std::iter::Iterator;
6191            self.parent_ids = v.into_iter().map(|i| i.into()).collect();
6192            self
6193        }
6194
6195        /// Sets the value of [create_time][crate::model::document::Revision::create_time].
6196        ///
6197        /// # Example
6198        /// ```ignore,no_run
6199        /// # use google_cloud_documentai_v1::model::document::Revision;
6200        /// use wkt::Timestamp;
6201        /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
6202        /// ```
6203        pub fn set_create_time<T>(mut self, v: T) -> Self
6204        where
6205            T: std::convert::Into<wkt::Timestamp>,
6206        {
6207            self.create_time = std::option::Option::Some(v.into());
6208            self
6209        }
6210
6211        /// Sets or clears the value of [create_time][crate::model::document::Revision::create_time].
6212        ///
6213        /// # Example
6214        /// ```ignore,no_run
6215        /// # use google_cloud_documentai_v1::model::document::Revision;
6216        /// use wkt::Timestamp;
6217        /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6218        /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
6219        /// ```
6220        pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6221        where
6222            T: std::convert::Into<wkt::Timestamp>,
6223        {
6224            self.create_time = v.map(|x| x.into());
6225            self
6226        }
6227
6228        /// Sets the value of [human_review][crate::model::document::Revision::human_review].
6229        ///
6230        /// # Example
6231        /// ```ignore,no_run
6232        /// # use google_cloud_documentai_v1::model::document::Revision;
6233        /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6234        /// let x = Revision::new().set_human_review(HumanReview::default()/* use setters */);
6235        /// ```
6236        pub fn set_human_review<T>(mut self, v: T) -> Self
6237        where
6238            T: std::convert::Into<crate::model::document::revision::HumanReview>,
6239        {
6240            self.human_review = std::option::Option::Some(v.into());
6241            self
6242        }
6243
6244        /// Sets or clears the value of [human_review][crate::model::document::Revision::human_review].
6245        ///
6246        /// # Example
6247        /// ```ignore,no_run
6248        /// # use google_cloud_documentai_v1::model::document::Revision;
6249        /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6250        /// let x = Revision::new().set_or_clear_human_review(Some(HumanReview::default()/* use setters */));
6251        /// let x = Revision::new().set_or_clear_human_review(None::<HumanReview>);
6252        /// ```
6253        pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
6254        where
6255            T: std::convert::Into<crate::model::document::revision::HumanReview>,
6256        {
6257            self.human_review = v.map(|x| x.into());
6258            self
6259        }
6260
6261        /// Sets the value of [source][crate::model::document::Revision::source].
6262        ///
6263        /// Note that all the setters affecting `source` are mutually
6264        /// exclusive.
6265        ///
6266        /// # Example
6267        /// ```ignore,no_run
6268        /// # use google_cloud_documentai_v1::model::document::Revision;
6269        /// use google_cloud_documentai_v1::model::document::revision::Source;
6270        /// let x = Revision::new().set_source(Some(Source::Agent("example".to_string())));
6271        /// ```
6272        pub fn set_source<
6273            T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
6274        >(
6275            mut self,
6276            v: T,
6277        ) -> Self {
6278            self.source = v.into();
6279            self
6280        }
6281
6282        /// The value of [source][crate::model::document::Revision::source]
6283        /// if it holds a `Agent`, `None` if the field is not set or
6284        /// holds a different branch.
6285        pub fn agent(&self) -> std::option::Option<&std::string::String> {
6286            #[allow(unreachable_patterns)]
6287            self.source.as_ref().and_then(|v| match v {
6288                crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
6289                _ => std::option::Option::None,
6290            })
6291        }
6292
6293        /// Sets the value of [source][crate::model::document::Revision::source]
6294        /// to hold a `Agent`.
6295        ///
6296        /// Note that all the setters affecting `source` are
6297        /// mutually exclusive.
6298        ///
6299        /// # Example
6300        /// ```ignore,no_run
6301        /// # use google_cloud_documentai_v1::model::document::Revision;
6302        /// let x = Revision::new().set_agent("example");
6303        /// assert!(x.agent().is_some());
6304        /// assert!(x.processor().is_none());
6305        /// ```
6306        pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6307            self.source = std::option::Option::Some(
6308                crate::model::document::revision::Source::Agent(v.into()),
6309            );
6310            self
6311        }
6312
6313        /// The value of [source][crate::model::document::Revision::source]
6314        /// if it holds a `Processor`, `None` if the field is not set or
6315        /// holds a different branch.
6316        pub fn processor(&self) -> std::option::Option<&std::string::String> {
6317            #[allow(unreachable_patterns)]
6318            self.source.as_ref().and_then(|v| match v {
6319                crate::model::document::revision::Source::Processor(v) => {
6320                    std::option::Option::Some(v)
6321                }
6322                _ => std::option::Option::None,
6323            })
6324        }
6325
6326        /// Sets the value of [source][crate::model::document::Revision::source]
6327        /// to hold a `Processor`.
6328        ///
6329        /// Note that all the setters affecting `source` are
6330        /// mutually exclusive.
6331        ///
6332        /// # Example
6333        /// ```ignore,no_run
6334        /// # use google_cloud_documentai_v1::model::document::Revision;
6335        /// let x = Revision::new().set_processor("example");
6336        /// assert!(x.processor().is_some());
6337        /// assert!(x.agent().is_none());
6338        /// ```
6339        pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6340            self.source = std::option::Option::Some(
6341                crate::model::document::revision::Source::Processor(v.into()),
6342            );
6343            self
6344        }
6345    }
6346
6347    impl wkt::message::Message for Revision {
6348        fn typename() -> &'static str {
6349            "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
6350        }
6351    }
6352
6353    /// Defines additional types related to [Revision].
6354    pub mod revision {
6355        #[allow(unused_imports)]
6356        use super::*;
6357
6358        /// Human Review information of the document.
6359        #[derive(Clone, Default, PartialEq)]
6360        #[non_exhaustive]
6361        pub struct HumanReview {
6362            /// Human review state. e.g. `requested`, `succeeded`, `rejected`.
6363            pub state: std::string::String,
6364
6365            /// A message providing more details about the current state of processing.
6366            /// For example, the rejection reason when the state is `rejected`.
6367            pub state_message: std::string::String,
6368
6369            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6370        }
6371
6372        impl HumanReview {
6373            pub fn new() -> Self {
6374                std::default::Default::default()
6375            }
6376
6377            /// Sets the value of [state][crate::model::document::revision::HumanReview::state].
6378            ///
6379            /// # Example
6380            /// ```ignore,no_run
6381            /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6382            /// let x = HumanReview::new().set_state("example");
6383            /// ```
6384            pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6385                self.state = v.into();
6386                self
6387            }
6388
6389            /// Sets the value of [state_message][crate::model::document::revision::HumanReview::state_message].
6390            ///
6391            /// # Example
6392            /// ```ignore,no_run
6393            /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6394            /// let x = HumanReview::new().set_state_message("example");
6395            /// ```
6396            pub fn set_state_message<T: std::convert::Into<std::string::String>>(
6397                mut self,
6398                v: T,
6399            ) -> Self {
6400                self.state_message = v.into();
6401                self
6402            }
6403        }
6404
6405        impl wkt::message::Message for HumanReview {
6406            fn typename() -> &'static str {
6407                "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
6408            }
6409        }
6410
6411        /// Who/what made the change
6412        #[derive(Clone, Debug, PartialEq)]
6413        #[non_exhaustive]
6414        pub enum Source {
6415            /// If the change was made by a person specify the name or id of that
6416            /// person.
6417            Agent(std::string::String),
6418            /// If the annotation was made by processor identify the processor by its
6419            /// resource name.
6420            Processor(std::string::String),
6421        }
6422    }
6423
6424    /// This message is used for text changes aka. OCR corrections.
6425    #[derive(Clone, Default, PartialEq)]
6426    #[non_exhaustive]
6427    pub struct TextChange {
6428        /// Provenance of the correction.
6429        /// Text anchor indexing into the
6430        /// [Document.text][google.cloud.documentai.v1.Document.text].  There can
6431        /// only be a single `TextAnchor.text_segments` element.  If the start and
6432        /// end index of the text segment are the same, the text change is inserted
6433        /// before that index.
6434        ///
6435        /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
6436        pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
6437
6438        /// The text that replaces the text identified in the `text_anchor`.
6439        pub changed_text: std::string::String,
6440
6441        /// The history of this annotation.
6442        #[deprecated]
6443        pub provenance: std::vec::Vec<crate::model::document::Provenance>,
6444
6445        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6446    }
6447
6448    impl TextChange {
6449        pub fn new() -> Self {
6450            std::default::Default::default()
6451        }
6452
6453        /// Sets the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6454        ///
6455        /// # Example
6456        /// ```ignore,no_run
6457        /// # use google_cloud_documentai_v1::model::document::TextChange;
6458        /// use google_cloud_documentai_v1::model::document::TextAnchor;
6459        /// let x = TextChange::new().set_text_anchor(TextAnchor::default()/* use setters */);
6460        /// ```
6461        pub fn set_text_anchor<T>(mut self, v: T) -> Self
6462        where
6463            T: std::convert::Into<crate::model::document::TextAnchor>,
6464        {
6465            self.text_anchor = std::option::Option::Some(v.into());
6466            self
6467        }
6468
6469        /// Sets or clears the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6470        ///
6471        /// # Example
6472        /// ```ignore,no_run
6473        /// # use google_cloud_documentai_v1::model::document::TextChange;
6474        /// use google_cloud_documentai_v1::model::document::TextAnchor;
6475        /// let x = TextChange::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
6476        /// let x = TextChange::new().set_or_clear_text_anchor(None::<TextAnchor>);
6477        /// ```
6478        pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
6479        where
6480            T: std::convert::Into<crate::model::document::TextAnchor>,
6481        {
6482            self.text_anchor = v.map(|x| x.into());
6483            self
6484        }
6485
6486        /// Sets the value of [changed_text][crate::model::document::TextChange::changed_text].
6487        ///
6488        /// # Example
6489        /// ```ignore,no_run
6490        /// # use google_cloud_documentai_v1::model::document::TextChange;
6491        /// let x = TextChange::new().set_changed_text("example");
6492        /// ```
6493        pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
6494            mut self,
6495            v: T,
6496        ) -> Self {
6497            self.changed_text = v.into();
6498            self
6499        }
6500
6501        /// Sets the value of [provenance][crate::model::document::TextChange::provenance].
6502        ///
6503        /// # Example
6504        /// ```ignore,no_run
6505        /// # use google_cloud_documentai_v1::model::document::TextChange;
6506        /// use google_cloud_documentai_v1::model::document::Provenance;
6507        /// let x = TextChange::new()
6508        ///     .set_provenance([
6509        ///         Provenance::default()/* use setters */,
6510        ///         Provenance::default()/* use (different) setters */,
6511        ///     ]);
6512        /// ```
6513        #[deprecated]
6514        pub fn set_provenance<T, V>(mut self, v: T) -> Self
6515        where
6516            T: std::iter::IntoIterator<Item = V>,
6517            V: std::convert::Into<crate::model::document::Provenance>,
6518        {
6519            use std::iter::Iterator;
6520            self.provenance = v.into_iter().map(|i| i.into()).collect();
6521            self
6522        }
6523    }
6524
6525    impl wkt::message::Message for TextChange {
6526        fn typename() -> &'static str {
6527            "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
6528        }
6529    }
6530
6531    /// Represents the parsed layout of a document as a collection of blocks that
6532    /// the document is divided into.
6533    #[derive(Clone, Default, PartialEq)]
6534    #[non_exhaustive]
6535    pub struct DocumentLayout {
6536        /// List of blocks in the document.
6537        pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6538
6539        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6540    }
6541
6542    impl DocumentLayout {
6543        pub fn new() -> Self {
6544            std::default::Default::default()
6545        }
6546
6547        /// Sets the value of [blocks][crate::model::document::DocumentLayout::blocks].
6548        ///
6549        /// # Example
6550        /// ```ignore,no_run
6551        /// # use google_cloud_documentai_v1::model::document::DocumentLayout;
6552        /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6553        /// let x = DocumentLayout::new()
6554        ///     .set_blocks([
6555        ///         DocumentLayoutBlock::default()/* use setters */,
6556        ///         DocumentLayoutBlock::default()/* use (different) setters */,
6557        ///     ]);
6558        /// ```
6559        pub fn set_blocks<T, V>(mut self, v: T) -> Self
6560        where
6561            T: std::iter::IntoIterator<Item = V>,
6562            V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
6563        {
6564            use std::iter::Iterator;
6565            self.blocks = v.into_iter().map(|i| i.into()).collect();
6566            self
6567        }
6568    }
6569
6570    impl wkt::message::Message for DocumentLayout {
6571        fn typename() -> &'static str {
6572            "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
6573        }
6574    }
6575
6576    /// Defines additional types related to [DocumentLayout].
6577    pub mod document_layout {
6578        #[allow(unused_imports)]
6579        use super::*;
6580
6581        /// Represents a block. A block could be one of the various types (text,
6582        /// table, list) supported.
6583        #[derive(Clone, Default, PartialEq)]
6584        #[non_exhaustive]
6585        pub struct DocumentLayoutBlock {
6586            /// ID of the block.
6587            pub block_id: std::string::String,
6588
6589            /// Page span of the block.
6590            pub page_span: std::option::Option<
6591                crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
6592            >,
6593
6594            /// Identifies the bounding box for the block.
6595            pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6596
6597            pub block: std::option::Option<
6598                crate::model::document::document_layout::document_layout_block::Block,
6599            >,
6600
6601            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6602        }
6603
6604        impl DocumentLayoutBlock {
6605            pub fn new() -> Self {
6606                std::default::Default::default()
6607            }
6608
6609            /// Sets the value of [block_id][crate::model::document::document_layout::DocumentLayoutBlock::block_id].
6610            ///
6611            /// # Example
6612            /// ```ignore,no_run
6613            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6614            /// let x = DocumentLayoutBlock::new().set_block_id("example");
6615            /// ```
6616            pub fn set_block_id<T: std::convert::Into<std::string::String>>(
6617                mut self,
6618                v: T,
6619            ) -> Self {
6620                self.block_id = v.into();
6621                self
6622            }
6623
6624            /// Sets the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6625            ///
6626            /// # Example
6627            /// ```ignore,no_run
6628            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6629            /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6630            /// let x = DocumentLayoutBlock::new().set_page_span(LayoutPageSpan::default()/* use setters */);
6631            /// ```
6632            pub fn set_page_span<T>(mut self, v: T) -> Self
6633            where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6634            {
6635                self.page_span = std::option::Option::Some(v.into());
6636                self
6637            }
6638
6639            /// Sets or clears the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6640            ///
6641            /// # Example
6642            /// ```ignore,no_run
6643            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6644            /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6645            /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(Some(LayoutPageSpan::default()/* use setters */));
6646            /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(None::<LayoutPageSpan>);
6647            /// ```
6648            pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
6649            where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6650            {
6651                self.page_span = v.map(|x| x.into());
6652                self
6653            }
6654
6655            /// Sets the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6656            ///
6657            /// # Example
6658            /// ```ignore,no_run
6659            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6660            /// use google_cloud_documentai_v1::model::BoundingPoly;
6661            /// let x = DocumentLayoutBlock::new().set_bounding_box(BoundingPoly::default()/* use setters */);
6662            /// ```
6663            pub fn set_bounding_box<T>(mut self, v: T) -> Self
6664            where
6665                T: std::convert::Into<crate::model::BoundingPoly>,
6666            {
6667                self.bounding_box = std::option::Option::Some(v.into());
6668                self
6669            }
6670
6671            /// Sets or clears the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6672            ///
6673            /// # Example
6674            /// ```ignore,no_run
6675            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6676            /// use google_cloud_documentai_v1::model::BoundingPoly;
6677            /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(Some(BoundingPoly::default()/* use setters */));
6678            /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(None::<BoundingPoly>);
6679            /// ```
6680            pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6681            where
6682                T: std::convert::Into<crate::model::BoundingPoly>,
6683            {
6684                self.bounding_box = v.map(|x| x.into());
6685                self
6686            }
6687
6688            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block].
6689            ///
6690            /// Note that all the setters affecting `block` are mutually
6691            /// exclusive.
6692            ///
6693            /// # Example
6694            /// ```ignore,no_run
6695            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6696            /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6697            /// let x = DocumentLayoutBlock::new().set_block(Some(
6698            ///     google_cloud_documentai_v1::model::document::document_layout::document_layout_block::Block::TextBlock(LayoutTextBlock::default().into())));
6699            /// ```
6700            pub fn set_block<
6701                T: std::convert::Into<
6702                        std::option::Option<
6703                            crate::model::document::document_layout::document_layout_block::Block,
6704                        >,
6705                    >,
6706            >(
6707                mut self,
6708                v: T,
6709            ) -> Self {
6710                self.block = v.into();
6711                self
6712            }
6713
6714            /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6715            /// if it holds a `TextBlock`, `None` if the field is not set or
6716            /// holds a different branch.
6717            pub fn text_block(
6718                &self,
6719            ) -> std::option::Option<
6720                &std::boxed::Box<
6721                    crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
6722                >,
6723            > {
6724                #[allow(unreachable_patterns)]
6725                self.block.as_ref().and_then(|v| match v {
6726                    crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
6727                    _ => std::option::Option::None,
6728                })
6729            }
6730
6731            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6732            /// to hold a `TextBlock`.
6733            ///
6734            /// Note that all the setters affecting `block` are
6735            /// mutually exclusive.
6736            ///
6737            /// # Example
6738            /// ```ignore,no_run
6739            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6740            /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6741            /// let x = DocumentLayoutBlock::new().set_text_block(LayoutTextBlock::default()/* use setters */);
6742            /// assert!(x.text_block().is_some());
6743            /// assert!(x.table_block().is_none());
6744            /// assert!(x.list_block().is_none());
6745            /// ```
6746            pub fn set_text_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>>>(mut self, v: T) -> Self{
6747                self.block = std::option::Option::Some(
6748                    crate::model::document::document_layout::document_layout_block::Block::TextBlock(
6749                        v.into()
6750                    )
6751                );
6752                self
6753            }
6754
6755            /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6756            /// if it holds a `TableBlock`, `None` if the field is not set or
6757            /// holds a different branch.
6758            pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
6759                #[allow(unreachable_patterns)]
6760                self.block.as_ref().and_then(|v| match v {
6761                    crate::model::document::document_layout::document_layout_block::Block::TableBlock(v) => std::option::Option::Some(v),
6762                    _ => std::option::Option::None,
6763                })
6764            }
6765
6766            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6767            /// to hold a `TableBlock`.
6768            ///
6769            /// Note that all the setters affecting `block` are
6770            /// mutually exclusive.
6771            ///
6772            /// # Example
6773            /// ```ignore,no_run
6774            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6775            /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
6776            /// let x = DocumentLayoutBlock::new().set_table_block(LayoutTableBlock::default()/* use setters */);
6777            /// assert!(x.table_block().is_some());
6778            /// assert!(x.text_block().is_none());
6779            /// assert!(x.list_block().is_none());
6780            /// ```
6781            pub fn set_table_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>>(mut self, v: T) -> Self{
6782                self.block = std::option::Option::Some(
6783                    crate::model::document::document_layout::document_layout_block::Block::TableBlock(
6784                        v.into()
6785                    )
6786                );
6787                self
6788            }
6789
6790            /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6791            /// if it holds a `ListBlock`, `None` if the field is not set or
6792            /// holds a different branch.
6793            pub fn list_block(
6794                &self,
6795            ) -> std::option::Option<
6796                &std::boxed::Box<
6797                    crate::model::document::document_layout::document_layout_block::LayoutListBlock,
6798                >,
6799            > {
6800                #[allow(unreachable_patterns)]
6801                self.block.as_ref().and_then(|v| match v {
6802                    crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
6803                    _ => std::option::Option::None,
6804                })
6805            }
6806
6807            /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6808            /// to hold a `ListBlock`.
6809            ///
6810            /// Note that all the setters affecting `block` are
6811            /// mutually exclusive.
6812            ///
6813            /// # Example
6814            /// ```ignore,no_run
6815            /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6816            /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
6817            /// let x = DocumentLayoutBlock::new().set_list_block(LayoutListBlock::default()/* use setters */);
6818            /// assert!(x.list_block().is_some());
6819            /// assert!(x.text_block().is_none());
6820            /// assert!(x.table_block().is_none());
6821            /// ```
6822            pub fn set_list_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>>>(mut self, v: T) -> Self{
6823                self.block = std::option::Option::Some(
6824                    crate::model::document::document_layout::document_layout_block::Block::ListBlock(
6825                        v.into()
6826                    )
6827                );
6828                self
6829            }
6830        }
6831
6832        impl wkt::message::Message for DocumentLayoutBlock {
6833            fn typename() -> &'static str {
6834                "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
6835            }
6836        }
6837
6838        /// Defines additional types related to [DocumentLayoutBlock].
6839        pub mod document_layout_block {
6840            #[allow(unused_imports)]
6841            use super::*;
6842
6843            /// Represents where the block starts and ends in the document.
6844            #[derive(Clone, Default, PartialEq)]
6845            #[non_exhaustive]
6846            pub struct LayoutPageSpan {
6847                /// Page where block starts in the document.
6848                pub page_start: i32,
6849
6850                /// Page where block ends in the document.
6851                pub page_end: i32,
6852
6853                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6854            }
6855
6856            impl LayoutPageSpan {
6857                pub fn new() -> Self {
6858                    std::default::Default::default()
6859                }
6860
6861                /// Sets the value of [page_start][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_start].
6862                ///
6863                /// # Example
6864                /// ```ignore,no_run
6865                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6866                /// let x = LayoutPageSpan::new().set_page_start(42);
6867                /// ```
6868                pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6869                    self.page_start = v.into();
6870                    self
6871                }
6872
6873                /// Sets the value of [page_end][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_end].
6874                ///
6875                /// # Example
6876                /// ```ignore,no_run
6877                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6878                /// let x = LayoutPageSpan::new().set_page_end(42);
6879                /// ```
6880                pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6881                    self.page_end = v.into();
6882                    self
6883                }
6884            }
6885
6886            impl wkt::message::Message for LayoutPageSpan {
6887                fn typename() -> &'static str {
6888                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
6889                }
6890            }
6891
6892            /// Represents a text type block.
6893            #[derive(Clone, Default, PartialEq)]
6894            #[non_exhaustive]
6895            pub struct LayoutTextBlock {
6896                /// Text content stored in the block.
6897                pub text: std::string::String,
6898
6899                /// Type of the text in the block. Available options are: `paragraph`,
6900                /// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
6901                /// `heading-5`, `header`, `footer`.
6902                pub r#type: std::string::String,
6903
6904                /// A text block could further have child blocks.
6905                /// Repeated blocks support further hierarchies and nested blocks.
6906                pub blocks:
6907                    std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6908
6909                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6910            }
6911
6912            impl LayoutTextBlock {
6913                pub fn new() -> Self {
6914                    std::default::Default::default()
6915                }
6916
6917                /// Sets the value of [text][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::text].
6918                ///
6919                /// # Example
6920                /// ```ignore,no_run
6921                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6922                /// let x = LayoutTextBlock::new().set_text("example");
6923                /// ```
6924                pub fn set_text<T: std::convert::Into<std::string::String>>(
6925                    mut self,
6926                    v: T,
6927                ) -> Self {
6928                    self.text = v.into();
6929                    self
6930                }
6931
6932                /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::type].
6933                ///
6934                /// # Example
6935                /// ```ignore,no_run
6936                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6937                /// let x = LayoutTextBlock::new().set_type("example");
6938                /// ```
6939                pub fn set_type<T: std::convert::Into<std::string::String>>(
6940                    mut self,
6941                    v: T,
6942                ) -> Self {
6943                    self.r#type = v.into();
6944                    self
6945                }
6946
6947                /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::blocks].
6948                ///
6949                /// # Example
6950                /// ```ignore,no_run
6951                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6952                /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6953                /// let x = LayoutTextBlock::new()
6954                ///     .set_blocks([
6955                ///         DocumentLayoutBlock::default()/* use setters */,
6956                ///         DocumentLayoutBlock::default()/* use (different) setters */,
6957                ///     ]);
6958                /// ```
6959                pub fn set_blocks<T, V>(mut self, v: T) -> Self
6960                where
6961                    T: std::iter::IntoIterator<Item = V>,
6962                    V: std::convert::Into<
6963                            crate::model::document::document_layout::DocumentLayoutBlock,
6964                        >,
6965                {
6966                    use std::iter::Iterator;
6967                    self.blocks = v.into_iter().map(|i| i.into()).collect();
6968                    self
6969                }
6970            }
6971
6972            impl wkt::message::Message for LayoutTextBlock {
6973                fn typename() -> &'static str {
6974                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
6975                }
6976            }
6977
6978            /// Represents a table type block.
6979            #[derive(Clone, Default, PartialEq)]
6980            #[non_exhaustive]
6981            pub struct LayoutTableBlock {
6982                /// Header rows at the top of the table.
6983                pub header_rows: std::vec::Vec<
6984                    crate::model::document::document_layout::document_layout_block::LayoutTableRow,
6985                >,
6986
6987                /// Body rows containing main table content.
6988                pub body_rows: std::vec::Vec<
6989                    crate::model::document::document_layout::document_layout_block::LayoutTableRow,
6990                >,
6991
6992                /// Table caption/title.
6993                pub caption: std::string::String,
6994
6995                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6996            }
6997
6998            impl LayoutTableBlock {
6999                pub fn new() -> Self {
7000                    std::default::Default::default()
7001                }
7002
7003                /// Sets the value of [header_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::header_rows].
7004                ///
7005                /// # Example
7006                /// ```ignore,no_run
7007                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7008                /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7009                /// let x = LayoutTableBlock::new()
7010                ///     .set_header_rows([
7011                ///         LayoutTableRow::default()/* use setters */,
7012                ///         LayoutTableRow::default()/* use (different) setters */,
7013                ///     ]);
7014                /// ```
7015                pub fn set_header_rows<T, V>(mut self, v: T) -> Self
7016                where
7017                    T: std::iter::IntoIterator<Item = V>,
7018                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7019                {
7020                    use std::iter::Iterator;
7021                    self.header_rows = v.into_iter().map(|i| i.into()).collect();
7022                    self
7023                }
7024
7025                /// Sets the value of [body_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::body_rows].
7026                ///
7027                /// # Example
7028                /// ```ignore,no_run
7029                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7030                /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7031                /// let x = LayoutTableBlock::new()
7032                ///     .set_body_rows([
7033                ///         LayoutTableRow::default()/* use setters */,
7034                ///         LayoutTableRow::default()/* use (different) setters */,
7035                ///     ]);
7036                /// ```
7037                pub fn set_body_rows<T, V>(mut self, v: T) -> Self
7038                where
7039                    T: std::iter::IntoIterator<Item = V>,
7040                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7041                {
7042                    use std::iter::Iterator;
7043                    self.body_rows = v.into_iter().map(|i| i.into()).collect();
7044                    self
7045                }
7046
7047                /// Sets the value of [caption][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::caption].
7048                ///
7049                /// # Example
7050                /// ```ignore,no_run
7051                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7052                /// let x = LayoutTableBlock::new().set_caption("example");
7053                /// ```
7054                pub fn set_caption<T: std::convert::Into<std::string::String>>(
7055                    mut self,
7056                    v: T,
7057                ) -> Self {
7058                    self.caption = v.into();
7059                    self
7060                }
7061            }
7062
7063            impl wkt::message::Message for LayoutTableBlock {
7064                fn typename() -> &'static str {
7065                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
7066                }
7067            }
7068
7069            /// Represents a row in a table.
7070            #[derive(Clone, Default, PartialEq)]
7071            #[non_exhaustive]
7072            pub struct LayoutTableRow {
7073                /// A table row is a list of table cells.
7074                pub cells: std::vec::Vec<
7075                    crate::model::document::document_layout::document_layout_block::LayoutTableCell,
7076                >,
7077
7078                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7079            }
7080
7081            impl LayoutTableRow {
7082                pub fn new() -> Self {
7083                    std::default::Default::default()
7084                }
7085
7086                /// Sets the value of [cells][crate::model::document::document_layout::document_layout_block::LayoutTableRow::cells].
7087                ///
7088                /// # Example
7089                /// ```ignore,no_run
7090                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7091                /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7092                /// let x = LayoutTableRow::new()
7093                ///     .set_cells([
7094                ///         LayoutTableCell::default()/* use setters */,
7095                ///         LayoutTableCell::default()/* use (different) setters */,
7096                ///     ]);
7097                /// ```
7098                pub fn set_cells<T, V>(mut self, v: T) -> Self
7099                where
7100                    T: std::iter::IntoIterator<Item = V>,
7101                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
7102                {
7103                    use std::iter::Iterator;
7104                    self.cells = v.into_iter().map(|i| i.into()).collect();
7105                    self
7106                }
7107            }
7108
7109            impl wkt::message::Message for LayoutTableRow {
7110                fn typename() -> &'static str {
7111                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
7112                }
7113            }
7114
7115            /// Represents a cell in a table row.
7116            #[derive(Clone, Default, PartialEq)]
7117            #[non_exhaustive]
7118            pub struct LayoutTableCell {
7119                /// A table cell is a list of blocks.
7120                /// Repeated blocks support further hierarchies and nested blocks.
7121                pub blocks:
7122                    std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7123
7124                /// How many rows this cell spans.
7125                pub row_span: i32,
7126
7127                /// How many columns this cell spans.
7128                pub col_span: i32,
7129
7130                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7131            }
7132
7133            impl LayoutTableCell {
7134                pub fn new() -> Self {
7135                    std::default::Default::default()
7136                }
7137
7138                /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTableCell::blocks].
7139                ///
7140                /// # Example
7141                /// ```ignore,no_run
7142                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7143                /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7144                /// let x = LayoutTableCell::new()
7145                ///     .set_blocks([
7146                ///         DocumentLayoutBlock::default()/* use setters */,
7147                ///         DocumentLayoutBlock::default()/* use (different) setters */,
7148                ///     ]);
7149                /// ```
7150                pub fn set_blocks<T, V>(mut self, v: T) -> Self
7151                where
7152                    T: std::iter::IntoIterator<Item = V>,
7153                    V: std::convert::Into<
7154                            crate::model::document::document_layout::DocumentLayoutBlock,
7155                        >,
7156                {
7157                    use std::iter::Iterator;
7158                    self.blocks = v.into_iter().map(|i| i.into()).collect();
7159                    self
7160                }
7161
7162                /// Sets the value of [row_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::row_span].
7163                ///
7164                /// # Example
7165                /// ```ignore,no_run
7166                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7167                /// let x = LayoutTableCell::new().set_row_span(42);
7168                /// ```
7169                pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7170                    self.row_span = v.into();
7171                    self
7172                }
7173
7174                /// Sets the value of [col_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::col_span].
7175                ///
7176                /// # Example
7177                /// ```ignore,no_run
7178                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7179                /// let x = LayoutTableCell::new().set_col_span(42);
7180                /// ```
7181                pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7182                    self.col_span = v.into();
7183                    self
7184                }
7185            }
7186
7187            impl wkt::message::Message for LayoutTableCell {
7188                fn typename() -> &'static str {
7189                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
7190                }
7191            }
7192
7193            /// Represents a list type block.
7194            #[derive(Clone, Default, PartialEq)]
7195            #[non_exhaustive]
7196            pub struct LayoutListBlock {
7197                /// List entries that constitute a list block.
7198                pub list_entries: std::vec::Vec<
7199                    crate::model::document::document_layout::document_layout_block::LayoutListEntry,
7200                >,
7201
7202                /// Type of the list_entries (if exist). Available options are `ordered`
7203                /// and `unordered`.
7204                pub r#type: std::string::String,
7205
7206                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7207            }
7208
7209            impl LayoutListBlock {
7210                pub fn new() -> Self {
7211                    std::default::Default::default()
7212                }
7213
7214                /// Sets the value of [list_entries][crate::model::document::document_layout::document_layout_block::LayoutListBlock::list_entries].
7215                ///
7216                /// # Example
7217                /// ```ignore,no_run
7218                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7219                /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7220                /// let x = LayoutListBlock::new()
7221                ///     .set_list_entries([
7222                ///         LayoutListEntry::default()/* use setters */,
7223                ///         LayoutListEntry::default()/* use (different) setters */,
7224                ///     ]);
7225                /// ```
7226                pub fn set_list_entries<T, V>(mut self, v: T) -> Self
7227                where
7228                    T: std::iter::IntoIterator<Item = V>,
7229                    V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
7230                {
7231                    use std::iter::Iterator;
7232                    self.list_entries = v.into_iter().map(|i| i.into()).collect();
7233                    self
7234                }
7235
7236                /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutListBlock::type].
7237                ///
7238                /// # Example
7239                /// ```ignore,no_run
7240                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7241                /// let x = LayoutListBlock::new().set_type("example");
7242                /// ```
7243                pub fn set_type<T: std::convert::Into<std::string::String>>(
7244                    mut self,
7245                    v: T,
7246                ) -> Self {
7247                    self.r#type = v.into();
7248                    self
7249                }
7250            }
7251
7252            impl wkt::message::Message for LayoutListBlock {
7253                fn typename() -> &'static str {
7254                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
7255                }
7256            }
7257
7258            /// Represents an entry in the list.
7259            #[derive(Clone, Default, PartialEq)]
7260            #[non_exhaustive]
7261            pub struct LayoutListEntry {
7262                /// A list entry is a list of blocks.
7263                /// Repeated blocks support further hierarchies and nested blocks.
7264                pub blocks:
7265                    std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7266
7267                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7268            }
7269
7270            impl LayoutListEntry {
7271                pub fn new() -> Self {
7272                    std::default::Default::default()
7273                }
7274
7275                /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutListEntry::blocks].
7276                ///
7277                /// # Example
7278                /// ```ignore,no_run
7279                /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7280                /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7281                /// let x = LayoutListEntry::new()
7282                ///     .set_blocks([
7283                ///         DocumentLayoutBlock::default()/* use setters */,
7284                ///         DocumentLayoutBlock::default()/* use (different) setters */,
7285                ///     ]);
7286                /// ```
7287                pub fn set_blocks<T, V>(mut self, v: T) -> Self
7288                where
7289                    T: std::iter::IntoIterator<Item = V>,
7290                    V: std::convert::Into<
7291                            crate::model::document::document_layout::DocumentLayoutBlock,
7292                        >,
7293                {
7294                    use std::iter::Iterator;
7295                    self.blocks = v.into_iter().map(|i| i.into()).collect();
7296                    self
7297                }
7298            }
7299
7300            impl wkt::message::Message for LayoutListEntry {
7301                fn typename() -> &'static str {
7302                    "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
7303                }
7304            }
7305
7306            #[derive(Clone, Debug, PartialEq)]
7307            #[non_exhaustive]
7308            pub enum Block {
7309                /// Block consisting of text content.
7310                TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
7311                /// Block consisting of table content/structure.
7312                TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
7313                /// Block consisting of list content/structure.
7314                ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
7315            }
7316        }
7317    }
7318
7319    /// Represents the chunks that the document is divided into.
7320    #[derive(Clone, Default, PartialEq)]
7321    #[non_exhaustive]
7322    pub struct ChunkedDocument {
7323        /// List of chunks.
7324        pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,
7325
7326        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7327    }
7328
7329    impl ChunkedDocument {
7330        pub fn new() -> Self {
7331            std::default::Default::default()
7332        }
7333
7334        /// Sets the value of [chunks][crate::model::document::ChunkedDocument::chunks].
7335        ///
7336        /// # Example
7337        /// ```ignore,no_run
7338        /// # use google_cloud_documentai_v1::model::document::ChunkedDocument;
7339        /// use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7340        /// let x = ChunkedDocument::new()
7341        ///     .set_chunks([
7342        ///         Chunk::default()/* use setters */,
7343        ///         Chunk::default()/* use (different) setters */,
7344        ///     ]);
7345        /// ```
7346        pub fn set_chunks<T, V>(mut self, v: T) -> Self
7347        where
7348            T: std::iter::IntoIterator<Item = V>,
7349            V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
7350        {
7351            use std::iter::Iterator;
7352            self.chunks = v.into_iter().map(|i| i.into()).collect();
7353            self
7354        }
7355    }
7356
7357    impl wkt::message::Message for ChunkedDocument {
7358        fn typename() -> &'static str {
7359            "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
7360        }
7361    }
7362
7363    /// Defines additional types related to [ChunkedDocument].
7364    pub mod chunked_document {
7365        #[allow(unused_imports)]
7366        use super::*;
7367
7368        /// Represents a chunk.
7369        #[derive(Clone, Default, PartialEq)]
7370        #[non_exhaustive]
7371        pub struct Chunk {
7372            /// ID of the chunk.
7373            pub chunk_id: std::string::String,
7374
7375            /// Unused.
7376            pub source_block_ids: std::vec::Vec<std::string::String>,
7377
7378            /// Text content of the chunk.
7379            pub content: std::string::String,
7380
7381            /// Page span of the chunk.
7382            pub page_span:
7383                std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,
7384
7385            /// Page headers associated with the chunk.
7386            pub page_headers:
7387                std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,
7388
7389            /// Page footers associated with the chunk.
7390            pub page_footers:
7391                std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,
7392
7393            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7394        }
7395
7396        impl Chunk {
7397            pub fn new() -> Self {
7398                std::default::Default::default()
7399            }
7400
7401            /// Sets the value of [chunk_id][crate::model::document::chunked_document::Chunk::chunk_id].
7402            ///
7403            /// # Example
7404            /// ```ignore,no_run
7405            /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7406            /// let x = Chunk::new().set_chunk_id("example");
7407            /// ```
7408            pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
7409                mut self,
7410                v: T,
7411            ) -> Self {
7412                self.chunk_id = v.into();
7413                self
7414            }
7415
7416            /// Sets the value of [source_block_ids][crate::model::document::chunked_document::Chunk::source_block_ids].
7417            ///
7418            /// # Example
7419            /// ```ignore,no_run
7420            /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7421            /// let x = Chunk::new().set_source_block_ids(["a", "b", "c"]);
7422            /// ```
7423            pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
7424            where
7425                T: std::iter::IntoIterator<Item = V>,
7426                V: std::convert::Into<std::string::String>,
7427            {
7428                use std::iter::Iterator;
7429                self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
7430                self
7431            }
7432
7433            /// Sets the value of [content][crate::model::document::chunked_document::Chunk::content].
7434            ///
7435            /// # Example
7436            /// ```ignore,no_run
7437            /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7438            /// let x = Chunk::new().set_content("example");
7439            /// ```
7440            pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7441                self.content = v.into();
7442                self
7443            }
7444
7445            /// Sets the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7446            ///
7447            /// # Example
7448            /// ```ignore,no_run
7449            /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7450            /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7451            /// let x = Chunk::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7452            /// ```
7453            pub fn set_page_span<T>(mut self, v: T) -> Self
7454            where
7455                T: std::convert::Into<
7456                        crate::model::document::chunked_document::chunk::ChunkPageSpan,
7457                    >,
7458            {
7459                self.page_span = std::option::Option::Some(v.into());
7460                self
7461            }
7462
7463            /// Sets or clears the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7464            ///
7465            /// # Example
7466            /// ```ignore,no_run
7467            /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7468            /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7469            /// let x = Chunk::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7470            /// let x = Chunk::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7471            /// ```
7472            pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7473            where
7474                T: std::convert::Into<
7475                        crate::model::document::chunked_document::chunk::ChunkPageSpan,
7476                    >,
7477            {
7478                self.page_span = v.map(|x| x.into());
7479                self
7480            }
7481
7482            /// Sets the value of [page_headers][crate::model::document::chunked_document::Chunk::page_headers].
7483            ///
7484            /// # Example
7485            /// ```ignore,no_run
7486            /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7487            /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7488            /// let x = Chunk::new()
7489            ///     .set_page_headers([
7490            ///         ChunkPageHeader::default()/* use setters */,
7491            ///         ChunkPageHeader::default()/* use (different) setters */,
7492            ///     ]);
7493            /// ```
7494            pub fn set_page_headers<T, V>(mut self, v: T) -> Self
7495            where
7496                T: std::iter::IntoIterator<Item = V>,
7497                V: std::convert::Into<
7498                        crate::model::document::chunked_document::chunk::ChunkPageHeader,
7499                    >,
7500            {
7501                use std::iter::Iterator;
7502                self.page_headers = v.into_iter().map(|i| i.into()).collect();
7503                self
7504            }
7505
7506            /// Sets the value of [page_footers][crate::model::document::chunked_document::Chunk::page_footers].
7507            ///
7508            /// # Example
7509            /// ```ignore,no_run
7510            /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7511            /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7512            /// let x = Chunk::new()
7513            ///     .set_page_footers([
7514            ///         ChunkPageFooter::default()/* use setters */,
7515            ///         ChunkPageFooter::default()/* use (different) setters */,
7516            ///     ]);
7517            /// ```
7518            pub fn set_page_footers<T, V>(mut self, v: T) -> Self
7519            where
7520                T: std::iter::IntoIterator<Item = V>,
7521                V: std::convert::Into<
7522                        crate::model::document::chunked_document::chunk::ChunkPageFooter,
7523                    >,
7524            {
7525                use std::iter::Iterator;
7526                self.page_footers = v.into_iter().map(|i| i.into()).collect();
7527                self
7528            }
7529        }
7530
7531        impl wkt::message::Message for Chunk {
7532            fn typename() -> &'static str {
7533                "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
7534            }
7535        }
7536
7537        /// Defines additional types related to [Chunk].
7538        pub mod chunk {
7539            #[allow(unused_imports)]
7540            use super::*;
7541
7542            /// Represents where the chunk starts and ends in the document.
7543            #[derive(Clone, Default, PartialEq)]
7544            #[non_exhaustive]
7545            pub struct ChunkPageSpan {
7546                /// Page where chunk starts in the document.
7547                pub page_start: i32,
7548
7549                /// Page where chunk ends in the document.
7550                pub page_end: i32,
7551
7552                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7553            }
7554
7555            impl ChunkPageSpan {
7556                pub fn new() -> Self {
7557                    std::default::Default::default()
7558                }
7559
7560                /// Sets the value of [page_start][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_start].
7561                ///
7562                /// # Example
7563                /// ```ignore,no_run
7564                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7565                /// let x = ChunkPageSpan::new().set_page_start(42);
7566                /// ```
7567                pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7568                    self.page_start = v.into();
7569                    self
7570                }
7571
7572                /// Sets the value of [page_end][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_end].
7573                ///
7574                /// # Example
7575                /// ```ignore,no_run
7576                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7577                /// let x = ChunkPageSpan::new().set_page_end(42);
7578                /// ```
7579                pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7580                    self.page_end = v.into();
7581                    self
7582                }
7583            }
7584
7585            impl wkt::message::Message for ChunkPageSpan {
7586                fn typename() -> &'static str {
7587                    "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
7588                }
7589            }
7590
7591            /// Represents the page header associated with the chunk.
7592            #[derive(Clone, Default, PartialEq)]
7593            #[non_exhaustive]
7594            pub struct ChunkPageHeader {
7595                /// Header in text format.
7596                pub text: std::string::String,
7597
7598                /// Page span of the header.
7599                pub page_span: std::option::Option<
7600                    crate::model::document::chunked_document::chunk::ChunkPageSpan,
7601                >,
7602
7603                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7604            }
7605
7606            impl ChunkPageHeader {
7607                pub fn new() -> Self {
7608                    std::default::Default::default()
7609                }
7610
7611                /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageHeader::text].
7612                ///
7613                /// # Example
7614                /// ```ignore,no_run
7615                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7616                /// let x = ChunkPageHeader::new().set_text("example");
7617                /// ```
7618                pub fn set_text<T: std::convert::Into<std::string::String>>(
7619                    mut self,
7620                    v: T,
7621                ) -> Self {
7622                    self.text = v.into();
7623                    self
7624                }
7625
7626                /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
7627                ///
7628                /// # Example
7629                /// ```ignore,no_run
7630                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7631                /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7632                /// let x = ChunkPageHeader::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7633                /// ```
7634                pub fn set_page_span<T>(mut self, v: T) -> Self
7635                where
7636                    T: std::convert::Into<
7637                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
7638                        >,
7639                {
7640                    self.page_span = std::option::Option::Some(v.into());
7641                    self
7642                }
7643
7644                /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
7645                ///
7646                /// # Example
7647                /// ```ignore,no_run
7648                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7649                /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7650                /// let x = ChunkPageHeader::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7651                /// let x = ChunkPageHeader::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7652                /// ```
7653                pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7654                where
7655                    T: std::convert::Into<
7656                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
7657                        >,
7658                {
7659                    self.page_span = v.map(|x| x.into());
7660                    self
7661                }
7662            }
7663
7664            impl wkt::message::Message for ChunkPageHeader {
7665                fn typename() -> &'static str {
7666                    "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
7667                }
7668            }
7669
7670            /// Represents the page footer associated with the chunk.
7671            #[derive(Clone, Default, PartialEq)]
7672            #[non_exhaustive]
7673            pub struct ChunkPageFooter {
7674                /// Footer in text format.
7675                pub text: std::string::String,
7676
7677                /// Page span of the footer.
7678                pub page_span: std::option::Option<
7679                    crate::model::document::chunked_document::chunk::ChunkPageSpan,
7680                >,
7681
7682                pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7683            }
7684
7685            impl ChunkPageFooter {
7686                pub fn new() -> Self {
7687                    std::default::Default::default()
7688                }
7689
7690                /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageFooter::text].
7691                ///
7692                /// # Example
7693                /// ```ignore,no_run
7694                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7695                /// let x = ChunkPageFooter::new().set_text("example");
7696                /// ```
7697                pub fn set_text<T: std::convert::Into<std::string::String>>(
7698                    mut self,
7699                    v: T,
7700                ) -> Self {
7701                    self.text = v.into();
7702                    self
7703                }
7704
7705                /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
7706                ///
7707                /// # Example
7708                /// ```ignore,no_run
7709                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7710                /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7711                /// let x = ChunkPageFooter::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7712                /// ```
7713                pub fn set_page_span<T>(mut self, v: T) -> Self
7714                where
7715                    T: std::convert::Into<
7716                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
7717                        >,
7718                {
7719                    self.page_span = std::option::Option::Some(v.into());
7720                    self
7721                }
7722
7723                /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
7724                ///
7725                /// # Example
7726                /// ```ignore,no_run
7727                /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7728                /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7729                /// let x = ChunkPageFooter::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7730                /// let x = ChunkPageFooter::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7731                /// ```
7732                pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7733                where
7734                    T: std::convert::Into<
7735                            crate::model::document::chunked_document::chunk::ChunkPageSpan,
7736                        >,
7737                {
7738                    self.page_span = v.map(|x| x.into());
7739                    self
7740                }
7741            }
7742
7743            impl wkt::message::Message for ChunkPageFooter {
7744                fn typename() -> &'static str {
7745                    "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
7746                }
7747            }
7748        }
7749    }
7750
7751    /// The output of the validation given the document and the validation rules.
7752    #[derive(Clone, Default, PartialEq)]
7753    #[non_exhaustive]
7754    pub struct EntityValidationOutput {
7755        /// The result of each validation rule.
7756        pub validation_results:
7757            std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,
7758
7759        /// The overall result of the validation, true if all applicable rules are
7760        /// valid.
7761        pub pass_all_rules: bool,
7762
7763        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7764    }
7765
7766    impl EntityValidationOutput {
7767        pub fn new() -> Self {
7768            std::default::Default::default()
7769        }
7770
7771        /// Sets the value of [validation_results][crate::model::document::EntityValidationOutput::validation_results].
7772        ///
7773        /// # Example
7774        /// ```ignore,no_run
7775        /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
7776        /// use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7777        /// let x = EntityValidationOutput::new()
7778        ///     .set_validation_results([
7779        ///         ValidationResult::default()/* use setters */,
7780        ///         ValidationResult::default()/* use (different) setters */,
7781        ///     ]);
7782        /// ```
7783        pub fn set_validation_results<T, V>(mut self, v: T) -> Self
7784        where
7785            T: std::iter::IntoIterator<Item = V>,
7786            V: std::convert::Into<
7787                    crate::model::document::entity_validation_output::ValidationResult,
7788                >,
7789        {
7790            use std::iter::Iterator;
7791            self.validation_results = v.into_iter().map(|i| i.into()).collect();
7792            self
7793        }
7794
7795        /// Sets the value of [pass_all_rules][crate::model::document::EntityValidationOutput::pass_all_rules].
7796        ///
7797        /// # Example
7798        /// ```ignore,no_run
7799        /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
7800        /// let x = EntityValidationOutput::new().set_pass_all_rules(true);
7801        /// ```
7802        pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7803            self.pass_all_rules = v.into();
7804            self
7805        }
7806    }
7807
7808    impl wkt::message::Message for EntityValidationOutput {
7809        fn typename() -> &'static str {
7810            "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
7811        }
7812    }
7813
7814    /// Defines additional types related to [EntityValidationOutput].
7815    pub mod entity_validation_output {
7816        #[allow(unused_imports)]
7817        use super::*;
7818
7819        /// Validation result for a single validation rule.
7820        #[derive(Clone, Default, PartialEq)]
7821        #[non_exhaustive]
7822        pub struct ValidationResult {
7823
7824            /// The name of the validation rule.
7825            pub rule_name: std::string::String,
7826
7827            /// The description of the validation rule.
7828            pub rule_description: std::string::String,
7829
7830            /// The result of the validation rule.
7831            pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,
7832
7833            /// The detailed information of the running the validation process using
7834            /// the entity from the document based on the validation rule.
7835            pub validation_details: std::string::String,
7836
7837            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7838        }
7839
7840        impl ValidationResult {
7841            pub fn new() -> Self {
7842                std::default::Default::default()
7843            }
7844
7845            /// Sets the value of [rule_name][crate::model::document::entity_validation_output::ValidationResult::rule_name].
7846            ///
7847            /// # Example
7848            /// ```ignore,no_run
7849            /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7850            /// let x = ValidationResult::new().set_rule_name("example");
7851            /// ```
7852            pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
7853                mut self,
7854                v: T,
7855            ) -> Self {
7856                self.rule_name = v.into();
7857                self
7858            }
7859
7860            /// Sets the value of [rule_description][crate::model::document::entity_validation_output::ValidationResult::rule_description].
7861            ///
7862            /// # Example
7863            /// ```ignore,no_run
7864            /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7865            /// let x = ValidationResult::new().set_rule_description("example");
7866            /// ```
7867            pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
7868                mut self,
7869                v: T,
7870            ) -> Self {
7871                self.rule_description = v.into();
7872                self
7873            }
7874
7875            /// Sets the value of [validation_result_type][crate::model::document::entity_validation_output::ValidationResult::validation_result_type].
7876            ///
7877            /// # Example
7878            /// ```ignore,no_run
7879            /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7880            /// use google_cloud_documentai_v1::model::document::entity_validation_output::validation_result::ValidationResultType;
7881            /// let x0 = ValidationResult::new().set_validation_result_type(ValidationResultType::Valid);
7882            /// let x1 = ValidationResult::new().set_validation_result_type(ValidationResultType::Invalid);
7883            /// let x2 = ValidationResult::new().set_validation_result_type(ValidationResultType::Skipped);
7884            /// ```
7885            pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
7886                self.validation_result_type = v.into();
7887                self
7888            }
7889
7890            /// Sets the value of [validation_details][crate::model::document::entity_validation_output::ValidationResult::validation_details].
7891            ///
7892            /// # Example
7893            /// ```ignore,no_run
7894            /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7895            /// let x = ValidationResult::new().set_validation_details("example");
7896            /// ```
7897            pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
7898                mut self,
7899                v: T,
7900            ) -> Self {
7901                self.validation_details = v.into();
7902                self
7903            }
7904        }
7905
7906        impl wkt::message::Message for ValidationResult {
7907            fn typename() -> &'static str {
7908                "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
7909            }
7910        }
7911
7912        /// Defines additional types related to [ValidationResult].
7913        pub mod validation_result {
7914            #[allow(unused_imports)]
7915            use super::*;
7916
7917            /// The result of the validation rule.
7918            ///
7919            /// # Working with unknown values
7920            ///
7921            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7922            /// additional enum variants at any time. Adding new variants is not considered
7923            /// a breaking change. Applications should write their code in anticipation of:
7924            ///
7925            /// - New values appearing in future releases of the client library, **and**
7926            /// - New values received dynamically, without application changes.
7927            ///
7928            /// Please consult the [Working with enums] section in the user guide for some
7929            /// guidelines.
7930            ///
7931            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7932            #[derive(Clone, Debug, PartialEq)]
7933            #[non_exhaustive]
7934            pub enum ValidationResultType {
7935                /// The validation result type is unspecified.
7936                Unspecified,
7937                /// The validation is valid.
7938                Valid,
7939                /// The validation is invalid.
7940                Invalid,
7941                /// The validation is skipped.
7942                Skipped,
7943                /// The validation is not applicable.
7944                NotApplicable,
7945                /// If set, the enum was initialized with an unknown value.
7946                ///
7947                /// Applications can examine the value using [ValidationResultType::value] or
7948                /// [ValidationResultType::name].
7949                UnknownValue(validation_result_type::UnknownValue),
7950            }
7951
7952            #[doc(hidden)]
7953            pub mod validation_result_type {
7954                #[allow(unused_imports)]
7955                use super::*;
7956                #[derive(Clone, Debug, PartialEq)]
7957                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7958            }
7959
7960            impl ValidationResultType {
7961                /// Gets the enum value.
7962                ///
7963                /// Returns `None` if the enum contains an unknown value deserialized from
7964                /// the string representation of enums.
7965                pub fn value(&self) -> std::option::Option<i32> {
7966                    match self {
7967                        Self::Unspecified => std::option::Option::Some(0),
7968                        Self::Valid => std::option::Option::Some(1),
7969                        Self::Invalid => std::option::Option::Some(2),
7970                        Self::Skipped => std::option::Option::Some(3),
7971                        Self::NotApplicable => std::option::Option::Some(4),
7972                        Self::UnknownValue(u) => u.0.value(),
7973                    }
7974                }
7975
7976                /// Gets the enum value as a string.
7977                ///
7978                /// Returns `None` if the enum contains an unknown value deserialized from
7979                /// the integer representation of enums.
7980                pub fn name(&self) -> std::option::Option<&str> {
7981                    match self {
7982                        Self::Unspecified => {
7983                            std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
7984                        }
7985                        Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
7986                        Self::Invalid => {
7987                            std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
7988                        }
7989                        Self::Skipped => {
7990                            std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
7991                        }
7992                        Self::NotApplicable => {
7993                            std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
7994                        }
7995                        Self::UnknownValue(u) => u.0.name(),
7996                    }
7997                }
7998            }
7999
8000            impl std::default::Default for ValidationResultType {
8001                fn default() -> Self {
8002                    use std::convert::From;
8003                    Self::from(0)
8004                }
8005            }
8006
8007            impl std::fmt::Display for ValidationResultType {
8008                fn fmt(
8009                    &self,
8010                    f: &mut std::fmt::Formatter<'_>,
8011                ) -> std::result::Result<(), std::fmt::Error> {
8012                    wkt::internal::display_enum(f, self.name(), self.value())
8013                }
8014            }
8015
8016            impl std::convert::From<i32> for ValidationResultType {
8017                fn from(value: i32) -> Self {
8018                    match value {
8019                        0 => Self::Unspecified,
8020                        1 => Self::Valid,
8021                        2 => Self::Invalid,
8022                        3 => Self::Skipped,
8023                        4 => Self::NotApplicable,
8024                        _ => Self::UnknownValue(validation_result_type::UnknownValue(
8025                            wkt::internal::UnknownEnumValue::Integer(value),
8026                        )),
8027                    }
8028                }
8029            }
8030
8031            impl std::convert::From<&str> for ValidationResultType {
8032                fn from(value: &str) -> Self {
8033                    use std::string::ToString;
8034                    match value {
8035                        "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
8036                        "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
8037                        "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
8038                        "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
8039                        "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
8040                        _ => Self::UnknownValue(validation_result_type::UnknownValue(
8041                            wkt::internal::UnknownEnumValue::String(value.to_string()),
8042                        )),
8043                    }
8044                }
8045            }
8046
8047            impl serde::ser::Serialize for ValidationResultType {
8048                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8049                where
8050                    S: serde::Serializer,
8051                {
8052                    match self {
8053                        Self::Unspecified => serializer.serialize_i32(0),
8054                        Self::Valid => serializer.serialize_i32(1),
8055                        Self::Invalid => serializer.serialize_i32(2),
8056                        Self::Skipped => serializer.serialize_i32(3),
8057                        Self::NotApplicable => serializer.serialize_i32(4),
8058                        Self::UnknownValue(u) => u.0.serialize(serializer),
8059                    }
8060                }
8061            }
8062
8063            impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
8064                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8065                where
8066                    D: serde::Deserializer<'de>,
8067                {
8068                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
8069                        ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
8070                }
8071            }
8072        }
8073    }
8074
8075    /// Entity revision.
8076    #[derive(Clone, Default, PartialEq)]
8077    #[non_exhaustive]
8078    pub struct EntitiesRevision {
8079        /// The revision id.
8080        pub revision_id: std::string::String,
8081
8082        /// The entities in this revision.
8083        pub entities: std::vec::Vec<crate::model::document::Entity>,
8084
8085        /// The entity validation output for this revision.
8086        pub entity_validation_output:
8087            std::option::Option<crate::model::document::EntityValidationOutput>,
8088
8089        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8090    }
8091
8092    impl EntitiesRevision {
8093        pub fn new() -> Self {
8094            std::default::Default::default()
8095        }
8096
8097        /// Sets the value of [revision_id][crate::model::document::EntitiesRevision::revision_id].
8098        ///
8099        /// # Example
8100        /// ```ignore,no_run
8101        /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8102        /// let x = EntitiesRevision::new().set_revision_id("example");
8103        /// ```
8104        pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8105            self.revision_id = v.into();
8106            self
8107        }
8108
8109        /// Sets the value of [entities][crate::model::document::EntitiesRevision::entities].
8110        ///
8111        /// # Example
8112        /// ```ignore,no_run
8113        /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8114        /// use google_cloud_documentai_v1::model::document::Entity;
8115        /// let x = EntitiesRevision::new()
8116        ///     .set_entities([
8117        ///         Entity::default()/* use setters */,
8118        ///         Entity::default()/* use (different) setters */,
8119        ///     ]);
8120        /// ```
8121        pub fn set_entities<T, V>(mut self, v: T) -> Self
8122        where
8123            T: std::iter::IntoIterator<Item = V>,
8124            V: std::convert::Into<crate::model::document::Entity>,
8125        {
8126            use std::iter::Iterator;
8127            self.entities = v.into_iter().map(|i| i.into()).collect();
8128            self
8129        }
8130
8131        /// Sets the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
8132        ///
8133        /// # Example
8134        /// ```ignore,no_run
8135        /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8136        /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8137        /// let x = EntitiesRevision::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
8138        /// ```
8139        pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
8140        where
8141            T: std::convert::Into<crate::model::document::EntityValidationOutput>,
8142        {
8143            self.entity_validation_output = std::option::Option::Some(v.into());
8144            self
8145        }
8146
8147        /// Sets or clears the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
8148        ///
8149        /// # Example
8150        /// ```ignore,no_run
8151        /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8152        /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8153        /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
8154        /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
8155        /// ```
8156        pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
8157        where
8158            T: std::convert::Into<crate::model::document::EntityValidationOutput>,
8159        {
8160            self.entity_validation_output = v.map(|x| x.into());
8161            self
8162        }
8163    }
8164
8165    impl wkt::message::Message for EntitiesRevision {
8166        fn typename() -> &'static str {
8167            "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
8168        }
8169    }
8170
8171    /// Original source document from the user.
8172    #[derive(Clone, Debug, PartialEq)]
8173    #[non_exhaustive]
8174    pub enum Source {
8175        /// Optional. Currently supports Google Cloud Storage URI of the form
8176        /// `gs://bucket_name/object_name`. Object versioning is not supported.
8177        /// For more information, refer to [Google Cloud Storage Request
8178        /// URIs](https://cloud.google.com/storage/docs/reference-uris).
8179        Uri(std::string::String),
8180        /// Optional. Inline document content, represented as a stream of bytes.
8181        /// Note: As with all `bytes` fields, protobuffers use a pure binary
8182        /// representation, whereas JSON representations use base64.
8183        Content(::bytes::Bytes),
8184    }
8185}
8186
8187/// Payload message of raw document content (bytes).
8188#[derive(Clone, Default, PartialEq)]
8189#[non_exhaustive]
8190pub struct RawDocument {
8191    /// Inline document content.
8192    pub content: ::bytes::Bytes,
8193
8194    /// An IANA MIME type (RFC6838) indicating the nature and format of the
8195    /// [content][google.cloud.documentai.v1.RawDocument.content].
8196    ///
8197    /// [google.cloud.documentai.v1.RawDocument.content]: crate::model::RawDocument::content
8198    pub mime_type: std::string::String,
8199
8200    /// The display name of the document, it supports all Unicode characters except
8201    /// the following:
8202    /// `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,`
8203    /// `~`, `=` and `:` are reserved.
8204    /// If not specified, a default ID is generated.
8205    pub display_name: std::string::String,
8206
8207    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8208}
8209
8210impl RawDocument {
8211    pub fn new() -> Self {
8212        std::default::Default::default()
8213    }
8214
8215    /// Sets the value of [content][crate::model::RawDocument::content].
8216    ///
8217    /// # Example
8218    /// ```ignore,no_run
8219    /// # use google_cloud_documentai_v1::model::RawDocument;
8220    /// let x = RawDocument::new().set_content(bytes::Bytes::from_static(b"example"));
8221    /// ```
8222    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8223        self.content = v.into();
8224        self
8225    }
8226
8227    /// Sets the value of [mime_type][crate::model::RawDocument::mime_type].
8228    ///
8229    /// # Example
8230    /// ```ignore,no_run
8231    /// # use google_cloud_documentai_v1::model::RawDocument;
8232    /// let x = RawDocument::new().set_mime_type("example");
8233    /// ```
8234    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8235        self.mime_type = v.into();
8236        self
8237    }
8238
8239    /// Sets the value of [display_name][crate::model::RawDocument::display_name].
8240    ///
8241    /// # Example
8242    /// ```ignore,no_run
8243    /// # use google_cloud_documentai_v1::model::RawDocument;
8244    /// let x = RawDocument::new().set_display_name("example");
8245    /// ```
8246    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8247        self.display_name = v.into();
8248        self
8249    }
8250}
8251
8252impl wkt::message::Message for RawDocument {
8253    fn typename() -> &'static str {
8254        "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
8255    }
8256}
8257
8258/// Specifies a document stored on Cloud Storage.
8259#[derive(Clone, Default, PartialEq)]
8260#[non_exhaustive]
8261pub struct GcsDocument {
8262    /// The Cloud Storage object uri.
8263    pub gcs_uri: std::string::String,
8264
8265    /// An IANA MIME type (RFC6838) of the content.
8266    pub mime_type: std::string::String,
8267
8268    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8269}
8270
8271impl GcsDocument {
8272    pub fn new() -> Self {
8273        std::default::Default::default()
8274    }
8275
8276    /// Sets the value of [gcs_uri][crate::model::GcsDocument::gcs_uri].
8277    ///
8278    /// # Example
8279    /// ```ignore,no_run
8280    /// # use google_cloud_documentai_v1::model::GcsDocument;
8281    /// let x = GcsDocument::new().set_gcs_uri("example");
8282    /// ```
8283    pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8284        self.gcs_uri = v.into();
8285        self
8286    }
8287
8288    /// Sets the value of [mime_type][crate::model::GcsDocument::mime_type].
8289    ///
8290    /// # Example
8291    /// ```ignore,no_run
8292    /// # use google_cloud_documentai_v1::model::GcsDocument;
8293    /// let x = GcsDocument::new().set_mime_type("example");
8294    /// ```
8295    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8296        self.mime_type = v.into();
8297        self
8298    }
8299}
8300
8301impl wkt::message::Message for GcsDocument {
8302    fn typename() -> &'static str {
8303        "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
8304    }
8305}
8306
8307/// Specifies a set of documents on Cloud Storage.
8308#[derive(Clone, Default, PartialEq)]
8309#[non_exhaustive]
8310pub struct GcsDocuments {
8311    /// The list of documents.
8312    pub documents: std::vec::Vec<crate::model::GcsDocument>,
8313
8314    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8315}
8316
8317impl GcsDocuments {
8318    pub fn new() -> Self {
8319        std::default::Default::default()
8320    }
8321
8322    /// Sets the value of [documents][crate::model::GcsDocuments::documents].
8323    ///
8324    /// # Example
8325    /// ```ignore,no_run
8326    /// # use google_cloud_documentai_v1::model::GcsDocuments;
8327    /// use google_cloud_documentai_v1::model::GcsDocument;
8328    /// let x = GcsDocuments::new()
8329    ///     .set_documents([
8330    ///         GcsDocument::default()/* use setters */,
8331    ///         GcsDocument::default()/* use (different) setters */,
8332    ///     ]);
8333    /// ```
8334    pub fn set_documents<T, V>(mut self, v: T) -> Self
8335    where
8336        T: std::iter::IntoIterator<Item = V>,
8337        V: std::convert::Into<crate::model::GcsDocument>,
8338    {
8339        use std::iter::Iterator;
8340        self.documents = v.into_iter().map(|i| i.into()).collect();
8341        self
8342    }
8343}
8344
8345impl wkt::message::Message for GcsDocuments {
8346    fn typename() -> &'static str {
8347        "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
8348    }
8349}
8350
8351/// Specifies all documents on Cloud Storage with a common prefix.
8352#[derive(Clone, Default, PartialEq)]
8353#[non_exhaustive]
8354pub struct GcsPrefix {
8355    /// The URI prefix.
8356    pub gcs_uri_prefix: std::string::String,
8357
8358    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8359}
8360
8361impl GcsPrefix {
8362    pub fn new() -> Self {
8363        std::default::Default::default()
8364    }
8365
8366    /// Sets the value of [gcs_uri_prefix][crate::model::GcsPrefix::gcs_uri_prefix].
8367    ///
8368    /// # Example
8369    /// ```ignore,no_run
8370    /// # use google_cloud_documentai_v1::model::GcsPrefix;
8371    /// let x = GcsPrefix::new().set_gcs_uri_prefix("example");
8372    /// ```
8373    pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8374        self.gcs_uri_prefix = v.into();
8375        self
8376    }
8377}
8378
8379impl wkt::message::Message for GcsPrefix {
8380    fn typename() -> &'static str {
8381        "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
8382    }
8383}
8384
8385/// The common config to specify a set of documents used as input.
8386#[derive(Clone, Default, PartialEq)]
8387#[non_exhaustive]
8388pub struct BatchDocumentsInputConfig {
8389    /// The source. Make sure that the caller of the API has storage.objects.get
8390    /// access to the buckets.
8391    pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,
8392
8393    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8394}
8395
8396impl BatchDocumentsInputConfig {
8397    pub fn new() -> Self {
8398        std::default::Default::default()
8399    }
8400
8401    /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source].
8402    ///
8403    /// Note that all the setters affecting `source` are mutually
8404    /// exclusive.
8405    ///
8406    /// # Example
8407    /// ```ignore,no_run
8408    /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
8409    /// use google_cloud_documentai_v1::model::GcsPrefix;
8410    /// let x = BatchDocumentsInputConfig::new().set_source(Some(
8411    ///     google_cloud_documentai_v1::model::batch_documents_input_config::Source::GcsPrefix(GcsPrefix::default().into())));
8412    /// ```
8413    pub fn set_source<
8414        T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
8415    >(
8416        mut self,
8417        v: T,
8418    ) -> Self {
8419        self.source = v.into();
8420        self
8421    }
8422
8423    /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
8424    /// if it holds a `GcsPrefix`, `None` if the field is not set or
8425    /// holds a different branch.
8426    pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
8427        #[allow(unreachable_patterns)]
8428        self.source.as_ref().and_then(|v| match v {
8429            crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
8430                std::option::Option::Some(v)
8431            }
8432            _ => std::option::Option::None,
8433        })
8434    }
8435
8436    /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
8437    /// to hold a `GcsPrefix`.
8438    ///
8439    /// Note that all the setters affecting `source` are
8440    /// mutually exclusive.
8441    ///
8442    /// # Example
8443    /// ```ignore,no_run
8444    /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
8445    /// use google_cloud_documentai_v1::model::GcsPrefix;
8446    /// let x = BatchDocumentsInputConfig::new().set_gcs_prefix(GcsPrefix::default()/* use setters */);
8447    /// assert!(x.gcs_prefix().is_some());
8448    /// assert!(x.gcs_documents().is_none());
8449    /// ```
8450    pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
8451        mut self,
8452        v: T,
8453    ) -> Self {
8454        self.source = std::option::Option::Some(
8455            crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
8456        );
8457        self
8458    }
8459
8460    /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
8461    /// if it holds a `GcsDocuments`, `None` if the field is not set or
8462    /// holds a different branch.
8463    pub fn gcs_documents(
8464        &self,
8465    ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
8466        #[allow(unreachable_patterns)]
8467        self.source.as_ref().and_then(|v| match v {
8468            crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
8469                std::option::Option::Some(v)
8470            }
8471            _ => std::option::Option::None,
8472        })
8473    }
8474
8475    /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
8476    /// to hold a `GcsDocuments`.
8477    ///
8478    /// Note that all the setters affecting `source` are
8479    /// mutually exclusive.
8480    ///
8481    /// # Example
8482    /// ```ignore,no_run
8483    /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
8484    /// use google_cloud_documentai_v1::model::GcsDocuments;
8485    /// let x = BatchDocumentsInputConfig::new().set_gcs_documents(GcsDocuments::default()/* use setters */);
8486    /// assert!(x.gcs_documents().is_some());
8487    /// assert!(x.gcs_prefix().is_none());
8488    /// ```
8489    pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
8490        mut self,
8491        v: T,
8492    ) -> Self {
8493        self.source = std::option::Option::Some(
8494            crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
8495        );
8496        self
8497    }
8498}
8499
8500impl wkt::message::Message for BatchDocumentsInputConfig {
8501    fn typename() -> &'static str {
8502        "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
8503    }
8504}
8505
8506/// Defines additional types related to [BatchDocumentsInputConfig].
8507pub mod batch_documents_input_config {
8508    #[allow(unused_imports)]
8509    use super::*;
8510
8511    /// The source. Make sure that the caller of the API has storage.objects.get
8512    /// access to the buckets.
8513    #[derive(Clone, Debug, PartialEq)]
8514    #[non_exhaustive]
8515    pub enum Source {
8516        /// The set of documents that match the specified Cloud Storage `gcs_prefix`.
8517        GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
8518        /// The set of documents individually specified on Cloud Storage.
8519        GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
8520    }
8521}
8522
8523/// Config that controls the output of documents. All documents will be written
8524/// as a JSON file.
8525#[derive(Clone, Default, PartialEq)]
8526#[non_exhaustive]
8527pub struct DocumentOutputConfig {
8528    /// The destination of the results.
8529    pub destination: std::option::Option<crate::model::document_output_config::Destination>,
8530
8531    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8532}
8533
8534impl DocumentOutputConfig {
8535    pub fn new() -> Self {
8536        std::default::Default::default()
8537    }
8538
8539    /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
8540    ///
8541    /// Note that all the setters affecting `destination` are mutually
8542    /// exclusive.
8543    ///
8544    /// # Example
8545    /// ```ignore,no_run
8546    /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
8547    /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8548    /// let x = DocumentOutputConfig::new().set_destination(Some(
8549    ///     google_cloud_documentai_v1::model::document_output_config::Destination::GcsOutputConfig(GcsOutputConfig::default().into())));
8550    /// ```
8551    pub fn set_destination<
8552        T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
8553    >(
8554        mut self,
8555        v: T,
8556    ) -> Self {
8557        self.destination = v.into();
8558        self
8559    }
8560
8561    /// The value of [destination][crate::model::DocumentOutputConfig::destination]
8562    /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
8563    /// holds a different branch.
8564    pub fn gcs_output_config(
8565        &self,
8566    ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
8567    {
8568        #[allow(unreachable_patterns)]
8569        self.destination.as_ref().and_then(|v| match v {
8570            crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
8571                std::option::Option::Some(v)
8572            }
8573            _ => std::option::Option::None,
8574        })
8575    }
8576
8577    /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
8578    /// to hold a `GcsOutputConfig`.
8579    ///
8580    /// Note that all the setters affecting `destination` are
8581    /// mutually exclusive.
8582    ///
8583    /// # Example
8584    /// ```ignore,no_run
8585    /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
8586    /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8587    /// let x = DocumentOutputConfig::new().set_gcs_output_config(GcsOutputConfig::default()/* use setters */);
8588    /// assert!(x.gcs_output_config().is_some());
8589    /// ```
8590    pub fn set_gcs_output_config<
8591        T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
8592    >(
8593        mut self,
8594        v: T,
8595    ) -> Self {
8596        self.destination = std::option::Option::Some(
8597            crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
8598        );
8599        self
8600    }
8601}
8602
8603impl wkt::message::Message for DocumentOutputConfig {
8604    fn typename() -> &'static str {
8605        "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
8606    }
8607}
8608
8609/// Defines additional types related to [DocumentOutputConfig].
8610pub mod document_output_config {
8611    #[allow(unused_imports)]
8612    use super::*;
8613
8614    /// The configuration used when outputting documents.
8615    #[derive(Clone, Default, PartialEq)]
8616    #[non_exhaustive]
8617    pub struct GcsOutputConfig {
8618        /// The Cloud Storage uri (a directory) of the output.
8619        pub gcs_uri: std::string::String,
8620
8621        /// Specifies which fields to include in the output documents.
8622        /// Only supports top level document and pages field so it must be in the
8623        /// form of `{document_field_name}` or `pages.{page_field_name}`.
8624        pub field_mask: std::option::Option<wkt::FieldMask>,
8625
8626        /// Specifies the sharding config for the output document.
8627        pub sharding_config: std::option::Option<
8628            crate::model::document_output_config::gcs_output_config::ShardingConfig,
8629        >,
8630
8631        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8632    }
8633
8634    impl GcsOutputConfig {
8635        pub fn new() -> Self {
8636            std::default::Default::default()
8637        }
8638
8639        /// Sets the value of [gcs_uri][crate::model::document_output_config::GcsOutputConfig::gcs_uri].
8640        ///
8641        /// # Example
8642        /// ```ignore,no_run
8643        /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8644        /// let x = GcsOutputConfig::new().set_gcs_uri("example");
8645        /// ```
8646        pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8647            self.gcs_uri = v.into();
8648            self
8649        }
8650
8651        /// Sets the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
8652        ///
8653        /// # Example
8654        /// ```ignore,no_run
8655        /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8656        /// use wkt::FieldMask;
8657        /// let x = GcsOutputConfig::new().set_field_mask(FieldMask::default()/* use setters */);
8658        /// ```
8659        pub fn set_field_mask<T>(mut self, v: T) -> Self
8660        where
8661            T: std::convert::Into<wkt::FieldMask>,
8662        {
8663            self.field_mask = std::option::Option::Some(v.into());
8664            self
8665        }
8666
8667        /// Sets or clears the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
8668        ///
8669        /// # Example
8670        /// ```ignore,no_run
8671        /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8672        /// use wkt::FieldMask;
8673        /// let x = GcsOutputConfig::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
8674        /// let x = GcsOutputConfig::new().set_or_clear_field_mask(None::<FieldMask>);
8675        /// ```
8676        pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
8677        where
8678            T: std::convert::Into<wkt::FieldMask>,
8679        {
8680            self.field_mask = v.map(|x| x.into());
8681            self
8682        }
8683
8684        /// Sets the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
8685        ///
8686        /// # Example
8687        /// ```ignore,no_run
8688        /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8689        /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8690        /// let x = GcsOutputConfig::new().set_sharding_config(ShardingConfig::default()/* use setters */);
8691        /// ```
8692        pub fn set_sharding_config<T>(mut self, v: T) -> Self
8693        where
8694            T: std::convert::Into<
8695                    crate::model::document_output_config::gcs_output_config::ShardingConfig,
8696                >,
8697        {
8698            self.sharding_config = std::option::Option::Some(v.into());
8699            self
8700        }
8701
8702        /// Sets or clears the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
8703        ///
8704        /// # Example
8705        /// ```ignore,no_run
8706        /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8707        /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8708        /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(Some(ShardingConfig::default()/* use setters */));
8709        /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(None::<ShardingConfig>);
8710        /// ```
8711        pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
8712        where
8713            T: std::convert::Into<
8714                    crate::model::document_output_config::gcs_output_config::ShardingConfig,
8715                >,
8716        {
8717            self.sharding_config = v.map(|x| x.into());
8718            self
8719        }
8720    }
8721
8722    impl wkt::message::Message for GcsOutputConfig {
8723        fn typename() -> &'static str {
8724            "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
8725        }
8726    }
8727
8728    /// Defines additional types related to [GcsOutputConfig].
8729    pub mod gcs_output_config {
8730        #[allow(unused_imports)]
8731        use super::*;
8732
8733        /// The sharding config for the output document.
8734        #[derive(Clone, Default, PartialEq)]
8735        #[non_exhaustive]
8736        pub struct ShardingConfig {
8737            /// The number of pages per shard.
8738            pub pages_per_shard: i32,
8739
8740            /// The number of overlapping pages between consecutive shards.
8741            pub pages_overlap: i32,
8742
8743            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8744        }
8745
8746        impl ShardingConfig {
8747            pub fn new() -> Self {
8748                std::default::Default::default()
8749            }
8750
8751            /// Sets the value of [pages_per_shard][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_per_shard].
8752            ///
8753            /// # Example
8754            /// ```ignore,no_run
8755            /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8756            /// let x = ShardingConfig::new().set_pages_per_shard(42);
8757            /// ```
8758            pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8759                self.pages_per_shard = v.into();
8760                self
8761            }
8762
8763            /// Sets the value of [pages_overlap][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_overlap].
8764            ///
8765            /// # Example
8766            /// ```ignore,no_run
8767            /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8768            /// let x = ShardingConfig::new().set_pages_overlap(42);
8769            /// ```
8770            pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8771                self.pages_overlap = v.into();
8772                self
8773            }
8774        }
8775
8776        impl wkt::message::Message for ShardingConfig {
8777            fn typename() -> &'static str {
8778                "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
8779            }
8780        }
8781    }
8782
8783    /// The destination of the results.
8784    #[derive(Clone, Debug, PartialEq)]
8785    #[non_exhaustive]
8786    pub enum Destination {
8787        /// Output config to write the results to Cloud Storage.
8788        GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
8789    }
8790}
8791
8792/// Config for Document OCR.
8793#[derive(Clone, Default, PartialEq)]
8794#[non_exhaustive]
8795pub struct OcrConfig {
8796    /// Hints for the OCR model.
8797    pub hints: std::option::Option<crate::model::ocr_config::Hints>,
8798
8799    /// Enables special handling for PDFs with existing text information. Results
8800    /// in better text extraction quality in such PDF inputs.
8801    pub enable_native_pdf_parsing: bool,
8802
8803    /// Enables intelligent document quality scores after OCR. Can help with
8804    /// diagnosing why OCR responses are of poor quality for a given input.
8805    /// Adds additional latency comparable to regular OCR to the process call.
8806    pub enable_image_quality_scores: bool,
8807
8808    /// A list of advanced OCR options to further fine-tune OCR behavior. Current
8809    /// valid values are:
8810    ///
8811    /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
8812    ///   an alternative to the current ML-based layout detection algorithm.
8813    ///   Customers can choose the best suitable layout algorithm based on their
8814    ///   situation.
8815    pub advanced_ocr_options: std::vec::Vec<std::string::String>,
8816
8817    /// Includes symbol level OCR information if set to true.
8818    pub enable_symbol: bool,
8819
8820    /// Turn on font identification model and return font style information.
8821    /// Deprecated, use
8822    /// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
8823    /// instead.
8824    ///
8825    /// [google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]: crate::model::ocr_config::PremiumFeatures::compute_style_info
8826    #[deprecated]
8827    pub compute_style_info: bool,
8828
8829    /// Turn off character box detector in OCR engine. Character box detection is
8830    /// enabled by default in OCR 2.0 (and later) processors.
8831    pub disable_character_boxes_detection: bool,
8832
8833    /// Configurations for premium OCR features.
8834    pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,
8835
8836    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8837}
8838
8839impl OcrConfig {
8840    pub fn new() -> Self {
8841        std::default::Default::default()
8842    }
8843
8844    /// Sets the value of [hints][crate::model::OcrConfig::hints].
8845    ///
8846    /// # Example
8847    /// ```ignore,no_run
8848    /// # use google_cloud_documentai_v1::model::OcrConfig;
8849    /// use google_cloud_documentai_v1::model::ocr_config::Hints;
8850    /// let x = OcrConfig::new().set_hints(Hints::default()/* use setters */);
8851    /// ```
8852    pub fn set_hints<T>(mut self, v: T) -> Self
8853    where
8854        T: std::convert::Into<crate::model::ocr_config::Hints>,
8855    {
8856        self.hints = std::option::Option::Some(v.into());
8857        self
8858    }
8859
8860    /// Sets or clears the value of [hints][crate::model::OcrConfig::hints].
8861    ///
8862    /// # Example
8863    /// ```ignore,no_run
8864    /// # use google_cloud_documentai_v1::model::OcrConfig;
8865    /// use google_cloud_documentai_v1::model::ocr_config::Hints;
8866    /// let x = OcrConfig::new().set_or_clear_hints(Some(Hints::default()/* use setters */));
8867    /// let x = OcrConfig::new().set_or_clear_hints(None::<Hints>);
8868    /// ```
8869    pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
8870    where
8871        T: std::convert::Into<crate::model::ocr_config::Hints>,
8872    {
8873        self.hints = v.map(|x| x.into());
8874        self
8875    }
8876
8877    /// Sets the value of [enable_native_pdf_parsing][crate::model::OcrConfig::enable_native_pdf_parsing].
8878    ///
8879    /// # Example
8880    /// ```ignore,no_run
8881    /// # use google_cloud_documentai_v1::model::OcrConfig;
8882    /// let x = OcrConfig::new().set_enable_native_pdf_parsing(true);
8883    /// ```
8884    pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8885        self.enable_native_pdf_parsing = v.into();
8886        self
8887    }
8888
8889    /// Sets the value of [enable_image_quality_scores][crate::model::OcrConfig::enable_image_quality_scores].
8890    ///
8891    /// # Example
8892    /// ```ignore,no_run
8893    /// # use google_cloud_documentai_v1::model::OcrConfig;
8894    /// let x = OcrConfig::new().set_enable_image_quality_scores(true);
8895    /// ```
8896    pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8897        self.enable_image_quality_scores = v.into();
8898        self
8899    }
8900
8901    /// Sets the value of [advanced_ocr_options][crate::model::OcrConfig::advanced_ocr_options].
8902    ///
8903    /// # Example
8904    /// ```ignore,no_run
8905    /// # use google_cloud_documentai_v1::model::OcrConfig;
8906    /// let x = OcrConfig::new().set_advanced_ocr_options(["a", "b", "c"]);
8907    /// ```
8908    pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
8909    where
8910        T: std::iter::IntoIterator<Item = V>,
8911        V: std::convert::Into<std::string::String>,
8912    {
8913        use std::iter::Iterator;
8914        self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
8915        self
8916    }
8917
8918    /// Sets the value of [enable_symbol][crate::model::OcrConfig::enable_symbol].
8919    ///
8920    /// # Example
8921    /// ```ignore,no_run
8922    /// # use google_cloud_documentai_v1::model::OcrConfig;
8923    /// let x = OcrConfig::new().set_enable_symbol(true);
8924    /// ```
8925    pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8926        self.enable_symbol = v.into();
8927        self
8928    }
8929
8930    /// Sets the value of [compute_style_info][crate::model::OcrConfig::compute_style_info].
8931    ///
8932    /// # Example
8933    /// ```ignore,no_run
8934    /// # use google_cloud_documentai_v1::model::OcrConfig;
8935    /// let x = OcrConfig::new().set_compute_style_info(true);
8936    /// ```
8937    #[deprecated]
8938    pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8939        self.compute_style_info = v.into();
8940        self
8941    }
8942
8943    /// Sets the value of [disable_character_boxes_detection][crate::model::OcrConfig::disable_character_boxes_detection].
8944    ///
8945    /// # Example
8946    /// ```ignore,no_run
8947    /// # use google_cloud_documentai_v1::model::OcrConfig;
8948    /// let x = OcrConfig::new().set_disable_character_boxes_detection(true);
8949    /// ```
8950    pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
8951        mut self,
8952        v: T,
8953    ) -> Self {
8954        self.disable_character_boxes_detection = v.into();
8955        self
8956    }
8957
8958    /// Sets the value of [premium_features][crate::model::OcrConfig::premium_features].
8959    ///
8960    /// # Example
8961    /// ```ignore,no_run
8962    /// # use google_cloud_documentai_v1::model::OcrConfig;
8963    /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
8964    /// let x = OcrConfig::new().set_premium_features(PremiumFeatures::default()/* use setters */);
8965    /// ```
8966    pub fn set_premium_features<T>(mut self, v: T) -> Self
8967    where
8968        T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
8969    {
8970        self.premium_features = std::option::Option::Some(v.into());
8971        self
8972    }
8973
8974    /// Sets or clears the value of [premium_features][crate::model::OcrConfig::premium_features].
8975    ///
8976    /// # Example
8977    /// ```ignore,no_run
8978    /// # use google_cloud_documentai_v1::model::OcrConfig;
8979    /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
8980    /// let x = OcrConfig::new().set_or_clear_premium_features(Some(PremiumFeatures::default()/* use setters */));
8981    /// let x = OcrConfig::new().set_or_clear_premium_features(None::<PremiumFeatures>);
8982    /// ```
8983    pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
8984    where
8985        T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
8986    {
8987        self.premium_features = v.map(|x| x.into());
8988        self
8989    }
8990}
8991
8992impl wkt::message::Message for OcrConfig {
8993    fn typename() -> &'static str {
8994        "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
8995    }
8996}
8997
8998/// Defines additional types related to [OcrConfig].
8999pub mod ocr_config {
9000    #[allow(unused_imports)]
9001    use super::*;
9002
9003    /// Hints for OCR Engine
9004    #[derive(Clone, Default, PartialEq)]
9005    #[non_exhaustive]
9006    pub struct Hints {
9007        /// List of BCP-47 language codes to use for OCR. In most cases, not
9008        /// specifying it yields the best results since it enables automatic language
9009        /// detection. For languages based on the Latin alphabet, setting hints is
9010        /// not needed. In rare cases, when the language of the text in the
9011        /// image is known, setting a hint will help get better results (although it
9012        /// will be a significant hindrance if the hint is wrong).
9013        pub language_hints: std::vec::Vec<std::string::String>,
9014
9015        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9016    }
9017
9018    impl Hints {
9019        pub fn new() -> Self {
9020            std::default::Default::default()
9021        }
9022
9023        /// Sets the value of [language_hints][crate::model::ocr_config::Hints::language_hints].
9024        ///
9025        /// # Example
9026        /// ```ignore,no_run
9027        /// # use google_cloud_documentai_v1::model::ocr_config::Hints;
9028        /// let x = Hints::new().set_language_hints(["a", "b", "c"]);
9029        /// ```
9030        pub fn set_language_hints<T, V>(mut self, v: T) -> Self
9031        where
9032            T: std::iter::IntoIterator<Item = V>,
9033            V: std::convert::Into<std::string::String>,
9034        {
9035            use std::iter::Iterator;
9036            self.language_hints = v.into_iter().map(|i| i.into()).collect();
9037            self
9038        }
9039    }
9040
9041    impl wkt::message::Message for Hints {
9042        fn typename() -> &'static str {
9043            "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
9044        }
9045    }
9046
9047    /// Configurations for premium OCR features.
9048    #[derive(Clone, Default, PartialEq)]
9049    #[non_exhaustive]
9050    pub struct PremiumFeatures {
9051        /// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
9052        /// (and later) processors.
9053        pub enable_selection_mark_detection: bool,
9054
9055        /// Turn on font identification model and return font style information.
9056        pub compute_style_info: bool,
9057
9058        /// Turn on the model that can extract LaTeX math formulas.
9059        pub enable_math_ocr: bool,
9060
9061        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9062    }
9063
9064    impl PremiumFeatures {
9065        pub fn new() -> Self {
9066            std::default::Default::default()
9067        }
9068
9069        /// Sets the value of [enable_selection_mark_detection][crate::model::ocr_config::PremiumFeatures::enable_selection_mark_detection].
9070        ///
9071        /// # Example
9072        /// ```ignore,no_run
9073        /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9074        /// let x = PremiumFeatures::new().set_enable_selection_mark_detection(true);
9075        /// ```
9076        pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
9077            mut self,
9078            v: T,
9079        ) -> Self {
9080            self.enable_selection_mark_detection = v.into();
9081            self
9082        }
9083
9084        /// Sets the value of [compute_style_info][crate::model::ocr_config::PremiumFeatures::compute_style_info].
9085        ///
9086        /// # Example
9087        /// ```ignore,no_run
9088        /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9089        /// let x = PremiumFeatures::new().set_compute_style_info(true);
9090        /// ```
9091        pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9092            self.compute_style_info = v.into();
9093            self
9094        }
9095
9096        /// Sets the value of [enable_math_ocr][crate::model::ocr_config::PremiumFeatures::enable_math_ocr].
9097        ///
9098        /// # Example
9099        /// ```ignore,no_run
9100        /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9101        /// let x = PremiumFeatures::new().set_enable_math_ocr(true);
9102        /// ```
9103        pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9104            self.enable_math_ocr = v.into();
9105            self
9106        }
9107    }
9108
9109    impl wkt::message::Message for PremiumFeatures {
9110        fn typename() -> &'static str {
9111            "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
9112        }
9113    }
9114}
9115
9116/// Options for Process API
9117#[derive(Clone, Default, PartialEq)]
9118#[non_exhaustive]
9119pub struct ProcessOptions {
9120    /// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
9121    /// Returns error if set on other processor types.
9122    pub ocr_config: std::option::Option<crate::model::OcrConfig>,
9123
9124    /// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
9125    /// Returns error if set on other processor types.
9126    pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,
9127
9128    /// Optional. Override the schema of the
9129    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
9130    /// return an Invalid Argument error if this field is set when the underlying
9131    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
9132    /// support schema override.
9133    ///
9134    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
9135    pub schema_override: std::option::Option<crate::model::DocumentSchema>,
9136
9137    /// A subset of pages to process. If not specified, all pages are processed.
9138    /// If a page range is set, only the given pages are extracted and processed
9139    /// from the document. In the output document,
9140    /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
9141    /// refers to the page number in the original document.
9142    /// This configuration only applies to online processing with
9143    /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
9144    ///
9145    /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
9146    /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
9147    pub page_range: std::option::Option<crate::model::process_options::PageRange>,
9148
9149    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9150}
9151
9152impl ProcessOptions {
9153    pub fn new() -> Self {
9154        std::default::Default::default()
9155    }
9156
9157    /// Sets the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
9158    ///
9159    /// # Example
9160    /// ```ignore,no_run
9161    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9162    /// use google_cloud_documentai_v1::model::OcrConfig;
9163    /// let x = ProcessOptions::new().set_ocr_config(OcrConfig::default()/* use setters */);
9164    /// ```
9165    pub fn set_ocr_config<T>(mut self, v: T) -> Self
9166    where
9167        T: std::convert::Into<crate::model::OcrConfig>,
9168    {
9169        self.ocr_config = std::option::Option::Some(v.into());
9170        self
9171    }
9172
9173    /// Sets or clears the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
9174    ///
9175    /// # Example
9176    /// ```ignore,no_run
9177    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9178    /// use google_cloud_documentai_v1::model::OcrConfig;
9179    /// let x = ProcessOptions::new().set_or_clear_ocr_config(Some(OcrConfig::default()/* use setters */));
9180    /// let x = ProcessOptions::new().set_or_clear_ocr_config(None::<OcrConfig>);
9181    /// ```
9182    pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
9183    where
9184        T: std::convert::Into<crate::model::OcrConfig>,
9185    {
9186        self.ocr_config = v.map(|x| x.into());
9187        self
9188    }
9189
9190    /// Sets the value of [layout_config][crate::model::ProcessOptions::layout_config].
9191    ///
9192    /// # Example
9193    /// ```ignore,no_run
9194    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9195    /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9196    /// let x = ProcessOptions::new().set_layout_config(LayoutConfig::default()/* use setters */);
9197    /// ```
9198    pub fn set_layout_config<T>(mut self, v: T) -> Self
9199    where
9200        T: std::convert::Into<crate::model::process_options::LayoutConfig>,
9201    {
9202        self.layout_config = std::option::Option::Some(v.into());
9203        self
9204    }
9205
9206    /// Sets or clears the value of [layout_config][crate::model::ProcessOptions::layout_config].
9207    ///
9208    /// # Example
9209    /// ```ignore,no_run
9210    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9211    /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9212    /// let x = ProcessOptions::new().set_or_clear_layout_config(Some(LayoutConfig::default()/* use setters */));
9213    /// let x = ProcessOptions::new().set_or_clear_layout_config(None::<LayoutConfig>);
9214    /// ```
9215    pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
9216    where
9217        T: std::convert::Into<crate::model::process_options::LayoutConfig>,
9218    {
9219        self.layout_config = v.map(|x| x.into());
9220        self
9221    }
9222
9223    /// Sets the value of [schema_override][crate::model::ProcessOptions::schema_override].
9224    ///
9225    /// # Example
9226    /// ```ignore,no_run
9227    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9228    /// use google_cloud_documentai_v1::model::DocumentSchema;
9229    /// let x = ProcessOptions::new().set_schema_override(DocumentSchema::default()/* use setters */);
9230    /// ```
9231    pub fn set_schema_override<T>(mut self, v: T) -> Self
9232    where
9233        T: std::convert::Into<crate::model::DocumentSchema>,
9234    {
9235        self.schema_override = std::option::Option::Some(v.into());
9236        self
9237    }
9238
9239    /// Sets or clears the value of [schema_override][crate::model::ProcessOptions::schema_override].
9240    ///
9241    /// # Example
9242    /// ```ignore,no_run
9243    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9244    /// use google_cloud_documentai_v1::model::DocumentSchema;
9245    /// let x = ProcessOptions::new().set_or_clear_schema_override(Some(DocumentSchema::default()/* use setters */));
9246    /// let x = ProcessOptions::new().set_or_clear_schema_override(None::<DocumentSchema>);
9247    /// ```
9248    pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
9249    where
9250        T: std::convert::Into<crate::model::DocumentSchema>,
9251    {
9252        self.schema_override = v.map(|x| x.into());
9253        self
9254    }
9255
9256    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range].
9257    ///
9258    /// Note that all the setters affecting `page_range` are mutually
9259    /// exclusive.
9260    ///
9261    /// # Example
9262    /// ```ignore,no_run
9263    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9264    /// use google_cloud_documentai_v1::model::process_options::PageRange;
9265    /// let x = ProcessOptions::new().set_page_range(Some(PageRange::FromStart(42)));
9266    /// ```
9267    pub fn set_page_range<
9268        T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
9269    >(
9270        mut self,
9271        v: T,
9272    ) -> Self {
9273        self.page_range = v.into();
9274        self
9275    }
9276
9277    /// The value of [page_range][crate::model::ProcessOptions::page_range]
9278    /// if it holds a `IndividualPageSelector`, `None` if the field is not set or
9279    /// holds a different branch.
9280    pub fn individual_page_selector(
9281        &self,
9282    ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
9283    {
9284        #[allow(unreachable_patterns)]
9285        self.page_range.as_ref().and_then(|v| match v {
9286            crate::model::process_options::PageRange::IndividualPageSelector(v) => {
9287                std::option::Option::Some(v)
9288            }
9289            _ => std::option::Option::None,
9290        })
9291    }
9292
9293    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
9294    /// to hold a `IndividualPageSelector`.
9295    ///
9296    /// Note that all the setters affecting `page_range` are
9297    /// mutually exclusive.
9298    ///
9299    /// # Example
9300    /// ```ignore,no_run
9301    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9302    /// use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
9303    /// let x = ProcessOptions::new().set_individual_page_selector(IndividualPageSelector::default()/* use setters */);
9304    /// assert!(x.individual_page_selector().is_some());
9305    /// assert!(x.from_start().is_none());
9306    /// assert!(x.from_end().is_none());
9307    /// ```
9308    pub fn set_individual_page_selector<
9309        T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
9310    >(
9311        mut self,
9312        v: T,
9313    ) -> Self {
9314        self.page_range = std::option::Option::Some(
9315            crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
9316        );
9317        self
9318    }
9319
9320    /// The value of [page_range][crate::model::ProcessOptions::page_range]
9321    /// if it holds a `FromStart`, `None` if the field is not set or
9322    /// holds a different branch.
9323    pub fn from_start(&self) -> std::option::Option<&i32> {
9324        #[allow(unreachable_patterns)]
9325        self.page_range.as_ref().and_then(|v| match v {
9326            crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
9327            _ => std::option::Option::None,
9328        })
9329    }
9330
9331    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
9332    /// to hold a `FromStart`.
9333    ///
9334    /// Note that all the setters affecting `page_range` are
9335    /// mutually exclusive.
9336    ///
9337    /// # Example
9338    /// ```ignore,no_run
9339    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9340    /// let x = ProcessOptions::new().set_from_start(42);
9341    /// assert!(x.from_start().is_some());
9342    /// assert!(x.individual_page_selector().is_none());
9343    /// assert!(x.from_end().is_none());
9344    /// ```
9345    pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9346        self.page_range = std::option::Option::Some(
9347            crate::model::process_options::PageRange::FromStart(v.into()),
9348        );
9349        self
9350    }
9351
9352    /// The value of [page_range][crate::model::ProcessOptions::page_range]
9353    /// if it holds a `FromEnd`, `None` if the field is not set or
9354    /// holds a different branch.
9355    pub fn from_end(&self) -> std::option::Option<&i32> {
9356        #[allow(unreachable_patterns)]
9357        self.page_range.as_ref().and_then(|v| match v {
9358            crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
9359            _ => std::option::Option::None,
9360        })
9361    }
9362
9363    /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
9364    /// to hold a `FromEnd`.
9365    ///
9366    /// Note that all the setters affecting `page_range` are
9367    /// mutually exclusive.
9368    ///
9369    /// # Example
9370    /// ```ignore,no_run
9371    /// # use google_cloud_documentai_v1::model::ProcessOptions;
9372    /// let x = ProcessOptions::new().set_from_end(42);
9373    /// assert!(x.from_end().is_some());
9374    /// assert!(x.individual_page_selector().is_none());
9375    /// assert!(x.from_start().is_none());
9376    /// ```
9377    pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9378        self.page_range =
9379            std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
9380        self
9381    }
9382}
9383
9384impl wkt::message::Message for ProcessOptions {
9385    fn typename() -> &'static str {
9386        "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
9387    }
9388}
9389
9390/// Defines additional types related to [ProcessOptions].
9391pub mod process_options {
9392    #[allow(unused_imports)]
9393    use super::*;
9394
9395    /// Serving config for layout parser processor.
9396    #[derive(Clone, Default, PartialEq)]
9397    #[non_exhaustive]
9398    pub struct LayoutConfig {
9399        /// Optional. Config for chunking in layout parser processor.
9400        pub chunking_config:
9401            std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,
9402
9403        /// Optional. Whether to include images in layout parser processor response.
9404        pub return_images: bool,
9405
9406        /// Optional. Whether to include bounding boxes in layout parser processor
9407        /// response.
9408        pub return_bounding_boxes: bool,
9409
9410        /// Optional. Whether to include image annotations in layout parser response.
9411        pub enable_image_annotation: bool,
9412
9413        /// Optional. Whether to include table annotations in layout parser response.
9414        pub enable_table_annotation: bool,
9415
9416        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9417    }
9418
9419    impl LayoutConfig {
9420        pub fn new() -> Self {
9421            std::default::Default::default()
9422        }
9423
9424        /// Sets the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
9425        ///
9426        /// # Example
9427        /// ```ignore,no_run
9428        /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9429        /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9430        /// let x = LayoutConfig::new().set_chunking_config(ChunkingConfig::default()/* use setters */);
9431        /// ```
9432        pub fn set_chunking_config<T>(mut self, v: T) -> Self
9433        where
9434            T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
9435        {
9436            self.chunking_config = std::option::Option::Some(v.into());
9437            self
9438        }
9439
9440        /// Sets or clears the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
9441        ///
9442        /// # Example
9443        /// ```ignore,no_run
9444        /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9445        /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9446        /// let x = LayoutConfig::new().set_or_clear_chunking_config(Some(ChunkingConfig::default()/* use setters */));
9447        /// let x = LayoutConfig::new().set_or_clear_chunking_config(None::<ChunkingConfig>);
9448        /// ```
9449        pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
9450        where
9451            T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
9452        {
9453            self.chunking_config = v.map(|x| x.into());
9454            self
9455        }
9456
9457        /// Sets the value of [return_images][crate::model::process_options::LayoutConfig::return_images].
9458        ///
9459        /// # Example
9460        /// ```ignore,no_run
9461        /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9462        /// let x = LayoutConfig::new().set_return_images(true);
9463        /// ```
9464        pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9465            self.return_images = v.into();
9466            self
9467        }
9468
9469        /// Sets the value of [return_bounding_boxes][crate::model::process_options::LayoutConfig::return_bounding_boxes].
9470        ///
9471        /// # Example
9472        /// ```ignore,no_run
9473        /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9474        /// let x = LayoutConfig::new().set_return_bounding_boxes(true);
9475        /// ```
9476        pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9477            self.return_bounding_boxes = v.into();
9478            self
9479        }
9480
9481        /// Sets the value of [enable_image_annotation][crate::model::process_options::LayoutConfig::enable_image_annotation].
9482        ///
9483        /// # Example
9484        /// ```ignore,no_run
9485        /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9486        /// let x = LayoutConfig::new().set_enable_image_annotation(true);
9487        /// ```
9488        pub fn set_enable_image_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9489            self.enable_image_annotation = v.into();
9490            self
9491        }
9492
9493        /// Sets the value of [enable_table_annotation][crate::model::process_options::LayoutConfig::enable_table_annotation].
9494        ///
9495        /// # Example
9496        /// ```ignore,no_run
9497        /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9498        /// let x = LayoutConfig::new().set_enable_table_annotation(true);
9499        /// ```
9500        pub fn set_enable_table_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9501            self.enable_table_annotation = v.into();
9502            self
9503        }
9504    }
9505
9506    impl wkt::message::Message for LayoutConfig {
9507        fn typename() -> &'static str {
9508            "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
9509        }
9510    }
9511
9512    /// Defines additional types related to [LayoutConfig].
9513    pub mod layout_config {
9514        #[allow(unused_imports)]
9515        use super::*;
9516
9517        /// Serving config for chunking.
9518        #[derive(Clone, Default, PartialEq)]
9519        #[non_exhaustive]
9520        pub struct ChunkingConfig {
9521            /// Optional. The chunk sizes to use when splitting documents, in order of
9522            /// level.
9523            pub chunk_size: i32,
9524
9525            /// Optional. Whether or not to include ancestor headings when splitting.
9526            pub include_ancestor_headings: bool,
9527
9528            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9529        }
9530
9531        impl ChunkingConfig {
9532            pub fn new() -> Self {
9533                std::default::Default::default()
9534            }
9535
9536            /// Sets the value of [chunk_size][crate::model::process_options::layout_config::ChunkingConfig::chunk_size].
9537            ///
9538            /// # Example
9539            /// ```ignore,no_run
9540            /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9541            /// let x = ChunkingConfig::new().set_chunk_size(42);
9542            /// ```
9543            pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9544                self.chunk_size = v.into();
9545                self
9546            }
9547
9548            /// Sets the value of [include_ancestor_headings][crate::model::process_options::layout_config::ChunkingConfig::include_ancestor_headings].
9549            ///
9550            /// # Example
9551            /// ```ignore,no_run
9552            /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9553            /// let x = ChunkingConfig::new().set_include_ancestor_headings(true);
9554            /// ```
9555            pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
9556                mut self,
9557                v: T,
9558            ) -> Self {
9559                self.include_ancestor_headings = v.into();
9560                self
9561            }
9562        }
9563
9564        impl wkt::message::Message for ChunkingConfig {
9565            fn typename() -> &'static str {
9566                "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
9567            }
9568        }
9569    }
9570
9571    /// A list of individual page numbers.
9572    #[derive(Clone, Default, PartialEq)]
9573    #[non_exhaustive]
9574    pub struct IndividualPageSelector {
9575        /// Optional. Indices of the pages (starting from 1).
9576        pub pages: std::vec::Vec<i32>,
9577
9578        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9579    }
9580
9581    impl IndividualPageSelector {
9582        pub fn new() -> Self {
9583            std::default::Default::default()
9584        }
9585
9586        /// Sets the value of [pages][crate::model::process_options::IndividualPageSelector::pages].
9587        ///
9588        /// # Example
9589        /// ```ignore,no_run
9590        /// # use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
9591        /// let x = IndividualPageSelector::new().set_pages([1, 2, 3]);
9592        /// ```
9593        pub fn set_pages<T, V>(mut self, v: T) -> Self
9594        where
9595            T: std::iter::IntoIterator<Item = V>,
9596            V: std::convert::Into<i32>,
9597        {
9598            use std::iter::Iterator;
9599            self.pages = v.into_iter().map(|i| i.into()).collect();
9600            self
9601        }
9602    }
9603
9604    impl wkt::message::Message for IndividualPageSelector {
9605        fn typename() -> &'static str {
9606            "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
9607        }
9608    }
9609
9610    /// A subset of pages to process. If not specified, all pages are processed.
9611    /// If a page range is set, only the given pages are extracted and processed
9612    /// from the document. In the output document,
9613    /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
9614    /// refers to the page number in the original document.
9615    /// This configuration only applies to online processing with
9616    /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
9617    ///
9618    /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
9619    /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
9620    #[derive(Clone, Debug, PartialEq)]
9621    #[non_exhaustive]
9622    pub enum PageRange {
9623        /// Which pages to process (1-indexed).
9624        IndividualPageSelector(
9625            std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
9626        ),
9627        /// Only process certain pages from the start. Process all if the document
9628        /// has fewer pages.
9629        FromStart(i32),
9630        /// Only process certain pages from the end, same as above.
9631        FromEnd(i32),
9632    }
9633}
9634
9635/// Request message for the
9636/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
9637/// method.
9638///
9639/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
9640#[derive(Clone, Default, PartialEq)]
9641#[non_exhaustive]
9642pub struct ProcessRequest {
9643    /// Required. The resource name of the
9644    /// [Processor][google.cloud.documentai.v1.Processor] or
9645    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
9646    /// to use for processing. If a
9647    /// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
9648    /// will use its [default
9649    /// version][google.cloud.documentai.v1.Processor.default_processor_version].
9650    /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
9651    /// or
9652    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
9653    ///
9654    /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
9655    /// [google.cloud.documentai.v1.Processor.default_processor_version]: crate::model::Processor::default_processor_version
9656    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
9657    pub name: std::string::String,
9658
9659    /// Whether human review should be skipped for this request. Default to
9660    /// `false`.
9661    pub skip_human_review: bool,
9662
9663    /// Specifies which fields to include in the
9664    /// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
9665    /// output. Only supports top-level document and pages field, so it must be in
9666    /// the form of `{document_field_name}` or `pages.{page_field_name}`.
9667    ///
9668    /// [google.cloud.documentai.v1.ProcessResponse.document]: crate::model::ProcessResponse::document
9669    pub field_mask: std::option::Option<wkt::FieldMask>,
9670
9671    /// Inference-time options for the process API
9672    pub process_options: std::option::Option<crate::model::ProcessOptions>,
9673
9674    /// Optional. The labels with user-defined metadata for the request.
9675    ///
9676    /// Label keys and values can be no longer than 63 characters
9677    /// (Unicode codepoints) and can only contain lowercase letters, numeric
9678    /// characters, underscores, and dashes. International characters are allowed.
9679    /// Label values are optional. Label keys must start with a letter.
9680    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9681
9682    /// Optional. Option to remove images from the document.
9683    pub imageless_mode: bool,
9684
9685    /// The document payload.
9686    pub source: std::option::Option<crate::model::process_request::Source>,
9687
9688    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9689}
9690
9691impl ProcessRequest {
9692    pub fn new() -> Self {
9693        std::default::Default::default()
9694    }
9695
9696    /// Sets the value of [name][crate::model::ProcessRequest::name].
9697    ///
9698    /// # Example
9699    /// ```ignore,no_run
9700    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9701    /// let x = ProcessRequest::new().set_name("example");
9702    /// ```
9703    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9704        self.name = v.into();
9705        self
9706    }
9707
9708    /// Sets the value of [skip_human_review][crate::model::ProcessRequest::skip_human_review].
9709    ///
9710    /// # Example
9711    /// ```ignore,no_run
9712    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9713    /// let x = ProcessRequest::new().set_skip_human_review(true);
9714    /// ```
9715    pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9716        self.skip_human_review = v.into();
9717        self
9718    }
9719
9720    /// Sets the value of [field_mask][crate::model::ProcessRequest::field_mask].
9721    ///
9722    /// # Example
9723    /// ```ignore,no_run
9724    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9725    /// use wkt::FieldMask;
9726    /// let x = ProcessRequest::new().set_field_mask(FieldMask::default()/* use setters */);
9727    /// ```
9728    pub fn set_field_mask<T>(mut self, v: T) -> Self
9729    where
9730        T: std::convert::Into<wkt::FieldMask>,
9731    {
9732        self.field_mask = std::option::Option::Some(v.into());
9733        self
9734    }
9735
9736    /// Sets or clears the value of [field_mask][crate::model::ProcessRequest::field_mask].
9737    ///
9738    /// # Example
9739    /// ```ignore,no_run
9740    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9741    /// use wkt::FieldMask;
9742    /// let x = ProcessRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
9743    /// let x = ProcessRequest::new().set_or_clear_field_mask(None::<FieldMask>);
9744    /// ```
9745    pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
9746    where
9747        T: std::convert::Into<wkt::FieldMask>,
9748    {
9749        self.field_mask = v.map(|x| x.into());
9750        self
9751    }
9752
9753    /// Sets the value of [process_options][crate::model::ProcessRequest::process_options].
9754    ///
9755    /// # Example
9756    /// ```ignore,no_run
9757    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9758    /// use google_cloud_documentai_v1::model::ProcessOptions;
9759    /// let x = ProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
9760    /// ```
9761    pub fn set_process_options<T>(mut self, v: T) -> Self
9762    where
9763        T: std::convert::Into<crate::model::ProcessOptions>,
9764    {
9765        self.process_options = std::option::Option::Some(v.into());
9766        self
9767    }
9768
9769    /// Sets or clears the value of [process_options][crate::model::ProcessRequest::process_options].
9770    ///
9771    /// # Example
9772    /// ```ignore,no_run
9773    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9774    /// use google_cloud_documentai_v1::model::ProcessOptions;
9775    /// let x = ProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
9776    /// let x = ProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
9777    /// ```
9778    pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
9779    where
9780        T: std::convert::Into<crate::model::ProcessOptions>,
9781    {
9782        self.process_options = v.map(|x| x.into());
9783        self
9784    }
9785
9786    /// Sets the value of [labels][crate::model::ProcessRequest::labels].
9787    ///
9788    /// # Example
9789    /// ```ignore,no_run
9790    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9791    /// let x = ProcessRequest::new().set_labels([
9792    ///     ("key0", "abc"),
9793    ///     ("key1", "xyz"),
9794    /// ]);
9795    /// ```
9796    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9797    where
9798        T: std::iter::IntoIterator<Item = (K, V)>,
9799        K: std::convert::Into<std::string::String>,
9800        V: std::convert::Into<std::string::String>,
9801    {
9802        use std::iter::Iterator;
9803        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9804        self
9805    }
9806
9807    /// Sets the value of [imageless_mode][crate::model::ProcessRequest::imageless_mode].
9808    ///
9809    /// # Example
9810    /// ```ignore,no_run
9811    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9812    /// let x = ProcessRequest::new().set_imageless_mode(true);
9813    /// ```
9814    pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9815        self.imageless_mode = v.into();
9816        self
9817    }
9818
9819    /// Sets the value of [source][crate::model::ProcessRequest::source].
9820    ///
9821    /// Note that all the setters affecting `source` are mutually
9822    /// exclusive.
9823    ///
9824    /// # Example
9825    /// ```ignore,no_run
9826    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9827    /// use google_cloud_documentai_v1::model::Document;
9828    /// let x = ProcessRequest::new().set_source(Some(
9829    ///     google_cloud_documentai_v1::model::process_request::Source::InlineDocument(Document::default().into())));
9830    /// ```
9831    pub fn set_source<
9832        T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
9833    >(
9834        mut self,
9835        v: T,
9836    ) -> Self {
9837        self.source = v.into();
9838        self
9839    }
9840
9841    /// The value of [source][crate::model::ProcessRequest::source]
9842    /// if it holds a `InlineDocument`, `None` if the field is not set or
9843    /// holds a different branch.
9844    pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
9845        #[allow(unreachable_patterns)]
9846        self.source.as_ref().and_then(|v| match v {
9847            crate::model::process_request::Source::InlineDocument(v) => {
9848                std::option::Option::Some(v)
9849            }
9850            _ => std::option::Option::None,
9851        })
9852    }
9853
9854    /// Sets the value of [source][crate::model::ProcessRequest::source]
9855    /// to hold a `InlineDocument`.
9856    ///
9857    /// Note that all the setters affecting `source` are
9858    /// mutually exclusive.
9859    ///
9860    /// # Example
9861    /// ```ignore,no_run
9862    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9863    /// use google_cloud_documentai_v1::model::Document;
9864    /// let x = ProcessRequest::new().set_inline_document(Document::default()/* use setters */);
9865    /// assert!(x.inline_document().is_some());
9866    /// assert!(x.raw_document().is_none());
9867    /// assert!(x.gcs_document().is_none());
9868    /// ```
9869    pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
9870        mut self,
9871        v: T,
9872    ) -> Self {
9873        self.source = std::option::Option::Some(
9874            crate::model::process_request::Source::InlineDocument(v.into()),
9875        );
9876        self
9877    }
9878
9879    /// The value of [source][crate::model::ProcessRequest::source]
9880    /// if it holds a `RawDocument`, `None` if the field is not set or
9881    /// holds a different branch.
9882    pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
9883        #[allow(unreachable_patterns)]
9884        self.source.as_ref().and_then(|v| match v {
9885            crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
9886            _ => std::option::Option::None,
9887        })
9888    }
9889
9890    /// Sets the value of [source][crate::model::ProcessRequest::source]
9891    /// to hold a `RawDocument`.
9892    ///
9893    /// Note that all the setters affecting `source` are
9894    /// mutually exclusive.
9895    ///
9896    /// # Example
9897    /// ```ignore,no_run
9898    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9899    /// use google_cloud_documentai_v1::model::RawDocument;
9900    /// let x = ProcessRequest::new().set_raw_document(RawDocument::default()/* use setters */);
9901    /// assert!(x.raw_document().is_some());
9902    /// assert!(x.inline_document().is_none());
9903    /// assert!(x.gcs_document().is_none());
9904    /// ```
9905    pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
9906        mut self,
9907        v: T,
9908    ) -> Self {
9909        self.source =
9910            std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
9911        self
9912    }
9913
9914    /// The value of [source][crate::model::ProcessRequest::source]
9915    /// if it holds a `GcsDocument`, `None` if the field is not set or
9916    /// holds a different branch.
9917    pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
9918        #[allow(unreachable_patterns)]
9919        self.source.as_ref().and_then(|v| match v {
9920            crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
9921            _ => std::option::Option::None,
9922        })
9923    }
9924
9925    /// Sets the value of [source][crate::model::ProcessRequest::source]
9926    /// to hold a `GcsDocument`.
9927    ///
9928    /// Note that all the setters affecting `source` are
9929    /// mutually exclusive.
9930    ///
9931    /// # Example
9932    /// ```ignore,no_run
9933    /// # use google_cloud_documentai_v1::model::ProcessRequest;
9934    /// use google_cloud_documentai_v1::model::GcsDocument;
9935    /// let x = ProcessRequest::new().set_gcs_document(GcsDocument::default()/* use setters */);
9936    /// assert!(x.gcs_document().is_some());
9937    /// assert!(x.inline_document().is_none());
9938    /// assert!(x.raw_document().is_none());
9939    /// ```
9940    pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
9941        mut self,
9942        v: T,
9943    ) -> Self {
9944        self.source =
9945            std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
9946        self
9947    }
9948}
9949
9950impl wkt::message::Message for ProcessRequest {
9951    fn typename() -> &'static str {
9952        "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
9953    }
9954}
9955
9956/// Defines additional types related to [ProcessRequest].
9957pub mod process_request {
9958    #[allow(unused_imports)]
9959    use super::*;
9960
9961    /// The document payload.
9962    #[derive(Clone, Debug, PartialEq)]
9963    #[non_exhaustive]
9964    pub enum Source {
9965        /// An inline document proto.
9966        InlineDocument(std::boxed::Box<crate::model::Document>),
9967        /// A raw document content (bytes).
9968        RawDocument(std::boxed::Box<crate::model::RawDocument>),
9969        /// A raw document on Google Cloud Storage.
9970        GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
9971    }
9972}
9973
9974/// The status of human review on a processed document.
9975#[derive(Clone, Default, PartialEq)]
9976#[non_exhaustive]
9977pub struct HumanReviewStatus {
9978    /// The state of human review on the processing request.
9979    pub state: crate::model::human_review_status::State,
9980
9981    /// A message providing more details about the human review state.
9982    pub state_message: std::string::String,
9983
9984    /// The name of the operation triggered by the processed document. This field
9985    /// is populated only when the
9986    /// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
9987    /// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
9988    /// the long-running operation returned by
9989    /// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
9990    ///
9991    /// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
9992    /// [google.cloud.documentai.v1.HumanReviewStatus.state]: crate::model::HumanReviewStatus::state
9993    pub human_review_operation: std::string::String,
9994
9995    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9996}
9997
9998impl HumanReviewStatus {
9999    pub fn new() -> Self {
10000        std::default::Default::default()
10001    }
10002
10003    /// Sets the value of [state][crate::model::HumanReviewStatus::state].
10004    ///
10005    /// # Example
10006    /// ```ignore,no_run
10007    /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
10008    /// use google_cloud_documentai_v1::model::human_review_status::State;
10009    /// let x0 = HumanReviewStatus::new().set_state(State::Skipped);
10010    /// let x1 = HumanReviewStatus::new().set_state(State::ValidationPassed);
10011    /// let x2 = HumanReviewStatus::new().set_state(State::InProgress);
10012    /// ```
10013    pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
10014        mut self,
10015        v: T,
10016    ) -> Self {
10017        self.state = v.into();
10018        self
10019    }
10020
10021    /// Sets the value of [state_message][crate::model::HumanReviewStatus::state_message].
10022    ///
10023    /// # Example
10024    /// ```ignore,no_run
10025    /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
10026    /// let x = HumanReviewStatus::new().set_state_message("example");
10027    /// ```
10028    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10029        self.state_message = v.into();
10030        self
10031    }
10032
10033    /// Sets the value of [human_review_operation][crate::model::HumanReviewStatus::human_review_operation].
10034    ///
10035    /// # Example
10036    /// ```ignore,no_run
10037    /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
10038    /// let x = HumanReviewStatus::new().set_human_review_operation("example");
10039    /// ```
10040    pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
10041        mut self,
10042        v: T,
10043    ) -> Self {
10044        self.human_review_operation = v.into();
10045        self
10046    }
10047}
10048
10049impl wkt::message::Message for HumanReviewStatus {
10050    fn typename() -> &'static str {
10051        "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
10052    }
10053}
10054
10055/// Defines additional types related to [HumanReviewStatus].
10056pub mod human_review_status {
10057    #[allow(unused_imports)]
10058    use super::*;
10059
10060    /// The final state of human review on a processed document.
10061    ///
10062    /// # Working with unknown values
10063    ///
10064    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10065    /// additional enum variants at any time. Adding new variants is not considered
10066    /// a breaking change. Applications should write their code in anticipation of:
10067    ///
10068    /// - New values appearing in future releases of the client library, **and**
10069    /// - New values received dynamically, without application changes.
10070    ///
10071    /// Please consult the [Working with enums] section in the user guide for some
10072    /// guidelines.
10073    ///
10074    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10075    #[derive(Clone, Debug, PartialEq)]
10076    #[non_exhaustive]
10077    pub enum State {
10078        /// Human review state is unspecified. Most likely due to an internal error.
10079        Unspecified,
10080        /// Human review is skipped for the document. This can happen because human
10081        /// review isn't enabled on the processor or the processing request has
10082        /// been set to skip this document.
10083        Skipped,
10084        /// Human review validation is triggered and passed, so no review is needed.
10085        ValidationPassed,
10086        /// Human review validation is triggered and the document is under review.
10087        InProgress,
10088        /// Some error happened during triggering human review, see the
10089        /// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
10090        /// for details.
10091        ///
10092        /// [google.cloud.documentai.v1.HumanReviewStatus.state_message]: crate::model::HumanReviewStatus::state_message
10093        Error,
10094        /// If set, the enum was initialized with an unknown value.
10095        ///
10096        /// Applications can examine the value using [State::value] or
10097        /// [State::name].
10098        UnknownValue(state::UnknownValue),
10099    }
10100
10101    #[doc(hidden)]
10102    pub mod state {
10103        #[allow(unused_imports)]
10104        use super::*;
10105        #[derive(Clone, Debug, PartialEq)]
10106        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10107    }
10108
10109    impl State {
10110        /// Gets the enum value.
10111        ///
10112        /// Returns `None` if the enum contains an unknown value deserialized from
10113        /// the string representation of enums.
10114        pub fn value(&self) -> std::option::Option<i32> {
10115            match self {
10116                Self::Unspecified => std::option::Option::Some(0),
10117                Self::Skipped => std::option::Option::Some(1),
10118                Self::ValidationPassed => std::option::Option::Some(2),
10119                Self::InProgress => std::option::Option::Some(3),
10120                Self::Error => std::option::Option::Some(4),
10121                Self::UnknownValue(u) => u.0.value(),
10122            }
10123        }
10124
10125        /// Gets the enum value as a string.
10126        ///
10127        /// Returns `None` if the enum contains an unknown value deserialized from
10128        /// the integer representation of enums.
10129        pub fn name(&self) -> std::option::Option<&str> {
10130            match self {
10131                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10132                Self::Skipped => std::option::Option::Some("SKIPPED"),
10133                Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
10134                Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
10135                Self::Error => std::option::Option::Some("ERROR"),
10136                Self::UnknownValue(u) => u.0.name(),
10137            }
10138        }
10139    }
10140
10141    impl std::default::Default for State {
10142        fn default() -> Self {
10143            use std::convert::From;
10144            Self::from(0)
10145        }
10146    }
10147
10148    impl std::fmt::Display for State {
10149        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10150            wkt::internal::display_enum(f, self.name(), self.value())
10151        }
10152    }
10153
10154    impl std::convert::From<i32> for State {
10155        fn from(value: i32) -> Self {
10156            match value {
10157                0 => Self::Unspecified,
10158                1 => Self::Skipped,
10159                2 => Self::ValidationPassed,
10160                3 => Self::InProgress,
10161                4 => Self::Error,
10162                _ => Self::UnknownValue(state::UnknownValue(
10163                    wkt::internal::UnknownEnumValue::Integer(value),
10164                )),
10165            }
10166        }
10167    }
10168
10169    impl std::convert::From<&str> for State {
10170        fn from(value: &str) -> Self {
10171            use std::string::ToString;
10172            match value {
10173                "STATE_UNSPECIFIED" => Self::Unspecified,
10174                "SKIPPED" => Self::Skipped,
10175                "VALIDATION_PASSED" => Self::ValidationPassed,
10176                "IN_PROGRESS" => Self::InProgress,
10177                "ERROR" => Self::Error,
10178                _ => Self::UnknownValue(state::UnknownValue(
10179                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10180                )),
10181            }
10182        }
10183    }
10184
10185    impl serde::ser::Serialize for State {
10186        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10187        where
10188            S: serde::Serializer,
10189        {
10190            match self {
10191                Self::Unspecified => serializer.serialize_i32(0),
10192                Self::Skipped => serializer.serialize_i32(1),
10193                Self::ValidationPassed => serializer.serialize_i32(2),
10194                Self::InProgress => serializer.serialize_i32(3),
10195                Self::Error => serializer.serialize_i32(4),
10196                Self::UnknownValue(u) => u.0.serialize(serializer),
10197            }
10198        }
10199    }
10200
10201    impl<'de> serde::de::Deserialize<'de> for State {
10202        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10203        where
10204            D: serde::Deserializer<'de>,
10205        {
10206            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10207                ".google.cloud.documentai.v1.HumanReviewStatus.State",
10208            ))
10209        }
10210    }
10211}
10212
10213/// Response message for the
10214/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
10215/// method.
10216///
10217/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10218#[derive(Clone, Default, PartialEq)]
10219#[non_exhaustive]
10220pub struct ProcessResponse {
10221    /// The document payload, will populate fields based on the processor's
10222    /// behavior.
10223    pub document: std::option::Option<crate::model::Document>,
10224
10225    /// The status of human review on the processed document.
10226    pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
10227
10228    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10229}
10230
10231impl ProcessResponse {
10232    pub fn new() -> Self {
10233        std::default::Default::default()
10234    }
10235
10236    /// Sets the value of [document][crate::model::ProcessResponse::document].
10237    ///
10238    /// # Example
10239    /// ```ignore,no_run
10240    /// # use google_cloud_documentai_v1::model::ProcessResponse;
10241    /// use google_cloud_documentai_v1::model::Document;
10242    /// let x = ProcessResponse::new().set_document(Document::default()/* use setters */);
10243    /// ```
10244    pub fn set_document<T>(mut self, v: T) -> Self
10245    where
10246        T: std::convert::Into<crate::model::Document>,
10247    {
10248        self.document = std::option::Option::Some(v.into());
10249        self
10250    }
10251
10252    /// Sets or clears the value of [document][crate::model::ProcessResponse::document].
10253    ///
10254    /// # Example
10255    /// ```ignore,no_run
10256    /// # use google_cloud_documentai_v1::model::ProcessResponse;
10257    /// use google_cloud_documentai_v1::model::Document;
10258    /// let x = ProcessResponse::new().set_or_clear_document(Some(Document::default()/* use setters */));
10259    /// let x = ProcessResponse::new().set_or_clear_document(None::<Document>);
10260    /// ```
10261    pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
10262    where
10263        T: std::convert::Into<crate::model::Document>,
10264    {
10265        self.document = v.map(|x| x.into());
10266        self
10267    }
10268
10269    /// Sets the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
10270    ///
10271    /// # Example
10272    /// ```ignore,no_run
10273    /// # use google_cloud_documentai_v1::model::ProcessResponse;
10274    /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10275    /// let x = ProcessResponse::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
10276    /// ```
10277    pub fn set_human_review_status<T>(mut self, v: T) -> Self
10278    where
10279        T: std::convert::Into<crate::model::HumanReviewStatus>,
10280    {
10281        self.human_review_status = std::option::Option::Some(v.into());
10282        self
10283    }
10284
10285    /// Sets or clears the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
10286    ///
10287    /// # Example
10288    /// ```ignore,no_run
10289    /// # use google_cloud_documentai_v1::model::ProcessResponse;
10290    /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10291    /// let x = ProcessResponse::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
10292    /// let x = ProcessResponse::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
10293    /// ```
10294    pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
10295    where
10296        T: std::convert::Into<crate::model::HumanReviewStatus>,
10297    {
10298        self.human_review_status = v.map(|x| x.into());
10299        self
10300    }
10301}
10302
10303impl wkt::message::Message for ProcessResponse {
10304    fn typename() -> &'static str {
10305        "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
10306    }
10307}
10308
10309/// Request message for
10310/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
10311///
10312/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10313#[derive(Clone, Default, PartialEq)]
10314#[non_exhaustive]
10315pub struct BatchProcessRequest {
10316    /// Required. The resource name of
10317    /// [Processor][google.cloud.documentai.v1.Processor] or
10318    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
10319    /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
10320    /// or
10321    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
10322    ///
10323    /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
10324    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10325    pub name: std::string::String,
10326
10327    /// The input documents for the
10328    /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
10329    /// method.
10330    ///
10331    /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10332    pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
10333
10334    /// The output configuration for the
10335    /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
10336    /// method.
10337    ///
10338    /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10339    pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
10340
10341    /// Whether human review should be skipped for this request. Default to
10342    /// `false`.
10343    pub skip_human_review: bool,
10344
10345    /// Inference-time options for the process API
10346    pub process_options: std::option::Option<crate::model::ProcessOptions>,
10347
10348    /// Optional. The labels with user-defined metadata for the request.
10349    ///
10350    /// Label keys and values can be no longer than 63 characters
10351    /// (Unicode codepoints) and can only contain lowercase letters, numeric
10352    /// characters, underscores, and dashes. International characters are allowed.
10353    /// Label values are optional. Label keys must start with a letter.
10354    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10355
10356    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10357}
10358
10359impl BatchProcessRequest {
10360    pub fn new() -> Self {
10361        std::default::Default::default()
10362    }
10363
10364    /// Sets the value of [name][crate::model::BatchProcessRequest::name].
10365    ///
10366    /// # Example
10367    /// ```ignore,no_run
10368    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10369    /// let x = BatchProcessRequest::new().set_name("example");
10370    /// ```
10371    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10372        self.name = v.into();
10373        self
10374    }
10375
10376    /// Sets the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
10377    ///
10378    /// # Example
10379    /// ```ignore,no_run
10380    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10381    /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
10382    /// let x = BatchProcessRequest::new().set_input_documents(BatchDocumentsInputConfig::default()/* use setters */);
10383    /// ```
10384    pub fn set_input_documents<T>(mut self, v: T) -> Self
10385    where
10386        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
10387    {
10388        self.input_documents = std::option::Option::Some(v.into());
10389        self
10390    }
10391
10392    /// Sets or clears the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
10393    ///
10394    /// # Example
10395    /// ```ignore,no_run
10396    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10397    /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
10398    /// let x = BatchProcessRequest::new().set_or_clear_input_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
10399    /// let x = BatchProcessRequest::new().set_or_clear_input_documents(None::<BatchDocumentsInputConfig>);
10400    /// ```
10401    pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
10402    where
10403        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
10404    {
10405        self.input_documents = v.map(|x| x.into());
10406        self
10407    }
10408
10409    /// Sets the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
10410    ///
10411    /// # Example
10412    /// ```ignore,no_run
10413    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10414    /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
10415    /// let x = BatchProcessRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);
10416    /// ```
10417    pub fn set_document_output_config<T>(mut self, v: T) -> Self
10418    where
10419        T: std::convert::Into<crate::model::DocumentOutputConfig>,
10420    {
10421        self.document_output_config = std::option::Option::Some(v.into());
10422        self
10423    }
10424
10425    /// Sets or clears the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
10426    ///
10427    /// # Example
10428    /// ```ignore,no_run
10429    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10430    /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
10431    /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
10432    /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);
10433    /// ```
10434    pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10435    where
10436        T: std::convert::Into<crate::model::DocumentOutputConfig>,
10437    {
10438        self.document_output_config = v.map(|x| x.into());
10439        self
10440    }
10441
10442    /// Sets the value of [skip_human_review][crate::model::BatchProcessRequest::skip_human_review].
10443    ///
10444    /// # Example
10445    /// ```ignore,no_run
10446    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10447    /// let x = BatchProcessRequest::new().set_skip_human_review(true);
10448    /// ```
10449    pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10450        self.skip_human_review = v.into();
10451        self
10452    }
10453
10454    /// Sets the value of [process_options][crate::model::BatchProcessRequest::process_options].
10455    ///
10456    /// # Example
10457    /// ```ignore,no_run
10458    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10459    /// use google_cloud_documentai_v1::model::ProcessOptions;
10460    /// let x = BatchProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
10461    /// ```
10462    pub fn set_process_options<T>(mut self, v: T) -> Self
10463    where
10464        T: std::convert::Into<crate::model::ProcessOptions>,
10465    {
10466        self.process_options = std::option::Option::Some(v.into());
10467        self
10468    }
10469
10470    /// Sets or clears the value of [process_options][crate::model::BatchProcessRequest::process_options].
10471    ///
10472    /// # Example
10473    /// ```ignore,no_run
10474    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10475    /// use google_cloud_documentai_v1::model::ProcessOptions;
10476    /// let x = BatchProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
10477    /// let x = BatchProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
10478    /// ```
10479    pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
10480    where
10481        T: std::convert::Into<crate::model::ProcessOptions>,
10482    {
10483        self.process_options = v.map(|x| x.into());
10484        self
10485    }
10486
10487    /// Sets the value of [labels][crate::model::BatchProcessRequest::labels].
10488    ///
10489    /// # Example
10490    /// ```ignore,no_run
10491    /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10492    /// let x = BatchProcessRequest::new().set_labels([
10493    ///     ("key0", "abc"),
10494    ///     ("key1", "xyz"),
10495    /// ]);
10496    /// ```
10497    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10498    where
10499        T: std::iter::IntoIterator<Item = (K, V)>,
10500        K: std::convert::Into<std::string::String>,
10501        V: std::convert::Into<std::string::String>,
10502    {
10503        use std::iter::Iterator;
10504        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10505        self
10506    }
10507}
10508
10509impl wkt::message::Message for BatchProcessRequest {
10510    fn typename() -> &'static str {
10511        "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
10512    }
10513}
10514
10515/// Response message for
10516/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
10517///
10518/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10519#[derive(Clone, Default, PartialEq)]
10520#[non_exhaustive]
10521pub struct BatchProcessResponse {
10522    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10523}
10524
10525impl BatchProcessResponse {
10526    pub fn new() -> Self {
10527        std::default::Default::default()
10528    }
10529}
10530
10531impl wkt::message::Message for BatchProcessResponse {
10532    fn typename() -> &'static str {
10533        "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
10534    }
10535}
10536
10537/// The long-running operation metadata for
10538/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
10539///
10540/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10541#[derive(Clone, Default, PartialEq)]
10542#[non_exhaustive]
10543pub struct BatchProcessMetadata {
10544    /// The state of the current batch processing.
10545    pub state: crate::model::batch_process_metadata::State,
10546
10547    /// A message providing more details about the current state of processing.
10548    /// For example, the error message if the operation is failed.
10549    pub state_message: std::string::String,
10550
10551    /// The creation time of the operation.
10552    pub create_time: std::option::Option<wkt::Timestamp>,
10553
10554    /// The last update time of the operation.
10555    pub update_time: std::option::Option<wkt::Timestamp>,
10556
10557    /// The list of response details of each document.
10558    pub individual_process_statuses:
10559        std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,
10560
10561    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10562}
10563
10564impl BatchProcessMetadata {
10565    pub fn new() -> Self {
10566        std::default::Default::default()
10567    }
10568
10569    /// Sets the value of [state][crate::model::BatchProcessMetadata::state].
10570    ///
10571    /// # Example
10572    /// ```ignore,no_run
10573    /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10574    /// use google_cloud_documentai_v1::model::batch_process_metadata::State;
10575    /// let x0 = BatchProcessMetadata::new().set_state(State::Waiting);
10576    /// let x1 = BatchProcessMetadata::new().set_state(State::Running);
10577    /// let x2 = BatchProcessMetadata::new().set_state(State::Succeeded);
10578    /// ```
10579    pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
10580        mut self,
10581        v: T,
10582    ) -> Self {
10583        self.state = v.into();
10584        self
10585    }
10586
10587    /// Sets the value of [state_message][crate::model::BatchProcessMetadata::state_message].
10588    ///
10589    /// # Example
10590    /// ```ignore,no_run
10591    /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10592    /// let x = BatchProcessMetadata::new().set_state_message("example");
10593    /// ```
10594    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10595        self.state_message = v.into();
10596        self
10597    }
10598
10599    /// Sets the value of [create_time][crate::model::BatchProcessMetadata::create_time].
10600    ///
10601    /// # Example
10602    /// ```ignore,no_run
10603    /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10604    /// use wkt::Timestamp;
10605    /// let x = BatchProcessMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10606    /// ```
10607    pub fn set_create_time<T>(mut self, v: T) -> Self
10608    where
10609        T: std::convert::Into<wkt::Timestamp>,
10610    {
10611        self.create_time = std::option::Option::Some(v.into());
10612        self
10613    }
10614
10615    /// Sets or clears the value of [create_time][crate::model::BatchProcessMetadata::create_time].
10616    ///
10617    /// # Example
10618    /// ```ignore,no_run
10619    /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10620    /// use wkt::Timestamp;
10621    /// let x = BatchProcessMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10622    /// let x = BatchProcessMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10623    /// ```
10624    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10625    where
10626        T: std::convert::Into<wkt::Timestamp>,
10627    {
10628        self.create_time = v.map(|x| x.into());
10629        self
10630    }
10631
10632    /// Sets the value of [update_time][crate::model::BatchProcessMetadata::update_time].
10633    ///
10634    /// # Example
10635    /// ```ignore,no_run
10636    /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10637    /// use wkt::Timestamp;
10638    /// let x = BatchProcessMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10639    /// ```
10640    pub fn set_update_time<T>(mut self, v: T) -> Self
10641    where
10642        T: std::convert::Into<wkt::Timestamp>,
10643    {
10644        self.update_time = std::option::Option::Some(v.into());
10645        self
10646    }
10647
10648    /// Sets or clears the value of [update_time][crate::model::BatchProcessMetadata::update_time].
10649    ///
10650    /// # Example
10651    /// ```ignore,no_run
10652    /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10653    /// use wkt::Timestamp;
10654    /// let x = BatchProcessMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10655    /// let x = BatchProcessMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10656    /// ```
10657    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10658    where
10659        T: std::convert::Into<wkt::Timestamp>,
10660    {
10661        self.update_time = v.map(|x| x.into());
10662        self
10663    }
10664
10665    /// Sets the value of [individual_process_statuses][crate::model::BatchProcessMetadata::individual_process_statuses].
10666    ///
10667    /// # Example
10668    /// ```ignore,no_run
10669    /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10670    /// use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10671    /// let x = BatchProcessMetadata::new()
10672    ///     .set_individual_process_statuses([
10673    ///         IndividualProcessStatus::default()/* use setters */,
10674    ///         IndividualProcessStatus::default()/* use (different) setters */,
10675    ///     ]);
10676    /// ```
10677    pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
10678    where
10679        T: std::iter::IntoIterator<Item = V>,
10680        V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
10681    {
10682        use std::iter::Iterator;
10683        self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
10684        self
10685    }
10686}
10687
10688impl wkt::message::Message for BatchProcessMetadata {
10689    fn typename() -> &'static str {
10690        "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
10691    }
10692}
10693
10694/// Defines additional types related to [BatchProcessMetadata].
10695pub mod batch_process_metadata {
10696    #[allow(unused_imports)]
10697    use super::*;
10698
10699    /// The status of a each individual document in the batch process.
10700    #[derive(Clone, Default, PartialEq)]
10701    #[non_exhaustive]
10702    pub struct IndividualProcessStatus {
10703        /// The source of the document, same as the
10704        /// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
10705        /// field in the request when the batch process started.
10706        ///
10707        /// [google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]: crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source
10708        pub input_gcs_source: std::string::String,
10709
10710        /// The status processing the document.
10711        pub status: std::option::Option<google_cloud_rpc::model::Status>,
10712
10713        /// The Cloud Storage output destination (in the request as
10714        /// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
10715        /// of the processed document if it was successful, otherwise empty.
10716        ///
10717        /// [google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]: crate::model::document_output_config::GcsOutputConfig::gcs_uri
10718        pub output_gcs_destination: std::string::String,
10719
10720        /// The status of human review on the processed document.
10721        pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
10722
10723        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10724    }
10725
10726    impl IndividualProcessStatus {
10727        pub fn new() -> Self {
10728            std::default::Default::default()
10729        }
10730
10731        /// Sets the value of [input_gcs_source][crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source].
10732        ///
10733        /// # Example
10734        /// ```ignore,no_run
10735        /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10736        /// let x = IndividualProcessStatus::new().set_input_gcs_source("example");
10737        /// ```
10738        pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
10739            mut self,
10740            v: T,
10741        ) -> Self {
10742            self.input_gcs_source = v.into();
10743            self
10744        }
10745
10746        /// Sets the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
10747        ///
10748        /// # Example
10749        /// ```ignore,no_run
10750        /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10751        /// use google_cloud_rpc::model::Status;
10752        /// let x = IndividualProcessStatus::new().set_status(Status::default()/* use setters */);
10753        /// ```
10754        pub fn set_status<T>(mut self, v: T) -> Self
10755        where
10756            T: std::convert::Into<google_cloud_rpc::model::Status>,
10757        {
10758            self.status = std::option::Option::Some(v.into());
10759            self
10760        }
10761
10762        /// Sets or clears the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
10763        ///
10764        /// # Example
10765        /// ```ignore,no_run
10766        /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10767        /// use google_cloud_rpc::model::Status;
10768        /// let x = IndividualProcessStatus::new().set_or_clear_status(Some(Status::default()/* use setters */));
10769        /// let x = IndividualProcessStatus::new().set_or_clear_status(None::<Status>);
10770        /// ```
10771        pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
10772        where
10773            T: std::convert::Into<google_cloud_rpc::model::Status>,
10774        {
10775            self.status = v.map(|x| x.into());
10776            self
10777        }
10778
10779        /// Sets the value of [output_gcs_destination][crate::model::batch_process_metadata::IndividualProcessStatus::output_gcs_destination].
10780        ///
10781        /// # Example
10782        /// ```ignore,no_run
10783        /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10784        /// let x = IndividualProcessStatus::new().set_output_gcs_destination("example");
10785        /// ```
10786        pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
10787            mut self,
10788            v: T,
10789        ) -> Self {
10790            self.output_gcs_destination = v.into();
10791            self
10792        }
10793
10794        /// Sets the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
10795        ///
10796        /// # Example
10797        /// ```ignore,no_run
10798        /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10799        /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10800        /// let x = IndividualProcessStatus::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
10801        /// ```
10802        pub fn set_human_review_status<T>(mut self, v: T) -> Self
10803        where
10804            T: std::convert::Into<crate::model::HumanReviewStatus>,
10805        {
10806            self.human_review_status = std::option::Option::Some(v.into());
10807            self
10808        }
10809
10810        /// Sets or clears the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
10811        ///
10812        /// # Example
10813        /// ```ignore,no_run
10814        /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10815        /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10816        /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
10817        /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
10818        /// ```
10819        pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
10820        where
10821            T: std::convert::Into<crate::model::HumanReviewStatus>,
10822        {
10823            self.human_review_status = v.map(|x| x.into());
10824            self
10825        }
10826    }
10827
10828    impl wkt::message::Message for IndividualProcessStatus {
10829        fn typename() -> &'static str {
10830            "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
10831        }
10832    }
10833
10834    /// Possible states of the batch processing operation.
10835    ///
10836    /// # Working with unknown values
10837    ///
10838    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10839    /// additional enum variants at any time. Adding new variants is not considered
10840    /// a breaking change. Applications should write their code in anticipation of:
10841    ///
10842    /// - New values appearing in future releases of the client library, **and**
10843    /// - New values received dynamically, without application changes.
10844    ///
10845    /// Please consult the [Working with enums] section in the user guide for some
10846    /// guidelines.
10847    ///
10848    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10849    #[derive(Clone, Debug, PartialEq)]
10850    #[non_exhaustive]
10851    pub enum State {
10852        /// The default value. This value is used if the state is omitted.
10853        Unspecified,
10854        /// Request operation is waiting for scheduling.
10855        Waiting,
10856        /// Request is being processed.
10857        Running,
10858        /// The batch processing completed successfully.
10859        Succeeded,
10860        /// The batch processing was being cancelled.
10861        Cancelling,
10862        /// The batch processing was cancelled.
10863        Cancelled,
10864        /// The batch processing has failed.
10865        Failed,
10866        /// If set, the enum was initialized with an unknown value.
10867        ///
10868        /// Applications can examine the value using [State::value] or
10869        /// [State::name].
10870        UnknownValue(state::UnknownValue),
10871    }
10872
10873    #[doc(hidden)]
10874    pub mod state {
10875        #[allow(unused_imports)]
10876        use super::*;
10877        #[derive(Clone, Debug, PartialEq)]
10878        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10879    }
10880
10881    impl State {
10882        /// Gets the enum value.
10883        ///
10884        /// Returns `None` if the enum contains an unknown value deserialized from
10885        /// the string representation of enums.
10886        pub fn value(&self) -> std::option::Option<i32> {
10887            match self {
10888                Self::Unspecified => std::option::Option::Some(0),
10889                Self::Waiting => std::option::Option::Some(1),
10890                Self::Running => std::option::Option::Some(2),
10891                Self::Succeeded => std::option::Option::Some(3),
10892                Self::Cancelling => std::option::Option::Some(4),
10893                Self::Cancelled => std::option::Option::Some(5),
10894                Self::Failed => std::option::Option::Some(6),
10895                Self::UnknownValue(u) => u.0.value(),
10896            }
10897        }
10898
10899        /// Gets the enum value as a string.
10900        ///
10901        /// Returns `None` if the enum contains an unknown value deserialized from
10902        /// the integer representation of enums.
10903        pub fn name(&self) -> std::option::Option<&str> {
10904            match self {
10905                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10906                Self::Waiting => std::option::Option::Some("WAITING"),
10907                Self::Running => std::option::Option::Some("RUNNING"),
10908                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
10909                Self::Cancelling => std::option::Option::Some("CANCELLING"),
10910                Self::Cancelled => std::option::Option::Some("CANCELLED"),
10911                Self::Failed => std::option::Option::Some("FAILED"),
10912                Self::UnknownValue(u) => u.0.name(),
10913            }
10914        }
10915    }
10916
10917    impl std::default::Default for State {
10918        fn default() -> Self {
10919            use std::convert::From;
10920            Self::from(0)
10921        }
10922    }
10923
10924    impl std::fmt::Display for State {
10925        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10926            wkt::internal::display_enum(f, self.name(), self.value())
10927        }
10928    }
10929
10930    impl std::convert::From<i32> for State {
10931        fn from(value: i32) -> Self {
10932            match value {
10933                0 => Self::Unspecified,
10934                1 => Self::Waiting,
10935                2 => Self::Running,
10936                3 => Self::Succeeded,
10937                4 => Self::Cancelling,
10938                5 => Self::Cancelled,
10939                6 => Self::Failed,
10940                _ => Self::UnknownValue(state::UnknownValue(
10941                    wkt::internal::UnknownEnumValue::Integer(value),
10942                )),
10943            }
10944        }
10945    }
10946
10947    impl std::convert::From<&str> for State {
10948        fn from(value: &str) -> Self {
10949            use std::string::ToString;
10950            match value {
10951                "STATE_UNSPECIFIED" => Self::Unspecified,
10952                "WAITING" => Self::Waiting,
10953                "RUNNING" => Self::Running,
10954                "SUCCEEDED" => Self::Succeeded,
10955                "CANCELLING" => Self::Cancelling,
10956                "CANCELLED" => Self::Cancelled,
10957                "FAILED" => Self::Failed,
10958                _ => Self::UnknownValue(state::UnknownValue(
10959                    wkt::internal::UnknownEnumValue::String(value.to_string()),
10960                )),
10961            }
10962        }
10963    }
10964
10965    impl serde::ser::Serialize for State {
10966        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10967        where
10968            S: serde::Serializer,
10969        {
10970            match self {
10971                Self::Unspecified => serializer.serialize_i32(0),
10972                Self::Waiting => serializer.serialize_i32(1),
10973                Self::Running => serializer.serialize_i32(2),
10974                Self::Succeeded => serializer.serialize_i32(3),
10975                Self::Cancelling => serializer.serialize_i32(4),
10976                Self::Cancelled => serializer.serialize_i32(5),
10977                Self::Failed => serializer.serialize_i32(6),
10978                Self::UnknownValue(u) => u.0.serialize(serializer),
10979            }
10980        }
10981    }
10982
10983    impl<'de> serde::de::Deserialize<'de> for State {
10984        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10985        where
10986            D: serde::Deserializer<'de>,
10987        {
10988            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10989                ".google.cloud.documentai.v1.BatchProcessMetadata.State",
10990            ))
10991        }
10992    }
10993}
10994
10995/// Request message for the
10996/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
10997/// method. Some processor types may require the project be added to an
10998/// allowlist.
10999///
11000/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
11001#[derive(Clone, Default, PartialEq)]
11002#[non_exhaustive]
11003pub struct FetchProcessorTypesRequest {
11004    /// Required. The location of processor types to list.
11005    /// Format: `projects/{project}/locations/{location}`.
11006    pub parent: std::string::String,
11007
11008    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11009}
11010
11011impl FetchProcessorTypesRequest {
11012    pub fn new() -> Self {
11013        std::default::Default::default()
11014    }
11015
11016    /// Sets the value of [parent][crate::model::FetchProcessorTypesRequest::parent].
11017    ///
11018    /// # Example
11019    /// ```ignore,no_run
11020    /// # use google_cloud_documentai_v1::model::FetchProcessorTypesRequest;
11021    /// let x = FetchProcessorTypesRequest::new().set_parent("example");
11022    /// ```
11023    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11024        self.parent = v.into();
11025        self
11026    }
11027}
11028
11029impl wkt::message::Message for FetchProcessorTypesRequest {
11030    fn typename() -> &'static str {
11031        "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
11032    }
11033}
11034
11035/// Response message for the
11036/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
11037/// method.
11038///
11039/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
11040#[derive(Clone, Default, PartialEq)]
11041#[non_exhaustive]
11042pub struct FetchProcessorTypesResponse {
11043    /// The list of processor types.
11044    pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
11045
11046    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11047}
11048
11049impl FetchProcessorTypesResponse {
11050    pub fn new() -> Self {
11051        std::default::Default::default()
11052    }
11053
11054    /// Sets the value of [processor_types][crate::model::FetchProcessorTypesResponse::processor_types].
11055    ///
11056    /// # Example
11057    /// ```ignore,no_run
11058    /// # use google_cloud_documentai_v1::model::FetchProcessorTypesResponse;
11059    /// use google_cloud_documentai_v1::model::ProcessorType;
11060    /// let x = FetchProcessorTypesResponse::new()
11061    ///     .set_processor_types([
11062    ///         ProcessorType::default()/* use setters */,
11063    ///         ProcessorType::default()/* use (different) setters */,
11064    ///     ]);
11065    /// ```
11066    pub fn set_processor_types<T, V>(mut self, v: T) -> Self
11067    where
11068        T: std::iter::IntoIterator<Item = V>,
11069        V: std::convert::Into<crate::model::ProcessorType>,
11070    {
11071        use std::iter::Iterator;
11072        self.processor_types = v.into_iter().map(|i| i.into()).collect();
11073        self
11074    }
11075}
11076
11077impl wkt::message::Message for FetchProcessorTypesResponse {
11078    fn typename() -> &'static str {
11079        "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
11080    }
11081}
11082
11083/// Request message for the
11084/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
11085/// method. Some processor types may require the project be added to an
11086/// allowlist.
11087///
11088/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
11089#[derive(Clone, Default, PartialEq)]
11090#[non_exhaustive]
11091pub struct ListProcessorTypesRequest {
11092    /// Required. The location of processor types to list.
11093    /// Format: `projects/{project}/locations/{location}`.
11094    pub parent: std::string::String,
11095
11096    /// The maximum number of processor types to return.
11097    /// If unspecified, at most `100` processor types will be returned.
11098    /// The maximum value is `500`. Values above `500` will be coerced to `500`.
11099    pub page_size: i32,
11100
11101    /// Used to retrieve the next page of results, empty if at the end of the list.
11102    pub page_token: std::string::String,
11103
11104    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11105}
11106
11107impl ListProcessorTypesRequest {
11108    pub fn new() -> Self {
11109        std::default::Default::default()
11110    }
11111
11112    /// Sets the value of [parent][crate::model::ListProcessorTypesRequest::parent].
11113    ///
11114    /// # Example
11115    /// ```ignore,no_run
11116    /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
11117    /// let x = ListProcessorTypesRequest::new().set_parent("example");
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 [page_size][crate::model::ListProcessorTypesRequest::page_size].
11125    ///
11126    /// # Example
11127    /// ```ignore,no_run
11128    /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
11129    /// let x = ListProcessorTypesRequest::new().set_page_size(42);
11130    /// ```
11131    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11132        self.page_size = v.into();
11133        self
11134    }
11135
11136    /// Sets the value of [page_token][crate::model::ListProcessorTypesRequest::page_token].
11137    ///
11138    /// # Example
11139    /// ```ignore,no_run
11140    /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
11141    /// let x = ListProcessorTypesRequest::new().set_page_token("example");
11142    /// ```
11143    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11144        self.page_token = v.into();
11145        self
11146    }
11147}
11148
11149impl wkt::message::Message for ListProcessorTypesRequest {
11150    fn typename() -> &'static str {
11151        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
11152    }
11153}
11154
11155/// Response message for the
11156/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
11157/// method.
11158///
11159/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
11160#[derive(Clone, Default, PartialEq)]
11161#[non_exhaustive]
11162pub struct ListProcessorTypesResponse {
11163    /// The processor types.
11164    pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
11165
11166    /// Points to the next page, otherwise empty.
11167    pub next_page_token: std::string::String,
11168
11169    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11170}
11171
11172impl ListProcessorTypesResponse {
11173    pub fn new() -> Self {
11174        std::default::Default::default()
11175    }
11176
11177    /// Sets the value of [processor_types][crate::model::ListProcessorTypesResponse::processor_types].
11178    ///
11179    /// # Example
11180    /// ```ignore,no_run
11181    /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
11182    /// use google_cloud_documentai_v1::model::ProcessorType;
11183    /// let x = ListProcessorTypesResponse::new()
11184    ///     .set_processor_types([
11185    ///         ProcessorType::default()/* use setters */,
11186    ///         ProcessorType::default()/* use (different) setters */,
11187    ///     ]);
11188    /// ```
11189    pub fn set_processor_types<T, V>(mut self, v: T) -> Self
11190    where
11191        T: std::iter::IntoIterator<Item = V>,
11192        V: std::convert::Into<crate::model::ProcessorType>,
11193    {
11194        use std::iter::Iterator;
11195        self.processor_types = v.into_iter().map(|i| i.into()).collect();
11196        self
11197    }
11198
11199    /// Sets the value of [next_page_token][crate::model::ListProcessorTypesResponse::next_page_token].
11200    ///
11201    /// # Example
11202    /// ```ignore,no_run
11203    /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
11204    /// let x = ListProcessorTypesResponse::new().set_next_page_token("example");
11205    /// ```
11206    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11207        self.next_page_token = v.into();
11208        self
11209    }
11210}
11211
11212impl wkt::message::Message for ListProcessorTypesResponse {
11213    fn typename() -> &'static str {
11214        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
11215    }
11216}
11217
11218#[doc(hidden)]
11219impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
11220    type PageItem = crate::model::ProcessorType;
11221
11222    fn items(self) -> std::vec::Vec<Self::PageItem> {
11223        self.processor_types
11224    }
11225
11226    fn next_page_token(&self) -> std::string::String {
11227        use std::clone::Clone;
11228        self.next_page_token.clone()
11229    }
11230}
11231
11232/// Request message for list all processors belongs to a project.
11233#[derive(Clone, Default, PartialEq)]
11234#[non_exhaustive]
11235pub struct ListProcessorsRequest {
11236    /// Required. The parent (project and location) which owns this collection of
11237    /// Processors. Format: `projects/{project}/locations/{location}`
11238    pub parent: std::string::String,
11239
11240    /// The maximum number of processors to return.
11241    /// If unspecified, at most `50` processors will be returned.
11242    /// The maximum value is `100`. Values above `100` will be coerced to `100`.
11243    pub page_size: i32,
11244
11245    /// We will return the processors sorted by creation time. The page token
11246    /// will point to the next processor.
11247    pub page_token: std::string::String,
11248
11249    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11250}
11251
11252impl ListProcessorsRequest {
11253    pub fn new() -> Self {
11254        std::default::Default::default()
11255    }
11256
11257    /// Sets the value of [parent][crate::model::ListProcessorsRequest::parent].
11258    ///
11259    /// # Example
11260    /// ```ignore,no_run
11261    /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
11262    /// let x = ListProcessorsRequest::new().set_parent("example");
11263    /// ```
11264    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11265        self.parent = v.into();
11266        self
11267    }
11268
11269    /// Sets the value of [page_size][crate::model::ListProcessorsRequest::page_size].
11270    ///
11271    /// # Example
11272    /// ```ignore,no_run
11273    /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
11274    /// let x = ListProcessorsRequest::new().set_page_size(42);
11275    /// ```
11276    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11277        self.page_size = v.into();
11278        self
11279    }
11280
11281    /// Sets the value of [page_token][crate::model::ListProcessorsRequest::page_token].
11282    ///
11283    /// # Example
11284    /// ```ignore,no_run
11285    /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
11286    /// let x = ListProcessorsRequest::new().set_page_token("example");
11287    /// ```
11288    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11289        self.page_token = v.into();
11290        self
11291    }
11292}
11293
11294impl wkt::message::Message for ListProcessorsRequest {
11295    fn typename() -> &'static str {
11296        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
11297    }
11298}
11299
11300/// Response message for the
11301/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
11302/// method.
11303///
11304/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]: crate::client::DocumentProcessorService::list_processors
11305#[derive(Clone, Default, PartialEq)]
11306#[non_exhaustive]
11307pub struct ListProcessorsResponse {
11308    /// The list of processors.
11309    pub processors: std::vec::Vec<crate::model::Processor>,
11310
11311    /// Points to the next processor, otherwise empty.
11312    pub next_page_token: std::string::String,
11313
11314    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11315}
11316
11317impl ListProcessorsResponse {
11318    pub fn new() -> Self {
11319        std::default::Default::default()
11320    }
11321
11322    /// Sets the value of [processors][crate::model::ListProcessorsResponse::processors].
11323    ///
11324    /// # Example
11325    /// ```ignore,no_run
11326    /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
11327    /// use google_cloud_documentai_v1::model::Processor;
11328    /// let x = ListProcessorsResponse::new()
11329    ///     .set_processors([
11330    ///         Processor::default()/* use setters */,
11331    ///         Processor::default()/* use (different) setters */,
11332    ///     ]);
11333    /// ```
11334    pub fn set_processors<T, V>(mut self, v: T) -> Self
11335    where
11336        T: std::iter::IntoIterator<Item = V>,
11337        V: std::convert::Into<crate::model::Processor>,
11338    {
11339        use std::iter::Iterator;
11340        self.processors = v.into_iter().map(|i| i.into()).collect();
11341        self
11342    }
11343
11344    /// Sets the value of [next_page_token][crate::model::ListProcessorsResponse::next_page_token].
11345    ///
11346    /// # Example
11347    /// ```ignore,no_run
11348    /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
11349    /// let x = ListProcessorsResponse::new().set_next_page_token("example");
11350    /// ```
11351    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11352        self.next_page_token = v.into();
11353        self
11354    }
11355}
11356
11357impl wkt::message::Message for ListProcessorsResponse {
11358    fn typename() -> &'static str {
11359        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
11360    }
11361}
11362
11363#[doc(hidden)]
11364impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorsResponse {
11365    type PageItem = crate::model::Processor;
11366
11367    fn items(self) -> std::vec::Vec<Self::PageItem> {
11368        self.processors
11369    }
11370
11371    fn next_page_token(&self) -> std::string::String {
11372        use std::clone::Clone;
11373        self.next_page_token.clone()
11374    }
11375}
11376
11377/// Request message for the
11378/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
11379/// method.
11380///
11381/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]: crate::client::DocumentProcessorService::get_processor_type
11382#[derive(Clone, Default, PartialEq)]
11383#[non_exhaustive]
11384pub struct GetProcessorTypeRequest {
11385    /// Required. The processor type resource name.
11386    pub name: std::string::String,
11387
11388    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11389}
11390
11391impl GetProcessorTypeRequest {
11392    pub fn new() -> Self {
11393        std::default::Default::default()
11394    }
11395
11396    /// Sets the value of [name][crate::model::GetProcessorTypeRequest::name].
11397    ///
11398    /// # Example
11399    /// ```ignore,no_run
11400    /// # use google_cloud_documentai_v1::model::GetProcessorTypeRequest;
11401    /// let x = GetProcessorTypeRequest::new().set_name("example");
11402    /// ```
11403    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11404        self.name = v.into();
11405        self
11406    }
11407}
11408
11409impl wkt::message::Message for GetProcessorTypeRequest {
11410    fn typename() -> &'static str {
11411        "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
11412    }
11413}
11414
11415/// Request message for the
11416/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
11417/// method.
11418///
11419/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]: crate::client::DocumentProcessorService::get_processor
11420#[derive(Clone, Default, PartialEq)]
11421#[non_exhaustive]
11422pub struct GetProcessorRequest {
11423    /// Required. The processor resource name.
11424    pub name: std::string::String,
11425
11426    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11427}
11428
11429impl GetProcessorRequest {
11430    pub fn new() -> Self {
11431        std::default::Default::default()
11432    }
11433
11434    /// Sets the value of [name][crate::model::GetProcessorRequest::name].
11435    ///
11436    /// # Example
11437    /// ```ignore,no_run
11438    /// # use google_cloud_documentai_v1::model::GetProcessorRequest;
11439    /// let x = GetProcessorRequest::new().set_name("example");
11440    /// ```
11441    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11442        self.name = v.into();
11443        self
11444    }
11445}
11446
11447impl wkt::message::Message for GetProcessorRequest {
11448    fn typename() -> &'static str {
11449        "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
11450    }
11451}
11452
11453/// Request message for the
11454/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
11455/// method.
11456///
11457/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]: crate::client::DocumentProcessorService::get_processor_version
11458#[derive(Clone, Default, PartialEq)]
11459#[non_exhaustive]
11460pub struct GetProcessorVersionRequest {
11461    /// Required. The processor resource name.
11462    pub name: std::string::String,
11463
11464    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11465}
11466
11467impl GetProcessorVersionRequest {
11468    pub fn new() -> Self {
11469        std::default::Default::default()
11470    }
11471
11472    /// Sets the value of [name][crate::model::GetProcessorVersionRequest::name].
11473    ///
11474    /// # Example
11475    /// ```ignore,no_run
11476    /// # use google_cloud_documentai_v1::model::GetProcessorVersionRequest;
11477    /// let x = GetProcessorVersionRequest::new().set_name("example");
11478    /// ```
11479    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11480        self.name = v.into();
11481        self
11482    }
11483}
11484
11485impl wkt::message::Message for GetProcessorVersionRequest {
11486    fn typename() -> &'static str {
11487        "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
11488    }
11489}
11490
11491/// Request message for list all processor versions belongs to a processor.
11492#[derive(Clone, Default, PartialEq)]
11493#[non_exhaustive]
11494pub struct ListProcessorVersionsRequest {
11495    /// Required. The parent (project, location and processor) to list all
11496    /// versions. Format:
11497    /// `projects/{project}/locations/{location}/processors/{processor}`
11498    pub parent: std::string::String,
11499
11500    /// The maximum number of processor versions to return.
11501    /// If unspecified, at most `10` processor versions will be returned.
11502    /// The maximum value is `20`. Values above `20` will be coerced to `20`.
11503    pub page_size: i32,
11504
11505    /// We will return the processor versions sorted by creation time. The page
11506    /// token will point to the next processor version.
11507    pub page_token: std::string::String,
11508
11509    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11510}
11511
11512impl ListProcessorVersionsRequest {
11513    pub fn new() -> Self {
11514        std::default::Default::default()
11515    }
11516
11517    /// Sets the value of [parent][crate::model::ListProcessorVersionsRequest::parent].
11518    ///
11519    /// # Example
11520    /// ```ignore,no_run
11521    /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
11522    /// let x = ListProcessorVersionsRequest::new().set_parent("example");
11523    /// ```
11524    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11525        self.parent = v.into();
11526        self
11527    }
11528
11529    /// Sets the value of [page_size][crate::model::ListProcessorVersionsRequest::page_size].
11530    ///
11531    /// # Example
11532    /// ```ignore,no_run
11533    /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
11534    /// let x = ListProcessorVersionsRequest::new().set_page_size(42);
11535    /// ```
11536    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11537        self.page_size = v.into();
11538        self
11539    }
11540
11541    /// Sets the value of [page_token][crate::model::ListProcessorVersionsRequest::page_token].
11542    ///
11543    /// # Example
11544    /// ```ignore,no_run
11545    /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
11546    /// let x = ListProcessorVersionsRequest::new().set_page_token("example");
11547    /// ```
11548    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11549        self.page_token = v.into();
11550        self
11551    }
11552}
11553
11554impl wkt::message::Message for ListProcessorVersionsRequest {
11555    fn typename() -> &'static str {
11556        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
11557    }
11558}
11559
11560/// Response message for the
11561/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
11562/// method.
11563///
11564/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]: crate::client::DocumentProcessorService::list_processor_versions
11565#[derive(Clone, Default, PartialEq)]
11566#[non_exhaustive]
11567pub struct ListProcessorVersionsResponse {
11568    /// The list of processors.
11569    pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,
11570
11571    /// Points to the next processor, otherwise empty.
11572    pub next_page_token: std::string::String,
11573
11574    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11575}
11576
11577impl ListProcessorVersionsResponse {
11578    pub fn new() -> Self {
11579        std::default::Default::default()
11580    }
11581
11582    /// Sets the value of [processor_versions][crate::model::ListProcessorVersionsResponse::processor_versions].
11583    ///
11584    /// # Example
11585    /// ```ignore,no_run
11586    /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
11587    /// use google_cloud_documentai_v1::model::ProcessorVersion;
11588    /// let x = ListProcessorVersionsResponse::new()
11589    ///     .set_processor_versions([
11590    ///         ProcessorVersion::default()/* use setters */,
11591    ///         ProcessorVersion::default()/* use (different) setters */,
11592    ///     ]);
11593    /// ```
11594    pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
11595    where
11596        T: std::iter::IntoIterator<Item = V>,
11597        V: std::convert::Into<crate::model::ProcessorVersion>,
11598    {
11599        use std::iter::Iterator;
11600        self.processor_versions = v.into_iter().map(|i| i.into()).collect();
11601        self
11602    }
11603
11604    /// Sets the value of [next_page_token][crate::model::ListProcessorVersionsResponse::next_page_token].
11605    ///
11606    /// # Example
11607    /// ```ignore,no_run
11608    /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
11609    /// let x = ListProcessorVersionsResponse::new().set_next_page_token("example");
11610    /// ```
11611    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11612        self.next_page_token = v.into();
11613        self
11614    }
11615}
11616
11617impl wkt::message::Message for ListProcessorVersionsResponse {
11618    fn typename() -> &'static str {
11619        "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
11620    }
11621}
11622
11623#[doc(hidden)]
11624impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
11625    type PageItem = crate::model::ProcessorVersion;
11626
11627    fn items(self) -> std::vec::Vec<Self::PageItem> {
11628        self.processor_versions
11629    }
11630
11631    fn next_page_token(&self) -> std::string::String {
11632        use std::clone::Clone;
11633        self.next_page_token.clone()
11634    }
11635}
11636
11637/// Request message for the
11638/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
11639/// method.
11640///
11641/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
11642#[derive(Clone, Default, PartialEq)]
11643#[non_exhaustive]
11644pub struct DeleteProcessorVersionRequest {
11645    /// Required. The processor version resource name to be deleted.
11646    pub name: std::string::String,
11647
11648    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11649}
11650
11651impl DeleteProcessorVersionRequest {
11652    pub fn new() -> Self {
11653        std::default::Default::default()
11654    }
11655
11656    /// Sets the value of [name][crate::model::DeleteProcessorVersionRequest::name].
11657    ///
11658    /// # Example
11659    /// ```ignore,no_run
11660    /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionRequest;
11661    /// let x = DeleteProcessorVersionRequest::new().set_name("example");
11662    /// ```
11663    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11664        self.name = v.into();
11665        self
11666    }
11667}
11668
11669impl wkt::message::Message for DeleteProcessorVersionRequest {
11670    fn typename() -> &'static str {
11671        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
11672    }
11673}
11674
11675/// The long-running operation metadata for the
11676/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
11677/// method.
11678///
11679/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
11680#[derive(Clone, Default, PartialEq)]
11681#[non_exhaustive]
11682pub struct DeleteProcessorVersionMetadata {
11683    /// The basic metadata of the long-running operation.
11684    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
11685
11686    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11687}
11688
11689impl DeleteProcessorVersionMetadata {
11690    pub fn new() -> Self {
11691        std::default::Default::default()
11692    }
11693
11694    /// Sets the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
11695    ///
11696    /// # Example
11697    /// ```ignore,no_run
11698    /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
11699    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11700    /// let x = DeleteProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
11701    /// ```
11702    pub fn set_common_metadata<T>(mut self, v: T) -> Self
11703    where
11704        T: std::convert::Into<crate::model::CommonOperationMetadata>,
11705    {
11706        self.common_metadata = std::option::Option::Some(v.into());
11707        self
11708    }
11709
11710    /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
11711    ///
11712    /// # Example
11713    /// ```ignore,no_run
11714    /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
11715    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11716    /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
11717    /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
11718    /// ```
11719    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
11720    where
11721        T: std::convert::Into<crate::model::CommonOperationMetadata>,
11722    {
11723        self.common_metadata = v.map(|x| x.into());
11724        self
11725    }
11726}
11727
11728impl wkt::message::Message for DeleteProcessorVersionMetadata {
11729    fn typename() -> &'static str {
11730        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
11731    }
11732}
11733
11734/// Request message for the
11735/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
11736/// method.
11737///
11738/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
11739#[derive(Clone, Default, PartialEq)]
11740#[non_exhaustive]
11741pub struct DeployProcessorVersionRequest {
11742    /// Required. The processor version resource name to be deployed.
11743    pub name: std::string::String,
11744
11745    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11746}
11747
11748impl DeployProcessorVersionRequest {
11749    pub fn new() -> Self {
11750        std::default::Default::default()
11751    }
11752
11753    /// Sets the value of [name][crate::model::DeployProcessorVersionRequest::name].
11754    ///
11755    /// # Example
11756    /// ```ignore,no_run
11757    /// # use google_cloud_documentai_v1::model::DeployProcessorVersionRequest;
11758    /// let x = DeployProcessorVersionRequest::new().set_name("example");
11759    /// ```
11760    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11761        self.name = v.into();
11762        self
11763    }
11764}
11765
11766impl wkt::message::Message for DeployProcessorVersionRequest {
11767    fn typename() -> &'static str {
11768        "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
11769    }
11770}
11771
11772/// Response message for the
11773/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
11774/// method.
11775///
11776/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
11777#[derive(Clone, Default, PartialEq)]
11778#[non_exhaustive]
11779pub struct DeployProcessorVersionResponse {
11780    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11781}
11782
11783impl DeployProcessorVersionResponse {
11784    pub fn new() -> Self {
11785        std::default::Default::default()
11786    }
11787}
11788
11789impl wkt::message::Message for DeployProcessorVersionResponse {
11790    fn typename() -> &'static str {
11791        "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
11792    }
11793}
11794
11795/// The long-running operation metadata for the
11796/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
11797/// method.
11798///
11799/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
11800#[derive(Clone, Default, PartialEq)]
11801#[non_exhaustive]
11802pub struct DeployProcessorVersionMetadata {
11803    /// The basic metadata of the long-running operation.
11804    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
11805
11806    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11807}
11808
11809impl DeployProcessorVersionMetadata {
11810    pub fn new() -> Self {
11811        std::default::Default::default()
11812    }
11813
11814    /// Sets the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
11815    ///
11816    /// # Example
11817    /// ```ignore,no_run
11818    /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
11819    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11820    /// let x = DeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
11821    /// ```
11822    pub fn set_common_metadata<T>(mut self, v: T) -> Self
11823    where
11824        T: std::convert::Into<crate::model::CommonOperationMetadata>,
11825    {
11826        self.common_metadata = std::option::Option::Some(v.into());
11827        self
11828    }
11829
11830    /// Sets or clears the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
11831    ///
11832    /// # Example
11833    /// ```ignore,no_run
11834    /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
11835    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11836    /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
11837    /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
11838    /// ```
11839    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
11840    where
11841        T: std::convert::Into<crate::model::CommonOperationMetadata>,
11842    {
11843        self.common_metadata = v.map(|x| x.into());
11844        self
11845    }
11846}
11847
11848impl wkt::message::Message for DeployProcessorVersionMetadata {
11849    fn typename() -> &'static str {
11850        "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
11851    }
11852}
11853
11854/// Request message for the
11855/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
11856/// method.
11857///
11858/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
11859#[derive(Clone, Default, PartialEq)]
11860#[non_exhaustive]
11861pub struct UndeployProcessorVersionRequest {
11862    /// Required. The processor version resource name to be undeployed.
11863    pub name: std::string::String,
11864
11865    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11866}
11867
11868impl UndeployProcessorVersionRequest {
11869    pub fn new() -> Self {
11870        std::default::Default::default()
11871    }
11872
11873    /// Sets the value of [name][crate::model::UndeployProcessorVersionRequest::name].
11874    ///
11875    /// # Example
11876    /// ```ignore,no_run
11877    /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionRequest;
11878    /// let x = UndeployProcessorVersionRequest::new().set_name("example");
11879    /// ```
11880    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11881        self.name = v.into();
11882        self
11883    }
11884}
11885
11886impl wkt::message::Message for UndeployProcessorVersionRequest {
11887    fn typename() -> &'static str {
11888        "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
11889    }
11890}
11891
11892/// Response message for the
11893/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
11894/// method.
11895///
11896/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
11897#[derive(Clone, Default, PartialEq)]
11898#[non_exhaustive]
11899pub struct UndeployProcessorVersionResponse {
11900    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11901}
11902
11903impl UndeployProcessorVersionResponse {
11904    pub fn new() -> Self {
11905        std::default::Default::default()
11906    }
11907}
11908
11909impl wkt::message::Message for UndeployProcessorVersionResponse {
11910    fn typename() -> &'static str {
11911        "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
11912    }
11913}
11914
11915/// The long-running operation metadata for the
11916/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
11917/// method.
11918///
11919/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
11920#[derive(Clone, Default, PartialEq)]
11921#[non_exhaustive]
11922pub struct UndeployProcessorVersionMetadata {
11923    /// The basic metadata of the long-running operation.
11924    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
11925
11926    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11927}
11928
11929impl UndeployProcessorVersionMetadata {
11930    pub fn new() -> Self {
11931        std::default::Default::default()
11932    }
11933
11934    /// Sets the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
11935    ///
11936    /// # Example
11937    /// ```ignore,no_run
11938    /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
11939    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11940    /// let x = UndeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
11941    /// ```
11942    pub fn set_common_metadata<T>(mut self, v: T) -> Self
11943    where
11944        T: std::convert::Into<crate::model::CommonOperationMetadata>,
11945    {
11946        self.common_metadata = std::option::Option::Some(v.into());
11947        self
11948    }
11949
11950    /// Sets or clears the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
11951    ///
11952    /// # Example
11953    /// ```ignore,no_run
11954    /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
11955    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11956    /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
11957    /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
11958    /// ```
11959    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
11960    where
11961        T: std::convert::Into<crate::model::CommonOperationMetadata>,
11962    {
11963        self.common_metadata = v.map(|x| x.into());
11964        self
11965    }
11966}
11967
11968impl wkt::message::Message for UndeployProcessorVersionMetadata {
11969    fn typename() -> &'static str {
11970        "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
11971    }
11972}
11973
11974/// Request message for the
11975/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
11976/// method. Notice this request is sent to a regionalized backend service. If the
11977/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
11978/// that region, the creation fails.
11979///
11980/// [google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]: crate::client::DocumentProcessorService::create_processor
11981/// [google.cloud.documentai.v1.ProcessorType]: crate::model::ProcessorType
11982#[derive(Clone, Default, PartialEq)]
11983#[non_exhaustive]
11984pub struct CreateProcessorRequest {
11985    /// Required. The parent (project and location) under which to create the
11986    /// processor. Format: `projects/{project}/locations/{location}`
11987    pub parent: std::string::String,
11988
11989    /// Required. The processor to be created, requires
11990    /// [Processor.type][google.cloud.documentai.v1.Processor.type] and
11991    /// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
11992    /// to be set. Also, the
11993    /// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
11994    /// field must be set if the processor is under CMEK.
11995    ///
11996    /// [google.cloud.documentai.v1.Processor.display_name]: crate::model::Processor::display_name
11997    /// [google.cloud.documentai.v1.Processor.kms_key_name]: crate::model::Processor::kms_key_name
11998    /// [google.cloud.documentai.v1.Processor.type]: crate::model::Processor::type
11999    pub processor: std::option::Option<crate::model::Processor>,
12000
12001    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12002}
12003
12004impl CreateProcessorRequest {
12005    pub fn new() -> Self {
12006        std::default::Default::default()
12007    }
12008
12009    /// Sets the value of [parent][crate::model::CreateProcessorRequest::parent].
12010    ///
12011    /// # Example
12012    /// ```ignore,no_run
12013    /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
12014    /// let x = CreateProcessorRequest::new().set_parent("example");
12015    /// ```
12016    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12017        self.parent = v.into();
12018        self
12019    }
12020
12021    /// Sets the value of [processor][crate::model::CreateProcessorRequest::processor].
12022    ///
12023    /// # Example
12024    /// ```ignore,no_run
12025    /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
12026    /// use google_cloud_documentai_v1::model::Processor;
12027    /// let x = CreateProcessorRequest::new().set_processor(Processor::default()/* use setters */);
12028    /// ```
12029    pub fn set_processor<T>(mut self, v: T) -> Self
12030    where
12031        T: std::convert::Into<crate::model::Processor>,
12032    {
12033        self.processor = std::option::Option::Some(v.into());
12034        self
12035    }
12036
12037    /// Sets or clears the value of [processor][crate::model::CreateProcessorRequest::processor].
12038    ///
12039    /// # Example
12040    /// ```ignore,no_run
12041    /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
12042    /// use google_cloud_documentai_v1::model::Processor;
12043    /// let x = CreateProcessorRequest::new().set_or_clear_processor(Some(Processor::default()/* use setters */));
12044    /// let x = CreateProcessorRequest::new().set_or_clear_processor(None::<Processor>);
12045    /// ```
12046    pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
12047    where
12048        T: std::convert::Into<crate::model::Processor>,
12049    {
12050        self.processor = v.map(|x| x.into());
12051        self
12052    }
12053}
12054
12055impl wkt::message::Message for CreateProcessorRequest {
12056    fn typename() -> &'static str {
12057        "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
12058    }
12059}
12060
12061/// Request message for the
12062/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
12063/// method.
12064///
12065/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
12066#[derive(Clone, Default, PartialEq)]
12067#[non_exhaustive]
12068pub struct DeleteProcessorRequest {
12069    /// Required. The processor resource name to be deleted.
12070    pub name: std::string::String,
12071
12072    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12073}
12074
12075impl DeleteProcessorRequest {
12076    pub fn new() -> Self {
12077        std::default::Default::default()
12078    }
12079
12080    /// Sets the value of [name][crate::model::DeleteProcessorRequest::name].
12081    ///
12082    /// # Example
12083    /// ```ignore,no_run
12084    /// # use google_cloud_documentai_v1::model::DeleteProcessorRequest;
12085    /// let x = DeleteProcessorRequest::new().set_name("example");
12086    /// ```
12087    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12088        self.name = v.into();
12089        self
12090    }
12091}
12092
12093impl wkt::message::Message for DeleteProcessorRequest {
12094    fn typename() -> &'static str {
12095        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
12096    }
12097}
12098
12099/// The long-running operation metadata for the
12100/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
12101/// method.
12102///
12103/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
12104#[derive(Clone, Default, PartialEq)]
12105#[non_exhaustive]
12106pub struct DeleteProcessorMetadata {
12107    /// The basic metadata of the long-running operation.
12108    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12109
12110    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12111}
12112
12113impl DeleteProcessorMetadata {
12114    pub fn new() -> Self {
12115        std::default::Default::default()
12116    }
12117
12118    /// Sets the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
12119    ///
12120    /// # Example
12121    /// ```ignore,no_run
12122    /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
12123    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12124    /// let x = DeleteProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12125    /// ```
12126    pub fn set_common_metadata<T>(mut self, v: T) -> Self
12127    where
12128        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12129    {
12130        self.common_metadata = std::option::Option::Some(v.into());
12131        self
12132    }
12133
12134    /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
12135    ///
12136    /// # Example
12137    /// ```ignore,no_run
12138    /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
12139    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12140    /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12141    /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12142    /// ```
12143    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12144    where
12145        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12146    {
12147        self.common_metadata = v.map(|x| x.into());
12148        self
12149    }
12150}
12151
12152impl wkt::message::Message for DeleteProcessorMetadata {
12153    fn typename() -> &'static str {
12154        "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
12155    }
12156}
12157
12158/// Request message for the
12159/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
12160/// method.
12161///
12162/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
12163#[derive(Clone, Default, PartialEq)]
12164#[non_exhaustive]
12165pub struct EnableProcessorRequest {
12166    /// Required. The processor resource name to be enabled.
12167    pub name: std::string::String,
12168
12169    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12170}
12171
12172impl EnableProcessorRequest {
12173    pub fn new() -> Self {
12174        std::default::Default::default()
12175    }
12176
12177    /// Sets the value of [name][crate::model::EnableProcessorRequest::name].
12178    ///
12179    /// # Example
12180    /// ```ignore,no_run
12181    /// # use google_cloud_documentai_v1::model::EnableProcessorRequest;
12182    /// let x = EnableProcessorRequest::new().set_name("example");
12183    /// ```
12184    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12185        self.name = v.into();
12186        self
12187    }
12188}
12189
12190impl wkt::message::Message for EnableProcessorRequest {
12191    fn typename() -> &'static str {
12192        "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
12193    }
12194}
12195
12196/// Response message for the
12197/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
12198/// method. Intentionally empty proto for adding fields in future.
12199///
12200/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
12201#[derive(Clone, Default, PartialEq)]
12202#[non_exhaustive]
12203pub struct EnableProcessorResponse {
12204    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12205}
12206
12207impl EnableProcessorResponse {
12208    pub fn new() -> Self {
12209        std::default::Default::default()
12210    }
12211}
12212
12213impl wkt::message::Message for EnableProcessorResponse {
12214    fn typename() -> &'static str {
12215        "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
12216    }
12217}
12218
12219/// The long-running operation metadata for the
12220/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
12221/// method.
12222///
12223/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
12224#[derive(Clone, Default, PartialEq)]
12225#[non_exhaustive]
12226pub struct EnableProcessorMetadata {
12227    /// The basic metadata of the long-running operation.
12228    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12229
12230    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12231}
12232
12233impl EnableProcessorMetadata {
12234    pub fn new() -> Self {
12235        std::default::Default::default()
12236    }
12237
12238    /// Sets the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
12239    ///
12240    /// # Example
12241    /// ```ignore,no_run
12242    /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
12243    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12244    /// let x = EnableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12245    /// ```
12246    pub fn set_common_metadata<T>(mut self, v: T) -> Self
12247    where
12248        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12249    {
12250        self.common_metadata = std::option::Option::Some(v.into());
12251        self
12252    }
12253
12254    /// Sets or clears the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
12255    ///
12256    /// # Example
12257    /// ```ignore,no_run
12258    /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
12259    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12260    /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12261    /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12262    /// ```
12263    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12264    where
12265        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12266    {
12267        self.common_metadata = v.map(|x| x.into());
12268        self
12269    }
12270}
12271
12272impl wkt::message::Message for EnableProcessorMetadata {
12273    fn typename() -> &'static str {
12274        "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
12275    }
12276}
12277
12278/// Request message for the
12279/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
12280/// method.
12281///
12282/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
12283#[derive(Clone, Default, PartialEq)]
12284#[non_exhaustive]
12285pub struct DisableProcessorRequest {
12286    /// Required. The processor resource name to be disabled.
12287    pub name: std::string::String,
12288
12289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12290}
12291
12292impl DisableProcessorRequest {
12293    pub fn new() -> Self {
12294        std::default::Default::default()
12295    }
12296
12297    /// Sets the value of [name][crate::model::DisableProcessorRequest::name].
12298    ///
12299    /// # Example
12300    /// ```ignore,no_run
12301    /// # use google_cloud_documentai_v1::model::DisableProcessorRequest;
12302    /// let x = DisableProcessorRequest::new().set_name("example");
12303    /// ```
12304    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12305        self.name = v.into();
12306        self
12307    }
12308}
12309
12310impl wkt::message::Message for DisableProcessorRequest {
12311    fn typename() -> &'static str {
12312        "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
12313    }
12314}
12315
12316/// Response message for the
12317/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
12318/// method. Intentionally empty proto for adding fields in future.
12319///
12320/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
12321#[derive(Clone, Default, PartialEq)]
12322#[non_exhaustive]
12323pub struct DisableProcessorResponse {
12324    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12325}
12326
12327impl DisableProcessorResponse {
12328    pub fn new() -> Self {
12329        std::default::Default::default()
12330    }
12331}
12332
12333impl wkt::message::Message for DisableProcessorResponse {
12334    fn typename() -> &'static str {
12335        "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
12336    }
12337}
12338
12339/// The long-running operation metadata for the
12340/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
12341/// method.
12342///
12343/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
12344#[derive(Clone, Default, PartialEq)]
12345#[non_exhaustive]
12346pub struct DisableProcessorMetadata {
12347    /// The basic metadata of the long-running operation.
12348    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12349
12350    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12351}
12352
12353impl DisableProcessorMetadata {
12354    pub fn new() -> Self {
12355        std::default::Default::default()
12356    }
12357
12358    /// Sets the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
12359    ///
12360    /// # Example
12361    /// ```ignore,no_run
12362    /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
12363    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12364    /// let x = DisableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12365    /// ```
12366    pub fn set_common_metadata<T>(mut self, v: T) -> Self
12367    where
12368        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12369    {
12370        self.common_metadata = std::option::Option::Some(v.into());
12371        self
12372    }
12373
12374    /// Sets or clears the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
12375    ///
12376    /// # Example
12377    /// ```ignore,no_run
12378    /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
12379    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12380    /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12381    /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12382    /// ```
12383    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12384    where
12385        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12386    {
12387        self.common_metadata = v.map(|x| x.into());
12388        self
12389    }
12390}
12391
12392impl wkt::message::Message for DisableProcessorMetadata {
12393    fn typename() -> &'static str {
12394        "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
12395    }
12396}
12397
12398/// Request message for the
12399/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
12400/// method.
12401///
12402/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
12403#[derive(Clone, Default, PartialEq)]
12404#[non_exhaustive]
12405pub struct SetDefaultProcessorVersionRequest {
12406    /// Required. The resource name of the
12407    /// [Processor][google.cloud.documentai.v1.Processor] to change default
12408    /// version.
12409    ///
12410    /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
12411    pub processor: std::string::String,
12412
12413    /// Required. The resource name of child
12414    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
12415    /// default. Format:
12416    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
12417    ///
12418    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
12419    pub default_processor_version: std::string::String,
12420
12421    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12422}
12423
12424impl SetDefaultProcessorVersionRequest {
12425    pub fn new() -> Self {
12426        std::default::Default::default()
12427    }
12428
12429    /// Sets the value of [processor][crate::model::SetDefaultProcessorVersionRequest::processor].
12430    ///
12431    /// # Example
12432    /// ```ignore,no_run
12433    /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
12434    /// let x = SetDefaultProcessorVersionRequest::new().set_processor("example");
12435    /// ```
12436    pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12437        self.processor = v.into();
12438        self
12439    }
12440
12441    /// Sets the value of [default_processor_version][crate::model::SetDefaultProcessorVersionRequest::default_processor_version].
12442    ///
12443    /// # Example
12444    /// ```ignore,no_run
12445    /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
12446    /// let x = SetDefaultProcessorVersionRequest::new().set_default_processor_version("example");
12447    /// ```
12448    pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
12449        mut self,
12450        v: T,
12451    ) -> Self {
12452        self.default_processor_version = v.into();
12453        self
12454    }
12455}
12456
12457impl wkt::message::Message for SetDefaultProcessorVersionRequest {
12458    fn typename() -> &'static str {
12459        "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
12460    }
12461}
12462
12463/// Response message for the
12464/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
12465/// method.
12466///
12467/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
12468#[derive(Clone, Default, PartialEq)]
12469#[non_exhaustive]
12470pub struct SetDefaultProcessorVersionResponse {
12471    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12472}
12473
12474impl SetDefaultProcessorVersionResponse {
12475    pub fn new() -> Self {
12476        std::default::Default::default()
12477    }
12478}
12479
12480impl wkt::message::Message for SetDefaultProcessorVersionResponse {
12481    fn typename() -> &'static str {
12482        "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
12483    }
12484}
12485
12486/// The long-running operation metadata for the
12487/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
12488/// method.
12489///
12490/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
12491#[derive(Clone, Default, PartialEq)]
12492#[non_exhaustive]
12493pub struct SetDefaultProcessorVersionMetadata {
12494    /// The basic metadata of the long-running operation.
12495    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12496
12497    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12498}
12499
12500impl SetDefaultProcessorVersionMetadata {
12501    pub fn new() -> Self {
12502        std::default::Default::default()
12503    }
12504
12505    /// Sets the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
12506    ///
12507    /// # Example
12508    /// ```ignore,no_run
12509    /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
12510    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12511    /// let x = SetDefaultProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12512    /// ```
12513    pub fn set_common_metadata<T>(mut self, v: T) -> Self
12514    where
12515        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12516    {
12517        self.common_metadata = std::option::Option::Some(v.into());
12518        self
12519    }
12520
12521    /// Sets or clears the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
12522    ///
12523    /// # Example
12524    /// ```ignore,no_run
12525    /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
12526    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12527    /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12528    /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12529    /// ```
12530    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12531    where
12532        T: std::convert::Into<crate::model::CommonOperationMetadata>,
12533    {
12534        self.common_metadata = v.map(|x| x.into());
12535        self
12536    }
12537}
12538
12539impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
12540    fn typename() -> &'static str {
12541        "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
12542    }
12543}
12544
12545/// Request message for the
12546/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
12547/// method.
12548///
12549/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
12550#[derive(Clone, Default, PartialEq)]
12551#[non_exhaustive]
12552pub struct TrainProcessorVersionRequest {
12553    /// Required. The parent (project, location and processor) to create the new
12554    /// version for. Format:
12555    /// `projects/{project}/locations/{location}/processors/{processor}`.
12556    pub parent: std::string::String,
12557
12558    /// Required. The processor version to be created.
12559    pub processor_version: std::option::Option<crate::model::ProcessorVersion>,
12560
12561    /// Optional. The schema the processor version will be trained with.
12562    pub document_schema: std::option::Option<crate::model::DocumentSchema>,
12563
12564    /// Optional. The input data used to train the
12565    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
12566    ///
12567    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
12568    pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,
12569
12570    /// Optional. The processor version to use as a base for training. This
12571    /// processor version must be a child of `parent`. Format:
12572    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
12573    pub base_processor_version: std::string::String,
12574
12575    pub processor_flags:
12576        std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
12577
12578    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12579}
12580
12581impl TrainProcessorVersionRequest {
12582    pub fn new() -> Self {
12583        std::default::Default::default()
12584    }
12585
12586    /// Sets the value of [parent][crate::model::TrainProcessorVersionRequest::parent].
12587    ///
12588    /// # Example
12589    /// ```ignore,no_run
12590    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12591    /// let x = TrainProcessorVersionRequest::new().set_parent("example");
12592    /// ```
12593    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12594        self.parent = v.into();
12595        self
12596    }
12597
12598    /// Sets the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
12599    ///
12600    /// # Example
12601    /// ```ignore,no_run
12602    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12603    /// use google_cloud_documentai_v1::model::ProcessorVersion;
12604    /// let x = TrainProcessorVersionRequest::new().set_processor_version(ProcessorVersion::default()/* use setters */);
12605    /// ```
12606    pub fn set_processor_version<T>(mut self, v: T) -> Self
12607    where
12608        T: std::convert::Into<crate::model::ProcessorVersion>,
12609    {
12610        self.processor_version = std::option::Option::Some(v.into());
12611        self
12612    }
12613
12614    /// Sets or clears the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
12615    ///
12616    /// # Example
12617    /// ```ignore,no_run
12618    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12619    /// use google_cloud_documentai_v1::model::ProcessorVersion;
12620    /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(Some(ProcessorVersion::default()/* use setters */));
12621    /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(None::<ProcessorVersion>);
12622    /// ```
12623    pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
12624    where
12625        T: std::convert::Into<crate::model::ProcessorVersion>,
12626    {
12627        self.processor_version = v.map(|x| x.into());
12628        self
12629    }
12630
12631    /// Sets the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
12632    ///
12633    /// # Example
12634    /// ```ignore,no_run
12635    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12636    /// use google_cloud_documentai_v1::model::DocumentSchema;
12637    /// let x = TrainProcessorVersionRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
12638    /// ```
12639    pub fn set_document_schema<T>(mut self, v: T) -> Self
12640    where
12641        T: std::convert::Into<crate::model::DocumentSchema>,
12642    {
12643        self.document_schema = std::option::Option::Some(v.into());
12644        self
12645    }
12646
12647    /// Sets or clears the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
12648    ///
12649    /// # Example
12650    /// ```ignore,no_run
12651    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12652    /// use google_cloud_documentai_v1::model::DocumentSchema;
12653    /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
12654    /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
12655    /// ```
12656    pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
12657    where
12658        T: std::convert::Into<crate::model::DocumentSchema>,
12659    {
12660        self.document_schema = v.map(|x| x.into());
12661        self
12662    }
12663
12664    /// Sets the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
12665    ///
12666    /// # Example
12667    /// ```ignore,no_run
12668    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12669    /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12670    /// let x = TrainProcessorVersionRequest::new().set_input_data(InputData::default()/* use setters */);
12671    /// ```
12672    pub fn set_input_data<T>(mut self, v: T) -> Self
12673    where
12674        T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
12675    {
12676        self.input_data = std::option::Option::Some(v.into());
12677        self
12678    }
12679
12680    /// Sets or clears the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
12681    ///
12682    /// # Example
12683    /// ```ignore,no_run
12684    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12685    /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12686    /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(Some(InputData::default()/* use setters */));
12687    /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(None::<InputData>);
12688    /// ```
12689    pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
12690    where
12691        T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
12692    {
12693        self.input_data = v.map(|x| x.into());
12694        self
12695    }
12696
12697    /// Sets the value of [base_processor_version][crate::model::TrainProcessorVersionRequest::base_processor_version].
12698    ///
12699    /// # Example
12700    /// ```ignore,no_run
12701    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12702    /// let x = TrainProcessorVersionRequest::new().set_base_processor_version("example");
12703    /// ```
12704    pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
12705        mut self,
12706        v: T,
12707    ) -> Self {
12708        self.base_processor_version = v.into();
12709        self
12710    }
12711
12712    /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags].
12713    ///
12714    /// Note that all the setters affecting `processor_flags` are mutually
12715    /// exclusive.
12716    ///
12717    /// # Example
12718    /// ```ignore,no_run
12719    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12720    /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
12721    /// let x = TrainProcessorVersionRequest::new().set_processor_flags(Some(
12722    ///     google_cloud_documentai_v1::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(CustomDocumentExtractionOptions::default().into())));
12723    /// ```
12724    pub fn set_processor_flags<
12725        T: std::convert::Into<
12726                std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
12727            >,
12728    >(
12729        mut self,
12730        v: T,
12731    ) -> Self {
12732        self.processor_flags = v.into();
12733        self
12734    }
12735
12736    /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12737    /// if it holds a `CustomDocumentExtractionOptions`, `None` if the field is not set or
12738    /// holds a different branch.
12739    pub fn custom_document_extraction_options(
12740        &self,
12741    ) -> std::option::Option<
12742        &std::boxed::Box<
12743            crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
12744        >,
12745    > {
12746        #[allow(unreachable_patterns)]
12747        self.processor_flags.as_ref().and_then(|v| match v {
12748            crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
12749            _ => std::option::Option::None,
12750        })
12751    }
12752
12753    /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12754    /// to hold a `CustomDocumentExtractionOptions`.
12755    ///
12756    /// Note that all the setters affecting `processor_flags` are
12757    /// mutually exclusive.
12758    ///
12759    /// # Example
12760    /// ```ignore,no_run
12761    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12762    /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
12763    /// let x = TrainProcessorVersionRequest::new().set_custom_document_extraction_options(CustomDocumentExtractionOptions::default()/* use setters */);
12764    /// assert!(x.custom_document_extraction_options().is_some());
12765    /// assert!(x.foundation_model_tuning_options().is_none());
12766    /// ```
12767    pub fn set_custom_document_extraction_options<
12768        T: std::convert::Into<
12769                std::boxed::Box<
12770                    crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
12771                >,
12772            >,
12773    >(
12774        mut self,
12775        v: T,
12776    ) -> Self {
12777        self.processor_flags = std::option::Option::Some(
12778            crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
12779                v.into()
12780            )
12781        );
12782        self
12783    }
12784
12785    /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12786    /// if it holds a `FoundationModelTuningOptions`, `None` if the field is not set or
12787    /// holds a different branch.
12788    pub fn foundation_model_tuning_options(
12789        &self,
12790    ) -> std::option::Option<
12791        &std::boxed::Box<
12792            crate::model::train_processor_version_request::FoundationModelTuningOptions,
12793        >,
12794    > {
12795        #[allow(unreachable_patterns)]
12796        self.processor_flags.as_ref().and_then(|v| match v {
12797            crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
12798            _ => std::option::Option::None,
12799        })
12800    }
12801
12802    /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12803    /// to hold a `FoundationModelTuningOptions`.
12804    ///
12805    /// Note that all the setters affecting `processor_flags` are
12806    /// mutually exclusive.
12807    ///
12808    /// # Example
12809    /// ```ignore,no_run
12810    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12811    /// use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
12812    /// let x = TrainProcessorVersionRequest::new().set_foundation_model_tuning_options(FoundationModelTuningOptions::default()/* use setters */);
12813    /// assert!(x.foundation_model_tuning_options().is_some());
12814    /// assert!(x.custom_document_extraction_options().is_none());
12815    /// ```
12816    pub fn set_foundation_model_tuning_options<
12817        T: std::convert::Into<
12818                std::boxed::Box<
12819                    crate::model::train_processor_version_request::FoundationModelTuningOptions,
12820                >,
12821            >,
12822    >(
12823        mut self,
12824        v: T,
12825    ) -> Self {
12826        self.processor_flags = std::option::Option::Some(
12827            crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
12828                v.into()
12829            )
12830        );
12831        self
12832    }
12833}
12834
12835impl wkt::message::Message for TrainProcessorVersionRequest {
12836    fn typename() -> &'static str {
12837        "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
12838    }
12839}
12840
12841/// Defines additional types related to [TrainProcessorVersionRequest].
12842pub mod train_processor_version_request {
12843    #[allow(unused_imports)]
12844    use super::*;
12845
12846    /// The input data used to train a new
12847    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
12848    ///
12849    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
12850    #[derive(Clone, Default, PartialEq)]
12851    #[non_exhaustive]
12852    pub struct InputData {
12853        /// The documents used for training the new version.
12854        pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
12855
12856        /// The documents used for testing the trained version.
12857        pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
12858
12859        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12860    }
12861
12862    impl InputData {
12863        pub fn new() -> Self {
12864            std::default::Default::default()
12865        }
12866
12867        /// Sets the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
12868        ///
12869        /// # Example
12870        /// ```ignore,no_run
12871        /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12872        /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12873        /// let x = InputData::new().set_training_documents(BatchDocumentsInputConfig::default()/* use setters */);
12874        /// ```
12875        pub fn set_training_documents<T>(mut self, v: T) -> Self
12876        where
12877            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12878        {
12879            self.training_documents = std::option::Option::Some(v.into());
12880            self
12881        }
12882
12883        /// Sets or clears the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
12884        ///
12885        /// # Example
12886        /// ```ignore,no_run
12887        /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12888        /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12889        /// let x = InputData::new().set_or_clear_training_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
12890        /// let x = InputData::new().set_or_clear_training_documents(None::<BatchDocumentsInputConfig>);
12891        /// ```
12892        pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
12893        where
12894            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12895        {
12896            self.training_documents = v.map(|x| x.into());
12897            self
12898        }
12899
12900        /// Sets the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
12901        ///
12902        /// # Example
12903        /// ```ignore,no_run
12904        /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12905        /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12906        /// let x = InputData::new().set_test_documents(BatchDocumentsInputConfig::default()/* use setters */);
12907        /// ```
12908        pub fn set_test_documents<T>(mut self, v: T) -> Self
12909        where
12910            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12911        {
12912            self.test_documents = std::option::Option::Some(v.into());
12913            self
12914        }
12915
12916        /// Sets or clears the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
12917        ///
12918        /// # Example
12919        /// ```ignore,no_run
12920        /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12921        /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12922        /// let x = InputData::new().set_or_clear_test_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
12923        /// let x = InputData::new().set_or_clear_test_documents(None::<BatchDocumentsInputConfig>);
12924        /// ```
12925        pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
12926        where
12927            T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12928        {
12929            self.test_documents = v.map(|x| x.into());
12930            self
12931        }
12932    }
12933
12934    impl wkt::message::Message for InputData {
12935        fn typename() -> &'static str {
12936            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
12937        }
12938    }
12939
12940    /// Options to control the training of the Custom Document Extraction (CDE)
12941    /// Processor.
12942    #[derive(Clone, Default, PartialEq)]
12943    #[non_exhaustive]
12944    pub struct CustomDocumentExtractionOptions {
12945
12946        /// Optional. Training method to use for CDE training.
12947        pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,
12948
12949        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12950    }
12951
12952    impl CustomDocumentExtractionOptions {
12953        pub fn new() -> Self {
12954            std::default::Default::default()
12955        }
12956
12957        /// Sets the value of [training_method][crate::model::train_processor_version_request::CustomDocumentExtractionOptions::training_method].
12958        ///
12959        /// # Example
12960        /// ```ignore,no_run
12961        /// # use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
12962        /// use google_cloud_documentai_v1::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod;
12963        /// let x0 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::ModelBased);
12964        /// let x1 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::TemplateBased);
12965        /// ```
12966        pub fn set_training_method<T: std::convert::Into<crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod>>(mut self, v: T) -> Self{
12967            self.training_method = v.into();
12968            self
12969        }
12970    }
12971
12972    impl wkt::message::Message for CustomDocumentExtractionOptions {
12973        fn typename() -> &'static str {
12974            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
12975        }
12976    }
12977
12978    /// Defines additional types related to [CustomDocumentExtractionOptions].
12979    pub mod custom_document_extraction_options {
12980        #[allow(unused_imports)]
12981        use super::*;
12982
12983        /// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
12984        /// `MODEL_BASED`.
12985        ///
12986        /// # Working with unknown values
12987        ///
12988        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12989        /// additional enum variants at any time. Adding new variants is not considered
12990        /// a breaking change. Applications should write their code in anticipation of:
12991        ///
12992        /// - New values appearing in future releases of the client library, **and**
12993        /// - New values received dynamically, without application changes.
12994        ///
12995        /// Please consult the [Working with enums] section in the user guide for some
12996        /// guidelines.
12997        ///
12998        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12999        #[derive(Clone, Debug, PartialEq)]
13000        #[non_exhaustive]
13001        pub enum TrainingMethod {
13002            Unspecified,
13003            ModelBased,
13004            TemplateBased,
13005            /// If set, the enum was initialized with an unknown value.
13006            ///
13007            /// Applications can examine the value using [TrainingMethod::value] or
13008            /// [TrainingMethod::name].
13009            UnknownValue(training_method::UnknownValue),
13010        }
13011
13012        #[doc(hidden)]
13013        pub mod training_method {
13014            #[allow(unused_imports)]
13015            use super::*;
13016            #[derive(Clone, Debug, PartialEq)]
13017            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13018        }
13019
13020        impl TrainingMethod {
13021            /// Gets the enum value.
13022            ///
13023            /// Returns `None` if the enum contains an unknown value deserialized from
13024            /// the string representation of enums.
13025            pub fn value(&self) -> std::option::Option<i32> {
13026                match self {
13027                    Self::Unspecified => std::option::Option::Some(0),
13028                    Self::ModelBased => std::option::Option::Some(1),
13029                    Self::TemplateBased => std::option::Option::Some(2),
13030                    Self::UnknownValue(u) => u.0.value(),
13031                }
13032            }
13033
13034            /// Gets the enum value as a string.
13035            ///
13036            /// Returns `None` if the enum contains an unknown value deserialized from
13037            /// the integer representation of enums.
13038            pub fn name(&self) -> std::option::Option<&str> {
13039                match self {
13040                    Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
13041                    Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
13042                    Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
13043                    Self::UnknownValue(u) => u.0.name(),
13044                }
13045            }
13046        }
13047
13048        impl std::default::Default for TrainingMethod {
13049            fn default() -> Self {
13050                use std::convert::From;
13051                Self::from(0)
13052            }
13053        }
13054
13055        impl std::fmt::Display for TrainingMethod {
13056            fn fmt(
13057                &self,
13058                f: &mut std::fmt::Formatter<'_>,
13059            ) -> std::result::Result<(), std::fmt::Error> {
13060                wkt::internal::display_enum(f, self.name(), self.value())
13061            }
13062        }
13063
13064        impl std::convert::From<i32> for TrainingMethod {
13065            fn from(value: i32) -> Self {
13066                match value {
13067                    0 => Self::Unspecified,
13068                    1 => Self::ModelBased,
13069                    2 => Self::TemplateBased,
13070                    _ => Self::UnknownValue(training_method::UnknownValue(
13071                        wkt::internal::UnknownEnumValue::Integer(value),
13072                    )),
13073                }
13074            }
13075        }
13076
13077        impl std::convert::From<&str> for TrainingMethod {
13078            fn from(value: &str) -> Self {
13079                use std::string::ToString;
13080                match value {
13081                    "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
13082                    "MODEL_BASED" => Self::ModelBased,
13083                    "TEMPLATE_BASED" => Self::TemplateBased,
13084                    _ => Self::UnknownValue(training_method::UnknownValue(
13085                        wkt::internal::UnknownEnumValue::String(value.to_string()),
13086                    )),
13087                }
13088            }
13089        }
13090
13091        impl serde::ser::Serialize for TrainingMethod {
13092            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13093            where
13094                S: serde::Serializer,
13095            {
13096                match self {
13097                    Self::Unspecified => serializer.serialize_i32(0),
13098                    Self::ModelBased => serializer.serialize_i32(1),
13099                    Self::TemplateBased => serializer.serialize_i32(2),
13100                    Self::UnknownValue(u) => u.0.serialize(serializer),
13101                }
13102            }
13103        }
13104
13105        impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
13106            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13107            where
13108                D: serde::Deserializer<'de>,
13109            {
13110                deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
13111                    ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
13112            }
13113        }
13114    }
13115
13116    /// Options to control foundation model tuning of the processor.
13117    #[derive(Clone, Default, PartialEq)]
13118    #[non_exhaustive]
13119    pub struct FoundationModelTuningOptions {
13120        /// Optional. The number of steps to run for model tuning. Valid values are
13121        /// between 1 and 400. If not provided, recommended steps will be used.
13122        pub train_steps: i32,
13123
13124        /// Optional. The multiplier to apply to the recommended learning rate. Valid
13125        /// values are between 0.1 and 10. If not provided, recommended learning rate
13126        /// will be used.
13127        pub learning_rate_multiplier: f32,
13128
13129        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13130    }
13131
13132    impl FoundationModelTuningOptions {
13133        pub fn new() -> Self {
13134            std::default::Default::default()
13135        }
13136
13137        /// Sets the value of [train_steps][crate::model::train_processor_version_request::FoundationModelTuningOptions::train_steps].
13138        ///
13139        /// # Example
13140        /// ```ignore,no_run
13141        /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13142        /// let x = FoundationModelTuningOptions::new().set_train_steps(42);
13143        /// ```
13144        pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13145            self.train_steps = v.into();
13146            self
13147        }
13148
13149        /// Sets the value of [learning_rate_multiplier][crate::model::train_processor_version_request::FoundationModelTuningOptions::learning_rate_multiplier].
13150        ///
13151        /// # Example
13152        /// ```ignore,no_run
13153        /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13154        /// let x = FoundationModelTuningOptions::new().set_learning_rate_multiplier(42.0);
13155        /// ```
13156        pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
13157            self.learning_rate_multiplier = v.into();
13158            self
13159        }
13160    }
13161
13162    impl wkt::message::Message for FoundationModelTuningOptions {
13163        fn typename() -> &'static str {
13164            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
13165        }
13166    }
13167
13168    #[derive(Clone, Debug, PartialEq)]
13169    #[non_exhaustive]
13170    pub enum ProcessorFlags {
13171        /// Options to control Custom Document Extraction (CDE) Processor.
13172        CustomDocumentExtractionOptions(
13173            std::boxed::Box<
13174                crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13175            >,
13176        ),
13177        /// Options to control foundation model tuning of a processor.
13178        FoundationModelTuningOptions(
13179            std::boxed::Box<
13180                crate::model::train_processor_version_request::FoundationModelTuningOptions,
13181            >,
13182        ),
13183    }
13184}
13185
13186/// The response for
13187/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
13188///
13189/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
13190#[derive(Clone, Default, PartialEq)]
13191#[non_exhaustive]
13192pub struct TrainProcessorVersionResponse {
13193    /// The resource name of the processor version produced by training.
13194    pub processor_version: std::string::String,
13195
13196    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13197}
13198
13199impl TrainProcessorVersionResponse {
13200    pub fn new() -> Self {
13201        std::default::Default::default()
13202    }
13203
13204    /// Sets the value of [processor_version][crate::model::TrainProcessorVersionResponse::processor_version].
13205    ///
13206    /// # Example
13207    /// ```ignore,no_run
13208    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionResponse;
13209    /// let x = TrainProcessorVersionResponse::new().set_processor_version("example");
13210    /// ```
13211    pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
13212        mut self,
13213        v: T,
13214    ) -> Self {
13215        self.processor_version = v.into();
13216        self
13217    }
13218}
13219
13220impl wkt::message::Message for TrainProcessorVersionResponse {
13221    fn typename() -> &'static str {
13222        "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
13223    }
13224}
13225
13226/// The metadata that represents a processor version being created.
13227#[derive(Clone, Default, PartialEq)]
13228#[non_exhaustive]
13229pub struct TrainProcessorVersionMetadata {
13230    /// The basic metadata of the long-running operation.
13231    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13232
13233    /// The training dataset validation information.
13234    pub training_dataset_validation:
13235        std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
13236
13237    /// The test dataset validation information.
13238    pub test_dataset_validation:
13239        std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
13240
13241    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13242}
13243
13244impl TrainProcessorVersionMetadata {
13245    pub fn new() -> Self {
13246        std::default::Default::default()
13247    }
13248
13249    /// Sets the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
13250    ///
13251    /// # Example
13252    /// ```ignore,no_run
13253    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13254    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13255    /// let x = TrainProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13256    /// ```
13257    pub fn set_common_metadata<T>(mut self, v: T) -> Self
13258    where
13259        T: std::convert::Into<crate::model::CommonOperationMetadata>,
13260    {
13261        self.common_metadata = std::option::Option::Some(v.into());
13262        self
13263    }
13264
13265    /// Sets or clears the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
13266    ///
13267    /// # Example
13268    /// ```ignore,no_run
13269    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13270    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13271    /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13272    /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13273    /// ```
13274    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13275    where
13276        T: std::convert::Into<crate::model::CommonOperationMetadata>,
13277    {
13278        self.common_metadata = v.map(|x| x.into());
13279        self
13280    }
13281
13282    /// Sets the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
13283    ///
13284    /// # Example
13285    /// ```ignore,no_run
13286    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13287    /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13288    /// let x = TrainProcessorVersionMetadata::new().set_training_dataset_validation(DatasetValidation::default()/* use setters */);
13289    /// ```
13290    pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
13291    where
13292        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13293    {
13294        self.training_dataset_validation = std::option::Option::Some(v.into());
13295        self
13296    }
13297
13298    /// Sets or clears the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
13299    ///
13300    /// # Example
13301    /// ```ignore,no_run
13302    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13303    /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13304    /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(Some(DatasetValidation::default()/* use setters */));
13305    /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(None::<DatasetValidation>);
13306    /// ```
13307    pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
13308    where
13309        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13310    {
13311        self.training_dataset_validation = v.map(|x| x.into());
13312        self
13313    }
13314
13315    /// Sets the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
13316    ///
13317    /// # Example
13318    /// ```ignore,no_run
13319    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13320    /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13321    /// let x = TrainProcessorVersionMetadata::new().set_test_dataset_validation(DatasetValidation::default()/* use setters */);
13322    /// ```
13323    pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
13324    where
13325        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13326    {
13327        self.test_dataset_validation = std::option::Option::Some(v.into());
13328        self
13329    }
13330
13331    /// Sets or clears the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
13332    ///
13333    /// # Example
13334    /// ```ignore,no_run
13335    /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13336    /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13337    /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(Some(DatasetValidation::default()/* use setters */));
13338    /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(None::<DatasetValidation>);
13339    /// ```
13340    pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
13341    where
13342        T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13343    {
13344        self.test_dataset_validation = v.map(|x| x.into());
13345        self
13346    }
13347}
13348
13349impl wkt::message::Message for TrainProcessorVersionMetadata {
13350    fn typename() -> &'static str {
13351        "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
13352    }
13353}
13354
13355/// Defines additional types related to [TrainProcessorVersionMetadata].
13356pub mod train_processor_version_metadata {
13357    #[allow(unused_imports)]
13358    use super::*;
13359
13360    /// The dataset validation information.
13361    /// This includes any and all errors with documents and the dataset.
13362    #[derive(Clone, Default, PartialEq)]
13363    #[non_exhaustive]
13364    pub struct DatasetValidation {
13365        /// The total number of document errors.
13366        pub document_error_count: i32,
13367
13368        /// The total number of dataset errors.
13369        pub dataset_error_count: i32,
13370
13371        /// Error information pertaining to specific documents. A maximum of 10
13372        /// document errors will be returned.
13373        /// Any document with errors will not be used throughout training.
13374        pub document_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
13375
13376        /// Error information for the dataset as a whole. A maximum of 10 dataset
13377        /// errors will be returned.
13378        /// A single dataset error is terminal for training.
13379        pub dataset_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
13380
13381        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13382    }
13383
13384    impl DatasetValidation {
13385        pub fn new() -> Self {
13386            std::default::Default::default()
13387        }
13388
13389        /// Sets the value of [document_error_count][crate::model::train_processor_version_metadata::DatasetValidation::document_error_count].
13390        ///
13391        /// # Example
13392        /// ```ignore,no_run
13393        /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13394        /// let x = DatasetValidation::new().set_document_error_count(42);
13395        /// ```
13396        pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13397            self.document_error_count = v.into();
13398            self
13399        }
13400
13401        /// Sets the value of [dataset_error_count][crate::model::train_processor_version_metadata::DatasetValidation::dataset_error_count].
13402        ///
13403        /// # Example
13404        /// ```ignore,no_run
13405        /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13406        /// let x = DatasetValidation::new().set_dataset_error_count(42);
13407        /// ```
13408        pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13409            self.dataset_error_count = v.into();
13410            self
13411        }
13412
13413        /// Sets the value of [document_errors][crate::model::train_processor_version_metadata::DatasetValidation::document_errors].
13414        ///
13415        /// # Example
13416        /// ```ignore,no_run
13417        /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13418        /// use google_cloud_rpc::model::Status;
13419        /// let x = DatasetValidation::new()
13420        ///     .set_document_errors([
13421        ///         Status::default()/* use setters */,
13422        ///         Status::default()/* use (different) setters */,
13423        ///     ]);
13424        /// ```
13425        pub fn set_document_errors<T, V>(mut self, v: T) -> Self
13426        where
13427            T: std::iter::IntoIterator<Item = V>,
13428            V: std::convert::Into<google_cloud_rpc::model::Status>,
13429        {
13430            use std::iter::Iterator;
13431            self.document_errors = v.into_iter().map(|i| i.into()).collect();
13432            self
13433        }
13434
13435        /// Sets the value of [dataset_errors][crate::model::train_processor_version_metadata::DatasetValidation::dataset_errors].
13436        ///
13437        /// # Example
13438        /// ```ignore,no_run
13439        /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13440        /// use google_cloud_rpc::model::Status;
13441        /// let x = DatasetValidation::new()
13442        ///     .set_dataset_errors([
13443        ///         Status::default()/* use setters */,
13444        ///         Status::default()/* use (different) setters */,
13445        ///     ]);
13446        /// ```
13447        pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
13448        where
13449            T: std::iter::IntoIterator<Item = V>,
13450            V: std::convert::Into<google_cloud_rpc::model::Status>,
13451        {
13452            use std::iter::Iterator;
13453            self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
13454            self
13455        }
13456    }
13457
13458    impl wkt::message::Message for DatasetValidation {
13459        fn typename() -> &'static str {
13460            "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
13461        }
13462    }
13463}
13464
13465/// Request message for the
13466/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
13467/// method.
13468///
13469/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
13470#[derive(Clone, Default, PartialEq)]
13471#[non_exhaustive]
13472pub struct ReviewDocumentRequest {
13473    /// Required. The resource name of the
13474    /// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
13475    /// document will be reviewed with.
13476    pub human_review_config: std::string::String,
13477
13478    /// Whether the validation should be performed on the ad-hoc review request.
13479    pub enable_schema_validation: bool,
13480
13481    /// The priority of the human review task.
13482    pub priority: crate::model::review_document_request::Priority,
13483
13484    /// The document schema of the human review task.
13485    pub document_schema: std::option::Option<crate::model::DocumentSchema>,
13486
13487    /// The document payload.
13488    pub source: std::option::Option<crate::model::review_document_request::Source>,
13489
13490    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13491}
13492
13493impl ReviewDocumentRequest {
13494    pub fn new() -> Self {
13495        std::default::Default::default()
13496    }
13497
13498    /// Sets the value of [human_review_config][crate::model::ReviewDocumentRequest::human_review_config].
13499    ///
13500    /// # Example
13501    /// ```ignore,no_run
13502    /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13503    /// let x = ReviewDocumentRequest::new().set_human_review_config("example");
13504    /// ```
13505    pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
13506        mut self,
13507        v: T,
13508    ) -> Self {
13509        self.human_review_config = v.into();
13510        self
13511    }
13512
13513    /// Sets the value of [enable_schema_validation][crate::model::ReviewDocumentRequest::enable_schema_validation].
13514    ///
13515    /// # Example
13516    /// ```ignore,no_run
13517    /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13518    /// let x = ReviewDocumentRequest::new().set_enable_schema_validation(true);
13519    /// ```
13520    pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13521        self.enable_schema_validation = v.into();
13522        self
13523    }
13524
13525    /// Sets the value of [priority][crate::model::ReviewDocumentRequest::priority].
13526    ///
13527    /// # Example
13528    /// ```ignore,no_run
13529    /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13530    /// use google_cloud_documentai_v1::model::review_document_request::Priority;
13531    /// let x0 = ReviewDocumentRequest::new().set_priority(Priority::Urgent);
13532    /// ```
13533    pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
13534        mut self,
13535        v: T,
13536    ) -> Self {
13537        self.priority = v.into();
13538        self
13539    }
13540
13541    /// Sets the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
13542    ///
13543    /// # Example
13544    /// ```ignore,no_run
13545    /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13546    /// use google_cloud_documentai_v1::model::DocumentSchema;
13547    /// let x = ReviewDocumentRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
13548    /// ```
13549    pub fn set_document_schema<T>(mut self, v: T) -> Self
13550    where
13551        T: std::convert::Into<crate::model::DocumentSchema>,
13552    {
13553        self.document_schema = std::option::Option::Some(v.into());
13554        self
13555    }
13556
13557    /// Sets or clears the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
13558    ///
13559    /// # Example
13560    /// ```ignore,no_run
13561    /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13562    /// use google_cloud_documentai_v1::model::DocumentSchema;
13563    /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
13564    /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
13565    /// ```
13566    pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
13567    where
13568        T: std::convert::Into<crate::model::DocumentSchema>,
13569    {
13570        self.document_schema = v.map(|x| x.into());
13571        self
13572    }
13573
13574    /// Sets the value of [source][crate::model::ReviewDocumentRequest::source].
13575    ///
13576    /// Note that all the setters affecting `source` are mutually
13577    /// exclusive.
13578    ///
13579    /// # Example
13580    /// ```ignore,no_run
13581    /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13582    /// use google_cloud_documentai_v1::model::Document;
13583    /// let x = ReviewDocumentRequest::new().set_source(Some(
13584    ///     google_cloud_documentai_v1::model::review_document_request::Source::InlineDocument(Document::default().into())));
13585    /// ```
13586    pub fn set_source<
13587        T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
13588    >(
13589        mut self,
13590        v: T,
13591    ) -> Self {
13592        self.source = v.into();
13593        self
13594    }
13595
13596    /// The value of [source][crate::model::ReviewDocumentRequest::source]
13597    /// if it holds a `InlineDocument`, `None` if the field is not set or
13598    /// holds a different branch.
13599    pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
13600        #[allow(unreachable_patterns)]
13601        self.source.as_ref().and_then(|v| match v {
13602            crate::model::review_document_request::Source::InlineDocument(v) => {
13603                std::option::Option::Some(v)
13604            }
13605            _ => std::option::Option::None,
13606        })
13607    }
13608
13609    /// Sets the value of [source][crate::model::ReviewDocumentRequest::source]
13610    /// to hold a `InlineDocument`.
13611    ///
13612    /// Note that all the setters affecting `source` are
13613    /// mutually exclusive.
13614    ///
13615    /// # Example
13616    /// ```ignore,no_run
13617    /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13618    /// use google_cloud_documentai_v1::model::Document;
13619    /// let x = ReviewDocumentRequest::new().set_inline_document(Document::default()/* use setters */);
13620    /// assert!(x.inline_document().is_some());
13621    /// ```
13622    pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
13623        mut self,
13624        v: T,
13625    ) -> Self {
13626        self.source = std::option::Option::Some(
13627            crate::model::review_document_request::Source::InlineDocument(v.into()),
13628        );
13629        self
13630    }
13631}
13632
13633impl wkt::message::Message for ReviewDocumentRequest {
13634    fn typename() -> &'static str {
13635        "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
13636    }
13637}
13638
13639/// Defines additional types related to [ReviewDocumentRequest].
13640pub mod review_document_request {
13641    #[allow(unused_imports)]
13642    use super::*;
13643
13644    /// The priority level of the human review task.
13645    ///
13646    /// # Working with unknown values
13647    ///
13648    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13649    /// additional enum variants at any time. Adding new variants is not considered
13650    /// a breaking change. Applications should write their code in anticipation of:
13651    ///
13652    /// - New values appearing in future releases of the client library, **and**
13653    /// - New values received dynamically, without application changes.
13654    ///
13655    /// Please consult the [Working with enums] section in the user guide for some
13656    /// guidelines.
13657    ///
13658    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13659    #[derive(Clone, Debug, PartialEq)]
13660    #[non_exhaustive]
13661    pub enum Priority {
13662        /// The default priority level.
13663        Default,
13664        /// The urgent priority level. The labeling manager should allocate labeler
13665        /// resource to the urgent task queue to respect this priority level.
13666        Urgent,
13667        /// If set, the enum was initialized with an unknown value.
13668        ///
13669        /// Applications can examine the value using [Priority::value] or
13670        /// [Priority::name].
13671        UnknownValue(priority::UnknownValue),
13672    }
13673
13674    #[doc(hidden)]
13675    pub mod priority {
13676        #[allow(unused_imports)]
13677        use super::*;
13678        #[derive(Clone, Debug, PartialEq)]
13679        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13680    }
13681
13682    impl Priority {
13683        /// Gets the enum value.
13684        ///
13685        /// Returns `None` if the enum contains an unknown value deserialized from
13686        /// the string representation of enums.
13687        pub fn value(&self) -> std::option::Option<i32> {
13688            match self {
13689                Self::Default => std::option::Option::Some(0),
13690                Self::Urgent => std::option::Option::Some(1),
13691                Self::UnknownValue(u) => u.0.value(),
13692            }
13693        }
13694
13695        /// Gets the enum value as a string.
13696        ///
13697        /// Returns `None` if the enum contains an unknown value deserialized from
13698        /// the integer representation of enums.
13699        pub fn name(&self) -> std::option::Option<&str> {
13700            match self {
13701                Self::Default => std::option::Option::Some("DEFAULT"),
13702                Self::Urgent => std::option::Option::Some("URGENT"),
13703                Self::UnknownValue(u) => u.0.name(),
13704            }
13705        }
13706    }
13707
13708    impl std::default::Default for Priority {
13709        fn default() -> Self {
13710            use std::convert::From;
13711            Self::from(0)
13712        }
13713    }
13714
13715    impl std::fmt::Display for Priority {
13716        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13717            wkt::internal::display_enum(f, self.name(), self.value())
13718        }
13719    }
13720
13721    impl std::convert::From<i32> for Priority {
13722        fn from(value: i32) -> Self {
13723            match value {
13724                0 => Self::Default,
13725                1 => Self::Urgent,
13726                _ => Self::UnknownValue(priority::UnknownValue(
13727                    wkt::internal::UnknownEnumValue::Integer(value),
13728                )),
13729            }
13730        }
13731    }
13732
13733    impl std::convert::From<&str> for Priority {
13734        fn from(value: &str) -> Self {
13735            use std::string::ToString;
13736            match value {
13737                "DEFAULT" => Self::Default,
13738                "URGENT" => Self::Urgent,
13739                _ => Self::UnknownValue(priority::UnknownValue(
13740                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13741                )),
13742            }
13743        }
13744    }
13745
13746    impl serde::ser::Serialize for Priority {
13747        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13748        where
13749            S: serde::Serializer,
13750        {
13751            match self {
13752                Self::Default => serializer.serialize_i32(0),
13753                Self::Urgent => serializer.serialize_i32(1),
13754                Self::UnknownValue(u) => u.0.serialize(serializer),
13755            }
13756        }
13757    }
13758
13759    impl<'de> serde::de::Deserialize<'de> for Priority {
13760        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13761        where
13762            D: serde::Deserializer<'de>,
13763        {
13764            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
13765                ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
13766            ))
13767        }
13768    }
13769
13770    /// The document payload.
13771    #[derive(Clone, Debug, PartialEq)]
13772    #[non_exhaustive]
13773    pub enum Source {
13774        /// An inline document proto.
13775        InlineDocument(std::boxed::Box<crate::model::Document>),
13776    }
13777}
13778
13779/// Response message for the
13780/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
13781/// method.
13782///
13783/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
13784#[derive(Clone, Default, PartialEq)]
13785#[non_exhaustive]
13786pub struct ReviewDocumentResponse {
13787    /// The Cloud Storage uri for the human reviewed document if the review is
13788    /// succeeded.
13789    pub gcs_destination: std::string::String,
13790
13791    /// The state of the review operation.
13792    pub state: crate::model::review_document_response::State,
13793
13794    /// The reason why the review is rejected by reviewer.
13795    pub rejection_reason: std::string::String,
13796
13797    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13798}
13799
13800impl ReviewDocumentResponse {
13801    pub fn new() -> Self {
13802        std::default::Default::default()
13803    }
13804
13805    /// Sets the value of [gcs_destination][crate::model::ReviewDocumentResponse::gcs_destination].
13806    ///
13807    /// # Example
13808    /// ```ignore,no_run
13809    /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
13810    /// let x = ReviewDocumentResponse::new().set_gcs_destination("example");
13811    /// ```
13812    pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13813        self.gcs_destination = v.into();
13814        self
13815    }
13816
13817    /// Sets the value of [state][crate::model::ReviewDocumentResponse::state].
13818    ///
13819    /// # Example
13820    /// ```ignore,no_run
13821    /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
13822    /// use google_cloud_documentai_v1::model::review_document_response::State;
13823    /// let x0 = ReviewDocumentResponse::new().set_state(State::Rejected);
13824    /// let x1 = ReviewDocumentResponse::new().set_state(State::Succeeded);
13825    /// ```
13826    pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
13827        mut self,
13828        v: T,
13829    ) -> Self {
13830        self.state = v.into();
13831        self
13832    }
13833
13834    /// Sets the value of [rejection_reason][crate::model::ReviewDocumentResponse::rejection_reason].
13835    ///
13836    /// # Example
13837    /// ```ignore,no_run
13838    /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
13839    /// let x = ReviewDocumentResponse::new().set_rejection_reason("example");
13840    /// ```
13841    pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
13842        mut self,
13843        v: T,
13844    ) -> Self {
13845        self.rejection_reason = v.into();
13846        self
13847    }
13848}
13849
13850impl wkt::message::Message for ReviewDocumentResponse {
13851    fn typename() -> &'static str {
13852        "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
13853    }
13854}
13855
13856/// Defines additional types related to [ReviewDocumentResponse].
13857pub mod review_document_response {
13858    #[allow(unused_imports)]
13859    use super::*;
13860
13861    /// Possible states of the review operation.
13862    ///
13863    /// # Working with unknown values
13864    ///
13865    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13866    /// additional enum variants at any time. Adding new variants is not considered
13867    /// a breaking change. Applications should write their code in anticipation of:
13868    ///
13869    /// - New values appearing in future releases of the client library, **and**
13870    /// - New values received dynamically, without application changes.
13871    ///
13872    /// Please consult the [Working with enums] section in the user guide for some
13873    /// guidelines.
13874    ///
13875    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13876    #[derive(Clone, Debug, PartialEq)]
13877    #[non_exhaustive]
13878    pub enum State {
13879        /// The default value. This value is used if the state is omitted.
13880        Unspecified,
13881        /// The review operation is rejected by the reviewer.
13882        Rejected,
13883        /// The review operation is succeeded.
13884        Succeeded,
13885        /// If set, the enum was initialized with an unknown value.
13886        ///
13887        /// Applications can examine the value using [State::value] or
13888        /// [State::name].
13889        UnknownValue(state::UnknownValue),
13890    }
13891
13892    #[doc(hidden)]
13893    pub mod state {
13894        #[allow(unused_imports)]
13895        use super::*;
13896        #[derive(Clone, Debug, PartialEq)]
13897        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13898    }
13899
13900    impl State {
13901        /// Gets the enum value.
13902        ///
13903        /// Returns `None` if the enum contains an unknown value deserialized from
13904        /// the string representation of enums.
13905        pub fn value(&self) -> std::option::Option<i32> {
13906            match self {
13907                Self::Unspecified => std::option::Option::Some(0),
13908                Self::Rejected => std::option::Option::Some(1),
13909                Self::Succeeded => std::option::Option::Some(2),
13910                Self::UnknownValue(u) => u.0.value(),
13911            }
13912        }
13913
13914        /// Gets the enum value as a string.
13915        ///
13916        /// Returns `None` if the enum contains an unknown value deserialized from
13917        /// the integer representation of enums.
13918        pub fn name(&self) -> std::option::Option<&str> {
13919            match self {
13920                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13921                Self::Rejected => std::option::Option::Some("REJECTED"),
13922                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
13923                Self::UnknownValue(u) => u.0.name(),
13924            }
13925        }
13926    }
13927
13928    impl std::default::Default for State {
13929        fn default() -> Self {
13930            use std::convert::From;
13931            Self::from(0)
13932        }
13933    }
13934
13935    impl std::fmt::Display for State {
13936        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13937            wkt::internal::display_enum(f, self.name(), self.value())
13938        }
13939    }
13940
13941    impl std::convert::From<i32> for State {
13942        fn from(value: i32) -> Self {
13943            match value {
13944                0 => Self::Unspecified,
13945                1 => Self::Rejected,
13946                2 => Self::Succeeded,
13947                _ => Self::UnknownValue(state::UnknownValue(
13948                    wkt::internal::UnknownEnumValue::Integer(value),
13949                )),
13950            }
13951        }
13952    }
13953
13954    impl std::convert::From<&str> for State {
13955        fn from(value: &str) -> Self {
13956            use std::string::ToString;
13957            match value {
13958                "STATE_UNSPECIFIED" => Self::Unspecified,
13959                "REJECTED" => Self::Rejected,
13960                "SUCCEEDED" => Self::Succeeded,
13961                _ => Self::UnknownValue(state::UnknownValue(
13962                    wkt::internal::UnknownEnumValue::String(value.to_string()),
13963                )),
13964            }
13965        }
13966    }
13967
13968    impl serde::ser::Serialize for State {
13969        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13970        where
13971            S: serde::Serializer,
13972        {
13973            match self {
13974                Self::Unspecified => serializer.serialize_i32(0),
13975                Self::Rejected => serializer.serialize_i32(1),
13976                Self::Succeeded => serializer.serialize_i32(2),
13977                Self::UnknownValue(u) => u.0.serialize(serializer),
13978            }
13979        }
13980    }
13981
13982    impl<'de> serde::de::Deserialize<'de> for State {
13983        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13984        where
13985            D: serde::Deserializer<'de>,
13986        {
13987            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13988                ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
13989            ))
13990        }
13991    }
13992}
13993
13994/// The long-running operation metadata for the
13995/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
13996/// method.
13997///
13998/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
13999#[derive(Clone, Default, PartialEq)]
14000#[non_exhaustive]
14001pub struct ReviewDocumentOperationMetadata {
14002    /// The basic metadata of the long-running operation.
14003    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14004
14005    /// The Crowd Compute question ID.
14006    pub question_id: std::string::String,
14007
14008    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14009}
14010
14011impl ReviewDocumentOperationMetadata {
14012    pub fn new() -> Self {
14013        std::default::Default::default()
14014    }
14015
14016    /// Sets the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
14017    ///
14018    /// # Example
14019    /// ```ignore,no_run
14020    /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
14021    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14022    /// let x = ReviewDocumentOperationMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14023    /// ```
14024    pub fn set_common_metadata<T>(mut self, v: T) -> Self
14025    where
14026        T: std::convert::Into<crate::model::CommonOperationMetadata>,
14027    {
14028        self.common_metadata = std::option::Option::Some(v.into());
14029        self
14030    }
14031
14032    /// Sets or clears the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
14033    ///
14034    /// # Example
14035    /// ```ignore,no_run
14036    /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
14037    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14038    /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14039    /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14040    /// ```
14041    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14042    where
14043        T: std::convert::Into<crate::model::CommonOperationMetadata>,
14044    {
14045        self.common_metadata = v.map(|x| x.into());
14046        self
14047    }
14048
14049    /// Sets the value of [question_id][crate::model::ReviewDocumentOperationMetadata::question_id].
14050    ///
14051    /// # Example
14052    /// ```ignore,no_run
14053    /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
14054    /// let x = ReviewDocumentOperationMetadata::new().set_question_id("example");
14055    /// ```
14056    pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14057        self.question_id = v.into();
14058        self
14059    }
14060}
14061
14062impl wkt::message::Message for ReviewDocumentOperationMetadata {
14063    fn typename() -> &'static str {
14064        "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
14065    }
14066}
14067
14068/// Evaluates the given
14069/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
14070/// supplied documents.
14071///
14072/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14073#[derive(Clone, Default, PartialEq)]
14074#[non_exhaustive]
14075pub struct EvaluateProcessorVersionRequest {
14076    /// Required. The resource name of the
14077    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
14078    /// evaluate.
14079    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
14080    ///
14081    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14082    pub processor_version: std::string::String,
14083
14084    /// Optional. The documents used in the evaluation. If unspecified, use the
14085    /// processor's dataset as evaluation input.
14086    pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
14087
14088    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14089}
14090
14091impl EvaluateProcessorVersionRequest {
14092    pub fn new() -> Self {
14093        std::default::Default::default()
14094    }
14095
14096    /// Sets the value of [processor_version][crate::model::EvaluateProcessorVersionRequest::processor_version].
14097    ///
14098    /// # Example
14099    /// ```ignore,no_run
14100    /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
14101    /// let x = EvaluateProcessorVersionRequest::new().set_processor_version("example");
14102    /// ```
14103    pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
14104        mut self,
14105        v: T,
14106    ) -> Self {
14107        self.processor_version = v.into();
14108        self
14109    }
14110
14111    /// Sets the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
14112    ///
14113    /// # Example
14114    /// ```ignore,no_run
14115    /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
14116    /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14117    /// let x = EvaluateProcessorVersionRequest::new().set_evaluation_documents(BatchDocumentsInputConfig::default()/* use setters */);
14118    /// ```
14119    pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
14120    where
14121        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14122    {
14123        self.evaluation_documents = std::option::Option::Some(v.into());
14124        self
14125    }
14126
14127    /// Sets or clears the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
14128    ///
14129    /// # Example
14130    /// ```ignore,no_run
14131    /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
14132    /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14133    /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
14134    /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(None::<BatchDocumentsInputConfig>);
14135    /// ```
14136    pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
14137    where
14138        T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14139    {
14140        self.evaluation_documents = v.map(|x| x.into());
14141        self
14142    }
14143}
14144
14145impl wkt::message::Message for EvaluateProcessorVersionRequest {
14146    fn typename() -> &'static str {
14147        "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
14148    }
14149}
14150
14151/// Metadata of the
14152/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
14153/// method.
14154///
14155/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
14156#[derive(Clone, Default, PartialEq)]
14157#[non_exhaustive]
14158pub struct EvaluateProcessorVersionMetadata {
14159    /// The basic metadata of the long-running operation.
14160    pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14161
14162    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14163}
14164
14165impl EvaluateProcessorVersionMetadata {
14166    pub fn new() -> Self {
14167        std::default::Default::default()
14168    }
14169
14170    /// Sets the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
14171    ///
14172    /// # Example
14173    /// ```ignore,no_run
14174    /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
14175    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14176    /// let x = EvaluateProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14177    /// ```
14178    pub fn set_common_metadata<T>(mut self, v: T) -> Self
14179    where
14180        T: std::convert::Into<crate::model::CommonOperationMetadata>,
14181    {
14182        self.common_metadata = std::option::Option::Some(v.into());
14183        self
14184    }
14185
14186    /// Sets or clears the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
14187    ///
14188    /// # Example
14189    /// ```ignore,no_run
14190    /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
14191    /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14192    /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14193    /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14194    /// ```
14195    pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14196    where
14197        T: std::convert::Into<crate::model::CommonOperationMetadata>,
14198    {
14199        self.common_metadata = v.map(|x| x.into());
14200        self
14201    }
14202}
14203
14204impl wkt::message::Message for EvaluateProcessorVersionMetadata {
14205    fn typename() -> &'static str {
14206        "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
14207    }
14208}
14209
14210/// Response of the
14211/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
14212/// method.
14213///
14214/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
14215#[derive(Clone, Default, PartialEq)]
14216#[non_exhaustive]
14217pub struct EvaluateProcessorVersionResponse {
14218    /// The resource name of the created evaluation.
14219    pub evaluation: std::string::String,
14220
14221    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14222}
14223
14224impl EvaluateProcessorVersionResponse {
14225    pub fn new() -> Self {
14226        std::default::Default::default()
14227    }
14228
14229    /// Sets the value of [evaluation][crate::model::EvaluateProcessorVersionResponse::evaluation].
14230    ///
14231    /// # Example
14232    /// ```ignore,no_run
14233    /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionResponse;
14234    /// let x = EvaluateProcessorVersionResponse::new().set_evaluation("example");
14235    /// ```
14236    pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14237        self.evaluation = v.into();
14238        self
14239    }
14240}
14241
14242impl wkt::message::Message for EvaluateProcessorVersionResponse {
14243    fn typename() -> &'static str {
14244        "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
14245    }
14246}
14247
14248/// Retrieves a specific Evaluation.
14249#[derive(Clone, Default, PartialEq)]
14250#[non_exhaustive]
14251pub struct GetEvaluationRequest {
14252    /// Required. The resource name of the
14253    /// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
14254    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
14255    ///
14256    /// [google.cloud.documentai.v1.Evaluation]: crate::model::Evaluation
14257    pub name: std::string::String,
14258
14259    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14260}
14261
14262impl GetEvaluationRequest {
14263    pub fn new() -> Self {
14264        std::default::Default::default()
14265    }
14266
14267    /// Sets the value of [name][crate::model::GetEvaluationRequest::name].
14268    ///
14269    /// # Example
14270    /// ```ignore,no_run
14271    /// # use google_cloud_documentai_v1::model::GetEvaluationRequest;
14272    /// let x = GetEvaluationRequest::new().set_name("example");
14273    /// ```
14274    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14275        self.name = v.into();
14276        self
14277    }
14278}
14279
14280impl wkt::message::Message for GetEvaluationRequest {
14281    fn typename() -> &'static str {
14282        "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
14283    }
14284}
14285
14286/// Retrieves a list of evaluations for a given
14287/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
14288///
14289/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14290#[derive(Clone, Default, PartialEq)]
14291#[non_exhaustive]
14292pub struct ListEvaluationsRequest {
14293    /// Required. The resource name of the
14294    /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
14295    /// evaluations for.
14296    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
14297    ///
14298    /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14299    pub parent: std::string::String,
14300
14301    /// The standard list page size.
14302    /// If unspecified, at most `5` evaluations are returned.
14303    /// The maximum value is `100`. Values above `100` are coerced to `100`.
14304    pub page_size: i32,
14305
14306    /// A page token, received from a previous `ListEvaluations` call.
14307    /// Provide this to retrieve the subsequent page.
14308    pub page_token: std::string::String,
14309
14310    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14311}
14312
14313impl ListEvaluationsRequest {
14314    pub fn new() -> Self {
14315        std::default::Default::default()
14316    }
14317
14318    /// Sets the value of [parent][crate::model::ListEvaluationsRequest::parent].
14319    ///
14320    /// # Example
14321    /// ```ignore,no_run
14322    /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
14323    /// let x = ListEvaluationsRequest::new().set_parent("example");
14324    /// ```
14325    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14326        self.parent = v.into();
14327        self
14328    }
14329
14330    /// Sets the value of [page_size][crate::model::ListEvaluationsRequest::page_size].
14331    ///
14332    /// # Example
14333    /// ```ignore,no_run
14334    /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
14335    /// let x = ListEvaluationsRequest::new().set_page_size(42);
14336    /// ```
14337    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14338        self.page_size = v.into();
14339        self
14340    }
14341
14342    /// Sets the value of [page_token][crate::model::ListEvaluationsRequest::page_token].
14343    ///
14344    /// # Example
14345    /// ```ignore,no_run
14346    /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
14347    /// let x = ListEvaluationsRequest::new().set_page_token("example");
14348    /// ```
14349    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14350        self.page_token = v.into();
14351        self
14352    }
14353}
14354
14355impl wkt::message::Message for ListEvaluationsRequest {
14356    fn typename() -> &'static str {
14357        "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
14358    }
14359}
14360
14361/// The response from `ListEvaluations`.
14362#[derive(Clone, Default, PartialEq)]
14363#[non_exhaustive]
14364pub struct ListEvaluationsResponse {
14365    /// The evaluations requested.
14366    pub evaluations: std::vec::Vec<crate::model::Evaluation>,
14367
14368    /// A token, which can be sent as `page_token` to retrieve the next page.
14369    /// If this field is omitted, there are no subsequent pages.
14370    pub next_page_token: std::string::String,
14371
14372    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14373}
14374
14375impl ListEvaluationsResponse {
14376    pub fn new() -> Self {
14377        std::default::Default::default()
14378    }
14379
14380    /// Sets the value of [evaluations][crate::model::ListEvaluationsResponse::evaluations].
14381    ///
14382    /// # Example
14383    /// ```ignore,no_run
14384    /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
14385    /// use google_cloud_documentai_v1::model::Evaluation;
14386    /// let x = ListEvaluationsResponse::new()
14387    ///     .set_evaluations([
14388    ///         Evaluation::default()/* use setters */,
14389    ///         Evaluation::default()/* use (different) setters */,
14390    ///     ]);
14391    /// ```
14392    pub fn set_evaluations<T, V>(mut self, v: T) -> Self
14393    where
14394        T: std::iter::IntoIterator<Item = V>,
14395        V: std::convert::Into<crate::model::Evaluation>,
14396    {
14397        use std::iter::Iterator;
14398        self.evaluations = v.into_iter().map(|i| i.into()).collect();
14399        self
14400    }
14401
14402    /// Sets the value of [next_page_token][crate::model::ListEvaluationsResponse::next_page_token].
14403    ///
14404    /// # Example
14405    /// ```ignore,no_run
14406    /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
14407    /// let x = ListEvaluationsResponse::new().set_next_page_token("example");
14408    /// ```
14409    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14410        self.next_page_token = v.into();
14411        self
14412    }
14413}
14414
14415impl wkt::message::Message for ListEvaluationsResponse {
14416    fn typename() -> &'static str {
14417        "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
14418    }
14419}
14420
14421#[doc(hidden)]
14422impl google_cloud_gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
14423    type PageItem = crate::model::Evaluation;
14424
14425    fn items(self) -> std::vec::Vec<Self::PageItem> {
14426        self.evaluations
14427    }
14428
14429    fn next_page_token(&self) -> std::string::String {
14430        use std::clone::Clone;
14431        self.next_page_token.clone()
14432    }
14433}
14434
14435/// The schema defines the output of the processed document by a processor.
14436#[derive(Clone, Default, PartialEq)]
14437#[non_exhaustive]
14438pub struct DocumentSchema {
14439    /// Display name to show to users.
14440    pub display_name: std::string::String,
14441
14442    /// Description of the schema.
14443    pub description: std::string::String,
14444
14445    /// Entity types of the schema.
14446    pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,
14447
14448    /// Metadata of the schema.
14449    pub metadata: std::option::Option<crate::model::document_schema::Metadata>,
14450
14451    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14452}
14453
14454impl DocumentSchema {
14455    pub fn new() -> Self {
14456        std::default::Default::default()
14457    }
14458
14459    /// Sets the value of [display_name][crate::model::DocumentSchema::display_name].
14460    ///
14461    /// # Example
14462    /// ```ignore,no_run
14463    /// # use google_cloud_documentai_v1::model::DocumentSchema;
14464    /// let x = DocumentSchema::new().set_display_name("example");
14465    /// ```
14466    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14467        self.display_name = v.into();
14468        self
14469    }
14470
14471    /// Sets the value of [description][crate::model::DocumentSchema::description].
14472    ///
14473    /// # Example
14474    /// ```ignore,no_run
14475    /// # use google_cloud_documentai_v1::model::DocumentSchema;
14476    /// let x = DocumentSchema::new().set_description("example");
14477    /// ```
14478    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14479        self.description = v.into();
14480        self
14481    }
14482
14483    /// Sets the value of [entity_types][crate::model::DocumentSchema::entity_types].
14484    ///
14485    /// # Example
14486    /// ```ignore,no_run
14487    /// # use google_cloud_documentai_v1::model::DocumentSchema;
14488    /// use google_cloud_documentai_v1::model::document_schema::EntityType;
14489    /// let x = DocumentSchema::new()
14490    ///     .set_entity_types([
14491    ///         EntityType::default()/* use setters */,
14492    ///         EntityType::default()/* use (different) setters */,
14493    ///     ]);
14494    /// ```
14495    pub fn set_entity_types<T, V>(mut self, v: T) -> Self
14496    where
14497        T: std::iter::IntoIterator<Item = V>,
14498        V: std::convert::Into<crate::model::document_schema::EntityType>,
14499    {
14500        use std::iter::Iterator;
14501        self.entity_types = v.into_iter().map(|i| i.into()).collect();
14502        self
14503    }
14504
14505    /// Sets the value of [metadata][crate::model::DocumentSchema::metadata].
14506    ///
14507    /// # Example
14508    /// ```ignore,no_run
14509    /// # use google_cloud_documentai_v1::model::DocumentSchema;
14510    /// use google_cloud_documentai_v1::model::document_schema::Metadata;
14511    /// let x = DocumentSchema::new().set_metadata(Metadata::default()/* use setters */);
14512    /// ```
14513    pub fn set_metadata<T>(mut self, v: T) -> Self
14514    where
14515        T: std::convert::Into<crate::model::document_schema::Metadata>,
14516    {
14517        self.metadata = std::option::Option::Some(v.into());
14518        self
14519    }
14520
14521    /// Sets or clears the value of [metadata][crate::model::DocumentSchema::metadata].
14522    ///
14523    /// # Example
14524    /// ```ignore,no_run
14525    /// # use google_cloud_documentai_v1::model::DocumentSchema;
14526    /// use google_cloud_documentai_v1::model::document_schema::Metadata;
14527    /// let x = DocumentSchema::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
14528    /// let x = DocumentSchema::new().set_or_clear_metadata(None::<Metadata>);
14529    /// ```
14530    pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14531    where
14532        T: std::convert::Into<crate::model::document_schema::Metadata>,
14533    {
14534        self.metadata = v.map(|x| x.into());
14535        self
14536    }
14537}
14538
14539impl wkt::message::Message for DocumentSchema {
14540    fn typename() -> &'static str {
14541        "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
14542    }
14543}
14544
14545/// Defines additional types related to [DocumentSchema].
14546pub mod document_schema {
14547    #[allow(unused_imports)]
14548    use super::*;
14549
14550    /// EntityType is the wrapper of a label of the corresponding model with
14551    /// detailed attributes and limitations for entity-based processors. Multiple
14552    /// types can also compose a dependency tree to represent nested types.
14553    #[derive(Clone, Default, PartialEq)]
14554    #[non_exhaustive]
14555    pub struct EntityType {
14556        /// User defined name for the type.
14557        pub display_name: std::string::String,
14558
14559        /// Name of the type. It must be unique within the schema file and
14560        /// cannot be a "Common Type".  The following naming conventions are used:
14561        ///
14562        /// - Use `snake_casing`.
14563        /// - Name matching is case-sensitive.
14564        /// - Maximum 64 characters.
14565        /// - Must start with a letter.
14566        /// - Allowed characters: ASCII letters `[a-z0-9_-]`.  (For backward
14567        ///   compatibility internal infrastructure and tooling can handle any ascii
14568        ///   character.)
14569        /// - The `/` is sometimes used to denote a property of a type.  For example
14570        ///   `line_item/amount`.  This convention is deprecated, but will still be
14571        ///   honored for backward compatibility.
14572        pub name: std::string::String,
14573
14574        /// The entity type that this type is derived from.  For now, one and only
14575        /// one should be set.
14576        pub base_types: std::vec::Vec<std::string::String>,
14577
14578        /// Description the nested structure, or composition of an entity.
14579        pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,
14580
14581        pub value_source:
14582            std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
14583
14584        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14585    }
14586
14587    impl EntityType {
14588        pub fn new() -> Self {
14589            std::default::Default::default()
14590        }
14591
14592        /// Sets the value of [display_name][crate::model::document_schema::EntityType::display_name].
14593        ///
14594        /// # Example
14595        /// ```ignore,no_run
14596        /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14597        /// let x = EntityType::new().set_display_name("example");
14598        /// ```
14599        pub fn set_display_name<T: std::convert::Into<std::string::String>>(
14600            mut self,
14601            v: T,
14602        ) -> Self {
14603            self.display_name = v.into();
14604            self
14605        }
14606
14607        /// Sets the value of [name][crate::model::document_schema::EntityType::name].
14608        ///
14609        /// # Example
14610        /// ```ignore,no_run
14611        /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14612        /// let x = EntityType::new().set_name("example");
14613        /// ```
14614        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14615            self.name = v.into();
14616            self
14617        }
14618
14619        /// Sets the value of [base_types][crate::model::document_schema::EntityType::base_types].
14620        ///
14621        /// # Example
14622        /// ```ignore,no_run
14623        /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14624        /// let x = EntityType::new().set_base_types(["a", "b", "c"]);
14625        /// ```
14626        pub fn set_base_types<T, V>(mut self, v: T) -> Self
14627        where
14628            T: std::iter::IntoIterator<Item = V>,
14629            V: std::convert::Into<std::string::String>,
14630        {
14631            use std::iter::Iterator;
14632            self.base_types = v.into_iter().map(|i| i.into()).collect();
14633            self
14634        }
14635
14636        /// Sets the value of [properties][crate::model::document_schema::EntityType::properties].
14637        ///
14638        /// # Example
14639        /// ```ignore,no_run
14640        /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14641        /// use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14642        /// let x = EntityType::new()
14643        ///     .set_properties([
14644        ///         Property::default()/* use setters */,
14645        ///         Property::default()/* use (different) setters */,
14646        ///     ]);
14647        /// ```
14648        pub fn set_properties<T, V>(mut self, v: T) -> Self
14649        where
14650            T: std::iter::IntoIterator<Item = V>,
14651            V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
14652        {
14653            use std::iter::Iterator;
14654            self.properties = v.into_iter().map(|i| i.into()).collect();
14655            self
14656        }
14657
14658        /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source].
14659        ///
14660        /// Note that all the setters affecting `value_source` are mutually
14661        /// exclusive.
14662        ///
14663        /// # Example
14664        /// ```ignore,no_run
14665        /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14666        /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
14667        /// let x = EntityType::new().set_value_source(Some(
14668        ///     google_cloud_documentai_v1::model::document_schema::entity_type::ValueSource::EnumValues(EnumValues::default().into())));
14669        /// ```
14670        pub fn set_value_source<
14671            T: std::convert::Into<
14672                    std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
14673                >,
14674        >(
14675            mut self,
14676            v: T,
14677        ) -> Self {
14678            self.value_source = v.into();
14679            self
14680        }
14681
14682        /// The value of [value_source][crate::model::document_schema::EntityType::value_source]
14683        /// if it holds a `EnumValues`, `None` if the field is not set or
14684        /// holds a different branch.
14685        pub fn enum_values(
14686            &self,
14687        ) -> std::option::Option<
14688            &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
14689        > {
14690            #[allow(unreachable_patterns)]
14691            self.value_source.as_ref().and_then(|v| match v {
14692                crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
14693                    std::option::Option::Some(v)
14694                }
14695                _ => std::option::Option::None,
14696            })
14697        }
14698
14699        /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source]
14700        /// to hold a `EnumValues`.
14701        ///
14702        /// Note that all the setters affecting `value_source` are
14703        /// mutually exclusive.
14704        ///
14705        /// # Example
14706        /// ```ignore,no_run
14707        /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14708        /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
14709        /// let x = EntityType::new().set_enum_values(EnumValues::default()/* use setters */);
14710        /// assert!(x.enum_values().is_some());
14711        /// ```
14712        pub fn set_enum_values<
14713            T: std::convert::Into<
14714                    std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
14715                >,
14716        >(
14717            mut self,
14718            v: T,
14719        ) -> Self {
14720            self.value_source = std::option::Option::Some(
14721                crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
14722            );
14723            self
14724        }
14725    }
14726
14727    impl wkt::message::Message for EntityType {
14728        fn typename() -> &'static str {
14729            "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
14730        }
14731    }
14732
14733    /// Defines additional types related to [EntityType].
14734    pub mod entity_type {
14735        #[allow(unused_imports)]
14736        use super::*;
14737
14738        /// Defines the a list of enum values.
14739        #[derive(Clone, Default, PartialEq)]
14740        #[non_exhaustive]
14741        pub struct EnumValues {
14742            /// The individual values that this enum values type can include.
14743            pub values: std::vec::Vec<std::string::String>,
14744
14745            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14746        }
14747
14748        impl EnumValues {
14749            pub fn new() -> Self {
14750                std::default::Default::default()
14751            }
14752
14753            /// Sets the value of [values][crate::model::document_schema::entity_type::EnumValues::values].
14754            ///
14755            /// # Example
14756            /// ```ignore,no_run
14757            /// # use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
14758            /// let x = EnumValues::new().set_values(["a", "b", "c"]);
14759            /// ```
14760            pub fn set_values<T, V>(mut self, v: T) -> Self
14761            where
14762                T: std::iter::IntoIterator<Item = V>,
14763                V: std::convert::Into<std::string::String>,
14764            {
14765                use std::iter::Iterator;
14766                self.values = v.into_iter().map(|i| i.into()).collect();
14767                self
14768            }
14769        }
14770
14771        impl wkt::message::Message for EnumValues {
14772            fn typename() -> &'static str {
14773                "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
14774            }
14775        }
14776
14777        /// Defines properties that can be part of the entity type.
14778        #[derive(Clone, Default, PartialEq)]
14779        #[non_exhaustive]
14780        pub struct Property {
14781            /// The name of the property.  Follows the same guidelines as the
14782            /// EntityType name.
14783            pub name: std::string::String,
14784
14785            /// User defined name for the property.
14786            pub display_name: std::string::String,
14787
14788            /// A reference to the value type of the property.  This type is subject
14789            /// to the same conventions as the `Entity.base_types` field.
14790            pub value_type: std::string::String,
14791
14792            /// Occurrence type limits the number of instances an entity type appears
14793            /// in the document.
14794            pub occurrence_type:
14795                crate::model::document_schema::entity_type::property::OccurrenceType,
14796
14797            /// Specifies how the entity's value is obtained.
14798            pub method: crate::model::document_schema::entity_type::property::Method,
14799
14800            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14801        }
14802
14803        impl Property {
14804            pub fn new() -> Self {
14805                std::default::Default::default()
14806            }
14807
14808            /// Sets the value of [name][crate::model::document_schema::entity_type::Property::name].
14809            ///
14810            /// # Example
14811            /// ```ignore,no_run
14812            /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14813            /// let x = Property::new().set_name("example");
14814            /// ```
14815            pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14816                self.name = v.into();
14817                self
14818            }
14819
14820            /// Sets the value of [display_name][crate::model::document_schema::entity_type::Property::display_name].
14821            ///
14822            /// # Example
14823            /// ```ignore,no_run
14824            /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14825            /// let x = Property::new().set_display_name("example");
14826            /// ```
14827            pub fn set_display_name<T: std::convert::Into<std::string::String>>(
14828                mut self,
14829                v: T,
14830            ) -> Self {
14831                self.display_name = v.into();
14832                self
14833            }
14834
14835            /// Sets the value of [value_type][crate::model::document_schema::entity_type::Property::value_type].
14836            ///
14837            /// # Example
14838            /// ```ignore,no_run
14839            /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14840            /// let x = Property::new().set_value_type("example");
14841            /// ```
14842            pub fn set_value_type<T: std::convert::Into<std::string::String>>(
14843                mut self,
14844                v: T,
14845            ) -> Self {
14846                self.value_type = v.into();
14847                self
14848            }
14849
14850            /// Sets the value of [occurrence_type][crate::model::document_schema::entity_type::Property::occurrence_type].
14851            ///
14852            /// # Example
14853            /// ```ignore,no_run
14854            /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14855            /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::OccurrenceType;
14856            /// let x0 = Property::new().set_occurrence_type(OccurrenceType::OptionalOnce);
14857            /// let x1 = Property::new().set_occurrence_type(OccurrenceType::OptionalMultiple);
14858            /// let x2 = Property::new().set_occurrence_type(OccurrenceType::RequiredOnce);
14859            /// ```
14860            pub fn set_occurrence_type<
14861                T: std::convert::Into<
14862                        crate::model::document_schema::entity_type::property::OccurrenceType,
14863                    >,
14864            >(
14865                mut self,
14866                v: T,
14867            ) -> Self {
14868                self.occurrence_type = v.into();
14869                self
14870            }
14871
14872            /// Sets the value of [method][crate::model::document_schema::entity_type::Property::method].
14873            ///
14874            /// # Example
14875            /// ```ignore,no_run
14876            /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14877            /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::Method;
14878            /// let x0 = Property::new().set_method(Method::Extract);
14879            /// let x1 = Property::new().set_method(Method::Derive);
14880            /// ```
14881            pub fn set_method<
14882                T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
14883            >(
14884                mut self,
14885                v: T,
14886            ) -> Self {
14887                self.method = v.into();
14888                self
14889            }
14890        }
14891
14892        impl wkt::message::Message for Property {
14893            fn typename() -> &'static str {
14894                "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
14895            }
14896        }
14897
14898        /// Defines additional types related to [Property].
14899        pub mod property {
14900            #[allow(unused_imports)]
14901            use super::*;
14902
14903            /// Types of occurrences of the entity type in the document.  This
14904            /// represents the number of instances, not mentions, of an entity.
14905            /// For example, a bank statement might only have one
14906            /// `account_number`, but this account number can be mentioned in several
14907            /// places on the document.  In this case, the `account_number` is
14908            /// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
14909            /// expect a bank statement to contain the status of multiple different
14910            /// accounts for the customers, the occurrence type is set to
14911            /// `REQUIRED_MULTIPLE`.
14912            ///
14913            /// # Working with unknown values
14914            ///
14915            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14916            /// additional enum variants at any time. Adding new variants is not considered
14917            /// a breaking change. Applications should write their code in anticipation of:
14918            ///
14919            /// - New values appearing in future releases of the client library, **and**
14920            /// - New values received dynamically, without application changes.
14921            ///
14922            /// Please consult the [Working with enums] section in the user guide for some
14923            /// guidelines.
14924            ///
14925            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14926            #[derive(Clone, Debug, PartialEq)]
14927            #[non_exhaustive]
14928            pub enum OccurrenceType {
14929                /// Unspecified occurrence type.
14930                Unspecified,
14931                /// There will be zero or one instance of this entity type.  The same
14932                /// entity instance may be mentioned multiple times.
14933                OptionalOnce,
14934                /// The entity type will appear zero or multiple times.
14935                OptionalMultiple,
14936                /// The entity type will only appear exactly once.  The same
14937                /// entity instance may be mentioned multiple times.
14938                RequiredOnce,
14939                /// The entity type will appear once or more times.
14940                RequiredMultiple,
14941                /// If set, the enum was initialized with an unknown value.
14942                ///
14943                /// Applications can examine the value using [OccurrenceType::value] or
14944                /// [OccurrenceType::name].
14945                UnknownValue(occurrence_type::UnknownValue),
14946            }
14947
14948            #[doc(hidden)]
14949            pub mod occurrence_type {
14950                #[allow(unused_imports)]
14951                use super::*;
14952                #[derive(Clone, Debug, PartialEq)]
14953                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14954            }
14955
14956            impl OccurrenceType {
14957                /// Gets the enum value.
14958                ///
14959                /// Returns `None` if the enum contains an unknown value deserialized from
14960                /// the string representation of enums.
14961                pub fn value(&self) -> std::option::Option<i32> {
14962                    match self {
14963                        Self::Unspecified => std::option::Option::Some(0),
14964                        Self::OptionalOnce => std::option::Option::Some(1),
14965                        Self::OptionalMultiple => std::option::Option::Some(2),
14966                        Self::RequiredOnce => std::option::Option::Some(3),
14967                        Self::RequiredMultiple => std::option::Option::Some(4),
14968                        Self::UnknownValue(u) => u.0.value(),
14969                    }
14970                }
14971
14972                /// Gets the enum value as a string.
14973                ///
14974                /// Returns `None` if the enum contains an unknown value deserialized from
14975                /// the integer representation of enums.
14976                pub fn name(&self) -> std::option::Option<&str> {
14977                    match self {
14978                        Self::Unspecified => {
14979                            std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
14980                        }
14981                        Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
14982                        Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
14983                        Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
14984                        Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
14985                        Self::UnknownValue(u) => u.0.name(),
14986                    }
14987                }
14988            }
14989
14990            impl std::default::Default for OccurrenceType {
14991                fn default() -> Self {
14992                    use std::convert::From;
14993                    Self::from(0)
14994                }
14995            }
14996
14997            impl std::fmt::Display for OccurrenceType {
14998                fn fmt(
14999                    &self,
15000                    f: &mut std::fmt::Formatter<'_>,
15001                ) -> std::result::Result<(), std::fmt::Error> {
15002                    wkt::internal::display_enum(f, self.name(), self.value())
15003                }
15004            }
15005
15006            impl std::convert::From<i32> for OccurrenceType {
15007                fn from(value: i32) -> Self {
15008                    match value {
15009                        0 => Self::Unspecified,
15010                        1 => Self::OptionalOnce,
15011                        2 => Self::OptionalMultiple,
15012                        3 => Self::RequiredOnce,
15013                        4 => Self::RequiredMultiple,
15014                        _ => Self::UnknownValue(occurrence_type::UnknownValue(
15015                            wkt::internal::UnknownEnumValue::Integer(value),
15016                        )),
15017                    }
15018                }
15019            }
15020
15021            impl std::convert::From<&str> for OccurrenceType {
15022                fn from(value: &str) -> Self {
15023                    use std::string::ToString;
15024                    match value {
15025                        "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
15026                        "OPTIONAL_ONCE" => Self::OptionalOnce,
15027                        "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
15028                        "REQUIRED_ONCE" => Self::RequiredOnce,
15029                        "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
15030                        _ => Self::UnknownValue(occurrence_type::UnknownValue(
15031                            wkt::internal::UnknownEnumValue::String(value.to_string()),
15032                        )),
15033                    }
15034                }
15035            }
15036
15037            impl serde::ser::Serialize for OccurrenceType {
15038                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15039                where
15040                    S: serde::Serializer,
15041                {
15042                    match self {
15043                        Self::Unspecified => serializer.serialize_i32(0),
15044                        Self::OptionalOnce => serializer.serialize_i32(1),
15045                        Self::OptionalMultiple => serializer.serialize_i32(2),
15046                        Self::RequiredOnce => serializer.serialize_i32(3),
15047                        Self::RequiredMultiple => serializer.serialize_i32(4),
15048                        Self::UnknownValue(u) => u.0.serialize(serializer),
15049                    }
15050                }
15051            }
15052
15053            impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
15054                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15055                where
15056                    D: serde::Deserializer<'de>,
15057                {
15058                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
15059                        ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
15060                }
15061            }
15062
15063            /// Specifies how the entity's value is obtained from the document.
15064            ///
15065            /// # Working with unknown values
15066            ///
15067            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15068            /// additional enum variants at any time. Adding new variants is not considered
15069            /// a breaking change. Applications should write their code in anticipation of:
15070            ///
15071            /// - New values appearing in future releases of the client library, **and**
15072            /// - New values received dynamically, without application changes.
15073            ///
15074            /// Please consult the [Working with enums] section in the user guide for some
15075            /// guidelines.
15076            ///
15077            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15078            #[derive(Clone, Debug, PartialEq)]
15079            #[non_exhaustive]
15080            pub enum Method {
15081                /// Unspecified method. It defaults to `EXTRACT`.
15082                Unspecified,
15083                /// The entity's value is directly extracted as-is from the document
15084                /// text.
15085                Extract,
15086                /// The entity's value is derived through inference and is not
15087                /// necessarily an exact text extraction from the document.
15088                Derive,
15089                /// If set, the enum was initialized with an unknown value.
15090                ///
15091                /// Applications can examine the value using [Method::value] or
15092                /// [Method::name].
15093                UnknownValue(method::UnknownValue),
15094            }
15095
15096            #[doc(hidden)]
15097            pub mod method {
15098                #[allow(unused_imports)]
15099                use super::*;
15100                #[derive(Clone, Debug, PartialEq)]
15101                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15102            }
15103
15104            impl Method {
15105                /// Gets the enum value.
15106                ///
15107                /// Returns `None` if the enum contains an unknown value deserialized from
15108                /// the string representation of enums.
15109                pub fn value(&self) -> std::option::Option<i32> {
15110                    match self {
15111                        Self::Unspecified => std::option::Option::Some(0),
15112                        Self::Extract => std::option::Option::Some(1),
15113                        Self::Derive => std::option::Option::Some(2),
15114                        Self::UnknownValue(u) => u.0.value(),
15115                    }
15116                }
15117
15118                /// Gets the enum value as a string.
15119                ///
15120                /// Returns `None` if the enum contains an unknown value deserialized from
15121                /// the integer representation of enums.
15122                pub fn name(&self) -> std::option::Option<&str> {
15123                    match self {
15124                        Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
15125                        Self::Extract => std::option::Option::Some("EXTRACT"),
15126                        Self::Derive => std::option::Option::Some("DERIVE"),
15127                        Self::UnknownValue(u) => u.0.name(),
15128                    }
15129                }
15130            }
15131
15132            impl std::default::Default for Method {
15133                fn default() -> Self {
15134                    use std::convert::From;
15135                    Self::from(0)
15136                }
15137            }
15138
15139            impl std::fmt::Display for Method {
15140                fn fmt(
15141                    &self,
15142                    f: &mut std::fmt::Formatter<'_>,
15143                ) -> std::result::Result<(), std::fmt::Error> {
15144                    wkt::internal::display_enum(f, self.name(), self.value())
15145                }
15146            }
15147
15148            impl std::convert::From<i32> for Method {
15149                fn from(value: i32) -> Self {
15150                    match value {
15151                        0 => Self::Unspecified,
15152                        1 => Self::Extract,
15153                        2 => Self::Derive,
15154                        _ => Self::UnknownValue(method::UnknownValue(
15155                            wkt::internal::UnknownEnumValue::Integer(value),
15156                        )),
15157                    }
15158                }
15159            }
15160
15161            impl std::convert::From<&str> for Method {
15162                fn from(value: &str) -> Self {
15163                    use std::string::ToString;
15164                    match value {
15165                        "METHOD_UNSPECIFIED" => Self::Unspecified,
15166                        "EXTRACT" => Self::Extract,
15167                        "DERIVE" => Self::Derive,
15168                        _ => Self::UnknownValue(method::UnknownValue(
15169                            wkt::internal::UnknownEnumValue::String(value.to_string()),
15170                        )),
15171                    }
15172                }
15173            }
15174
15175            impl serde::ser::Serialize for Method {
15176                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15177                where
15178                    S: serde::Serializer,
15179                {
15180                    match self {
15181                        Self::Unspecified => serializer.serialize_i32(0),
15182                        Self::Extract => serializer.serialize_i32(1),
15183                        Self::Derive => serializer.serialize_i32(2),
15184                        Self::UnknownValue(u) => u.0.serialize(serializer),
15185                    }
15186                }
15187            }
15188
15189            impl<'de> serde::de::Deserialize<'de> for Method {
15190                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15191                where
15192                    D: serde::Deserializer<'de>,
15193                {
15194                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
15195                        ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
15196                    ))
15197                }
15198            }
15199        }
15200
15201        #[derive(Clone, Debug, PartialEq)]
15202        #[non_exhaustive]
15203        pub enum ValueSource {
15204            /// If specified, lists all the possible values for this entity.  This
15205            /// should not be more than a handful of values.  If the number of values
15206            /// is >10 or could change frequently use the `EntityType.value_ontology`
15207            /// field and specify a list of all possible values in a value ontology
15208            /// file.
15209            EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
15210        }
15211    }
15212
15213    /// Metadata for global schema behavior.
15214    #[derive(Clone, Default, PartialEq)]
15215    #[non_exhaustive]
15216    pub struct Metadata {
15217        /// If true, a `document` entity type can be applied to subdocument
15218        /// (splitting). Otherwise, it can only be applied to the entire document
15219        /// (classification).
15220        pub document_splitter: bool,
15221
15222        /// If true, on a given page, there can be multiple `document` annotations
15223        /// covering it.
15224        pub document_allow_multiple_labels: bool,
15225
15226        /// If set, all the nested entities must be prefixed with the parents.
15227        pub prefixed_naming_on_properties: bool,
15228
15229        /// If set, we will skip the naming format validation in the schema. So the
15230        /// string values in `DocumentSchema.EntityType.name` and
15231        /// `DocumentSchema.EntityType.Property.name` will not be checked.
15232        pub skip_naming_validation: bool,
15233
15234        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15235    }
15236
15237    impl Metadata {
15238        pub fn new() -> Self {
15239            std::default::Default::default()
15240        }
15241
15242        /// Sets the value of [document_splitter][crate::model::document_schema::Metadata::document_splitter].
15243        ///
15244        /// # Example
15245        /// ```ignore,no_run
15246        /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15247        /// let x = Metadata::new().set_document_splitter(true);
15248        /// ```
15249        pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15250            self.document_splitter = v.into();
15251            self
15252        }
15253
15254        /// Sets the value of [document_allow_multiple_labels][crate::model::document_schema::Metadata::document_allow_multiple_labels].
15255        ///
15256        /// # Example
15257        /// ```ignore,no_run
15258        /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15259        /// let x = Metadata::new().set_document_allow_multiple_labels(true);
15260        /// ```
15261        pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
15262            mut self,
15263            v: T,
15264        ) -> Self {
15265            self.document_allow_multiple_labels = v.into();
15266            self
15267        }
15268
15269        /// Sets the value of [prefixed_naming_on_properties][crate::model::document_schema::Metadata::prefixed_naming_on_properties].
15270        ///
15271        /// # Example
15272        /// ```ignore,no_run
15273        /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15274        /// let x = Metadata::new().set_prefixed_naming_on_properties(true);
15275        /// ```
15276        pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
15277            mut self,
15278            v: T,
15279        ) -> Self {
15280            self.prefixed_naming_on_properties = v.into();
15281            self
15282        }
15283
15284        /// Sets the value of [skip_naming_validation][crate::model::document_schema::Metadata::skip_naming_validation].
15285        ///
15286        /// # Example
15287        /// ```ignore,no_run
15288        /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15289        /// let x = Metadata::new().set_skip_naming_validation(true);
15290        /// ```
15291        pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15292            self.skip_naming_validation = v.into();
15293            self
15294        }
15295    }
15296
15297    impl wkt::message::Message for Metadata {
15298        fn typename() -> &'static str {
15299            "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
15300        }
15301    }
15302}
15303
15304/// Gives a short summary of an evaluation, and links to the evaluation itself.
15305#[derive(Clone, Default, PartialEq)]
15306#[non_exhaustive]
15307pub struct EvaluationReference {
15308    /// The resource name of the Long Running Operation for the evaluation.
15309    pub operation: std::string::String,
15310
15311    /// The resource name of the evaluation.
15312    pub evaluation: std::string::String,
15313
15314    /// An aggregate of the statistics for the evaluation with fuzzy matching on.
15315    pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,
15316
15317    /// An aggregate of the statistics for the evaluation with fuzzy matching off.
15318    pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,
15319
15320    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15321}
15322
15323impl EvaluationReference {
15324    pub fn new() -> Self {
15325        std::default::Default::default()
15326    }
15327
15328    /// Sets the value of [operation][crate::model::EvaluationReference::operation].
15329    ///
15330    /// # Example
15331    /// ```ignore,no_run
15332    /// # use google_cloud_documentai_v1::model::EvaluationReference;
15333    /// let x = EvaluationReference::new().set_operation("example");
15334    /// ```
15335    pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15336        self.operation = v.into();
15337        self
15338    }
15339
15340    /// Sets the value of [evaluation][crate::model::EvaluationReference::evaluation].
15341    ///
15342    /// # Example
15343    /// ```ignore,no_run
15344    /// # use google_cloud_documentai_v1::model::EvaluationReference;
15345    /// let x = EvaluationReference::new().set_evaluation("example");
15346    /// ```
15347    pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15348        self.evaluation = v.into();
15349        self
15350    }
15351
15352    /// Sets the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
15353    ///
15354    /// # Example
15355    /// ```ignore,no_run
15356    /// # use google_cloud_documentai_v1::model::EvaluationReference;
15357    /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15358    /// let x = EvaluationReference::new().set_aggregate_metrics(Metrics::default()/* use setters */);
15359    /// ```
15360    pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
15361    where
15362        T: std::convert::Into<crate::model::evaluation::Metrics>,
15363    {
15364        self.aggregate_metrics = std::option::Option::Some(v.into());
15365        self
15366    }
15367
15368    /// Sets or clears the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
15369    ///
15370    /// # Example
15371    /// ```ignore,no_run
15372    /// # use google_cloud_documentai_v1::model::EvaluationReference;
15373    /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15374    /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(Some(Metrics::default()/* use setters */));
15375    /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(None::<Metrics>);
15376    /// ```
15377    pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
15378    where
15379        T: std::convert::Into<crate::model::evaluation::Metrics>,
15380    {
15381        self.aggregate_metrics = v.map(|x| x.into());
15382        self
15383    }
15384
15385    /// Sets the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
15386    ///
15387    /// # Example
15388    /// ```ignore,no_run
15389    /// # use google_cloud_documentai_v1::model::EvaluationReference;
15390    /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15391    /// let x = EvaluationReference::new().set_aggregate_metrics_exact(Metrics::default()/* use setters */);
15392    /// ```
15393    pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
15394    where
15395        T: std::convert::Into<crate::model::evaluation::Metrics>,
15396    {
15397        self.aggregate_metrics_exact = std::option::Option::Some(v.into());
15398        self
15399    }
15400
15401    /// Sets or clears the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
15402    ///
15403    /// # Example
15404    /// ```ignore,no_run
15405    /// # use google_cloud_documentai_v1::model::EvaluationReference;
15406    /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15407    /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(Some(Metrics::default()/* use setters */));
15408    /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(None::<Metrics>);
15409    /// ```
15410    pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
15411    where
15412        T: std::convert::Into<crate::model::evaluation::Metrics>,
15413    {
15414        self.aggregate_metrics_exact = v.map(|x| x.into());
15415        self
15416    }
15417}
15418
15419impl wkt::message::Message for EvaluationReference {
15420    fn typename() -> &'static str {
15421        "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
15422    }
15423}
15424
15425/// An evaluation of a ProcessorVersion's performance.
15426#[derive(Clone, Default, PartialEq)]
15427#[non_exhaustive]
15428pub struct Evaluation {
15429    /// The resource name of the evaluation.
15430    /// Format:
15431    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
15432    pub name: std::string::String,
15433
15434    /// The time that the evaluation was created.
15435    pub create_time: std::option::Option<wkt::Timestamp>,
15436
15437    /// Counters for the documents used in the evaluation.
15438    pub document_counters: std::option::Option<crate::model::evaluation::Counters>,
15439
15440    /// Metrics for all the entities in aggregate.
15441    pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,
15442
15443    /// Metrics across confidence levels, for different entities.
15444    pub entity_metrics: std::collections::HashMap<
15445        std::string::String,
15446        crate::model::evaluation::MultiConfidenceMetrics,
15447    >,
15448
15449    /// The KMS key name used for encryption.
15450    pub kms_key_name: std::string::String,
15451
15452    /// The KMS key version with which data is encrypted.
15453    pub kms_key_version_name: std::string::String,
15454
15455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15456}
15457
15458impl Evaluation {
15459    pub fn new() -> Self {
15460        std::default::Default::default()
15461    }
15462
15463    /// Sets the value of [name][crate::model::Evaluation::name].
15464    ///
15465    /// # Example
15466    /// ```ignore,no_run
15467    /// # use google_cloud_documentai_v1::model::Evaluation;
15468    /// let x = Evaluation::new().set_name("example");
15469    /// ```
15470    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15471        self.name = v.into();
15472        self
15473    }
15474
15475    /// Sets the value of [create_time][crate::model::Evaluation::create_time].
15476    ///
15477    /// # Example
15478    /// ```ignore,no_run
15479    /// # use google_cloud_documentai_v1::model::Evaluation;
15480    /// use wkt::Timestamp;
15481    /// let x = Evaluation::new().set_create_time(Timestamp::default()/* use setters */);
15482    /// ```
15483    pub fn set_create_time<T>(mut self, v: T) -> Self
15484    where
15485        T: std::convert::Into<wkt::Timestamp>,
15486    {
15487        self.create_time = std::option::Option::Some(v.into());
15488        self
15489    }
15490
15491    /// Sets or clears the value of [create_time][crate::model::Evaluation::create_time].
15492    ///
15493    /// # Example
15494    /// ```ignore,no_run
15495    /// # use google_cloud_documentai_v1::model::Evaluation;
15496    /// use wkt::Timestamp;
15497    /// let x = Evaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15498    /// let x = Evaluation::new().set_or_clear_create_time(None::<Timestamp>);
15499    /// ```
15500    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15501    where
15502        T: std::convert::Into<wkt::Timestamp>,
15503    {
15504        self.create_time = v.map(|x| x.into());
15505        self
15506    }
15507
15508    /// Sets the value of [document_counters][crate::model::Evaluation::document_counters].
15509    ///
15510    /// # Example
15511    /// ```ignore,no_run
15512    /// # use google_cloud_documentai_v1::model::Evaluation;
15513    /// use google_cloud_documentai_v1::model::evaluation::Counters;
15514    /// let x = Evaluation::new().set_document_counters(Counters::default()/* use setters */);
15515    /// ```
15516    pub fn set_document_counters<T>(mut self, v: T) -> Self
15517    where
15518        T: std::convert::Into<crate::model::evaluation::Counters>,
15519    {
15520        self.document_counters = std::option::Option::Some(v.into());
15521        self
15522    }
15523
15524    /// Sets or clears the value of [document_counters][crate::model::Evaluation::document_counters].
15525    ///
15526    /// # Example
15527    /// ```ignore,no_run
15528    /// # use google_cloud_documentai_v1::model::Evaluation;
15529    /// use google_cloud_documentai_v1::model::evaluation::Counters;
15530    /// let x = Evaluation::new().set_or_clear_document_counters(Some(Counters::default()/* use setters */));
15531    /// let x = Evaluation::new().set_or_clear_document_counters(None::<Counters>);
15532    /// ```
15533    pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
15534    where
15535        T: std::convert::Into<crate::model::evaluation::Counters>,
15536    {
15537        self.document_counters = v.map(|x| x.into());
15538        self
15539    }
15540
15541    /// Sets the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
15542    ///
15543    /// # Example
15544    /// ```ignore,no_run
15545    /// # use google_cloud_documentai_v1::model::Evaluation;
15546    /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
15547    /// let x = Evaluation::new().set_all_entities_metrics(MultiConfidenceMetrics::default()/* use setters */);
15548    /// ```
15549    pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
15550    where
15551        T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
15552    {
15553        self.all_entities_metrics = std::option::Option::Some(v.into());
15554        self
15555    }
15556
15557    /// Sets or clears the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
15558    ///
15559    /// # Example
15560    /// ```ignore,no_run
15561    /// # use google_cloud_documentai_v1::model::Evaluation;
15562    /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
15563    /// let x = Evaluation::new().set_or_clear_all_entities_metrics(Some(MultiConfidenceMetrics::default()/* use setters */));
15564    /// let x = Evaluation::new().set_or_clear_all_entities_metrics(None::<MultiConfidenceMetrics>);
15565    /// ```
15566    pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
15567    where
15568        T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
15569    {
15570        self.all_entities_metrics = v.map(|x| x.into());
15571        self
15572    }
15573
15574    /// Sets the value of [entity_metrics][crate::model::Evaluation::entity_metrics].
15575    ///
15576    /// # Example
15577    /// ```ignore,no_run
15578    /// # use google_cloud_documentai_v1::model::Evaluation;
15579    /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
15580    /// let x = Evaluation::new().set_entity_metrics([
15581    ///     ("key0", MultiConfidenceMetrics::default()/* use setters */),
15582    ///     ("key1", MultiConfidenceMetrics::default()/* use (different) setters */),
15583    /// ]);
15584    /// ```
15585    pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
15586    where
15587        T: std::iter::IntoIterator<Item = (K, V)>,
15588        K: std::convert::Into<std::string::String>,
15589        V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
15590    {
15591        use std::iter::Iterator;
15592        self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15593        self
15594    }
15595
15596    /// Sets the value of [kms_key_name][crate::model::Evaluation::kms_key_name].
15597    ///
15598    /// # Example
15599    /// ```ignore,no_run
15600    /// # use google_cloud_documentai_v1::model::Evaluation;
15601    /// let x = Evaluation::new().set_kms_key_name("example");
15602    /// ```
15603    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15604        self.kms_key_name = v.into();
15605        self
15606    }
15607
15608    /// Sets the value of [kms_key_version_name][crate::model::Evaluation::kms_key_version_name].
15609    ///
15610    /// # Example
15611    /// ```ignore,no_run
15612    /// # use google_cloud_documentai_v1::model::Evaluation;
15613    /// let x = Evaluation::new().set_kms_key_version_name("example");
15614    /// ```
15615    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
15616        mut self,
15617        v: T,
15618    ) -> Self {
15619        self.kms_key_version_name = v.into();
15620        self
15621    }
15622}
15623
15624impl wkt::message::Message for Evaluation {
15625    fn typename() -> &'static str {
15626        "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
15627    }
15628}
15629
15630/// Defines additional types related to [Evaluation].
15631pub mod evaluation {
15632    #[allow(unused_imports)]
15633    use super::*;
15634
15635    /// Evaluation counters for the documents that were used.
15636    #[derive(Clone, Default, PartialEq)]
15637    #[non_exhaustive]
15638    pub struct Counters {
15639        /// How many documents were sent for evaluation.
15640        pub input_documents_count: i32,
15641
15642        /// How many documents were not included in the evaluation as they didn't
15643        /// pass validation.
15644        pub invalid_documents_count: i32,
15645
15646        /// How many documents were not included in the evaluation as Document AI
15647        /// failed to process them.
15648        pub failed_documents_count: i32,
15649
15650        /// How many documents were used in the evaluation.
15651        pub evaluated_documents_count: i32,
15652
15653        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15654    }
15655
15656    impl Counters {
15657        pub fn new() -> Self {
15658            std::default::Default::default()
15659        }
15660
15661        /// Sets the value of [input_documents_count][crate::model::evaluation::Counters::input_documents_count].
15662        ///
15663        /// # Example
15664        /// ```ignore,no_run
15665        /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15666        /// let x = Counters::new().set_input_documents_count(42);
15667        /// ```
15668        pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15669            self.input_documents_count = v.into();
15670            self
15671        }
15672
15673        /// Sets the value of [invalid_documents_count][crate::model::evaluation::Counters::invalid_documents_count].
15674        ///
15675        /// # Example
15676        /// ```ignore,no_run
15677        /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15678        /// let x = Counters::new().set_invalid_documents_count(42);
15679        /// ```
15680        pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15681            self.invalid_documents_count = v.into();
15682            self
15683        }
15684
15685        /// Sets the value of [failed_documents_count][crate::model::evaluation::Counters::failed_documents_count].
15686        ///
15687        /// # Example
15688        /// ```ignore,no_run
15689        /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15690        /// let x = Counters::new().set_failed_documents_count(42);
15691        /// ```
15692        pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15693            self.failed_documents_count = v.into();
15694            self
15695        }
15696
15697        /// Sets the value of [evaluated_documents_count][crate::model::evaluation::Counters::evaluated_documents_count].
15698        ///
15699        /// # Example
15700        /// ```ignore,no_run
15701        /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15702        /// let x = Counters::new().set_evaluated_documents_count(42);
15703        /// ```
15704        pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15705            self.evaluated_documents_count = v.into();
15706            self
15707        }
15708    }
15709
15710    impl wkt::message::Message for Counters {
15711        fn typename() -> &'static str {
15712            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
15713        }
15714    }
15715
15716    /// Evaluation metrics, either in aggregate or about a specific entity.
15717    #[derive(Clone, Default, PartialEq)]
15718    #[non_exhaustive]
15719    pub struct Metrics {
15720        /// The calculated precision.
15721        pub precision: f32,
15722
15723        /// The calculated recall.
15724        pub recall: f32,
15725
15726        /// The calculated f1 score.
15727        pub f1_score: f32,
15728
15729        /// The amount of occurrences in predicted documents.
15730        pub predicted_occurrences_count: i32,
15731
15732        /// The amount of occurrences in ground truth documents.
15733        pub ground_truth_occurrences_count: i32,
15734
15735        /// The amount of documents with a predicted occurrence.
15736        pub predicted_document_count: i32,
15737
15738        /// The amount of documents with a ground truth occurrence.
15739        pub ground_truth_document_count: i32,
15740
15741        /// The amount of true positives.
15742        pub true_positives_count: i32,
15743
15744        /// The amount of false positives.
15745        pub false_positives_count: i32,
15746
15747        /// The amount of false negatives.
15748        pub false_negatives_count: i32,
15749
15750        /// The amount of documents that had an occurrence of this label.
15751        pub total_documents_count: i32,
15752
15753        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15754    }
15755
15756    impl Metrics {
15757        pub fn new() -> Self {
15758            std::default::Default::default()
15759        }
15760
15761        /// Sets the value of [precision][crate::model::evaluation::Metrics::precision].
15762        ///
15763        /// # Example
15764        /// ```ignore,no_run
15765        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15766        /// let x = Metrics::new().set_precision(42.0);
15767        /// ```
15768        pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15769            self.precision = v.into();
15770            self
15771        }
15772
15773        /// Sets the value of [recall][crate::model::evaluation::Metrics::recall].
15774        ///
15775        /// # Example
15776        /// ```ignore,no_run
15777        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15778        /// let x = Metrics::new().set_recall(42.0);
15779        /// ```
15780        pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15781            self.recall = v.into();
15782            self
15783        }
15784
15785        /// Sets the value of [f1_score][crate::model::evaluation::Metrics::f1_score].
15786        ///
15787        /// # Example
15788        /// ```ignore,no_run
15789        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15790        /// let x = Metrics::new().set_f1_score(42.0);
15791        /// ```
15792        pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15793            self.f1_score = v.into();
15794            self
15795        }
15796
15797        /// Sets the value of [predicted_occurrences_count][crate::model::evaluation::Metrics::predicted_occurrences_count].
15798        ///
15799        /// # Example
15800        /// ```ignore,no_run
15801        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15802        /// let x = Metrics::new().set_predicted_occurrences_count(42);
15803        /// ```
15804        pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15805            self.predicted_occurrences_count = v.into();
15806            self
15807        }
15808
15809        /// Sets the value of [ground_truth_occurrences_count][crate::model::evaluation::Metrics::ground_truth_occurrences_count].
15810        ///
15811        /// # Example
15812        /// ```ignore,no_run
15813        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15814        /// let x = Metrics::new().set_ground_truth_occurrences_count(42);
15815        /// ```
15816        pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
15817            mut self,
15818            v: T,
15819        ) -> Self {
15820            self.ground_truth_occurrences_count = v.into();
15821            self
15822        }
15823
15824        /// Sets the value of [predicted_document_count][crate::model::evaluation::Metrics::predicted_document_count].
15825        ///
15826        /// # Example
15827        /// ```ignore,no_run
15828        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15829        /// let x = Metrics::new().set_predicted_document_count(42);
15830        /// ```
15831        pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15832            self.predicted_document_count = v.into();
15833            self
15834        }
15835
15836        /// Sets the value of [ground_truth_document_count][crate::model::evaluation::Metrics::ground_truth_document_count].
15837        ///
15838        /// # Example
15839        /// ```ignore,no_run
15840        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15841        /// let x = Metrics::new().set_ground_truth_document_count(42);
15842        /// ```
15843        pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15844            self.ground_truth_document_count = v.into();
15845            self
15846        }
15847
15848        /// Sets the value of [true_positives_count][crate::model::evaluation::Metrics::true_positives_count].
15849        ///
15850        /// # Example
15851        /// ```ignore,no_run
15852        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15853        /// let x = Metrics::new().set_true_positives_count(42);
15854        /// ```
15855        pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15856            self.true_positives_count = v.into();
15857            self
15858        }
15859
15860        /// Sets the value of [false_positives_count][crate::model::evaluation::Metrics::false_positives_count].
15861        ///
15862        /// # Example
15863        /// ```ignore,no_run
15864        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15865        /// let x = Metrics::new().set_false_positives_count(42);
15866        /// ```
15867        pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15868            self.false_positives_count = v.into();
15869            self
15870        }
15871
15872        /// Sets the value of [false_negatives_count][crate::model::evaluation::Metrics::false_negatives_count].
15873        ///
15874        /// # Example
15875        /// ```ignore,no_run
15876        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15877        /// let x = Metrics::new().set_false_negatives_count(42);
15878        /// ```
15879        pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15880            self.false_negatives_count = v.into();
15881            self
15882        }
15883
15884        /// Sets the value of [total_documents_count][crate::model::evaluation::Metrics::total_documents_count].
15885        ///
15886        /// # Example
15887        /// ```ignore,no_run
15888        /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15889        /// let x = Metrics::new().set_total_documents_count(42);
15890        /// ```
15891        pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15892            self.total_documents_count = v.into();
15893            self
15894        }
15895    }
15896
15897    impl wkt::message::Message for Metrics {
15898        fn typename() -> &'static str {
15899            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
15900        }
15901    }
15902
15903    /// Evaluations metrics, at a specific confidence level.
15904    #[derive(Clone, Default, PartialEq)]
15905    #[non_exhaustive]
15906    pub struct ConfidenceLevelMetrics {
15907        /// The confidence level.
15908        pub confidence_level: f32,
15909
15910        /// The metrics at the specific confidence level.
15911        pub metrics: std::option::Option<crate::model::evaluation::Metrics>,
15912
15913        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15914    }
15915
15916    impl ConfidenceLevelMetrics {
15917        pub fn new() -> Self {
15918            std::default::Default::default()
15919        }
15920
15921        /// Sets the value of [confidence_level][crate::model::evaluation::ConfidenceLevelMetrics::confidence_level].
15922        ///
15923        /// # Example
15924        /// ```ignore,no_run
15925        /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
15926        /// let x = ConfidenceLevelMetrics::new().set_confidence_level(42.0);
15927        /// ```
15928        pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15929            self.confidence_level = v.into();
15930            self
15931        }
15932
15933        /// Sets the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
15934        ///
15935        /// # Example
15936        /// ```ignore,no_run
15937        /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
15938        /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15939        /// let x = ConfidenceLevelMetrics::new().set_metrics(Metrics::default()/* use setters */);
15940        /// ```
15941        pub fn set_metrics<T>(mut self, v: T) -> Self
15942        where
15943            T: std::convert::Into<crate::model::evaluation::Metrics>,
15944        {
15945            self.metrics = std::option::Option::Some(v.into());
15946            self
15947        }
15948
15949        /// Sets or clears the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
15950        ///
15951        /// # Example
15952        /// ```ignore,no_run
15953        /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
15954        /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15955        /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(Some(Metrics::default()/* use setters */));
15956        /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(None::<Metrics>);
15957        /// ```
15958        pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
15959        where
15960            T: std::convert::Into<crate::model::evaluation::Metrics>,
15961        {
15962            self.metrics = v.map(|x| x.into());
15963            self
15964        }
15965    }
15966
15967    impl wkt::message::Message for ConfidenceLevelMetrics {
15968        fn typename() -> &'static str {
15969            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
15970        }
15971    }
15972
15973    /// Metrics across multiple confidence levels.
15974    #[derive(Clone, Default, PartialEq)]
15975    #[non_exhaustive]
15976    pub struct MultiConfidenceMetrics {
15977        /// Metrics across confidence levels with fuzzy matching enabled.
15978        pub confidence_level_metrics:
15979            std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
15980
15981        /// Metrics across confidence levels with only exact matching.
15982        pub confidence_level_metrics_exact:
15983            std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
15984
15985        /// The calculated area under the precision recall curve (AUPRC), computed by
15986        /// integrating over all confidence thresholds.
15987        pub auprc: f32,
15988
15989        /// The Estimated Calibration Error (ECE) of the confidence of the predicted
15990        /// entities.
15991        pub estimated_calibration_error: f32,
15992
15993        /// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
15994        /// only.
15995        pub auprc_exact: f32,
15996
15997        /// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
15998        /// exact matching only.
15999        pub estimated_calibration_error_exact: f32,
16000
16001        /// The metrics type for the label.
16002        pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,
16003
16004        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16005    }
16006
16007    impl MultiConfidenceMetrics {
16008        pub fn new() -> Self {
16009            std::default::Default::default()
16010        }
16011
16012        /// Sets the value of [confidence_level_metrics][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics].
16013        ///
16014        /// # Example
16015        /// ```ignore,no_run
16016        /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16017        /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16018        /// let x = MultiConfidenceMetrics::new()
16019        ///     .set_confidence_level_metrics([
16020        ///         ConfidenceLevelMetrics::default()/* use setters */,
16021        ///         ConfidenceLevelMetrics::default()/* use (different) setters */,
16022        ///     ]);
16023        /// ```
16024        pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
16025        where
16026            T: std::iter::IntoIterator<Item = V>,
16027            V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
16028        {
16029            use std::iter::Iterator;
16030            self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
16031            self
16032        }
16033
16034        /// Sets the value of [confidence_level_metrics_exact][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics_exact].
16035        ///
16036        /// # Example
16037        /// ```ignore,no_run
16038        /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16039        /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16040        /// let x = MultiConfidenceMetrics::new()
16041        ///     .set_confidence_level_metrics_exact([
16042        ///         ConfidenceLevelMetrics::default()/* use setters */,
16043        ///         ConfidenceLevelMetrics::default()/* use (different) setters */,
16044        ///     ]);
16045        /// ```
16046        pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
16047        where
16048            T: std::iter::IntoIterator<Item = V>,
16049            V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
16050        {
16051            use std::iter::Iterator;
16052            self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
16053            self
16054        }
16055
16056        /// Sets the value of [auprc][crate::model::evaluation::MultiConfidenceMetrics::auprc].
16057        ///
16058        /// # Example
16059        /// ```ignore,no_run
16060        /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16061        /// let x = MultiConfidenceMetrics::new().set_auprc(42.0);
16062        /// ```
16063        pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16064            self.auprc = v.into();
16065            self
16066        }
16067
16068        /// Sets the value of [estimated_calibration_error][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error].
16069        ///
16070        /// # Example
16071        /// ```ignore,no_run
16072        /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16073        /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error(42.0);
16074        /// ```
16075        pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16076            self.estimated_calibration_error = v.into();
16077            self
16078        }
16079
16080        /// Sets the value of [auprc_exact][crate::model::evaluation::MultiConfidenceMetrics::auprc_exact].
16081        ///
16082        /// # Example
16083        /// ```ignore,no_run
16084        /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16085        /// let x = MultiConfidenceMetrics::new().set_auprc_exact(42.0);
16086        /// ```
16087        pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16088            self.auprc_exact = v.into();
16089            self
16090        }
16091
16092        /// Sets the value of [estimated_calibration_error_exact][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error_exact].
16093        ///
16094        /// # Example
16095        /// ```ignore,no_run
16096        /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16097        /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error_exact(42.0);
16098        /// ```
16099        pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
16100            mut self,
16101            v: T,
16102        ) -> Self {
16103            self.estimated_calibration_error_exact = v.into();
16104            self
16105        }
16106
16107        /// Sets the value of [metrics_type][crate::model::evaluation::MultiConfidenceMetrics::metrics_type].
16108        ///
16109        /// # Example
16110        /// ```ignore,no_run
16111        /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16112        /// use google_cloud_documentai_v1::model::evaluation::multi_confidence_metrics::MetricsType;
16113        /// let x0 = MultiConfidenceMetrics::new().set_metrics_type(MetricsType::Aggregate);
16114        /// ```
16115        pub fn set_metrics_type<
16116            T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
16117        >(
16118            mut self,
16119            v: T,
16120        ) -> Self {
16121            self.metrics_type = v.into();
16122            self
16123        }
16124    }
16125
16126    impl wkt::message::Message for MultiConfidenceMetrics {
16127        fn typename() -> &'static str {
16128            "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
16129        }
16130    }
16131
16132    /// Defines additional types related to [MultiConfidenceMetrics].
16133    pub mod multi_confidence_metrics {
16134        #[allow(unused_imports)]
16135        use super::*;
16136
16137        /// A type that determines how metrics should be interpreted.
16138        ///
16139        /// # Working with unknown values
16140        ///
16141        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16142        /// additional enum variants at any time. Adding new variants is not considered
16143        /// a breaking change. Applications should write their code in anticipation of:
16144        ///
16145        /// - New values appearing in future releases of the client library, **and**
16146        /// - New values received dynamically, without application changes.
16147        ///
16148        /// Please consult the [Working with enums] section in the user guide for some
16149        /// guidelines.
16150        ///
16151        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16152        #[derive(Clone, Debug, PartialEq)]
16153        #[non_exhaustive]
16154        pub enum MetricsType {
16155            /// The metrics type is unspecified. By default, metrics without a
16156            /// particular specification are for leaf entity types (i.e., top-level
16157            /// entity types without child types, or child types which are not
16158            /// parent types themselves).
16159            Unspecified,
16160            /// Indicates whether metrics for this particular label type represent an
16161            /// aggregate of metrics for other types instead of being based on actual
16162            /// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
16163            /// entity types are an aggregate of metrics for their children.
16164            Aggregate,
16165            /// If set, the enum was initialized with an unknown value.
16166            ///
16167            /// Applications can examine the value using [MetricsType::value] or
16168            /// [MetricsType::name].
16169            UnknownValue(metrics_type::UnknownValue),
16170        }
16171
16172        #[doc(hidden)]
16173        pub mod metrics_type {
16174            #[allow(unused_imports)]
16175            use super::*;
16176            #[derive(Clone, Debug, PartialEq)]
16177            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16178        }
16179
16180        impl MetricsType {
16181            /// Gets the enum value.
16182            ///
16183            /// Returns `None` if the enum contains an unknown value deserialized from
16184            /// the string representation of enums.
16185            pub fn value(&self) -> std::option::Option<i32> {
16186                match self {
16187                    Self::Unspecified => std::option::Option::Some(0),
16188                    Self::Aggregate => std::option::Option::Some(1),
16189                    Self::UnknownValue(u) => u.0.value(),
16190                }
16191            }
16192
16193            /// Gets the enum value as a string.
16194            ///
16195            /// Returns `None` if the enum contains an unknown value deserialized from
16196            /// the integer representation of enums.
16197            pub fn name(&self) -> std::option::Option<&str> {
16198                match self {
16199                    Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
16200                    Self::Aggregate => std::option::Option::Some("AGGREGATE"),
16201                    Self::UnknownValue(u) => u.0.name(),
16202                }
16203            }
16204        }
16205
16206        impl std::default::Default for MetricsType {
16207            fn default() -> Self {
16208                use std::convert::From;
16209                Self::from(0)
16210            }
16211        }
16212
16213        impl std::fmt::Display for MetricsType {
16214            fn fmt(
16215                &self,
16216                f: &mut std::fmt::Formatter<'_>,
16217            ) -> std::result::Result<(), std::fmt::Error> {
16218                wkt::internal::display_enum(f, self.name(), self.value())
16219            }
16220        }
16221
16222        impl std::convert::From<i32> for MetricsType {
16223            fn from(value: i32) -> Self {
16224                match value {
16225                    0 => Self::Unspecified,
16226                    1 => Self::Aggregate,
16227                    _ => Self::UnknownValue(metrics_type::UnknownValue(
16228                        wkt::internal::UnknownEnumValue::Integer(value),
16229                    )),
16230                }
16231            }
16232        }
16233
16234        impl std::convert::From<&str> for MetricsType {
16235            fn from(value: &str) -> Self {
16236                use std::string::ToString;
16237                match value {
16238                    "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
16239                    "AGGREGATE" => Self::Aggregate,
16240                    _ => Self::UnknownValue(metrics_type::UnknownValue(
16241                        wkt::internal::UnknownEnumValue::String(value.to_string()),
16242                    )),
16243                }
16244            }
16245        }
16246
16247        impl serde::ser::Serialize for MetricsType {
16248            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16249            where
16250                S: serde::Serializer,
16251            {
16252                match self {
16253                    Self::Unspecified => serializer.serialize_i32(0),
16254                    Self::Aggregate => serializer.serialize_i32(1),
16255                    Self::UnknownValue(u) => u.0.serialize(serializer),
16256                }
16257            }
16258        }
16259
16260        impl<'de> serde::de::Deserialize<'de> for MetricsType {
16261            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16262            where
16263                D: serde::Deserializer<'de>,
16264            {
16265                deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
16266                    ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
16267                ))
16268            }
16269        }
16270    }
16271}
16272
16273/// A vertex represents a 2D point in the image.
16274/// NOTE: the vertex coordinates are in the same scale as the original image.
16275#[derive(Clone, Default, PartialEq)]
16276#[non_exhaustive]
16277pub struct Vertex {
16278    /// X coordinate.
16279    pub x: i32,
16280
16281    /// Y coordinate (starts from the top of the image).
16282    pub y: i32,
16283
16284    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16285}
16286
16287impl Vertex {
16288    pub fn new() -> Self {
16289        std::default::Default::default()
16290    }
16291
16292    /// Sets the value of [x][crate::model::Vertex::x].
16293    ///
16294    /// # Example
16295    /// ```ignore,no_run
16296    /// # use google_cloud_documentai_v1::model::Vertex;
16297    /// let x = Vertex::new().set_x(42);
16298    /// ```
16299    pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16300        self.x = v.into();
16301        self
16302    }
16303
16304    /// Sets the value of [y][crate::model::Vertex::y].
16305    ///
16306    /// # Example
16307    /// ```ignore,no_run
16308    /// # use google_cloud_documentai_v1::model::Vertex;
16309    /// let x = Vertex::new().set_y(42);
16310    /// ```
16311    pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16312        self.y = v.into();
16313        self
16314    }
16315}
16316
16317impl wkt::message::Message for Vertex {
16318    fn typename() -> &'static str {
16319        "type.googleapis.com/google.cloud.documentai.v1.Vertex"
16320    }
16321}
16322
16323/// A vertex represents a 2D point in the image.
16324/// NOTE: the normalized vertex coordinates are relative to the original image
16325/// and range from 0 to 1.
16326#[derive(Clone, Default, PartialEq)]
16327#[non_exhaustive]
16328pub struct NormalizedVertex {
16329    /// X coordinate.
16330    pub x: f32,
16331
16332    /// Y coordinate (starts from the top of the image).
16333    pub y: f32,
16334
16335    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16336}
16337
16338impl NormalizedVertex {
16339    pub fn new() -> Self {
16340        std::default::Default::default()
16341    }
16342
16343    /// Sets the value of [x][crate::model::NormalizedVertex::x].
16344    ///
16345    /// # Example
16346    /// ```ignore,no_run
16347    /// # use google_cloud_documentai_v1::model::NormalizedVertex;
16348    /// let x = NormalizedVertex::new().set_x(42.0);
16349    /// ```
16350    pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16351        self.x = v.into();
16352        self
16353    }
16354
16355    /// Sets the value of [y][crate::model::NormalizedVertex::y].
16356    ///
16357    /// # Example
16358    /// ```ignore,no_run
16359    /// # use google_cloud_documentai_v1::model::NormalizedVertex;
16360    /// let x = NormalizedVertex::new().set_y(42.0);
16361    /// ```
16362    pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16363        self.y = v.into();
16364        self
16365    }
16366}
16367
16368impl wkt::message::Message for NormalizedVertex {
16369    fn typename() -> &'static str {
16370        "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
16371    }
16372}
16373
16374/// A bounding polygon for the detected image annotation.
16375#[derive(Clone, Default, PartialEq)]
16376#[non_exhaustive]
16377pub struct BoundingPoly {
16378    /// The bounding polygon vertices.
16379    pub vertices: std::vec::Vec<crate::model::Vertex>,
16380
16381    /// The bounding polygon normalized vertices.
16382    pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
16383
16384    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16385}
16386
16387impl BoundingPoly {
16388    pub fn new() -> Self {
16389        std::default::Default::default()
16390    }
16391
16392    /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
16393    ///
16394    /// # Example
16395    /// ```ignore,no_run
16396    /// # use google_cloud_documentai_v1::model::BoundingPoly;
16397    /// use google_cloud_documentai_v1::model::Vertex;
16398    /// let x = BoundingPoly::new()
16399    ///     .set_vertices([
16400    ///         Vertex::default()/* use setters */,
16401    ///         Vertex::default()/* use (different) setters */,
16402    ///     ]);
16403    /// ```
16404    pub fn set_vertices<T, V>(mut self, v: T) -> Self
16405    where
16406        T: std::iter::IntoIterator<Item = V>,
16407        V: std::convert::Into<crate::model::Vertex>,
16408    {
16409        use std::iter::Iterator;
16410        self.vertices = v.into_iter().map(|i| i.into()).collect();
16411        self
16412    }
16413
16414    /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
16415    ///
16416    /// # Example
16417    /// ```ignore,no_run
16418    /// # use google_cloud_documentai_v1::model::BoundingPoly;
16419    /// use google_cloud_documentai_v1::model::NormalizedVertex;
16420    /// let x = BoundingPoly::new()
16421    ///     .set_normalized_vertices([
16422    ///         NormalizedVertex::default()/* use setters */,
16423    ///         NormalizedVertex::default()/* use (different) setters */,
16424    ///     ]);
16425    /// ```
16426    pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
16427    where
16428        T: std::iter::IntoIterator<Item = V>,
16429        V: std::convert::Into<crate::model::NormalizedVertex>,
16430    {
16431        use std::iter::Iterator;
16432        self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
16433        self
16434    }
16435}
16436
16437impl wkt::message::Message for BoundingPoly {
16438    fn typename() -> &'static str {
16439        "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
16440    }
16441}
16442
16443/// The common metadata for long running operations.
16444#[derive(Clone, Default, PartialEq)]
16445#[non_exhaustive]
16446pub struct CommonOperationMetadata {
16447    /// The state of the operation.
16448    pub state: crate::model::common_operation_metadata::State,
16449
16450    /// A message providing more details about the current state of processing.
16451    pub state_message: std::string::String,
16452
16453    /// A related resource to this operation.
16454    pub resource: std::string::String,
16455
16456    /// The creation time of the operation.
16457    pub create_time: std::option::Option<wkt::Timestamp>,
16458
16459    /// The last update time of the operation.
16460    pub update_time: std::option::Option<wkt::Timestamp>,
16461
16462    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16463}
16464
16465impl CommonOperationMetadata {
16466    pub fn new() -> Self {
16467        std::default::Default::default()
16468    }
16469
16470    /// Sets the value of [state][crate::model::CommonOperationMetadata::state].
16471    ///
16472    /// # Example
16473    /// ```ignore,no_run
16474    /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16475    /// use google_cloud_documentai_v1::model::common_operation_metadata::State;
16476    /// let x0 = CommonOperationMetadata::new().set_state(State::Running);
16477    /// let x1 = CommonOperationMetadata::new().set_state(State::Cancelling);
16478    /// let x2 = CommonOperationMetadata::new().set_state(State::Succeeded);
16479    /// ```
16480    pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
16481        mut self,
16482        v: T,
16483    ) -> Self {
16484        self.state = v.into();
16485        self
16486    }
16487
16488    /// Sets the value of [state_message][crate::model::CommonOperationMetadata::state_message].
16489    ///
16490    /// # Example
16491    /// ```ignore,no_run
16492    /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16493    /// let x = CommonOperationMetadata::new().set_state_message("example");
16494    /// ```
16495    pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16496        self.state_message = v.into();
16497        self
16498    }
16499
16500    /// Sets the value of [resource][crate::model::CommonOperationMetadata::resource].
16501    ///
16502    /// # Example
16503    /// ```ignore,no_run
16504    /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16505    /// let x = CommonOperationMetadata::new().set_resource("example");
16506    /// ```
16507    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16508        self.resource = v.into();
16509        self
16510    }
16511
16512    /// Sets the value of [create_time][crate::model::CommonOperationMetadata::create_time].
16513    ///
16514    /// # Example
16515    /// ```ignore,no_run
16516    /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16517    /// use wkt::Timestamp;
16518    /// let x = CommonOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16519    /// ```
16520    pub fn set_create_time<T>(mut self, v: T) -> Self
16521    where
16522        T: std::convert::Into<wkt::Timestamp>,
16523    {
16524        self.create_time = std::option::Option::Some(v.into());
16525        self
16526    }
16527
16528    /// Sets or clears the value of [create_time][crate::model::CommonOperationMetadata::create_time].
16529    ///
16530    /// # Example
16531    /// ```ignore,no_run
16532    /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16533    /// use wkt::Timestamp;
16534    /// let x = CommonOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16535    /// let x = CommonOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16536    /// ```
16537    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16538    where
16539        T: std::convert::Into<wkt::Timestamp>,
16540    {
16541        self.create_time = v.map(|x| x.into());
16542        self
16543    }
16544
16545    /// Sets the value of [update_time][crate::model::CommonOperationMetadata::update_time].
16546    ///
16547    /// # Example
16548    /// ```ignore,no_run
16549    /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16550    /// use wkt::Timestamp;
16551    /// let x = CommonOperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
16552    /// ```
16553    pub fn set_update_time<T>(mut self, v: T) -> Self
16554    where
16555        T: std::convert::Into<wkt::Timestamp>,
16556    {
16557        self.update_time = std::option::Option::Some(v.into());
16558        self
16559    }
16560
16561    /// Sets or clears the value of [update_time][crate::model::CommonOperationMetadata::update_time].
16562    ///
16563    /// # Example
16564    /// ```ignore,no_run
16565    /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16566    /// use wkt::Timestamp;
16567    /// let x = CommonOperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
16568    /// let x = CommonOperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
16569    /// ```
16570    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16571    where
16572        T: std::convert::Into<wkt::Timestamp>,
16573    {
16574        self.update_time = v.map(|x| x.into());
16575        self
16576    }
16577}
16578
16579impl wkt::message::Message for CommonOperationMetadata {
16580    fn typename() -> &'static str {
16581        "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
16582    }
16583}
16584
16585/// Defines additional types related to [CommonOperationMetadata].
16586pub mod common_operation_metadata {
16587    #[allow(unused_imports)]
16588    use super::*;
16589
16590    /// State of the longrunning operation.
16591    ///
16592    /// # Working with unknown values
16593    ///
16594    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16595    /// additional enum variants at any time. Adding new variants is not considered
16596    /// a breaking change. Applications should write their code in anticipation of:
16597    ///
16598    /// - New values appearing in future releases of the client library, **and**
16599    /// - New values received dynamically, without application changes.
16600    ///
16601    /// Please consult the [Working with enums] section in the user guide for some
16602    /// guidelines.
16603    ///
16604    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16605    #[derive(Clone, Debug, PartialEq)]
16606    #[non_exhaustive]
16607    pub enum State {
16608        /// Unspecified state.
16609        Unspecified,
16610        /// Operation is still running.
16611        Running,
16612        /// Operation is being cancelled.
16613        Cancelling,
16614        /// Operation succeeded.
16615        Succeeded,
16616        /// Operation failed.
16617        Failed,
16618        /// Operation is cancelled.
16619        Cancelled,
16620        /// If set, the enum was initialized with an unknown value.
16621        ///
16622        /// Applications can examine the value using [State::value] or
16623        /// [State::name].
16624        UnknownValue(state::UnknownValue),
16625    }
16626
16627    #[doc(hidden)]
16628    pub mod state {
16629        #[allow(unused_imports)]
16630        use super::*;
16631        #[derive(Clone, Debug, PartialEq)]
16632        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16633    }
16634
16635    impl State {
16636        /// Gets the enum value.
16637        ///
16638        /// Returns `None` if the enum contains an unknown value deserialized from
16639        /// the string representation of enums.
16640        pub fn value(&self) -> std::option::Option<i32> {
16641            match self {
16642                Self::Unspecified => std::option::Option::Some(0),
16643                Self::Running => std::option::Option::Some(1),
16644                Self::Cancelling => std::option::Option::Some(2),
16645                Self::Succeeded => std::option::Option::Some(3),
16646                Self::Failed => std::option::Option::Some(4),
16647                Self::Cancelled => std::option::Option::Some(5),
16648                Self::UnknownValue(u) => u.0.value(),
16649            }
16650        }
16651
16652        /// Gets the enum value as a string.
16653        ///
16654        /// Returns `None` if the enum contains an unknown value deserialized from
16655        /// the integer representation of enums.
16656        pub fn name(&self) -> std::option::Option<&str> {
16657            match self {
16658                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
16659                Self::Running => std::option::Option::Some("RUNNING"),
16660                Self::Cancelling => std::option::Option::Some("CANCELLING"),
16661                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
16662                Self::Failed => std::option::Option::Some("FAILED"),
16663                Self::Cancelled => std::option::Option::Some("CANCELLED"),
16664                Self::UnknownValue(u) => u.0.name(),
16665            }
16666        }
16667    }
16668
16669    impl std::default::Default for State {
16670        fn default() -> Self {
16671            use std::convert::From;
16672            Self::from(0)
16673        }
16674    }
16675
16676    impl std::fmt::Display for State {
16677        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16678            wkt::internal::display_enum(f, self.name(), self.value())
16679        }
16680    }
16681
16682    impl std::convert::From<i32> for State {
16683        fn from(value: i32) -> Self {
16684            match value {
16685                0 => Self::Unspecified,
16686                1 => Self::Running,
16687                2 => Self::Cancelling,
16688                3 => Self::Succeeded,
16689                4 => Self::Failed,
16690                5 => Self::Cancelled,
16691                _ => Self::UnknownValue(state::UnknownValue(
16692                    wkt::internal::UnknownEnumValue::Integer(value),
16693                )),
16694            }
16695        }
16696    }
16697
16698    impl std::convert::From<&str> for State {
16699        fn from(value: &str) -> Self {
16700            use std::string::ToString;
16701            match value {
16702                "STATE_UNSPECIFIED" => Self::Unspecified,
16703                "RUNNING" => Self::Running,
16704                "CANCELLING" => Self::Cancelling,
16705                "SUCCEEDED" => Self::Succeeded,
16706                "FAILED" => Self::Failed,
16707                "CANCELLED" => Self::Cancelled,
16708                _ => Self::UnknownValue(state::UnknownValue(
16709                    wkt::internal::UnknownEnumValue::String(value.to_string()),
16710                )),
16711            }
16712        }
16713    }
16714
16715    impl serde::ser::Serialize for State {
16716        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16717        where
16718            S: serde::Serializer,
16719        {
16720            match self {
16721                Self::Unspecified => serializer.serialize_i32(0),
16722                Self::Running => serializer.serialize_i32(1),
16723                Self::Cancelling => serializer.serialize_i32(2),
16724                Self::Succeeded => serializer.serialize_i32(3),
16725                Self::Failed => serializer.serialize_i32(4),
16726                Self::Cancelled => serializer.serialize_i32(5),
16727                Self::UnknownValue(u) => u.0.serialize(serializer),
16728            }
16729        }
16730    }
16731
16732    impl<'de> serde::de::Deserialize<'de> for State {
16733        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16734        where
16735            D: serde::Deserializer<'de>,
16736        {
16737            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
16738                ".google.cloud.documentai.v1.CommonOperationMetadata.State",
16739            ))
16740        }
16741    }
16742}
16743
16744/// A processor version is an implementation of a processor. Each processor
16745/// can have multiple versions, pretrained by Google internally or uptrained
16746/// by the customer. A processor can only have one default version at a time.
16747/// Its document-processing behavior is defined by that version.
16748#[derive(Clone, Default, PartialEq)]
16749#[non_exhaustive]
16750pub struct ProcessorVersion {
16751    /// Identifier. The resource name of the processor version.
16752    /// Format:
16753    /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
16754    pub name: std::string::String,
16755
16756    /// The display name of the processor version.
16757    pub display_name: std::string::String,
16758
16759    /// Output only. The schema of the processor version. Describes the output.
16760    pub document_schema: std::option::Option<crate::model::DocumentSchema>,
16761
16762    /// Output only. The state of the processor version.
16763    pub state: crate::model::processor_version::State,
16764
16765    /// Output only. The time the processor version was created.
16766    pub create_time: std::option::Option<wkt::Timestamp>,
16767
16768    /// Output only. The most recently invoked evaluation for the processor
16769    /// version.
16770    pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,
16771
16772    /// Output only. The KMS key name used for encryption.
16773    pub kms_key_name: std::string::String,
16774
16775    /// Output only. The KMS key version with which data is encrypted.
16776    pub kms_key_version_name: std::string::String,
16777
16778    /// Output only. Denotes that this `ProcessorVersion` is managed by Google.
16779    pub google_managed: bool,
16780
16781    /// Output only. If set, information about the eventual deprecation of this
16782    /// version.
16783    pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,
16784
16785    /// Output only. The model type of this processor version.
16786    pub model_type: crate::model::processor_version::ModelType,
16787
16788    /// Output only. Reserved for future use.
16789    pub satisfies_pzs: bool,
16790
16791    /// Output only. Reserved for future use.
16792    pub satisfies_pzi: bool,
16793
16794    /// Output only. Information about Generative AI model-based processor
16795    /// versions.
16796    pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,
16797
16798    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16799}
16800
16801impl ProcessorVersion {
16802    pub fn new() -> Self {
16803        std::default::Default::default()
16804    }
16805
16806    /// Sets the value of [name][crate::model::ProcessorVersion::name].
16807    ///
16808    /// # Example
16809    /// ```ignore,no_run
16810    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16811    /// let x = ProcessorVersion::new().set_name("example");
16812    /// ```
16813    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16814        self.name = v.into();
16815        self
16816    }
16817
16818    /// Sets the value of [display_name][crate::model::ProcessorVersion::display_name].
16819    ///
16820    /// # Example
16821    /// ```ignore,no_run
16822    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16823    /// let x = ProcessorVersion::new().set_display_name("example");
16824    /// ```
16825    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16826        self.display_name = v.into();
16827        self
16828    }
16829
16830    /// Sets the value of [document_schema][crate::model::ProcessorVersion::document_schema].
16831    ///
16832    /// # Example
16833    /// ```ignore,no_run
16834    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16835    /// use google_cloud_documentai_v1::model::DocumentSchema;
16836    /// let x = ProcessorVersion::new().set_document_schema(DocumentSchema::default()/* use setters */);
16837    /// ```
16838    pub fn set_document_schema<T>(mut self, v: T) -> Self
16839    where
16840        T: std::convert::Into<crate::model::DocumentSchema>,
16841    {
16842        self.document_schema = std::option::Option::Some(v.into());
16843        self
16844    }
16845
16846    /// Sets or clears the value of [document_schema][crate::model::ProcessorVersion::document_schema].
16847    ///
16848    /// # Example
16849    /// ```ignore,no_run
16850    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16851    /// use google_cloud_documentai_v1::model::DocumentSchema;
16852    /// let x = ProcessorVersion::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
16853    /// let x = ProcessorVersion::new().set_or_clear_document_schema(None::<DocumentSchema>);
16854    /// ```
16855    pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
16856    where
16857        T: std::convert::Into<crate::model::DocumentSchema>,
16858    {
16859        self.document_schema = v.map(|x| x.into());
16860        self
16861    }
16862
16863    /// Sets the value of [state][crate::model::ProcessorVersion::state].
16864    ///
16865    /// # Example
16866    /// ```ignore,no_run
16867    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16868    /// use google_cloud_documentai_v1::model::processor_version::State;
16869    /// let x0 = ProcessorVersion::new().set_state(State::Deployed);
16870    /// let x1 = ProcessorVersion::new().set_state(State::Deploying);
16871    /// let x2 = ProcessorVersion::new().set_state(State::Undeployed);
16872    /// ```
16873    pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
16874        mut self,
16875        v: T,
16876    ) -> Self {
16877        self.state = v.into();
16878        self
16879    }
16880
16881    /// Sets the value of [create_time][crate::model::ProcessorVersion::create_time].
16882    ///
16883    /// # Example
16884    /// ```ignore,no_run
16885    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16886    /// use wkt::Timestamp;
16887    /// let x = ProcessorVersion::new().set_create_time(Timestamp::default()/* use setters */);
16888    /// ```
16889    pub fn set_create_time<T>(mut self, v: T) -> Self
16890    where
16891        T: std::convert::Into<wkt::Timestamp>,
16892    {
16893        self.create_time = std::option::Option::Some(v.into());
16894        self
16895    }
16896
16897    /// Sets or clears the value of [create_time][crate::model::ProcessorVersion::create_time].
16898    ///
16899    /// # Example
16900    /// ```ignore,no_run
16901    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16902    /// use wkt::Timestamp;
16903    /// let x = ProcessorVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16904    /// let x = ProcessorVersion::new().set_or_clear_create_time(None::<Timestamp>);
16905    /// ```
16906    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16907    where
16908        T: std::convert::Into<wkt::Timestamp>,
16909    {
16910        self.create_time = v.map(|x| x.into());
16911        self
16912    }
16913
16914    /// Sets the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
16915    ///
16916    /// # Example
16917    /// ```ignore,no_run
16918    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16919    /// use google_cloud_documentai_v1::model::EvaluationReference;
16920    /// let x = ProcessorVersion::new().set_latest_evaluation(EvaluationReference::default()/* use setters */);
16921    /// ```
16922    pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
16923    where
16924        T: std::convert::Into<crate::model::EvaluationReference>,
16925    {
16926        self.latest_evaluation = std::option::Option::Some(v.into());
16927        self
16928    }
16929
16930    /// Sets or clears the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
16931    ///
16932    /// # Example
16933    /// ```ignore,no_run
16934    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16935    /// use google_cloud_documentai_v1::model::EvaluationReference;
16936    /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(Some(EvaluationReference::default()/* use setters */));
16937    /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(None::<EvaluationReference>);
16938    /// ```
16939    pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
16940    where
16941        T: std::convert::Into<crate::model::EvaluationReference>,
16942    {
16943        self.latest_evaluation = v.map(|x| x.into());
16944        self
16945    }
16946
16947    /// Sets the value of [kms_key_name][crate::model::ProcessorVersion::kms_key_name].
16948    ///
16949    /// # Example
16950    /// ```ignore,no_run
16951    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16952    /// let x = ProcessorVersion::new().set_kms_key_name("example");
16953    /// ```
16954    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16955        self.kms_key_name = v.into();
16956        self
16957    }
16958
16959    /// Sets the value of [kms_key_version_name][crate::model::ProcessorVersion::kms_key_version_name].
16960    ///
16961    /// # Example
16962    /// ```ignore,no_run
16963    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16964    /// let x = ProcessorVersion::new().set_kms_key_version_name("example");
16965    /// ```
16966    pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
16967        mut self,
16968        v: T,
16969    ) -> Self {
16970        self.kms_key_version_name = v.into();
16971        self
16972    }
16973
16974    /// Sets the value of [google_managed][crate::model::ProcessorVersion::google_managed].
16975    ///
16976    /// # Example
16977    /// ```ignore,no_run
16978    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16979    /// let x = ProcessorVersion::new().set_google_managed(true);
16980    /// ```
16981    pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16982        self.google_managed = v.into();
16983        self
16984    }
16985
16986    /// Sets the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
16987    ///
16988    /// # Example
16989    /// ```ignore,no_run
16990    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16991    /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
16992    /// let x = ProcessorVersion::new().set_deprecation_info(DeprecationInfo::default()/* use setters */);
16993    /// ```
16994    pub fn set_deprecation_info<T>(mut self, v: T) -> Self
16995    where
16996        T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
16997    {
16998        self.deprecation_info = std::option::Option::Some(v.into());
16999        self
17000    }
17001
17002    /// Sets or clears the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
17003    ///
17004    /// # Example
17005    /// ```ignore,no_run
17006    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17007    /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17008    /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(Some(DeprecationInfo::default()/* use setters */));
17009    /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(None::<DeprecationInfo>);
17010    /// ```
17011    pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
17012    where
17013        T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
17014    {
17015        self.deprecation_info = v.map(|x| x.into());
17016        self
17017    }
17018
17019    /// Sets the value of [model_type][crate::model::ProcessorVersion::model_type].
17020    ///
17021    /// # Example
17022    /// ```ignore,no_run
17023    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17024    /// use google_cloud_documentai_v1::model::processor_version::ModelType;
17025    /// let x0 = ProcessorVersion::new().set_model_type(ModelType::Generative);
17026    /// let x1 = ProcessorVersion::new().set_model_type(ModelType::Custom);
17027    /// ```
17028    pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
17029        mut self,
17030        v: T,
17031    ) -> Self {
17032        self.model_type = v.into();
17033        self
17034    }
17035
17036    /// Sets the value of [satisfies_pzs][crate::model::ProcessorVersion::satisfies_pzs].
17037    ///
17038    /// # Example
17039    /// ```ignore,no_run
17040    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17041    /// let x = ProcessorVersion::new().set_satisfies_pzs(true);
17042    /// ```
17043    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17044        self.satisfies_pzs = v.into();
17045        self
17046    }
17047
17048    /// Sets the value of [satisfies_pzi][crate::model::ProcessorVersion::satisfies_pzi].
17049    ///
17050    /// # Example
17051    /// ```ignore,no_run
17052    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17053    /// let x = ProcessorVersion::new().set_satisfies_pzi(true);
17054    /// ```
17055    pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17056        self.satisfies_pzi = v.into();
17057        self
17058    }
17059
17060    /// Sets the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
17061    ///
17062    /// # Example
17063    /// ```ignore,no_run
17064    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17065    /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17066    /// let x = ProcessorVersion::new().set_gen_ai_model_info(GenAiModelInfo::default()/* use setters */);
17067    /// ```
17068    pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
17069    where
17070        T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
17071    {
17072        self.gen_ai_model_info = std::option::Option::Some(v.into());
17073        self
17074    }
17075
17076    /// Sets or clears the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
17077    ///
17078    /// # Example
17079    /// ```ignore,no_run
17080    /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17081    /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17082    /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(Some(GenAiModelInfo::default()/* use setters */));
17083    /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(None::<GenAiModelInfo>);
17084    /// ```
17085    pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
17086    where
17087        T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
17088    {
17089        self.gen_ai_model_info = v.map(|x| x.into());
17090        self
17091    }
17092}
17093
17094impl wkt::message::Message for ProcessorVersion {
17095    fn typename() -> &'static str {
17096        "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
17097    }
17098}
17099
17100/// Defines additional types related to [ProcessorVersion].
17101pub mod processor_version {
17102    #[allow(unused_imports)]
17103    use super::*;
17104
17105    /// Information about the upcoming deprecation of this processor version.
17106    #[derive(Clone, Default, PartialEq)]
17107    #[non_exhaustive]
17108    pub struct DeprecationInfo {
17109        /// The time at which this processor version will be deprecated.
17110        pub deprecation_time: std::option::Option<wkt::Timestamp>,
17111
17112        /// If set, the processor version that will be used as a replacement.
17113        pub replacement_processor_version: std::string::String,
17114
17115        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17116    }
17117
17118    impl DeprecationInfo {
17119        pub fn new() -> Self {
17120            std::default::Default::default()
17121        }
17122
17123        /// Sets the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
17124        ///
17125        /// # Example
17126        /// ```ignore,no_run
17127        /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17128        /// use wkt::Timestamp;
17129        /// let x = DeprecationInfo::new().set_deprecation_time(Timestamp::default()/* use setters */);
17130        /// ```
17131        pub fn set_deprecation_time<T>(mut self, v: T) -> Self
17132        where
17133            T: std::convert::Into<wkt::Timestamp>,
17134        {
17135            self.deprecation_time = std::option::Option::Some(v.into());
17136            self
17137        }
17138
17139        /// Sets or clears the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
17140        ///
17141        /// # Example
17142        /// ```ignore,no_run
17143        /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17144        /// use wkt::Timestamp;
17145        /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(Some(Timestamp::default()/* use setters */));
17146        /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(None::<Timestamp>);
17147        /// ```
17148        pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
17149        where
17150            T: std::convert::Into<wkt::Timestamp>,
17151        {
17152            self.deprecation_time = v.map(|x| x.into());
17153            self
17154        }
17155
17156        /// Sets the value of [replacement_processor_version][crate::model::processor_version::DeprecationInfo::replacement_processor_version].
17157        ///
17158        /// # Example
17159        /// ```ignore,no_run
17160        /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17161        /// let x = DeprecationInfo::new().set_replacement_processor_version("example");
17162        /// ```
17163        pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
17164            mut self,
17165            v: T,
17166        ) -> Self {
17167            self.replacement_processor_version = v.into();
17168            self
17169        }
17170    }
17171
17172    impl wkt::message::Message for DeprecationInfo {
17173        fn typename() -> &'static str {
17174            "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
17175        }
17176    }
17177
17178    /// Information about Generative AI model-based processor versions.
17179    #[derive(Clone, Default, PartialEq)]
17180    #[non_exhaustive]
17181    pub struct GenAiModelInfo {
17182        /// The processor version is either a pretrained Google-managed foundation
17183        /// model or a custom Generative AI model created by the user.
17184        pub model_info:
17185            std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,
17186
17187        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17188    }
17189
17190    impl GenAiModelInfo {
17191        pub fn new() -> Self {
17192            std::default::Default::default()
17193        }
17194
17195        /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info].
17196        ///
17197        /// Note that all the setters affecting `model_info` are mutually
17198        /// exclusive.
17199        ///
17200        /// # Example
17201        /// ```ignore,no_run
17202        /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17203        /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17204        /// let x = GenAiModelInfo::new().set_model_info(Some(
17205        ///     google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(FoundationGenAiModelInfo::default().into())));
17206        /// ```
17207        pub fn set_model_info<
17208            T: std::convert::Into<
17209                    std::option::Option<
17210                        crate::model::processor_version::gen_ai_model_info::ModelInfo,
17211                    >,
17212                >,
17213        >(
17214            mut self,
17215            v: T,
17216        ) -> Self {
17217            self.model_info = v.into();
17218            self
17219        }
17220
17221        /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17222        /// if it holds a `FoundationGenAiModelInfo`, `None` if the field is not set or
17223        /// holds a different branch.
17224        pub fn foundation_gen_ai_model_info(
17225            &self,
17226        ) -> std::option::Option<
17227            &std::boxed::Box<
17228                crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
17229            >,
17230        > {
17231            #[allow(unreachable_patterns)]
17232            self.model_info.as_ref().and_then(|v| match v {
17233                crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
17234                _ => std::option::Option::None,
17235            })
17236        }
17237
17238        /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17239        /// to hold a `FoundationGenAiModelInfo`.
17240        ///
17241        /// Note that all the setters affecting `model_info` are
17242        /// mutually exclusive.
17243        ///
17244        /// # Example
17245        /// ```ignore,no_run
17246        /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17247        /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17248        /// let x = GenAiModelInfo::new().set_foundation_gen_ai_model_info(FoundationGenAiModelInfo::default()/* use setters */);
17249        /// assert!(x.foundation_gen_ai_model_info().is_some());
17250        /// assert!(x.custom_gen_ai_model_info().is_none());
17251        /// ```
17252        pub fn set_foundation_gen_ai_model_info<T: std::convert::Into<std::boxed::Box<crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo>>>(mut self, v: T) -> Self{
17253            self.model_info = std::option::Option::Some(
17254                crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
17255                    v.into()
17256                )
17257            );
17258            self
17259        }
17260
17261        /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17262        /// if it holds a `CustomGenAiModelInfo`, `None` if the field is not set or
17263        /// holds a different branch.
17264        pub fn custom_gen_ai_model_info(
17265            &self,
17266        ) -> std::option::Option<
17267            &std::boxed::Box<
17268                crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
17269            >,
17270        > {
17271            #[allow(unreachable_patterns)]
17272            self.model_info.as_ref().and_then(|v| match v {
17273                crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
17274                _ => std::option::Option::None,
17275            })
17276        }
17277
17278        /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17279        /// to hold a `CustomGenAiModelInfo`.
17280        ///
17281        /// Note that all the setters affecting `model_info` are
17282        /// mutually exclusive.
17283        ///
17284        /// # Example
17285        /// ```ignore,no_run
17286        /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17287        /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
17288        /// let x = GenAiModelInfo::new().set_custom_gen_ai_model_info(CustomGenAiModelInfo::default()/* use setters */);
17289        /// assert!(x.custom_gen_ai_model_info().is_some());
17290        /// assert!(x.foundation_gen_ai_model_info().is_none());
17291        /// ```
17292        pub fn set_custom_gen_ai_model_info<
17293            T: std::convert::Into<
17294                    std::boxed::Box<
17295                        crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
17296                    >,
17297                >,
17298        >(
17299            mut self,
17300            v: T,
17301        ) -> Self {
17302            self.model_info = std::option::Option::Some(
17303                crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
17304                    v.into(),
17305                ),
17306            );
17307            self
17308        }
17309    }
17310
17311    impl wkt::message::Message for GenAiModelInfo {
17312        fn typename() -> &'static str {
17313            "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
17314        }
17315    }
17316
17317    /// Defines additional types related to [GenAiModelInfo].
17318    pub mod gen_ai_model_info {
17319        #[allow(unused_imports)]
17320        use super::*;
17321
17322        /// Information for a pretrained Google-managed foundation model.
17323        #[derive(Clone, Default, PartialEq)]
17324        #[non_exhaustive]
17325        pub struct FoundationGenAiModelInfo {
17326            /// Whether finetuning is allowed for this base processor version.
17327            pub finetuning_allowed: bool,
17328
17329            /// The minimum number of labeled documents in the training dataset
17330            /// required for finetuning.
17331            pub min_train_labeled_documents: i32,
17332
17333            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17334        }
17335
17336        impl FoundationGenAiModelInfo {
17337            pub fn new() -> Self {
17338                std::default::Default::default()
17339            }
17340
17341            /// Sets the value of [finetuning_allowed][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::finetuning_allowed].
17342            ///
17343            /// # Example
17344            /// ```ignore,no_run
17345            /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17346            /// let x = FoundationGenAiModelInfo::new().set_finetuning_allowed(true);
17347            /// ```
17348            pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17349                self.finetuning_allowed = v.into();
17350                self
17351            }
17352
17353            /// Sets the value of [min_train_labeled_documents][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::min_train_labeled_documents].
17354            ///
17355            /// # Example
17356            /// ```ignore,no_run
17357            /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17358            /// let x = FoundationGenAiModelInfo::new().set_min_train_labeled_documents(42);
17359            /// ```
17360            pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
17361                mut self,
17362                v: T,
17363            ) -> Self {
17364                self.min_train_labeled_documents = v.into();
17365                self
17366            }
17367        }
17368
17369        impl wkt::message::Message for FoundationGenAiModelInfo {
17370            fn typename() -> &'static str {
17371                "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
17372            }
17373        }
17374
17375        /// Information for a custom Generative AI model created by the user. These
17376        /// are created with `Create New Version` in either the `Call foundation
17377        /// model` or `Fine tuning` tabs.
17378        #[derive(Clone, Default, PartialEq)]
17379        #[non_exhaustive]
17380        pub struct CustomGenAiModelInfo {
17381
17382            /// The type of custom model created by the user.
17383            pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,
17384
17385            /// The base processor version ID for the custom model.
17386            pub base_processor_version_id: std::string::String,
17387
17388            pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17389        }
17390
17391        impl CustomGenAiModelInfo {
17392            pub fn new() -> Self {
17393                std::default::Default::default()
17394            }
17395
17396            /// Sets the value of [custom_model_type][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::custom_model_type].
17397            ///
17398            /// # Example
17399            /// ```ignore,no_run
17400            /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
17401            /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType;
17402            /// let x0 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::VersionedFoundation);
17403            /// let x1 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::FineTuned);
17404            /// ```
17405            pub fn set_custom_model_type<T: std::convert::Into<crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType>>(mut self, v: T) -> Self{
17406                self.custom_model_type = v.into();
17407                self
17408            }
17409
17410            /// Sets the value of [base_processor_version_id][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::base_processor_version_id].
17411            ///
17412            /// # Example
17413            /// ```ignore,no_run
17414            /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
17415            /// let x = CustomGenAiModelInfo::new().set_base_processor_version_id("example");
17416            /// ```
17417            pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
17418                mut self,
17419                v: T,
17420            ) -> Self {
17421                self.base_processor_version_id = v.into();
17422                self
17423            }
17424        }
17425
17426        impl wkt::message::Message for CustomGenAiModelInfo {
17427            fn typename() -> &'static str {
17428                "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
17429            }
17430        }
17431
17432        /// Defines additional types related to [CustomGenAiModelInfo].
17433        pub mod custom_gen_ai_model_info {
17434            #[allow(unused_imports)]
17435            use super::*;
17436
17437            /// The type of custom model created by the user.
17438            ///
17439            /// # Working with unknown values
17440            ///
17441            /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17442            /// additional enum variants at any time. Adding new variants is not considered
17443            /// a breaking change. Applications should write their code in anticipation of:
17444            ///
17445            /// - New values appearing in future releases of the client library, **and**
17446            /// - New values received dynamically, without application changes.
17447            ///
17448            /// Please consult the [Working with enums] section in the user guide for some
17449            /// guidelines.
17450            ///
17451            /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17452            #[derive(Clone, Debug, PartialEq)]
17453            #[non_exhaustive]
17454            pub enum CustomModelType {
17455                /// The model type is unspecified.
17456                Unspecified,
17457                /// The model is a versioned foundation model.
17458                VersionedFoundation,
17459                /// The model is a finetuned foundation model.
17460                FineTuned,
17461                /// If set, the enum was initialized with an unknown value.
17462                ///
17463                /// Applications can examine the value using [CustomModelType::value] or
17464                /// [CustomModelType::name].
17465                UnknownValue(custom_model_type::UnknownValue),
17466            }
17467
17468            #[doc(hidden)]
17469            pub mod custom_model_type {
17470                #[allow(unused_imports)]
17471                use super::*;
17472                #[derive(Clone, Debug, PartialEq)]
17473                pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17474            }
17475
17476            impl CustomModelType {
17477                /// Gets the enum value.
17478                ///
17479                /// Returns `None` if the enum contains an unknown value deserialized from
17480                /// the string representation of enums.
17481                pub fn value(&self) -> std::option::Option<i32> {
17482                    match self {
17483                        Self::Unspecified => std::option::Option::Some(0),
17484                        Self::VersionedFoundation => std::option::Option::Some(1),
17485                        Self::FineTuned => std::option::Option::Some(2),
17486                        Self::UnknownValue(u) => u.0.value(),
17487                    }
17488                }
17489
17490                /// Gets the enum value as a string.
17491                ///
17492                /// Returns `None` if the enum contains an unknown value deserialized from
17493                /// the integer representation of enums.
17494                pub fn name(&self) -> std::option::Option<&str> {
17495                    match self {
17496                        Self::Unspecified => {
17497                            std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
17498                        }
17499                        Self::VersionedFoundation => {
17500                            std::option::Option::Some("VERSIONED_FOUNDATION")
17501                        }
17502                        Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
17503                        Self::UnknownValue(u) => u.0.name(),
17504                    }
17505                }
17506            }
17507
17508            impl std::default::Default for CustomModelType {
17509                fn default() -> Self {
17510                    use std::convert::From;
17511                    Self::from(0)
17512                }
17513            }
17514
17515            impl std::fmt::Display for CustomModelType {
17516                fn fmt(
17517                    &self,
17518                    f: &mut std::fmt::Formatter<'_>,
17519                ) -> std::result::Result<(), std::fmt::Error> {
17520                    wkt::internal::display_enum(f, self.name(), self.value())
17521                }
17522            }
17523
17524            impl std::convert::From<i32> for CustomModelType {
17525                fn from(value: i32) -> Self {
17526                    match value {
17527                        0 => Self::Unspecified,
17528                        1 => Self::VersionedFoundation,
17529                        2 => Self::FineTuned,
17530                        _ => Self::UnknownValue(custom_model_type::UnknownValue(
17531                            wkt::internal::UnknownEnumValue::Integer(value),
17532                        )),
17533                    }
17534                }
17535            }
17536
17537            impl std::convert::From<&str> for CustomModelType {
17538                fn from(value: &str) -> Self {
17539                    use std::string::ToString;
17540                    match value {
17541                        "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
17542                        "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
17543                        "FINE_TUNED" => Self::FineTuned,
17544                        _ => Self::UnknownValue(custom_model_type::UnknownValue(
17545                            wkt::internal::UnknownEnumValue::String(value.to_string()),
17546                        )),
17547                    }
17548                }
17549            }
17550
17551            impl serde::ser::Serialize for CustomModelType {
17552                fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17553                where
17554                    S: serde::Serializer,
17555                {
17556                    match self {
17557                        Self::Unspecified => serializer.serialize_i32(0),
17558                        Self::VersionedFoundation => serializer.serialize_i32(1),
17559                        Self::FineTuned => serializer.serialize_i32(2),
17560                        Self::UnknownValue(u) => u.0.serialize(serializer),
17561                    }
17562                }
17563            }
17564
17565            impl<'de> serde::de::Deserialize<'de> for CustomModelType {
17566                fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17567                where
17568                    D: serde::Deserializer<'de>,
17569                {
17570                    deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
17571                        ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
17572                }
17573            }
17574        }
17575
17576        /// The processor version is either a pretrained Google-managed foundation
17577        /// model or a custom Generative AI model created by the user.
17578        #[derive(Clone, Debug, PartialEq)]
17579        #[non_exhaustive]
17580        pub enum ModelInfo {
17581            /// Information for a pretrained Google-managed foundation model.
17582            FoundationGenAiModelInfo(
17583                std::boxed::Box<
17584                    crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
17585                >,
17586            ),
17587            /// Information for a custom Generative AI model created by the user.
17588            CustomGenAiModelInfo(
17589                std::boxed::Box<
17590                    crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
17591                >,
17592            ),
17593        }
17594    }
17595
17596    /// The possible states of the processor version.
17597    ///
17598    /// # Working with unknown values
17599    ///
17600    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17601    /// additional enum variants at any time. Adding new variants is not considered
17602    /// a breaking change. Applications should write their code in anticipation of:
17603    ///
17604    /// - New values appearing in future releases of the client library, **and**
17605    /// - New values received dynamically, without application changes.
17606    ///
17607    /// Please consult the [Working with enums] section in the user guide for some
17608    /// guidelines.
17609    ///
17610    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17611    #[derive(Clone, Debug, PartialEq)]
17612    #[non_exhaustive]
17613    pub enum State {
17614        /// The processor version is in an unspecified state.
17615        Unspecified,
17616        /// The processor version is deployed and can be used for processing.
17617        Deployed,
17618        /// The processor version is being deployed.
17619        Deploying,
17620        /// The processor version is not deployed and cannot be used for processing.
17621        Undeployed,
17622        /// The processor version is being undeployed.
17623        Undeploying,
17624        /// The processor version is being created.
17625        Creating,
17626        /// The processor version is being deleted.
17627        Deleting,
17628        /// The processor version failed and is in an indeterminate state.
17629        Failed,
17630        /// The processor version is being imported.
17631        Importing,
17632        /// If set, the enum was initialized with an unknown value.
17633        ///
17634        /// Applications can examine the value using [State::value] or
17635        /// [State::name].
17636        UnknownValue(state::UnknownValue),
17637    }
17638
17639    #[doc(hidden)]
17640    pub mod state {
17641        #[allow(unused_imports)]
17642        use super::*;
17643        #[derive(Clone, Debug, PartialEq)]
17644        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17645    }
17646
17647    impl State {
17648        /// Gets the enum value.
17649        ///
17650        /// Returns `None` if the enum contains an unknown value deserialized from
17651        /// the string representation of enums.
17652        pub fn value(&self) -> std::option::Option<i32> {
17653            match self {
17654                Self::Unspecified => std::option::Option::Some(0),
17655                Self::Deployed => std::option::Option::Some(1),
17656                Self::Deploying => std::option::Option::Some(2),
17657                Self::Undeployed => std::option::Option::Some(3),
17658                Self::Undeploying => std::option::Option::Some(4),
17659                Self::Creating => std::option::Option::Some(5),
17660                Self::Deleting => std::option::Option::Some(6),
17661                Self::Failed => std::option::Option::Some(7),
17662                Self::Importing => std::option::Option::Some(8),
17663                Self::UnknownValue(u) => u.0.value(),
17664            }
17665        }
17666
17667        /// Gets the enum value as a string.
17668        ///
17669        /// Returns `None` if the enum contains an unknown value deserialized from
17670        /// the integer representation of enums.
17671        pub fn name(&self) -> std::option::Option<&str> {
17672            match self {
17673                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17674                Self::Deployed => std::option::Option::Some("DEPLOYED"),
17675                Self::Deploying => std::option::Option::Some("DEPLOYING"),
17676                Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
17677                Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
17678                Self::Creating => std::option::Option::Some("CREATING"),
17679                Self::Deleting => std::option::Option::Some("DELETING"),
17680                Self::Failed => std::option::Option::Some("FAILED"),
17681                Self::Importing => std::option::Option::Some("IMPORTING"),
17682                Self::UnknownValue(u) => u.0.name(),
17683            }
17684        }
17685    }
17686
17687    impl std::default::Default for State {
17688        fn default() -> Self {
17689            use std::convert::From;
17690            Self::from(0)
17691        }
17692    }
17693
17694    impl std::fmt::Display for State {
17695        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17696            wkt::internal::display_enum(f, self.name(), self.value())
17697        }
17698    }
17699
17700    impl std::convert::From<i32> for State {
17701        fn from(value: i32) -> Self {
17702            match value {
17703                0 => Self::Unspecified,
17704                1 => Self::Deployed,
17705                2 => Self::Deploying,
17706                3 => Self::Undeployed,
17707                4 => Self::Undeploying,
17708                5 => Self::Creating,
17709                6 => Self::Deleting,
17710                7 => Self::Failed,
17711                8 => Self::Importing,
17712                _ => Self::UnknownValue(state::UnknownValue(
17713                    wkt::internal::UnknownEnumValue::Integer(value),
17714                )),
17715            }
17716        }
17717    }
17718
17719    impl std::convert::From<&str> for State {
17720        fn from(value: &str) -> Self {
17721            use std::string::ToString;
17722            match value {
17723                "STATE_UNSPECIFIED" => Self::Unspecified,
17724                "DEPLOYED" => Self::Deployed,
17725                "DEPLOYING" => Self::Deploying,
17726                "UNDEPLOYED" => Self::Undeployed,
17727                "UNDEPLOYING" => Self::Undeploying,
17728                "CREATING" => Self::Creating,
17729                "DELETING" => Self::Deleting,
17730                "FAILED" => Self::Failed,
17731                "IMPORTING" => Self::Importing,
17732                _ => Self::UnknownValue(state::UnknownValue(
17733                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17734                )),
17735            }
17736        }
17737    }
17738
17739    impl serde::ser::Serialize for State {
17740        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17741        where
17742            S: serde::Serializer,
17743        {
17744            match self {
17745                Self::Unspecified => serializer.serialize_i32(0),
17746                Self::Deployed => serializer.serialize_i32(1),
17747                Self::Deploying => serializer.serialize_i32(2),
17748                Self::Undeployed => serializer.serialize_i32(3),
17749                Self::Undeploying => serializer.serialize_i32(4),
17750                Self::Creating => serializer.serialize_i32(5),
17751                Self::Deleting => serializer.serialize_i32(6),
17752                Self::Failed => serializer.serialize_i32(7),
17753                Self::Importing => serializer.serialize_i32(8),
17754                Self::UnknownValue(u) => u.0.serialize(serializer),
17755            }
17756        }
17757    }
17758
17759    impl<'de> serde::de::Deserialize<'de> for State {
17760        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17761        where
17762            D: serde::Deserializer<'de>,
17763        {
17764            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17765                ".google.cloud.documentai.v1.ProcessorVersion.State",
17766            ))
17767        }
17768    }
17769
17770    /// The possible model types of the processor version.
17771    ///
17772    /// # Working with unknown values
17773    ///
17774    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17775    /// additional enum variants at any time. Adding new variants is not considered
17776    /// a breaking change. Applications should write their code in anticipation of:
17777    ///
17778    /// - New values appearing in future releases of the client library, **and**
17779    /// - New values received dynamically, without application changes.
17780    ///
17781    /// Please consult the [Working with enums] section in the user guide for some
17782    /// guidelines.
17783    ///
17784    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17785    #[derive(Clone, Debug, PartialEq)]
17786    #[non_exhaustive]
17787    pub enum ModelType {
17788        /// The processor version has unspecified model type.
17789        Unspecified,
17790        /// The processor version has generative model type.
17791        Generative,
17792        /// The processor version has custom model type.
17793        Custom,
17794        /// If set, the enum was initialized with an unknown value.
17795        ///
17796        /// Applications can examine the value using [ModelType::value] or
17797        /// [ModelType::name].
17798        UnknownValue(model_type::UnknownValue),
17799    }
17800
17801    #[doc(hidden)]
17802    pub mod model_type {
17803        #[allow(unused_imports)]
17804        use super::*;
17805        #[derive(Clone, Debug, PartialEq)]
17806        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17807    }
17808
17809    impl ModelType {
17810        /// Gets the enum value.
17811        ///
17812        /// Returns `None` if the enum contains an unknown value deserialized from
17813        /// the string representation of enums.
17814        pub fn value(&self) -> std::option::Option<i32> {
17815            match self {
17816                Self::Unspecified => std::option::Option::Some(0),
17817                Self::Generative => std::option::Option::Some(1),
17818                Self::Custom => std::option::Option::Some(2),
17819                Self::UnknownValue(u) => u.0.value(),
17820            }
17821        }
17822
17823        /// Gets the enum value as a string.
17824        ///
17825        /// Returns `None` if the enum contains an unknown value deserialized from
17826        /// the integer representation of enums.
17827        pub fn name(&self) -> std::option::Option<&str> {
17828            match self {
17829                Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
17830                Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
17831                Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
17832                Self::UnknownValue(u) => u.0.name(),
17833            }
17834        }
17835    }
17836
17837    impl std::default::Default for ModelType {
17838        fn default() -> Self {
17839            use std::convert::From;
17840            Self::from(0)
17841        }
17842    }
17843
17844    impl std::fmt::Display for ModelType {
17845        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17846            wkt::internal::display_enum(f, self.name(), self.value())
17847        }
17848    }
17849
17850    impl std::convert::From<i32> for ModelType {
17851        fn from(value: i32) -> Self {
17852            match value {
17853                0 => Self::Unspecified,
17854                1 => Self::Generative,
17855                2 => Self::Custom,
17856                _ => Self::UnknownValue(model_type::UnknownValue(
17857                    wkt::internal::UnknownEnumValue::Integer(value),
17858                )),
17859            }
17860        }
17861    }
17862
17863    impl std::convert::From<&str> for ModelType {
17864        fn from(value: &str) -> Self {
17865            use std::string::ToString;
17866            match value {
17867                "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
17868                "MODEL_TYPE_GENERATIVE" => Self::Generative,
17869                "MODEL_TYPE_CUSTOM" => Self::Custom,
17870                _ => Self::UnknownValue(model_type::UnknownValue(
17871                    wkt::internal::UnknownEnumValue::String(value.to_string()),
17872                )),
17873            }
17874        }
17875    }
17876
17877    impl serde::ser::Serialize for ModelType {
17878        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17879        where
17880            S: serde::Serializer,
17881        {
17882            match self {
17883                Self::Unspecified => serializer.serialize_i32(0),
17884                Self::Generative => serializer.serialize_i32(1),
17885                Self::Custom => serializer.serialize_i32(2),
17886                Self::UnknownValue(u) => u.0.serialize(serializer),
17887            }
17888        }
17889    }
17890
17891    impl<'de> serde::de::Deserialize<'de> for ModelType {
17892        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17893        where
17894            D: serde::Deserializer<'de>,
17895        {
17896            deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
17897                ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
17898            ))
17899        }
17900    }
17901}
17902
17903/// Contains the alias and the aliased resource name of processor version.
17904#[derive(Clone, Default, PartialEq)]
17905#[non_exhaustive]
17906pub struct ProcessorVersionAlias {
17907    /// The alias in the form of `processor_version` resource name.
17908    pub alias: std::string::String,
17909
17910    /// The resource name of aliased processor version.
17911    pub processor_version: std::string::String,
17912
17913    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17914}
17915
17916impl ProcessorVersionAlias {
17917    pub fn new() -> Self {
17918        std::default::Default::default()
17919    }
17920
17921    /// Sets the value of [alias][crate::model::ProcessorVersionAlias::alias].
17922    ///
17923    /// # Example
17924    /// ```ignore,no_run
17925    /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
17926    /// let x = ProcessorVersionAlias::new().set_alias("example");
17927    /// ```
17928    pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17929        self.alias = v.into();
17930        self
17931    }
17932
17933    /// Sets the value of [processor_version][crate::model::ProcessorVersionAlias::processor_version].
17934    ///
17935    /// # Example
17936    /// ```ignore,no_run
17937    /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
17938    /// let x = ProcessorVersionAlias::new().set_processor_version("example");
17939    /// ```
17940    pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
17941        mut self,
17942        v: T,
17943    ) -> Self {
17944        self.processor_version = v.into();
17945        self
17946    }
17947}
17948
17949impl wkt::message::Message for ProcessorVersionAlias {
17950    fn typename() -> &'static str {
17951        "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
17952    }
17953}
17954
17955/// The first-class citizen for Document AI. Each processor defines how to
17956/// extract structural information from a document.
17957#[derive(Clone, Default, PartialEq)]
17958#[non_exhaustive]
17959pub struct Processor {
17960    /// Output only. Immutable. The resource name of the processor.
17961    /// Format: `projects/{project}/locations/{location}/processors/{processor}`
17962    pub name: std::string::String,
17963
17964    /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
17965    /// To get a list of processor types, see
17966    /// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
17967    ///
17968    /// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
17969    pub r#type: std::string::String,
17970
17971    /// The display name of the processor.
17972    pub display_name: std::string::String,
17973
17974    /// Output only. The state of the processor.
17975    pub state: crate::model::processor::State,
17976
17977    /// The default processor version.
17978    pub default_processor_version: std::string::String,
17979
17980    /// Output only. The processor version aliases.
17981    pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,
17982
17983    /// Output only. Immutable. The http endpoint that can be called to invoke
17984    /// processing.
17985    pub process_endpoint: std::string::String,
17986
17987    /// Output only. The time the processor was created.
17988    pub create_time: std::option::Option<wkt::Timestamp>,
17989
17990    /// The [KMS key](https://cloud.google.com/security-key-management) used for
17991    /// encryption and decryption in CMEK scenarios.
17992    pub kms_key_name: std::string::String,
17993
17994    /// Output only. Reserved for future use.
17995    pub satisfies_pzs: bool,
17996
17997    /// Output only. Reserved for future use.
17998    pub satisfies_pzi: bool,
17999
18000    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18001}
18002
18003impl Processor {
18004    pub fn new() -> Self {
18005        std::default::Default::default()
18006    }
18007
18008    /// Sets the value of [name][crate::model::Processor::name].
18009    ///
18010    /// # Example
18011    /// ```ignore,no_run
18012    /// # use google_cloud_documentai_v1::model::Processor;
18013    /// let x = Processor::new().set_name("example");
18014    /// ```
18015    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18016        self.name = v.into();
18017        self
18018    }
18019
18020    /// Sets the value of [r#type][crate::model::Processor::type].
18021    ///
18022    /// # Example
18023    /// ```ignore,no_run
18024    /// # use google_cloud_documentai_v1::model::Processor;
18025    /// let x = Processor::new().set_type("example");
18026    /// ```
18027    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18028        self.r#type = v.into();
18029        self
18030    }
18031
18032    /// Sets the value of [display_name][crate::model::Processor::display_name].
18033    ///
18034    /// # Example
18035    /// ```ignore,no_run
18036    /// # use google_cloud_documentai_v1::model::Processor;
18037    /// let x = Processor::new().set_display_name("example");
18038    /// ```
18039    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18040        self.display_name = v.into();
18041        self
18042    }
18043
18044    /// Sets the value of [state][crate::model::Processor::state].
18045    ///
18046    /// # Example
18047    /// ```ignore,no_run
18048    /// # use google_cloud_documentai_v1::model::Processor;
18049    /// use google_cloud_documentai_v1::model::processor::State;
18050    /// let x0 = Processor::new().set_state(State::Enabled);
18051    /// let x1 = Processor::new().set_state(State::Disabled);
18052    /// let x2 = Processor::new().set_state(State::Enabling);
18053    /// ```
18054    pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
18055        mut self,
18056        v: T,
18057    ) -> Self {
18058        self.state = v.into();
18059        self
18060    }
18061
18062    /// Sets the value of [default_processor_version][crate::model::Processor::default_processor_version].
18063    ///
18064    /// # Example
18065    /// ```ignore,no_run
18066    /// # use google_cloud_documentai_v1::model::Processor;
18067    /// let x = Processor::new().set_default_processor_version("example");
18068    /// ```
18069    pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
18070        mut self,
18071        v: T,
18072    ) -> Self {
18073        self.default_processor_version = v.into();
18074        self
18075    }
18076
18077    /// Sets the value of [processor_version_aliases][crate::model::Processor::processor_version_aliases].
18078    ///
18079    /// # Example
18080    /// ```ignore,no_run
18081    /// # use google_cloud_documentai_v1::model::Processor;
18082    /// use google_cloud_documentai_v1::model::ProcessorVersionAlias;
18083    /// let x = Processor::new()
18084    ///     .set_processor_version_aliases([
18085    ///         ProcessorVersionAlias::default()/* use setters */,
18086    ///         ProcessorVersionAlias::default()/* use (different) setters */,
18087    ///     ]);
18088    /// ```
18089    pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
18090    where
18091        T: std::iter::IntoIterator<Item = V>,
18092        V: std::convert::Into<crate::model::ProcessorVersionAlias>,
18093    {
18094        use std::iter::Iterator;
18095        self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
18096        self
18097    }
18098
18099    /// Sets the value of [process_endpoint][crate::model::Processor::process_endpoint].
18100    ///
18101    /// # Example
18102    /// ```ignore,no_run
18103    /// # use google_cloud_documentai_v1::model::Processor;
18104    /// let x = Processor::new().set_process_endpoint("example");
18105    /// ```
18106    pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
18107        mut self,
18108        v: T,
18109    ) -> Self {
18110        self.process_endpoint = v.into();
18111        self
18112    }
18113
18114    /// Sets the value of [create_time][crate::model::Processor::create_time].
18115    ///
18116    /// # Example
18117    /// ```ignore,no_run
18118    /// # use google_cloud_documentai_v1::model::Processor;
18119    /// use wkt::Timestamp;
18120    /// let x = Processor::new().set_create_time(Timestamp::default()/* use setters */);
18121    /// ```
18122    pub fn set_create_time<T>(mut self, v: T) -> Self
18123    where
18124        T: std::convert::Into<wkt::Timestamp>,
18125    {
18126        self.create_time = std::option::Option::Some(v.into());
18127        self
18128    }
18129
18130    /// Sets or clears the value of [create_time][crate::model::Processor::create_time].
18131    ///
18132    /// # Example
18133    /// ```ignore,no_run
18134    /// # use google_cloud_documentai_v1::model::Processor;
18135    /// use wkt::Timestamp;
18136    /// let x = Processor::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18137    /// let x = Processor::new().set_or_clear_create_time(None::<Timestamp>);
18138    /// ```
18139    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18140    where
18141        T: std::convert::Into<wkt::Timestamp>,
18142    {
18143        self.create_time = v.map(|x| x.into());
18144        self
18145    }
18146
18147    /// Sets the value of [kms_key_name][crate::model::Processor::kms_key_name].
18148    ///
18149    /// # Example
18150    /// ```ignore,no_run
18151    /// # use google_cloud_documentai_v1::model::Processor;
18152    /// let x = Processor::new().set_kms_key_name("example");
18153    /// ```
18154    pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18155        self.kms_key_name = v.into();
18156        self
18157    }
18158
18159    /// Sets the value of [satisfies_pzs][crate::model::Processor::satisfies_pzs].
18160    ///
18161    /// # Example
18162    /// ```ignore,no_run
18163    /// # use google_cloud_documentai_v1::model::Processor;
18164    /// let x = Processor::new().set_satisfies_pzs(true);
18165    /// ```
18166    pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18167        self.satisfies_pzs = v.into();
18168        self
18169    }
18170
18171    /// Sets the value of [satisfies_pzi][crate::model::Processor::satisfies_pzi].
18172    ///
18173    /// # Example
18174    /// ```ignore,no_run
18175    /// # use google_cloud_documentai_v1::model::Processor;
18176    /// let x = Processor::new().set_satisfies_pzi(true);
18177    /// ```
18178    pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18179        self.satisfies_pzi = v.into();
18180        self
18181    }
18182}
18183
18184impl wkt::message::Message for Processor {
18185    fn typename() -> &'static str {
18186        "type.googleapis.com/google.cloud.documentai.v1.Processor"
18187    }
18188}
18189
18190/// Defines additional types related to [Processor].
18191pub mod processor {
18192    #[allow(unused_imports)]
18193    use super::*;
18194
18195    /// The possible states of the processor.
18196    ///
18197    /// # Working with unknown values
18198    ///
18199    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18200    /// additional enum variants at any time. Adding new variants is not considered
18201    /// a breaking change. Applications should write their code in anticipation of:
18202    ///
18203    /// - New values appearing in future releases of the client library, **and**
18204    /// - New values received dynamically, without application changes.
18205    ///
18206    /// Please consult the [Working with enums] section in the user guide for some
18207    /// guidelines.
18208    ///
18209    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18210    #[derive(Clone, Debug, PartialEq)]
18211    #[non_exhaustive]
18212    pub enum State {
18213        /// The processor is in an unspecified state.
18214        Unspecified,
18215        /// The processor is enabled, i.e., has an enabled version which can
18216        /// currently serve processing requests and all the feature dependencies have
18217        /// been successfully initialized.
18218        Enabled,
18219        /// The processor is disabled.
18220        Disabled,
18221        /// The processor is being enabled, will become `ENABLED` if successful.
18222        Enabling,
18223        /// The processor is being disabled, will become `DISABLED` if successful.
18224        Disabling,
18225        /// The processor is being created, will become either `ENABLED` (for
18226        /// successful creation) or `FAILED` (for failed ones).
18227        /// Once a processor is in this state, it can then be used for document
18228        /// processing, but the feature dependencies of the processor might not be
18229        /// fully created yet.
18230        Creating,
18231        /// The processor failed during creation or initialization of feature
18232        /// dependencies. The user should delete the processor and recreate one as
18233        /// all the functionalities of the processor are disabled.
18234        Failed,
18235        /// The processor is being deleted, will be removed if successful.
18236        Deleting,
18237        /// If set, the enum was initialized with an unknown value.
18238        ///
18239        /// Applications can examine the value using [State::value] or
18240        /// [State::name].
18241        UnknownValue(state::UnknownValue),
18242    }
18243
18244    #[doc(hidden)]
18245    pub mod state {
18246        #[allow(unused_imports)]
18247        use super::*;
18248        #[derive(Clone, Debug, PartialEq)]
18249        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18250    }
18251
18252    impl State {
18253        /// Gets the enum value.
18254        ///
18255        /// Returns `None` if the enum contains an unknown value deserialized from
18256        /// the string representation of enums.
18257        pub fn value(&self) -> std::option::Option<i32> {
18258            match self {
18259                Self::Unspecified => std::option::Option::Some(0),
18260                Self::Enabled => std::option::Option::Some(1),
18261                Self::Disabled => std::option::Option::Some(2),
18262                Self::Enabling => std::option::Option::Some(3),
18263                Self::Disabling => std::option::Option::Some(4),
18264                Self::Creating => std::option::Option::Some(5),
18265                Self::Failed => std::option::Option::Some(6),
18266                Self::Deleting => std::option::Option::Some(7),
18267                Self::UnknownValue(u) => u.0.value(),
18268            }
18269        }
18270
18271        /// Gets the enum value as a string.
18272        ///
18273        /// Returns `None` if the enum contains an unknown value deserialized from
18274        /// the integer representation of enums.
18275        pub fn name(&self) -> std::option::Option<&str> {
18276            match self {
18277                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
18278                Self::Enabled => std::option::Option::Some("ENABLED"),
18279                Self::Disabled => std::option::Option::Some("DISABLED"),
18280                Self::Enabling => std::option::Option::Some("ENABLING"),
18281                Self::Disabling => std::option::Option::Some("DISABLING"),
18282                Self::Creating => std::option::Option::Some("CREATING"),
18283                Self::Failed => std::option::Option::Some("FAILED"),
18284                Self::Deleting => std::option::Option::Some("DELETING"),
18285                Self::UnknownValue(u) => u.0.name(),
18286            }
18287        }
18288    }
18289
18290    impl std::default::Default for State {
18291        fn default() -> Self {
18292            use std::convert::From;
18293            Self::from(0)
18294        }
18295    }
18296
18297    impl std::fmt::Display for State {
18298        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18299            wkt::internal::display_enum(f, self.name(), self.value())
18300        }
18301    }
18302
18303    impl std::convert::From<i32> for State {
18304        fn from(value: i32) -> Self {
18305            match value {
18306                0 => Self::Unspecified,
18307                1 => Self::Enabled,
18308                2 => Self::Disabled,
18309                3 => Self::Enabling,
18310                4 => Self::Disabling,
18311                5 => Self::Creating,
18312                6 => Self::Failed,
18313                7 => Self::Deleting,
18314                _ => Self::UnknownValue(state::UnknownValue(
18315                    wkt::internal::UnknownEnumValue::Integer(value),
18316                )),
18317            }
18318        }
18319    }
18320
18321    impl std::convert::From<&str> for State {
18322        fn from(value: &str) -> Self {
18323            use std::string::ToString;
18324            match value {
18325                "STATE_UNSPECIFIED" => Self::Unspecified,
18326                "ENABLED" => Self::Enabled,
18327                "DISABLED" => Self::Disabled,
18328                "ENABLING" => Self::Enabling,
18329                "DISABLING" => Self::Disabling,
18330                "CREATING" => Self::Creating,
18331                "FAILED" => Self::Failed,
18332                "DELETING" => Self::Deleting,
18333                _ => Self::UnknownValue(state::UnknownValue(
18334                    wkt::internal::UnknownEnumValue::String(value.to_string()),
18335                )),
18336            }
18337        }
18338    }
18339
18340    impl serde::ser::Serialize for State {
18341        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18342        where
18343            S: serde::Serializer,
18344        {
18345            match self {
18346                Self::Unspecified => serializer.serialize_i32(0),
18347                Self::Enabled => serializer.serialize_i32(1),
18348                Self::Disabled => serializer.serialize_i32(2),
18349                Self::Enabling => serializer.serialize_i32(3),
18350                Self::Disabling => serializer.serialize_i32(4),
18351                Self::Creating => serializer.serialize_i32(5),
18352                Self::Failed => serializer.serialize_i32(6),
18353                Self::Deleting => serializer.serialize_i32(7),
18354                Self::UnknownValue(u) => u.0.serialize(serializer),
18355            }
18356        }
18357    }
18358
18359    impl<'de> serde::de::Deserialize<'de> for State {
18360        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18361        where
18362            D: serde::Deserializer<'de>,
18363        {
18364            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
18365                ".google.cloud.documentai.v1.Processor.State",
18366            ))
18367        }
18368    }
18369}
18370
18371/// A processor type is responsible for performing a certain document
18372/// understanding task on a certain type of document.
18373#[derive(Clone, Default, PartialEq)]
18374#[non_exhaustive]
18375pub struct ProcessorType {
18376    /// The resource name of the processor type.
18377    /// Format: `projects/{project}/processorTypes/{processor_type}`
18378    pub name: std::string::String,
18379
18380    /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
18381    pub r#type: std::string::String,
18382
18383    /// The processor category, used by UI to group processor types.
18384    pub category: std::string::String,
18385
18386    /// The locations in which this processor is available.
18387    pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,
18388
18389    /// Whether the processor type allows creation. If true, users can create a
18390    /// processor of this processor type. Otherwise, users need to request access.
18391    pub allow_creation: bool,
18392
18393    /// Launch stage of the processor type
18394    pub launch_stage: google_cloud_api::model::LaunchStage,
18395
18396    /// A set of Cloud Storage URIs of sample documents for this processor.
18397    pub sample_document_uris: std::vec::Vec<std::string::String>,
18398
18399    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18400}
18401
18402impl ProcessorType {
18403    pub fn new() -> Self {
18404        std::default::Default::default()
18405    }
18406
18407    /// Sets the value of [name][crate::model::ProcessorType::name].
18408    ///
18409    /// # Example
18410    /// ```ignore,no_run
18411    /// # use google_cloud_documentai_v1::model::ProcessorType;
18412    /// let x = ProcessorType::new().set_name("example");
18413    /// ```
18414    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18415        self.name = v.into();
18416        self
18417    }
18418
18419    /// Sets the value of [r#type][crate::model::ProcessorType::type].
18420    ///
18421    /// # Example
18422    /// ```ignore,no_run
18423    /// # use google_cloud_documentai_v1::model::ProcessorType;
18424    /// let x = ProcessorType::new().set_type("example");
18425    /// ```
18426    pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18427        self.r#type = v.into();
18428        self
18429    }
18430
18431    /// Sets the value of [category][crate::model::ProcessorType::category].
18432    ///
18433    /// # Example
18434    /// ```ignore,no_run
18435    /// # use google_cloud_documentai_v1::model::ProcessorType;
18436    /// let x = ProcessorType::new().set_category("example");
18437    /// ```
18438    pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18439        self.category = v.into();
18440        self
18441    }
18442
18443    /// Sets the value of [available_locations][crate::model::ProcessorType::available_locations].
18444    ///
18445    /// # Example
18446    /// ```ignore,no_run
18447    /// # use google_cloud_documentai_v1::model::ProcessorType;
18448    /// use google_cloud_documentai_v1::model::processor_type::LocationInfo;
18449    /// let x = ProcessorType::new()
18450    ///     .set_available_locations([
18451    ///         LocationInfo::default()/* use setters */,
18452    ///         LocationInfo::default()/* use (different) setters */,
18453    ///     ]);
18454    /// ```
18455    pub fn set_available_locations<T, V>(mut self, v: T) -> Self
18456    where
18457        T: std::iter::IntoIterator<Item = V>,
18458        V: std::convert::Into<crate::model::processor_type::LocationInfo>,
18459    {
18460        use std::iter::Iterator;
18461        self.available_locations = v.into_iter().map(|i| i.into()).collect();
18462        self
18463    }
18464
18465    /// Sets the value of [allow_creation][crate::model::ProcessorType::allow_creation].
18466    ///
18467    /// # Example
18468    /// ```ignore,no_run
18469    /// # use google_cloud_documentai_v1::model::ProcessorType;
18470    /// let x = ProcessorType::new().set_allow_creation(true);
18471    /// ```
18472    pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18473        self.allow_creation = v.into();
18474        self
18475    }
18476
18477    /// Sets the value of [launch_stage][crate::model::ProcessorType::launch_stage].
18478    ///
18479    /// # Example
18480    /// ```ignore,no_run
18481    /// # use google_cloud_documentai_v1::model::ProcessorType;
18482    /// use google_cloud_api::model::LaunchStage;
18483    /// let x0 = ProcessorType::new().set_launch_stage(LaunchStage::Unimplemented);
18484    /// let x1 = ProcessorType::new().set_launch_stage(LaunchStage::Prelaunch);
18485    /// let x2 = ProcessorType::new().set_launch_stage(LaunchStage::EarlyAccess);
18486    /// ```
18487    pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
18488        mut self,
18489        v: T,
18490    ) -> Self {
18491        self.launch_stage = v.into();
18492        self
18493    }
18494
18495    /// Sets the value of [sample_document_uris][crate::model::ProcessorType::sample_document_uris].
18496    ///
18497    /// # Example
18498    /// ```ignore,no_run
18499    /// # use google_cloud_documentai_v1::model::ProcessorType;
18500    /// let x = ProcessorType::new().set_sample_document_uris(["a", "b", "c"]);
18501    /// ```
18502    pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
18503    where
18504        T: std::iter::IntoIterator<Item = V>,
18505        V: std::convert::Into<std::string::String>,
18506    {
18507        use std::iter::Iterator;
18508        self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
18509        self
18510    }
18511}
18512
18513impl wkt::message::Message for ProcessorType {
18514    fn typename() -> &'static str {
18515        "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
18516    }
18517}
18518
18519/// Defines additional types related to [ProcessorType].
18520pub mod processor_type {
18521    #[allow(unused_imports)]
18522    use super::*;
18523
18524    /// The location information about where the processor is available.
18525    #[derive(Clone, Default, PartialEq)]
18526    #[non_exhaustive]
18527    pub struct LocationInfo {
18528        /// The location ID. For supported locations, refer to [regional and
18529        /// multi-regional support](/document-ai/docs/regions).
18530        pub location_id: std::string::String,
18531
18532        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18533    }
18534
18535    impl LocationInfo {
18536        pub fn new() -> Self {
18537            std::default::Default::default()
18538        }
18539
18540        /// Sets the value of [location_id][crate::model::processor_type::LocationInfo::location_id].
18541        ///
18542        /// # Example
18543        /// ```ignore,no_run
18544        /// # use google_cloud_documentai_v1::model::processor_type::LocationInfo;
18545        /// let x = LocationInfo::new().set_location_id("example");
18546        /// ```
18547        pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18548            self.location_id = v.into();
18549            self
18550        }
18551    }
18552
18553    impl wkt::message::Message for LocationInfo {
18554        fn typename() -> &'static str {
18555            "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
18556        }
18557    }
18558}